refactor(bs3): use templates for modals

This commit is contained in:
Matteo Pagliazzi 2014-01-29 22:18:13 +01:00
parent 7354efc1d5
commit c93bc46908
14 changed files with 134 additions and 157 deletions

View file

@ -1,5 +1,5 @@
// Streak
div(modal='modals.achievements.streak')
script(id='modals/achievements/streak.html', type='text/ng-template')
.modal-header
h3=env.t('modalAchievement')
.modal-body
@ -9,7 +9,7 @@ div(modal='modals.achievements.streak')
button.btn.btn-default.cancel(ng-click='modals.achievements.streak = false')=env.t('ok')
// Max Gear
div(modal='modals.achievements.ultimateGear')
script(id='modals/achievements/ultimateGear.html', type='text/ng-template')
.modal-header
h3=env.t('modalAchievement')
.modal-body
@ -19,7 +19,7 @@ div(modal='modals.achievements.ultimateGear')
button.btn.btn-default.cancel(ng-click='modals.achievements.ultimateGear = false')=env.t('ok')
// Beast Master
div(modal='modals.achievements.beastMaster')
script(id='modals/achievements/ultimateGear.html', type='text/ng-template')
.modal-header
h3=env.t('modalAchievement')
.modal-body
@ -30,7 +30,8 @@ div(modal='modals.achievements.beastMaster')
button.btn.btn-default.cancel(ng-click='modals.achievements.beastMaster = false')=env.t('ok')
// Contributor
div(modal='user.flags.contributor')
// activated by user.flags.contributor
script(id='modals/achievements/contributor.html', type='text/ng-template')
.modal-header
h3=env.t('modalContribAchievement')
.modal-body
@ -45,7 +46,7 @@ div(modal='user.flags.contributor')
button.btn.btn-default.cancel(ng-click='set({"flags.contributor":false})')=env.t('ok')
//Rebirth
div(modal='modals.achievements.rebirth')
script(id='modals/achievements/rebirth.html', type='text/ng-template')
.modal-header
h3=env.t('modalAchievement')
.modal-body

View file

@ -1,4 +1,5 @@
div(modal='modals.buyGems')
//Why is shown? Because of script here at line 24!!!!!!!!!
script(id='modals/buyGems.html', type='text/ng-template')
.modal-body
.buy-gems
include ../gems
@ -20,7 +21,7 @@ div(modal='modals.buyGems')
.btn.btn-primary(ng-click='showStripe()',style='margin-left:10px;')=env.t('payWithCard')
div(style='float:left;')
//-script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-env="#{env.NODE_ENV == 'production' ? '' : 'sandbox'}", data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
//script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name=env.t('paypalText'), data-quantity='1', data-amount='5', data-currency='USD', data-tax='0', data-callback='#{env.BASE_URL}/api/v2/user/buy-gems/paypal-ipn', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-rm='1', data-no_shipping='1')
p
small.muted(style='line-height:10px;')=env.t('payNote')

View file

@ -1,4 +1,6 @@
.modal(ng-if='!user.flags.classSelected && user.stats.lvl >= 10', data-backdrop=true, ng-controller='UserCtrl')
//activated by
// ng-if='!user.flags.classSelected && user.stats.lvl >= 10', data-backdrop=true, ng-controller='UserCtrl')
script(type='text/ng-template', id='modals/chooseClass.html')
.modal-header
h3=env.t('chooseClass1')
a(href='http://habitrpg.wikia.com/wiki/Class_System' target='_blank')=env.t('chooseClass2')

View file

@ -1,4 +1,5 @@
div(modal='user.stats.hp <= 0', options='{backdrop:true, keyboard:false, backdropClick:false}')
//div(modal='user.stats.hp <= 0', options='{backdrop:true, keyboard:false, backdropClick:false}')
script(type='text/ng-template', id='modals/death.html')
.modal-body
.row-fluid
.span4

View file

