Merge branch 'master' into production

Several UI bugfixes
This commit is contained in:
phoenixeliot 2016-07-08 16:33:34 -07:00
commit e825010b26
9 changed files with 82 additions and 32 deletions

View file

@ -15,6 +15,16 @@
.form-group .form-group
text-align: left text-align: left
margin: 0
input
max-height: 5vh
.form-container
> .form-group, > .row
max-height: 84px
flex-grow: 1
align-self: flex-start
.btn-illustrated img .btn-illustrated img
// Undo previous opacity-toggling hover behavior // Undo previous opacity-toggling hover behavior

View file

@ -1,8 +1,16 @@
@import "app/styles/style-flat-variables" @import "app/styles/style-flat-variables"
#choose-account-type-view #choose-account-type-view
.choose-type-title
display: flex
flex-direction: column
flex-grow: 0.5
justify-content: flex-end
h4
padding-bottom: 10px
.path-cards .path-cards
margin-top: 15px
display: flex display: flex
.path-card ~ .path-card .path-card ~ .path-card
@ -13,7 +21,8 @@
flex-direction: column flex-direction: column
justify-content: space-between justify-content: space-between
width: 235px width: 235px
min-height: 340px height: 340px
max-height: 42vh
border-style: solid border-style: solid
border-width: thin border-width: thin
border-radius: 5px border-radius: 5px
@ -35,6 +44,7 @@
align-items: center align-items: center
justify-content: center justify-content: center
height: 50px height: 50px
max-height: 5vh
color: white color: white
font-weight: bold font-weight: bold
text-align: center text-align: center
@ -43,7 +53,8 @@
flex-grow: 1 flex-grow: 1
display: flex display: flex
flex-direction: column flex-direction: column
margin: 50px 20px 0 justify-content: center
margin: 0 20px
ul ul
align-self: center align-self: center
@ -55,14 +66,26 @@
left: -5px left: -5px
.card-footer .card-footer
margin: 20px margin: 0 20px 20px
min-height: 62px
display: flex
flex-direction: column
justify-content: flex-end
.individual-section .individual-section
margin-top: 50px display: flex
flex-grow: 1
flex-direction: column
align-items: center
justify-content: center
max-width: 425px max-width: 425px
.individual-title .individual-title
font-weight: bold font-weight: bold
.individual-description
margin: 0
flex-grow: 0.2
.text-h6 .text-h6
color: white color: white

View file

@ -17,6 +17,7 @@
display: flex display: flex
flex-direction: column flex-direction: column
height: 850px height: 850px
max-height: 90vh
width: 850px width: 850px
text-align: center text-align: center
padding: 0 padding: 0
@ -44,6 +45,7 @@
align-items: center align-items: center
justify-content: flex-end justify-content: flex-end
height: 100px height: 100px
max-height: 10.5vh
padding: 0 padding: 0
background-color: $navy background-color: $navy

View file

@ -1,5 +1,5 @@
.modal-body-content .modal-body-content
h4 h4.choose-type-title
span(data-i18n="signup.choose_type") span(data-i18n="signup.choose_type")
.path-cards .path-cards
.path-card.navy .path-card.navy

View file

@ -10,7 +10,7 @@
else else
p(data-i18n="signup.confirm_individual_blurb") p(data-i18n="signup.confirm_individual_blurb")
.signup-info-box-wrapper.m-y-3 .signup-info-box-wrapper
.text-burgandy(data-i18n="signup.write_this_down") .text-burgandy(data-i18n="signup.write_this_down")
.signup-info-box.text-center .signup-info-box.text-center
if me.get('name') if me.get('name')
@ -32,4 +32,4 @@
span(data-i18n="general.email") span(data-i18n="general.email")
| : #{me.get('email')} | : #{me.get('email')}
button#start-btn.btn.btn-navy.btn-lg.m-y-3(data-i18n="signup.start_playing") button#start-btn.btn.btn-navy.btn-lg.m-t-3(data-i18n="signup.start_playing")

View file

@ -182,7 +182,8 @@ mixin studentsTab
th.checkbox-col.select-all.small.text-center th.checkbox-col.select-all.small.text-center
span(data-i18n="teacher.select_all") span(data-i18n="teacher.select_all")
.checkbox-flat .checkbox-flat
input(type='checkbox' id='checkbox-all-students') - var allStudentsChecked = _.all(state.get('checkboxStates'))
input(type='checkbox', id='checkbox-all-students', checked=allStudentsChecked)
label.checkmark(for='checkbox-all-students') label.checkmark(for='checkbox-all-students')
th th
+sortButtons +sortButtons
@ -201,7 +202,7 @@ mixin studentRow(student)
tr.student-row.alternating-background tr.student-row.alternating-background
td.checkbox-col.student-checkbox td.checkbox-col.student-checkbox
.checkbox-flat .checkbox-flat
input(type='checkbox' id='checkbox-student-' + student.id, data-student-id=student.id) input(type='checkbox' id='checkbox-student-' + student.id, data-student-id=student.id, checked=state.get('checkboxStates')[student.id])
label.checkmark(for='checkbox-student-' + student.id) label.checkmark(for='checkbox-student-' + student.id)
td.student-info-col td.student-info-col
.student-info .student-info

