changing to 'id' for linking in YmlBasedLesson

This commit is contained in:
Jason White 2016-07-05 08:22:37 -04:00
parent d27712affa
commit 8e862ba9c3
4 changed files with 13 additions and 12 deletions

View File

@ -88,7 +88,7 @@ public class StartLesson {
List<AbstractLesson> lessons = ws.getCourse()
.getLessons(ws, AbstractLesson.USER_ROLE);//TODO this should work with the security roles of Spring
Optional<AbstractLesson> lesson = lessons.stream()
.filter(l -> l.getHtml().equals(lessonName))
.filter(l -> l.getId().equals(lessonName))
.findFirst();
model.setViewName("lesson_content");
model.addObject("lesson", lesson.get());

View File

@ -626,7 +626,7 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object
* @return a {@link java.lang.String} object.
*/
protected String getPath() {
return "#attack";
return "#lesson/";
}
/**
@ -645,9 +645,10 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object
StringBuffer link = new StringBuffer(getPath());
// mvc update:
return link
.append("/").append(getScreenId())
.append("/").append(getCategory().getRanking()).toString();
// return link
// .append("/").append(getScreenId())
// .append("/").append(getCategory().getRanking()).toString();
return link.append(getId()).toString();
}
/**
@ -999,7 +1000,7 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object
return labelManager;
}
public String getHtml() {
public String getId() {
return "";
}
}

View File

@ -83,7 +83,7 @@ public class Plugin {
final String category = (String) lessonYml.get("category");
final List<String> hints = (List<String>) lessonYml.get("hints");
final String title = (String) lessonYml.get("title");
final String html = (String) lessonYml.get("html");
final String html = (String) lessonYml.get("id");
this.ymlBasedLesson = new YmlBasedLesson(category, hints, title, html);
this.lesson = null;
} catch (IOException e) {

View File

@ -41,13 +41,13 @@ public class YmlBasedLesson extends LessonAdapter {
private final String category;
private final List<String> hints;
private final String title;
private final String html;
private final String id;
public YmlBasedLesson(String category, List<String> hints, String title, String html) {
public YmlBasedLesson(String category, List<String> hints, String title, String id) {
this.category = category;
this.hints = hints;
this.title = title;
this.html = html;
this.id = id;
}
@Override
@ -70,8 +70,8 @@ public class YmlBasedLesson extends LessonAdapter {
return title;
}
public String getHtml() {
return html;
public String getId() {
return id;
}