@ -1,4 +1,5 @@
div(modal='modals.dropsEnabled')
//div(modal='modals.dropsEnabled')
script(type='text/ng-template', id='modals/dropsEnabled.html')
.modal-header
h3=env.t('dropsEnabled')
.modal-body
@ -12,7 +13,8 @@ div(modal='modals.dropsEnabled')
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.dropsEnabled = false')=env.t('close')
div(modal='modals.drop')
//div(modal='modals.drop')
script(type='text/ng-template', id='modals/drop.html')
.modal-header
h3=env.t('itemDrop')
.modal-body

View file

@ -1,5 +1,4 @@
include ./achievements
include ./login
include ./reroll
include ./death
include ./new-stuff

View file

@ -1,42 +0,0 @@
// This file was moved to /views/static/front.jade, as we're requiring login / registration from front page now
keep this file around until we're sure of that decision
//-div(modal='modals.login')
.modal-header
h3 Login / Register
.modal-body
//a(href='/auth/facebook')
img(src='/img/facebook-login-register.jpeg', alt='Login / Register With Facebook')
//h3 Or
tabset
tab(heading='Login')
form(ng-controller='AuthCtrl', ng-submit='auth()')
.control-group
input(type='text', ng-model='loginUsername', placeholder='{{useUUID ? \'UUID\' : \'Username\'}}')
.control-group
input(type='{{useUUID ? "text" : "password"}}', ng-model='loginPassword', placeholder='{{useUUID ? \'API Token\' : \'Password\'}}')
.control-group
label.checkbox
input(type='checkbox', ng-click='useUUID = !useUUID')
| Use UUID / API Token (For Facebook Users)
.control-group
input.btn.btn-primary(type='submit', value='Login')
tab(heading='Register')
form(ng-controller='AuthCtrl', ng-submit='register()', name='registrationForm')
.control-group
input(type='text', ng-model='registerVals.username', placeholder='Username', required)
.control-group
input(type='email', ng-model='registerVals.email', placeholder='Email', required)
.control-group
input(type='password', ng-model='registerVals.password', placeholder='Password', required)
.control-group
input(type='password', ng-model='registerVals.confirmPassword', placeholder='Password Confirm', required)
.control-group
input.btn.btn-primary(type='submit', value='Register')
.modal-footer
button.btn.btn-warning.cancel(ng-click='modals.login = false') Cancel

View file

@ -1,26 +1,28 @@
div(ng-controller='MemberModalCtrl')
//div(ng-controller='MemberModalCtrl')
#memberModal(modal='modals.member')
.modal-header(bindonce='profile')
h3
span {{profile.profile.name}}
span(ng-if='profile.contributor.level') - {{contribText(profile.contributor, profile.backer)}}
.modal-body(bindonce='profile')
.row-fluid
.span6
img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}')
markdown(ng-show='profile.profile.blurb', ng-model='profile.profile.blurb')
ul.muted.unstyled(ng-if='profile.auth.timestamps', style='margin-top:10px;')
li {{profile._id}}
li(ng-show='profile.auth.timestamps.created')=env.t('memberSince')
| {{timestamp(profile.auth.timestamps.created)}} -
li(ng-show='profile.auth.timestamps.loggedin')=env.t('lastLoggedIn')
| {{timestamp(profile.auth.timestamps.loggedin)}} -
h3=env.t('stats')
.label.label-info {{profile.stats.class}}
include ../profiles/stats
.span6
include ../header/avatar
h3 Achievements
include ../profiles/achievements
.modal-footer
button.btn.btn-default(ng-click='modals.member = false')=env.t('ok')
script(type='text/ng-template', id='modals/member.html')
.modal-header(bindonce='profile')
h3
span {{profile.profile.name}}
span(ng-if='profile.contributor.level') - {{contribText(profile.contributor, profile.backer)}}
.modal-body(bindonce='profile')
.row-fluid
.span6
img(ng-show='profile.profile.imageUrl', ng-src='{{profile.profile.imageUrl}}')
markdown(ng-show='profile.profile.blurb', ng-model='profile.profile.blurb')
ul.muted.unstyled(ng-if='profile.auth.timestamps', style='margin-top:10px;')
li {{profile._id}}
li(ng-show='profile.auth.timestamps.created')=env.t('memberSince')
| {{timestamp(profile.auth.timestamps.created)}} -
li(ng-show='profile.auth.timestamps.loggedin')=env.t('lastLoggedIn')
| {{timestamp(profile.auth.timestamps.loggedin)}} -
h3=env.t('stats')
.label.label-info {{profile.stats.class}}
include ../profiles/stats
.span6
include ../header/avatar
h3 Achievements
include ../profiles/achievements
.modal-footer
button.btn.btn-default(ng-click='modals.member = false')=env.t('ok')

