diff options
5 files changed, 84 insertions, 21 deletions
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<String>(new JsonRequestProvider<TrainingRecord>(getContext().getClientDispatcher(), TrainingRecord.class)) { + mTrainingRecordProvider = new TrainingRecordProvider<String>( + new JsonRequestProvider<TrainingRecord>( + 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<String, Object> 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<Map<String, Object>> VIDEO_COMPARATOR = new Comparator<Map<String, Object>>() { @Override public int compare(Map<String, Object> left, Map<String, Object> 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 @@ </ul> <h3>Other</h3> <ul> - <li><a href="/account/training/leader">Group Leader Orientation</a></li> <li><a href="http://www.myfoursquarechurch.com/connect/community-groups/">Join a Community Group</a></li> </ul> </article> 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> + </@noticebox> + + <@content class="text"> + <h1>Welcome</h1> + + <p> + Welcome to the "Leader" portion of GROW. This portion of the GROW + process is intended for those who either: + </p> + + <ul> + <li>Want to lead in the church, or,</li> + <li>Just want to continue to grow personally and be prepared if + called by God to lead</li> + </ul> + + <p> + This section of GROW contains two elements: Teacher and Group Leader + </p> + + <ol> + <li>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</li> + + <li>Group Leader: If you are considering leading a Community Group, + you must complete BOTH Teacher and Group Leader</li> + </ol> + + <p> + 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. + </p> + + </@content> + + <#if nextstage??> + <div id="getstarted"> + <a class="greenbutton" href="${dynamicRoot}/account/training/${nextstage}">Continue GROWing ➙</a> + </div> + </#if> +</@commonpage> |