mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-02 04:00:36 +00:00
more optimizations with bindonce, replacing ngIf with boIf.
some of this was done with an axe rather than a fine brush, so there may be issues we need to be on the watch for.
This commit is contained in:
parent
0d19c0de21
commit
b431336463
8 changed files with 52 additions and 52 deletions
|
|
@ -5,14 +5,14 @@
|
|||
li
|
||||
a(rel='tooltip', title='Edit Tags', ng-click='saveOrEdit()')
|
||||
i(ng-class='{"icon-ok": _editing, "icon-pencil": !_editing}')
|
||||
li(ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', style='position: relative;')
|
||||
li(bindonce='user.tags', ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', style='position: relative;')
|
||||
.input-append.option-group.tag-editing(ng-show='_editing')
|
||||
input.input.input-small.option-content.tag-editing-pill(type='text', ng-model='tag.name')
|
||||
span.add-on.tag-editing-pill
|
||||
a.pull-right(ng-click='delete(tag,$index)')
|
||||
i.icon-trash
|
||||
a(ng-hide='_editing', ng-click='toggleFilter(tag)')
|
||||
i.icon-bullhorn(ng-if="tag.challenge")
|
||||
i.icon-bullhorn(bo-if="tag.challenge")
|
||||
| {{tag.name}}
|
||||
li
|
||||
form.form-inline(ng-show='_editing', ng-submit='createTag(_newTag)')
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
| Challenges
|
||||
a.pull-right(target='_blank', href='https://trello.com/card/challenges-individual-party-guild-public/50e5d3684fe3a7266b0036d6/58')
|
||||
i.icon-question-sign
|
||||
.modal-body
|
||||
div(ng-if='group.challenges.length > 0')
|
||||
.modal-body(bindonce='group.challenges')
|
||||
div(bo-if='group.challenges.length > 0')
|
||||
table.table.table-striped
|
||||
tr(ng-repeat='challenge in group.challenges')
|
||||
td
|
||||
a(ui-sref='options.social.challenges.detail({cid:challenge._id})') {{challenge.name}}
|
||||
div(ng-if='group.challenges.length == 0')
|
||||
div(bo-if='group.challenges.length == 0')
|
||||
p.
|
||||
No challenges yet, visit <a class='label' ui-sref='options.social.challenges'><i class=icon-bullhorn></i> Challenges</a> to create one.
|
||||
|
|
@ -18,7 +18,7 @@ script(type='text/ng-template', id='partials/options.social.challenges.detail.me
|
|||
|
||||
script(type='text/ng-template', id='partials/options.social.challenges.detail.html')
|
||||
// Edit button
|
||||
div(ng-if='challenge.leader==user._id')
|
||||
div(bindonce='challenge', bo-if='challenge.leader==user._id')
|
||||
ul.unstyled
|
||||
li(ng-hide='challenge._locked==false')
|
||||
button.btn.btn-small.btn-default(ng-click='challenge._locked = false') Edit
|
||||
|
|
@ -35,12 +35,12 @@ script(type='text/ng-template', id='partials/options.social.challenges.detail.ht
|
|||
textarea.option-content(cols='3', placeholder='Description', ng-model='challenge.description')
|
||||
hr
|
||||
|
||||
.well(ng-if='challenge.description') {{challenge.description}}
|
||||
.well(bindonce='challenge', bo-if='challenge.description') {{challenge.description}}
|
||||
i.icon-question-sign(popover="These are the challenge's tasks. As users participate, they will change color and gain graphs to show you the overall progress of the group.", popover-trigger='mouseenter', popover-placement='right')
|
||||
habitrpg-tasks(obj='challenge', main=false)
|
||||
|
||||
// Member List
|
||||
div(ng-if='challenge.members.length > 0')
|
||||
div(bindonce='challenge', bo-if='challenge.members.length > 0')
|
||||
h3 How's Everyone Doing?
|
||||
menu
|
||||
button.customize-option(ng-repeat='member in challenge.members', ng-click='toggleMember(challenge._id, member._id)') {{member.profile.name}}
|
||||
|
|
@ -49,11 +49,11 @@ script(type='text/ng-template', id='partials/options.social.challenges.detail.ht
|
|||
// Accordion version if we choose that instead
|
||||
//- div(ng-if='challenge.members')
|
||||
h4 How's Everyone Doing?
|
||||
.accordion-group(ng-repeat='member in challenge.members')
|
||||
.accordion-group(bindonce='challenge.members', ng-repeat='member in challenge.members')
|
||||
.accordion-heading
|
||||
a.accordion-toggle(ng-click='toggleMember(challenge._id, member._id)') {{member.profile.name}}
|
||||
.accordion-body(ng-class='{collapse: $stateParams.uid != member._id}')
|
||||
.accordion-inner(ng-if='$stateParams.uid == member._id')
|
||||
.accordion-inner(bo-if='$stateParams.uid == member._id')
|
||||
div(ui-view)
|
||||
|
||||
script(type='text/ng-template', id='partials/options.social.challenges.html')
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
|
|||
|
||||
// ------ Information -------
|
||||
.modal(style='position: relative;top: auto;left: auto;right: auto;margin: 0 auto 20px;z-index: 1;max-width: 100%;')
|
||||
.modal-header
|
||||
span(ng-if='group.leader == user.id')
|
||||
.modal-header(bindonce='group')
|
||||
span(bo-if='group.leader == user.id')
|
||||
button.btn.btn-primary.pull-right(ng-click='save(group)', ng-show='group._editing') Save
|
||||
button.btn.btn-default.pull-right(ng-click='group._editing = true', ng-hide='group._editing') Edit Group
|
||||
h3 {{group.name}}
|
||||
|
|
@ -40,7 +40,7 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
|
|||
.modal-header
|
||||
h3 Members
|
||||
.modal-body
|
||||
table.table.table-striped
|
||||
table.table.table-striped(bindonce='group')
|
||||
tr(ng-repeat='member in group.members')
|
||||
td
|
||||
// allow leaders to ban members
|
||||
|
|
@ -48,9 +48,9 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
|
|||
a(ng-click='removeMember(group, member, true)')
|
||||
i.icon-ban-circle(tooltip='Boot Member')
|
||||
a
|
||||
span(bindonce='group', bo-class='{"badge badge-info": group.leader==member._id}', ng-click='clickMember(member._id, true)')
|
||||
span(bo-class='{"badge badge-info": group.leader==member._id}', ng-click='clickMember(member._id, true)')
|
||||
| {{member.profile.name}}
|
||||
tr(ng-if='group.memberCount > group.members.length')
|
||||
tr(bo-if='group.memberCount > group.members.length')
|
||||
td.
|
||||
<span class='badge'>{{group.memberCount - group.members.length}} more members</span>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
div(ng-controller='MemberModalCtrl')
|
||||
#memberModal(modal='modals.member')
|
||||
.modal-header
|
||||
.modal-header(bindonce='profile')
|
||||
h3
|
||||
span {{profile.profile.name}}
|
||||
span(ng-if='profile.contributor.level') - {{contribText(profile.contributor, profile.backer)}}
|
||||
.modal-body
|
||||
span(bo-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;')
|
||||
img(bo-show='profile.profile.imageUrl', bo-src='{{profile.profile.imageUrl}}')
|
||||
markdown(bo-show='profile.profile.blurb', ng-model='profile.profile.blurb')
|
||||
ul.muted.unstyled(bo-if='profile.auth.timestamps', style='margin-top:10px;')
|
||||
li {{profile._id}}
|
||||
li(ng-show='profile.auth.timestamps.created') - Member since {{timestamp(profile.auth.timestamps.created)}} -
|
||||
li(ng-show='profile.auth.timestamps.loggedin') - Last logged in {{timestamp(profile.auth.timestamps.loggedin)}} -
|
||||
li(bo-show='profile.auth.timestamps.created') - Member since {{timestamp(profile.auth.timestamps.created)}} -
|
||||
li(bo-show='profile.auth.timestamps.loggedin') - Last logged in {{timestamp(profile.auth.timestamps.loggedin)}} -
|
||||
h3 Stats
|
||||
include ../profiles/stats
|
||||
.span6
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
hr
|
||||
|
||||
div(bo-if='profile.contributor.level || user._id == profile._id')
|
||||
.achievement.achievement-firefox(ng-if='profile.contributor.level')
|
||||
.achievement.achievement-firefox(bo-if='profile.contributor.level')
|
||||
div(ng-class='{muted: !profile.contributor.level}')
|
||||
h5
|
||||
span.label(bo-if='profile.contributor.level', class='label-contributor-{{profile.contributor.level}}') {{contribText(profile.contributor, profile.backer)}}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
.task-column(class='{{list.type}}s')
|
||||
|
||||
// Todos export/graph options
|
||||
span.option-box.pull-right(ng-if='main && list.type=="todo"')
|
||||
span.option-box.pull-right(bo-if='main && list.type=="todo"')
|
||||
a.option-action(ng-show='obj.history.todos', ng-click='toggleChart("todos")', tooltip='Progress')
|
||||
i.icon-signal
|
||||
//-a.option-action(ng-href='/v1/users/{{user.id}}/calendar.ics?apiToken={{user.apiToken}}', tooltip='iCal')
|
||||
|
|
@ -16,7 +16,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
// <a href="https://www.google.com/calendar/render?cid={{encodeiCalLink(_user.id, _user.apiToken)}}" rel=tooltip title="Google Calendar"><i class=icon-calendar></i></a>
|
||||
|
||||
// Gold & Gems
|
||||
span.option-box.pull-right.wallet(ng-if='main && list.type=="reward"')
|
||||
span.option-box.pull-right.wallet(bo-if='main && list.type=="reward"')
|
||||
.money
|
||||
| {{gold(user.stats.gp)}}
|
||||
span.shop_gold(tooltip='Gold')
|
||||
|
|
@ -28,7 +28,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
h2.task-column_title {{list.header}}
|
||||
|
||||
// Todo Chart
|
||||
.todos-chart(ng-if='list.type == "todo"', ng-show='charts.todos')
|
||||
.todos-chart(bo-if='list.type == "todo"', ng-show='charts.todos')
|
||||
|
||||
// Add New
|
||||
form.addtask-form.form-inline.new-task-form(name='new{{list.type}}form', ng-hide='obj._locked || (list.showCompleted && list.type=="todo")', ng-submit='addTask(obj[list.type+"s"],list)')
|
||||
|
|
@ -45,7 +45,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
include ./task
|
||||
|
||||
// Static Rewards
|
||||
ul.items(ng-if='main && list.type=="reward" && user.flags.itemsEnabled')
|
||||
ul.items(bo-if='main && list.type=="reward" && user.flags.itemsEnabled')
|
||||
li.task.reward-item(ng-hide='item.hide', ng-repeat='item in itemStore')
|
||||
// right-hand side control buttons
|
||||
.task-meta-controls
|
||||
|
|
@ -53,9 +53,9 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
i.icon-comment
|
||||
//left-hand size commands
|
||||
.task-controls
|
||||
a.task-action-btn.btn-reroll(ng-if='item.type=="reroll"', ng-click='modals.reroll = true')
|
||||
a.task-action-btn.btn-reroll(bo-if='item.type=="reroll"', ng-click='modals.reroll = true')
|
||||
i.icon-repeat
|
||||
a.money.btn-buy.item-btn(ng-if='item.type!="reroll"', ng-click='buy(item.type)')
|
||||
a.money.btn-buy.item-btn(bo-if='item.type!="reroll"', ng-click='buy(item.type)')
|
||||
span.reward-cost {{item.value}}
|
||||
span.shop_gold
|
||||
// main content
|
||||
|
|
@ -65,7 +65,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
br
|
||||
|
||||
// Ads
|
||||
div(ng-if='main && !user.purchased.ads && list.type!="reward"')
|
||||
div(bo-if='main && !user.purchased.ads && list.type!="reward"')
|
||||
span.pull-right
|
||||
a(ng-click='modals.buyGems=true', tooltip=env.t('removeAds'))
|
||||
i.icon-remove
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', data-id='{{task.id}}')
|
||||
li(bindonce='list', ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', data-id='{{task.id}}')
|
||||
// right-hand side control buttons
|
||||
.task-meta-controls
|
||||
|
||||
// Due Date
|
||||
span.task-date(ng-if='task.type=="todo" && task.date')
|
||||
span.task-date(bo-if='task.type=="todo" && task.date')
|
||||
| {{task.date}}
|
||||
// Streak
|
||||
span(ng-show='task.streak') {{task.streak}}
|
||||
|
|
@ -11,7 +11,7 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
i.icon-forward
|
||||
|
||||
// Icons only available if you own the tasks (aka, hidden from challenge stats)
|
||||
span(ng-if='!obj._locked')
|
||||
span(bo-if='!obj._locked')
|
||||
i.icon-tags(tooltip='{{appliedTags(user.tags, task.tags)}}', ng-hide='noTags(task.tags)')
|
||||
// edit
|
||||
a(ng-hide='task._editing', ng-click='editTask(task)', tooltip='Edit')
|
||||
|
|
@ -23,13 +23,13 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
a(ng-hide='!task._editing', ng-click='editTask(task);saveTask(task)', tooltip='Save')
|
||||
i.icon-ok(ng-hide='!task._editing')
|
||||
//challenges
|
||||
span(ng-if='task.challenge.id')
|
||||
span(ng-if='task.challenge.broken')
|
||||
span(bo-if='task.challenge.id')
|
||||
span(bo-if='task.challenge.broken')
|
||||
i.icon-bullhorn(style='background-color:red;', ng-click='task._editing = true', tooltip="Broken Challenge Link", tooltip-placement='right')
|
||||
span(ng-if='!task.challenge.broken')
|
||||
span(bo-if='!task.challenge.broken')
|
||||
i.icon-bullhorn(tooltip="Challenge")
|
||||
// delete
|
||||
a(ng-if='!task.challenge.id', ng-click='removeTask(obj[list.type+"s"], $index)', tooltip='Delete')
|
||||
a(bo-if='!task.challenge.id', ng-click='removeTask(obj[list.type+"s"], $index)', tooltip='Delete')
|
||||
i.icon-trash
|
||||
|
||||
// chart
|
||||
|
|
@ -43,7 +43,7 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
.task-controls.task-primary
|
||||
|
||||
// Habits
|
||||
span(ng-if='task.type=="habit"')
|
||||
span(bo-if='task.type=="habit"')
|
||||
// score() is overridden in challengesCtrl to do nothing
|
||||
a.task-action-btn(ng-if='task.up', ng-click='score(task,"up")') +
|
||||
a.task-action-btn(ng-if='task.down', ng-click='score(task,"down")') -
|
||||
|
|
@ -55,7 +55,7 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
span.shop_gold
|
||||
|
||||
// Daily & Todos
|
||||
span.task-checker.action-yesno(ng-if='task.type=="daily" || task.type=="todo"')
|
||||
span.task-checker.action-yesno(bo-if='task.type=="daily" || task.type=="todo"')
|
||||
input.visuallyhidden.focusable(ng-if='$state.includes("tasks")', id='box-{{obj._id}}_{{task.id}}', type='checkbox', ng-model='task.completed', ng-change='changeCheck(task)')
|
||||
input.visuallyhidden.focusable(ng-if='!$state.includes("tasks")', id='box-{{obj._id}}_{{task.id}}', type='checkbox')
|
||||
label(for='box-{{obj._id}}_{{task.id}}')
|
||||
|
|
@ -67,27 +67,27 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
.task-options(ng-show='task._editing')
|
||||
|
||||
// Broken Challenge
|
||||
.well(ng-if='task.challenge.broken')
|
||||
div(ng-if='task.challenge.broken=="TASK_DELETED"')
|
||||
.well(bo-if='task.challenge.broken')
|
||||
div(bo-if='task.challenge.broken=="TASK_DELETED"')
|
||||
p Broken Challenge Link: this task was part of a challenge, but has been removed from it. What would you like to do?
|
||||
p
|
||||
a(ng-click='unlink(task, "keep")') Keep It
|
||||
| |
|
||||
a(ng-click="removeTask(obj[list.type+'s'], $index)") Remove It
|
||||
div(ng-if='task.challenge.broken=="CHALLENGE_DELETED"')
|
||||
div(bo-if='task.challenge.broken=="CHALLENGE_DELETED"')
|
||||
p Broken Challenge Link: this task was part of a challenge, but the challenge (or group) has been deleted. What to do with the orphan tasks?
|
||||
p
|
||||
a(ng-click='unlink(task, "keep-all")') Keep Them
|
||||
| |
|
||||
a(ng-click='unlink(task, "remove-all")') Remove Them
|
||||
div(ng-if='task.challenge.broken=="CHALLENGE_CLOSED"')
|
||||
div(bo-if='task.challenge.broken=="CHALLENGE_CLOSED"')
|
||||
p.
|
||||
This challenge has been completed, and the winner was <span class='badge'>{{task.challenge.winner}}</span>! What to do with the orphan tasks?
|
||||
p
|
||||
a(ng-click='unlink(task, "keep-all")') Keep Them
|
||||
| |
|
||||
a(ng-click='unlink(task, "remove-all")') Remove Them
|
||||
//-div(ng-if='task.challenge.broken=="UNSUBSCRIBED"')
|
||||
//-div(bo-if='task.challenge.broken=="UNSUBSCRIBED"')
|
||||
p Broken Challenge Link: this task was part of a challenge, but you have unsubscribed from the challenge. What to do with the orphan tasks?
|
||||
p
|
||||
a(ng-click="unlink(task, 'keep-all')") Keep Them
|
||||
|
|
@ -104,7 +104,7 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
textarea.option-content(rows='3', ng-model='task.notes', ng-disabled='task.challenge.id')
|
||||
|
||||
// if Habit, plus/minus command options
|
||||
fieldset.option-group(ng-if='task.type=="habit" && !task.challenge.id')
|
||||
fieldset.option-group(bo-if='task.type=="habit" && !task.challenge.id')
|
||||
legend.option-title Direction/Actions
|
||||
span.task-checker.action-plusminus.select-toggle
|
||||
input.visuallyhidden.focusable(id='{{obj._id}}_{{task.id}}-option-plus', type='checkbox', ng-model='task.up')
|
||||
|
|
@ -114,7 +114,7 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
label(for='{{obj._id}}_{{task.id}}-option-minus')
|
||||
|
||||
// if Daily, calendar
|
||||
fieldset(ng-if='task.type=="daily"', class="option-group")
|
||||
fieldset(bo-if='task.type=="daily"', class="option-group")
|
||||
legend.option-title Repeat
|
||||
.task-controls.tile-group.repeat-days
|
||||
// note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding
|
||||
|
|
@ -127,14 +127,14 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
button.task-action-btn.tile(ng-class='{active: task.repeat.s}', type='button', data-day='s', ng-click='task.challenge.id || (task.repeat.s = !task.repeat.s)') S
|
||||
|
||||
// if Reward, pricing
|
||||
fieldset.option-group.option-short(ng-if='task.type=="reward" && !task.challenge.id')
|
||||
fieldset.option-group.option-short(bo-if='task.type=="reward" && !task.challenge.id')
|
||||
legend.option-title Price
|
||||
input.option-content(type='number', size='16', min='0', step="any", ng-model='task.value')
|
||||
.money.input-suffix
|
||||
span.shop_gold
|
||||
|
||||
// if Todos, the due date
|
||||
fieldset.option-group(ng-if='task.type=="todo" && !task.challenge.id')
|
||||
fieldset.option-group(bo-if='task.type=="todo" && !task.challenge.id')
|
||||
legend.option-title Due Date
|
||||
input.option-content.datepicker(type='text', data-date-format='mm/dd/yyyy', ng-model='task.date')
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
| {{tag.name}}
|
||||
|
||||
// Advanced Options
|
||||
span(ng-if='task.type!="reward"')
|
||||
span(bo-if='task.type!="reward"')
|
||||
p.option-title.mega(ng-click='task._advanced = !task._advanced') Advanced Options
|
||||
fieldset.option-group.advanced-option(ng-class="{visuallyhidden: !task._advanced}")
|
||||
legend.option-title
|
||||
|
|
@ -156,8 +156,8 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.
|
|||
button.task-action-btn.tile(type='button', ng-class='{active: task.priority=="!" || !task.priority}', ng-click='task.challenge.id || (task.priority="!")') Easy
|
||||
button.task-action-btn.tile(type='button', ng-class='{active: task.priority=="!!"}', ng-click='task.challenge.id || (task.priority="!!")') Medium
|
||||
button.task-action-btn.tile(type='button', ng-class='{active: task.priority=="!!!"}', ng-click='task.challenge.id || (task.priority="!!!")') Hard
|
||||
//-span(ng-if='task.type=="daily" && !task.challenge.id')
|
||||
span(ng-if='task.type=="daily"')
|
||||
//-span(bo-if='task.type=="daily" && !task.challenge.id')
|
||||
span(bo-if='task.type=="daily"')
|
||||
legend.option-title Restore Streak
|
||||
input.option-content(type='number', ng-model='task.streak')
|
||||
button.task-action-btn.tile.spacious(type='submit') Save & Close
|
||||
|
|
|
|||
Loading…
Reference in a new issue