View file

@ -28,6 +28,7 @@ module.exports = class BasicInfoView extends CocoView
events: events:
'change input[name="email"]': 'onChangeEmail' 'change input[name="email"]': 'onChangeEmail'
'change input[name="name"]': 'onChangeName' 'change input[name="name"]': 'onChangeName'
'change input[name="password"]': 'onChangePassword'
'click .back-button': 'onClickBackButton' 'click .back-button': 'onClickBackButton'
'submit form': 'onSubmitForm' 'submit form': 'onSubmitForm'
'click .use-suggested-name-link': 'onClickUseSuggestedNameLink' 'click .use-suggested-name-link': 'onClickUseSuggestedNameLink'
@ -51,7 +52,14 @@ module.exports = class BasicInfoView extends CocoView
@listenTo @signupState, 'change:facebookEnabled', -> @renderSelectors('.auth-network-logins') @listenTo @signupState, 'change:facebookEnabled', -> @renderSelectors('.auth-network-logins')
@listenTo @signupState, 'change:gplusEnabled', -> @renderSelectors('.auth-network-logins') @listenTo @signupState, 'change:gplusEnabled', -> @renderSelectors('.auth-network-logins')
onChangeEmail: -> # These values are passed along to AuthModal if the user clicks "Sign In" (handled by CreateAccountModal)
updateAuthModalInitialValues: (values) ->
@signupState.set {
authModalInitialValues: _.merge @signupState.get('authModalInitialValues'), values
}, { silent: true }
onChangeEmail: (e) ->
@updateAuthModalInitialValues { email: @$(e.currentTarget).val() }
@checkEmail() @checkEmail()
checkEmail: -> checkEmail: ->
@ -85,7 +93,8 @@ module.exports = class BasicInfoView extends CocoView
}) })
return @state.get('checkEmailPromise') return @state.get('checkEmailPromise')
onChangeName: -> onChangeName: (e) ->
@updateAuthModalInitialValues { name: @$(e.currentTarget).val() }
@checkName() @checkName()
checkName: -> checkName: ->
@ -122,6 +131,9 @@ module.exports = class BasicInfoView extends CocoView
return @state.get('checkNamePromise') return @state.get('checkNamePromise')
onChangePassword: (e) ->
@updateAuthModalInitialValues { password: @$(e.currentTarget).val() }
checkBasicInfo: (data) -> checkBasicInfo: (data) ->
# TODO: Move this to somewhere appropriate # TODO: Move this to somewhere appropriate
tv4.addFormat({ tv4.addFormat({

View file

@ -62,6 +62,7 @@ module.exports = class CreateAccountModal extends ModalView
gplusEnabled: application.gplusHandler.apiLoaded gplusEnabled: application.gplusHandler.apiLoaded
classCode classCode
birthday: new Date('') # so that birthday.getTime() is NaN birthday: new Date('') # so that birthday.getTime() is NaN
authModalInitialValues: {}
} }
{ startOnPath } = options { startOnPath } = options
@ -112,5 +113,4 @@ module.exports = class CreateAccountModal extends ModalView
document.location.reload() document.location.reload()
onClickLoginLink: -> onClickLoginLink: ->
# TODO: Make sure the right information makes its way into the state. @openModalView(new AuthModal({ initialValues: @signupState.get('authModalInitialValues') }))
@openModalView(new AuthModal({ initialValues: @signupState.pick(['email', 'name', 'password']) }))

View file

@ -56,6 +56,7 @@ module.exports = class TeacherClassView extends RootView
assigningToNobody: false assigningToNobody: false
assigningToUnenrolled: false assigningToUnenrolled: false
selectedCourse: undefined selectedCourse: undefined
checkboxStates: {}
classStats: classStats:
averagePlaytime: "" averagePlaytime: ""
totalPlaytime: "" totalPlaytime: ""
@ -145,6 +146,10 @@ module.exports = class TeacherClassView extends RootView
classStats = @calculateClassStats() classStats = @calculateClassStats()
@state.set classStats: classStats if classStats @state.set classStats: classStats if classStats
@state.set students: @students @state.set students: @students
checkboxStates = {}
for student in @students.models
checkboxStates[student.id] = @state.get('checkboxStates')[student.id] or false
@state.set { checkboxStates }
@listenTo @students, 'sort', -> @listenTo @students, 'sort', ->
@state.set students: @students @state.set students: @students
@listenTo @, 'course-select:change', ({ selectedCourse }) -> @listenTo @, 'course-select:change', ({ selectedCourse }) ->
@ -291,8 +296,7 @@ module.exports = class TeacherClassView extends RootView
@trigger 'course-select:change', { selectedCourse: @courses.get($(e.currentTarget).val()) } @trigger 'course-select:change', { selectedCourse: @courses.get($(e.currentTarget).val()) }
getSelectedStudentIDs: -> getSelectedStudentIDs: ->
@$('.student-row .checkbox-flat input:checked').map (index, checkbox) -> Object.keys(_.pick @state.get('checkboxStates'), (checked) -> checked)
$(checkbox).data('student-id')
ensureInstance: (courseID) -> ensureInstance: (courseID) ->
@ -304,7 +308,7 @@ module.exports = class TeacherClassView extends RootView
window.tracker?.trackEvent $(e.currentTarget).data('event-action'), category: 'Teachers', classroomID: @classroom.id, userID: userID, ['Mixpanel'] window.tracker?.trackEvent $(e.currentTarget).data('event-action'), category: 'Teachers', classroomID: @classroom.id, userID: userID, ['Mixpanel']
onClickBulkEnroll: -> onClickBulkEnroll: ->
userIDs = @getSelectedStudentIDs().toArray() userIDs = @getSelectedStudentIDs()
selectedUsers = new Users(@students.get(userID) for userID in userIDs) selectedUsers = new Users(@students.get(userID) for userID in userIDs)
@enrollStudents(selectedUsers) @enrollStudents(selectedUsers)
window.tracker?.trackEvent 'Teachers Class Students Enroll Selected', category: 'Teachers', classroomID: @classroom.id, ['Mixpanel'] window.tracker?.trackEvent 'Teachers Class Students Enroll Selected', category: 'Teachers', classroomID: @classroom.id, ['Mixpanel']
@ -385,10 +389,9 @@ module.exports = class TeacherClassView extends RootView
onClickBulkAssign: -> onClickBulkAssign: ->
courseID = @$('.bulk-course-select').val() courseID = @$('.bulk-course-select').val()
selectedIDs = @getSelectedStudentIDs() selectedIDs = @getSelectedStudentIDs()
members = selectedIDs.filter((index, userID) => members = selectedIDs.filter (userID) =>
user = @students.get(userID) user = @students.get(userID)
user.isEnrolled() user.isEnrolled()
).toArray()
assigningToUnenrolled = _.any selectedIDs, (userID) => assigningToUnenrolled = _.any selectedIDs, (userID) =>
not @students.get(userID).isEnrolled() not @students.get(userID).isEnrolled()
assigningToNobody = selectedIDs.length is 0 assigningToNobody = selectedIDs.length is 0
@ -417,23 +420,22 @@ module.exports = class TeacherClassView extends RootView
onClickSelectAll: (e) -> onClickSelectAll: (e) ->
e.preventDefault() e.preventDefault()
checkboxes = @$('.student-checkbox input') checkboxStates = _.clone @state.get('checkboxStates')
if _.all(checkboxes, 'checked') if _.all(checkboxStates)
@$('.select-all input').prop('checked', false) for studentID of checkboxStates
checkboxes.prop('checked', false) checkboxStates[studentID] = false
else else
@$('.select-all input').prop('checked', true) for studentID of checkboxStates
checkboxes.prop('checked', true) checkboxStates[studentID] = true
null @state.set { checkboxStates }
onClickStudentCheckbox: (e) -> onClickStudentCheckbox: (e) ->
e.preventDefault() e.preventDefault()
# $(e.target).$()
checkbox = $(e.currentTarget).find('input') checkbox = $(e.currentTarget).find('input')
checkbox.prop('checked', not checkbox.prop('checked')) studentID = checkbox.data('student-id')
# checkboxes.prop('checked', false) checkboxStates = _.clone @state.get('checkboxStates')
checkboxes = @$('.student-checkbox input') checkboxStates[studentID] = not checkboxStates[studentID]
@$('.select-all input').prop('checked', _.all(checkboxes, 'checked')) @state.set { checkboxStates }
calculateClassStats: -> calculateClassStats: ->
return {} unless @classroom.sessions?.loaded and @students.loaded return {} unless @classroom.sessions?.loaded and @students.loaded