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() List<AbstractLesson> lessons = ws.getCourse()
.getLessons(ws, AbstractLesson.USER_ROLE);//TODO this should work with the security roles of Spring .getLessons(ws, AbstractLesson.USER_ROLE);//TODO this should work with the security roles of Spring
Optional<AbstractLesson> lesson = lessons.stream() Optional<AbstractLesson> lesson = lessons.stream()
.filter(l -> l.getHtml().equals(lessonName)) .filter(l -> l.getId().equals(lessonName))
.findFirst(); .findFirst();
model.setViewName("lesson_content"); model.setViewName("lesson_content");
model.addObject("lesson", lesson.get()); 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. * @return a {@link java.lang.String} object.
*/ */
protected String getPath() { 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()); StringBuffer link = new StringBuffer(getPath());
// mvc update: // mvc update:
return link // return link
.append("/").append(getScreenId()) // .append("/").append(getScreenId())
.append("/").append(getCategory().getRanking()).toString(); // .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; return labelManager;
} }
public String getHtml() { public String getId() {
return ""; return "";
} }
} }

View File

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

View File

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