Restrict resource hub access

Closes 
This commit is contained in:
Matt Lott 2016-09-03 23:10:02 -07:00
parent c86c3c4628
commit 9f93c0ed18
4 changed files with 109 additions and 57 deletions
app
locale
styles/teachers
templates/teachers
views/teachers

View file

@ -1495,6 +1495,9 @@
cs2_curriculum_desc: "Scope and sequence, lesson plans, activities and more for Course 2."
cs1_pairprogramming: "Pair Programming Activity"
cs1_pairprogramming_desc: "Introduce students to a pair programming exercise that will help them become better listeners and communicators."
unlock_resources: "Unlock more resources!"
unlock_resources_desc: "Gain access to additional guides by adding student licenses to your account. Request a demo today to get started."
request_demo: "Request Demo"
sharing:
game: "Game"

View file

@ -11,9 +11,15 @@
p
font-size: .8em
.comingsoon
.comingsoon, .unlock
h4
text-align: center
margin: 0 auto 0 auto
color: #666
margin: 30px 0 0 0
p
text-align: center
margin: 0 auto 0 auto
font-size: .9em
padding: 0 0 10px 0

View file

@ -4,68 +4,93 @@ block page_nav
include ../courses/teacher-dashboard-nav.jade
block content
if !me.isTeacher() && !me.isAdmin()
.access-restricted.container.text-center.m-y-3
h5(data-i18n='teacher.access_restricted')
p(data-i18n='teacher.teacher_account_required')
if me.isAnonymous()
.login-button.btn.btn-lg.btn-primary(data-i18n='login.log_in')
a.btn.btn-lg.btn-primary-alt(href="/teachers/signup" data-i18n='teacher.create_teacher_account')
else
a.btn.btn-lg.btn-primary(href="/teachers/update-account" data-i18n="teachers_quote.convert_account_title")
button#logout-button.btn.btn-lg.btn-primary-alt(data-i18n="login.log_out")
.container
.teacher-account-blurb.text-center.col-xs-6.col-xs-offset-3.m-y-3
h5(data-i18n='teacher.what_is_a_teacher_account')
p(data-i18n='teacher.teacher_account_explanation')
.container
else
.container
.content
h1(data-i18n="teacher.resource_hub")
.content
h1(data-i18n="teacher.resource_hub")
h4(data-i18n="teacher.getting_started")
ul
li
a(href="/teachers/resources/getting-started")
span(data-i18n="teacher.teacher_getting_started")
p(data-i18n="teacher.teacher_getting_started_desc")
li
a(href="http://files.codecombat.com/docs/resources/StudentQuickStartGuide.pdf" target="blank")
span(data-i18n="teacher.student_getting_started")
span.spl [PDF]
p(data-i18n="teacher.student_getting_started_desc")
li
a(href="http://files.codecombat.com/docs/resources/ProgressJournal.pdf" target="blank")
span(data-i18n="teacher.progress_journal")
span.spl [PDF]
p(data-i18n="teacher.progress_journal_desc")
h4(data-i18n="teacher.getting_started")
ul
li
a(href="/teachers/resources/getting-started")
span(data-i18n="teacher.teacher_getting_started")
p(data-i18n="teacher.teacher_getting_started_desc")
li
a(href="http://files.codecombat.com/docs/resources/StudentQuickStartGuide.pdf" target="blank")
span(data-i18n="teacher.student_getting_started")
span.spl [PDF]
p(data-i18n="teacher.student_getting_started_desc")
li
a(href="http://files.codecombat.com/docs/resources/ProgressJournal.pdf" target="blank")
span(data-i18n="teacher.progress_journal")
span.spl [PDF]
p(data-i18n="teacher.progress_journal_desc")
h4(data-i18n="teacher.cs1")
ul
h4(data-i18n="teacher.cs1")
ul
li
a(href="/teachers/resources/cs1" target="blank")
span(data-i18n="teacher.cs1_curriculum")
p(data-i18n="teacher.cs1_curriculum_desc")
li
a(href="http://files.codecombat.com/docs/resources/Course1PythonSyntaxGuide.pdf" target="blank")
span(data-i18n="teacher.cs1_syntax_python")
span.spl [PDF]
p(data-i18n="teacher.cs1_syntax_python_desc")
li
a(href="http://files.codecombat.com/docs/resources/Course1JavaScriptSyntaxGuide.pdf" target="blank")
span(data-i18n="teacher.cs1_syntax_javascript")
span.spl [PDF]
p(data-i18n="teacher.cs1_syntax_javascript_desc")
li
a(href="http://files.codecombat.com/docs/resources/EngineeringCycleWorksheet.pdf" target="blank")
span(data-i18n="teacher.engineering_cycle_worksheet")
span.spl [PDF]
a(href="http://files.codecombat.com/docs/resources/WorksheetExample.pdf" target="blank")
i.span.spl(data-i18n="teacher.engineering_cycle_worksheet_link")
p(data-i18n="teacher.engineering_cycle_worksheet_desc")
li
a(href="/teachers/resources/pair-programming")
span(data-i18n="teacher.cs1_pairprogramming")
p(data-i18n="teacher.cs1_pairprogramming_desc")
li
a(href="/teachers/resources/cs1" target="blank")
span(data-i18n="teacher.cs1_curriculum")
p(data-i18n="teacher.cs1_curriculum_desc")
li
a(href="http://files.codecombat.com/docs/resources/Course1PythonSyntaxGuide.pdf" target="blank")
span(data-i18n="teacher.cs1_syntax_python")
span.spl [PDF]
p(data-i18n="teacher.cs1_syntax_python_desc")
li
a(href="http://files.codecombat.com/docs/resources/Course1JavaScriptSyntaxGuide.pdf" target="blank")
span(data-i18n="teacher.cs1_syntax_javascript")
span.spl [PDF]
p(data-i18n="teacher.cs1_syntax_javascript_desc")
li
a(href="http://files.codecombat.com/docs/resources/EngineeringCycleWorksheet.pdf" target="blank")
span(data-i18n="teacher.engineering_cycle_worksheet")
span.spl [PDF]
a(href="http://files.codecombat.com/docs/resources/WorksheetExample.pdf" target="blank")
i.span.spl(data-i18n="teacher.engineering_cycle_worksheet_link")
p(data-i18n="teacher.engineering_cycle_worksheet_desc")
li
a(href="/teachers/resources/pair-programming")
span(data-i18n="teacher.cs1_pairprogramming")
p(data-i18n="teacher.cs1_pairprogramming_desc")
h4(data-i18n="teacher.cs2")
ul
li
a(href="/teachers/resources/cs2" target="blank")
span(data-i18n="teacher.cs2_curriculum")
p(data-i18n="teacher.cs2_curriculum_desc")
if !view.paidAccess && !me.isAdmin()
.unlock
h4
i(data-i18n="teacher.unlock_resources")
p(data-i18n="teacher.unlock_resources_desc")
p
button#request-demo-btn.btn-lg.btn.btn-forest(onClick="window.location.href = '/teachers/demo'" data-i18n="teacher.request_demo")
//- p
//- a(href="/teachers/licenses", data-i18n="teacher.enrollments")
else
h4(data-i18n="teacher.cs2")
ul
li
a(href="/teachers/resources/cs2" target="blank")
span(data-i18n="teacher.cs2_curriculum")
p(data-i18n="teacher.cs2_curriculum_desc")
.comingsoon
h4
i(data-i18n="teacher.coming_soon")
.comingsoon
h4
i(data-i18n="teacher.coming_soon")

View file

@ -1,5 +1,23 @@
RootView = require 'views/core/RootView'
Prepaids = require 'collections/Prepaids'
module.exports = class ResourceHubView extends RootView
id: 'resource-hub-view'
template: require 'templates/teachers/resource-hub-view'
getTitle: -> return $.i18n.t('teacher.resource_hub')
initialize: (options) ->
unless me.isAnonymous()
@prepaids = new Prepaids()
@supermodel.trackRequest(@prepaids.fetchByCreator(me.id))
super(options)
onLoaded: ->
# Grant access for current or future licenses
today = new Date().toISOString()
for prepaid in @prepaids.models when prepaid.get('type') is 'course'
if today.localeCompare(prepaid.get('endDate') ? '') < 0
@paidAccess = true
break
super()