From a3c691f19b0c43ad0bf5be3f47f9620ee79701fa Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sun, 27 Jul 2014 09:39:45 -0700 Subject: Adding new transition page before Teacher section. Also added the Leader page to the normal Chapter list. --- .../grow/frontend/ChapterCompletePage.java | 54 ++++++++++++++-------- src/com/p4square/grow/frontend/GrowFrontend.java | 1 - .../grow/frontend/TrainingPageResource.java | 2 +- src/templates/pages/deeper/teacher.html.ftl | 1 - src/templates/templates/stage-teacher-forward.ftl | 47 +++++++++++++++++++ 5 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 src/templates/templates/stage-teacher-forward.ftl diff --git a/src/com/p4square/grow/frontend/ChapterCompletePage.java b/src/com/p4square/grow/frontend/ChapterCompletePage.java index e8d5ca4..221519f 100644 --- a/src/com/p4square/grow/frontend/ChapterCompletePage.java +++ b/src/com/p4square/grow/frontend/ChapterCompletePage.java @@ -51,7 +51,10 @@ public class ChapterCompletePage extends FreeMarkerPageResource { mConfig = mGrowFrontend.getConfig(); mJsonClient = new JsonRequestClient(getContext().getClientDispatcher()); - mTrainingRecordProvider = new TrainingRecordProvider(new JsonRequestProvider(getContext().getClientDispatcher(), TrainingRecord.class)) { + mTrainingRecordProvider = new TrainingRecordProvider( + new JsonRequestProvider( + getContext().getClientDispatcher(), + TrainingRecord.class)) { @Override public String makeKey(String userid) { return getBackendEndpoint() + "/accounts/" + userid + "/training"; @@ -68,14 +71,7 @@ public class ChapterCompletePage extends FreeMarkerPageResource { */ @Override protected Representation get() { - Template t = mGrowFrontend.getTemplate("templates/stage-complete.ftl"); - try { - if (t == null) { - setStatus(Status.CLIENT_ERROR_NOT_FOUND); - return ErrorPage.TEMPLATE_NOT_FOUND; - } - Map root = getRootObject(); // Get the training summary @@ -110,16 +106,35 @@ public class ChapterCompletePage extends FreeMarkerPageResource { } } - // Skip the chapter complete message for "Introduction" - if ("introduction".equals(mChapter)) { - String nextPage = mConfig.getString("dynamicRoot", ""); - nextPage += "/account/training/" + nextChapter; - getResponse().redirectSeeOther(nextPage); - return new StringRepresentation("Redirecting to " + nextPage); - } - root.put("stage", mChapter); root.put("nextstage", nextChapter); + + /* + * We will display one of two transitional pages: + * + * If the next chapter has a forward page, display the forward page. + * Else, if this chapter is not "Introduction", display the chapter + * complete message. + */ + Template t = mGrowFrontend.getTemplate("templates/stage-" + + nextChapter + "-forward.ftl"); + + if (t == null) { + // Skip the chapter complete message for "Introduction" + if ("introduction".equals(mChapter)) { + String nextPage = mConfig.getString("dynamicRoot", ""); + nextPage += "/account/training/" + nextChapter; + getResponse().redirectSeeOther(nextPage); + return new StringRepresentation("Redirecting to " + nextPage); + } + + t = mGrowFrontend.getTemplate("templates/stage-complete.ftl"); + if (t == null) { + setStatus(Status.CLIENT_ERROR_NOT_FOUND); + return ErrorPage.TEMPLATE_NOT_FOUND; + } + } + return new TemplateRepresentation(t, root, MediaType.TEXT_HTML); } catch (Exception e) { @@ -145,14 +160,17 @@ public class ChapterCompletePage extends FreeMarkerPageResource { final JsonResponse response = mJsonClient.get(getBackendEndpoint() + uri); final Status status = response.getStatus(); if (!status.isSuccess() && !Status.CLIENT_ERROR_NOT_FOUND.equals(status)) { - LOG.warn("Error making backend request for '" + uri + "'. status = " + response.getStatus().toString()); + LOG.warn("Error making backend request for '" + uri + + "'. status = " + response.getStatus().toString()); } return response; } int chapterIndex(String chapter) { - if ("teacher".equals(chapter)) { + if ("leader".equals(chapter)) { + return 5; + } else if ("teacher".equals(chapter)) { return 4; } else if ("disciple".equals(chapter)) { return 3; diff --git a/src/com/p4square/grow/frontend/GrowFrontend.java b/src/com/p4square/grow/frontend/GrowFrontend.java index aaf51a4..4b193d0 100644 --- a/src/com/p4square/grow/frontend/GrowFrontend.java +++ b/src/com/p4square/grow/frontend/GrowFrontend.java @@ -108,7 +108,6 @@ public class GrowFrontend extends FMFacade { accountRouter.attach("/assessment", SurveyPageResource.class); accountRouter.attach("/training/{chapter}/completed", ChapterCompletePage.class); accountRouter.attach("/training/{chapter}/videos/{videoId}.json", VideosResource.class); - accountRouter.attach("/training/leader", GroupLeaderTrainingPageResource.class); accountRouter.attach("/training/{chapter}", TrainingPageResource.class); accountRouter.attach("/training", TrainingPageResource.class); accountRouter.attach("/feed/{topic}", FeedResource.class); diff --git a/src/com/p4square/grow/frontend/TrainingPageResource.java b/src/com/p4square/grow/frontend/TrainingPageResource.java index ae2f3a7..a1e7789 100644 --- a/src/com/p4square/grow/frontend/TrainingPageResource.java +++ b/src/com/p4square/grow/frontend/TrainingPageResource.java @@ -48,7 +48,7 @@ import com.p4square.grow.provider.Provider; public class TrainingPageResource extends FreeMarkerPageResource { private static final Logger LOG = Logger.getLogger(TrainingPageResource.class); - private static final String[] CHAPTERS = { "introduction", "seeker", "believer", "disciple", "teacher" }; + private static final String[] CHAPTERS = { "introduction", "seeker", "believer", "disciple", "teacher", "leader" }; private static final Comparator> VIDEO_COMPARATOR = new Comparator>() { @Override public int compare(Map left, Map right) { diff --git a/src/templates/pages/deeper/teacher.html.ftl b/src/templates/pages/deeper/teacher.html.ftl index 684923e..f0046f2 100644 --- a/src/templates/pages/deeper/teacher.html.ftl +++ b/src/templates/pages/deeper/teacher.html.ftl @@ -35,7 +35,6 @@

Other

diff --git a/src/templates/templates/stage-teacher-forward.ftl b/src/templates/templates/stage-teacher-forward.ftl new file mode 100644 index 0000000..e8f186d --- /dev/null +++ b/src/templates/templates/stage-teacher-forward.ftl @@ -0,0 +1,47 @@ +<#include "/macros/common.ftl"> +<#include "/macros/common-page.ftl"> + +<@commonpage> + <@noticebox> + + + <@content class="text"> +

Welcome

+ +

+ Welcome to the "Leader" portion of GROW. This portion of the GROW + process is intended for those who either: +

+ +
    +
  • Want to lead in the church, or,
  • +
  • Just want to continue to grow personally and be prepared if + called by God to lead
  • +
+ +

+ This section of GROW contains two elements: Teacher and Group Leader +

+ +
    +
  1. Teacher: If you are considering leading in the church in any + capacity; on a team in ministry, or as a Community Group leader you must + complete Teacher
  2. + +
  3. Group Leader: If you are considering leading a Community Group, + you must complete BOTH Teacher and Group Leader
  4. +
+ +

+ We trust you will enjoy these teachings, learn and grow and be better + equipped to serve God regardless of how or where you serve or lead. +

+ + + + <#if nextstage??> + + + -- cgit v1.2.3