View file

@ -11,7 +11,8 @@
.modal-footer
button.btn.btn-default.cancel(ng-click='User.set({"flags.mathUpdates":true})') Dismiss
div(modal='modals.newStuff')
//div(modal='modals.newStuff')
script(type='text/ng-template', id='modals/newStuff.html')
.modal-header
h3 New Stuff!
.modal-body

View file

@ -11,7 +11,8 @@ script(id='partials/options.social.party.quest-rewards.html', type='text/ng-temp
td {{quest.drop.gp}}
=env.t('gold')
div(modal='user.party.quest.completed', ng-controller='InventoryCtrl')
//div(modal='user.party.quest.completed', ng-controller='InventoryCtrl')
script(type='text/ng-template', id='modals/questCompleted.html')
.modal-header
h3 "{{Content.quests[user.party.quest.completed].text}}"
=env.t('completed')
@ -21,7 +22,8 @@ div(modal='user.party.quest.completed', ng-controller='InventoryCtrl')
.modal-footer
button.btn.btn-default.btn-primary(ng-click='set({"party.quest.completed":""})')=env.t('accept')
div(modal='modals.showQuest', ng-controller='InventoryCtrl')
//div(modal='modals.showQuest', ng-controller='InventoryCtrl')
script(type='text/ng-template', id='modals/showQuest.html')
.modal-header
h3 {{selectedQuest.text}}
.modal-body
@ -36,7 +38,8 @@ div(modal='modals.showQuest', ng-controller='InventoryCtrl')
button.btn.btn-default.btn-small.btn-cancel(ng-click='closeQuest()')=env.t('cancel')
button.btn.btn-default.btn-primary(ng-click='questInit()')=env.t('inviteParty')
div(modal='modals.buyQuest', ng-controller='InventoryCtrl')
//div(modal='modals.buyQuest', ng-controller='InventoryCtrl')
script(type='text/ng-template', id='modals/buyQuest.html')
.modal-header
h3 {{selectedQuest.text}}
.modal-body
@ -47,7 +50,8 @@ div(modal='modals.buyQuest', ng-controller='InventoryCtrl')
button.btn.btn-large.cancel(ng-click='closeQuest()')=env.t('neverMind')
button.btn.btn-default.btn-large.btn-primary(ng-click='purchase("quests", quest);closeQuest()')=env.t('buyQuest')
div(modal='party.quest.key && !party.quest.active && !questHold && party.quest.members[user._id] == undefined')
//div(modal='party.quest.key && !party.quest.active && !questHold && party.quest.members[user._id] == undefined')
script(type='text/ng-template', id='modals/questInvitation.html')
.modal-header
h3=env.t('questInvitation')
| {{Content.quests[party.quest.key].text}}

View file

@ -1,6 +1,7 @@
// Created by Sabe on 12/22/13.
div(modal='modals.rebirthEnabled')
//div(modal='modals.rebirthEnabled')
script(type='text/ng-template', id='modals/rebirthEnabled.html')
.modal-header
h3=env.t('rebirthNew')
.modal-body
@ -10,7 +11,8 @@ div(modal='modals.rebirthEnabled')
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.rebirthEnabled = false')=env.t('close')
div(modal='modals.rebirth')
//div(modal='modals.rebirth')
script(type='text/ng-template', id='modals/rebirth.html')
.modal-header
h3=env.t('rebirthBegin')
.modal-body

View file

@ -1,5 +1,6 @@
// Re-Roll modal
div(modal='modals.reroll')
//div(modal='modals.reroll')
script(type='text/ng-template', id='modals/reroll.html')
.modal-header
h3=env.t('fortify')
.modal-body

View file

@ -1,76 +1,79 @@
div(ng-controller='SettingsCtrl')
//div(ng-controller='SettingsCtrl')
div(modal='modals.reset')
.modal-header
h3=env.t('resetaccount')
.modal-body
p=env.t('resetText1')
p=env.t('resetText2')
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.reset = false')=env.t('neverMind')
button.btn.btn-danger(data-dismiss='modal', ng-click='reset()')=env.t('resetDo')
script(type='text/ng-template', id='modals/reset.html')
.modal-header
h3=env.t('resetaccount')
.modal-body
p=env.t('resetText1')
p=env.t('resetText2')
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.reset = false')=env.t('neverMind')
button.btn.btn-danger(data-dismiss='modal', ng-click='reset()')=env.t('resetDo')
div(modal='modals.restore')
.modal-header
h3=env.t('fixValues')
.modal-body
p=env.t('fixValuesText1')
p=env.t('fixValuesText2')
div.restore-options
form#restore-form.form-horizontal
h3=env.t('stats')
//div(modal='modals.restore')
script(type='text/ng-template', id='modals/restore.html')
.modal-header
h3=env.t('fixValues')
.modal-body
p=env.t('fixValuesText1')
p=env.t('fixValuesText2')
div.restore-options
form#restore-form.form-horizontal
h3=env.t('stats')
.option-group.option-medium
input.option-content(type='number', step="any", data-for='stats.hp', ng-model='restoreValues.stats.hp')
span.input-suffix=env.t('health')
.option-group.option-medium
input.option-content(type='number', step="any", data-for='stats.exp', ng-model='restoreValues.stats.exp')
span.input-suffix=env.t('experience')
.option-group.option-medium(ng-if='!user.purchased.plan.customerId')
//input.option-content(type='number', step="any", data-for='stats.gp', ng-model='restoreValues.stats.gp')
input.option-content(type='number', step="any", data-for='stats.gp', ng-model='restoreValues.stats.gp',disabled)
span.input-suffix=env.t('gold')
p.alert
small=env.t('disabledWinterEvent')
.option-group.option-medium
input.option-content(type='number', step="any", data-for='stats.mp', ng-model='restoreValues.stats.mp')
span.input-suffix=env.t('mana')
.option-group.option-medium
input.option-content(type='number', data-for='stats.lvl', ng-model='restoreValues.stats.lvl')
span.input-suffix=env.t('level')
//-
//- Commenting out since it doesn't make sense to restore equipment with Armory anymore. They can just restore GP & buy
h3 Equipment
.option-group.option-medium
input.option-content(type='number', step="any", data-for='stats.hp', ng-model='restoreValues.stats.hp')
span.input-suffix=env.t('health')
input.option-content(type='number', data-for='items.weapon', ng-model='restoreValues.items.weapon')
span.input-suffix Weapon
.option-group.option-medium
input.option-content(type='number', step="any", data-for='stats.exp', ng-model='restoreValues.stats.exp')
span.input-suffix=env.t('experience')
.option-group.option-medium(ng-if='!user.purchased.plan.customerId')
//input.option-content(type='number', step="any", data-for='stats.gp', ng-model='restoreValues.stats.gp')
input.option-content(type='number', step="any", data-for='stats.gp', ng-model='restoreValues.stats.gp',disabled)
span.input-suffix=env.t('gold')
p.alert
small=env.t('disabledWinterEvent')
input.option-content(type='number', data-for='items.armor', ng-model='restoreValues.items.armor')
span.input-suffix Armor
.option-group.option-medium
input.option-content(type='number', step="any", data-for='stats.mp', ng-model='restoreValues.stats.mp')
span.input-suffix=env.t('mana')
input.option-content(type='number', data-for='items.head', ng-model='restoreValues.items.head')
span.input-suffix Helm
.option-group.option-medium
input.option-content(type='number', data-for='stats.lvl', ng-model='restoreValues.stats.lvl')
span.input-suffix=env.t('level')
//-
//- Commenting out since it doesn't make sense to restore equipment with Armory anymore. They can just restore GP & buy
h3 Equipment
.option-group.option-medium
input.option-content(type='number', data-for='items.weapon', ng-model='restoreValues.items.weapon')
span.input-suffix Weapon
.option-group.option-medium
input.option-content(type='number', data-for='items.armor', ng-model='restoreValues.items.armor')
span.input-suffix Armor
.option-group.option-medium
input.option-content(type='number', data-for='items.head', ng-model='restoreValues.items.head')
span.input-suffix Helm
.option-group.option-medium
input.option-content(type='number', data-for='items.shield', ng-model='restoreValues.items.shield')
span.input-suffix Shield
h3=env.t('achievements')
.option-group.option-medium
input.option-content(type='number', data-for='achievements.streak', ng-model='restoreValues.achievements.streak')
span.input-suffix=env.t('fix21Streaks')
//- This is causing too many problems for users
h3=env.t('other')
a.btn.btn-small.btn-warning(ng-controller='FooterCtrl', ng-click='addMissedDay()')=env.t('triggerDay')
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.restore = false')=env.t('discardChanges')
button.btn.btn-primary(ng-click='restore()')=env.t('saveAndClose')
input.option-content(type='number', data-for='items.shield', ng-model='restoreValues.items.shield')
span.input-suffix Shield
h3=env.t('achievements')
.option-group.option-medium
input.option-content(type='number', data-for='achievements.streak', ng-model='restoreValues.achievements.streak')
span.input-suffix=env.t('fix21Streaks')
//- This is causing too many problems for users
h3=env.t('other')
a.btn.btn-small.btn-warning(ng-controller='FooterCtrl', ng-click='addMissedDay()')=env.t('triggerDay')
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.restore = false')=env.t('discardChanges')
button.btn.btn-primary(ng-click='restore()')=env.t('saveAndClose')
div(modal='modals.delete')
.modal-header
h3=env.t('deleteaccount')
.modal-body
p=env.t('deleteText1')
strong=env.t('deleteText2')
=env.t('deleteText3')
p
input(type='text', ng-model='_deleteAccount')
.modal-footer
button.btn.btn-default(ng-click='modals.delete = false')=env.t('neverMind')
button.btn.btn-danger.btn-small(ng-disabled='_deleteAccount != "DELETE"', ng-click='delete()')=env.t('deleteDo')
//div(modal='modals.delete')
script(type='text/ng-template', id='modals/delete.html')
.modal-header
h3=env.t('deleteaccount')
.modal-body
p=env.t('deleteText1')
strong=env.t('deleteText2')
=env.t('deleteText3')
p
input(type='text', ng-model='_deleteAccount')
.modal-footer
button.btn.btn-default(ng-click='modals.delete = false')=env.t('neverMind')
button.btn.btn-danger.btn-small(ng-disabled='_deleteAccount != "DELETE"', ng-click='delete()')=env.t('deleteDo')

View file

@ -1,4 +1,4 @@
script(id='modals/login.html', type="text/ng-template")
script(id='modals/login.html', type='text/ng-template')
.modal-header
button.close(type='button', ng-click='$close()') ×
h4.modal-title=env.t('loginAndReg')