Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #318 from negue/performance
Browse files Browse the repository at this point in the history
the first performance changes
  • Loading branch information
negue committed Jan 5, 2015
2 parents 799428b + 2d2876d commit be88a48
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 24 deletions.
6 changes: 5 additions & 1 deletion scripts/controllers/tasksCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ habitrpg
case (value < 10): return ' color-better';
default: return ' color-best';
}
}
};

$scope.isDateSet = function(task){
return !!task.date;
};

$scope.addTask = function (newTask, type) {
var text = newTask.text
Expand Down
10 changes: 5 additions & 5 deletions views/app.jade
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ include app/chat
include app/guild
include app/buygems

- var sideMenuItems = {'tasks/habits':'Tasks','profile/avatar':'Profile','inventory/inventory':'Inventory','stable/pets':'Stable','social/tavern':'Social',purchase: 'Purchase Gems',settings:'Settings',about:'About'}

script(id='views/app.html',type='text/ng-template')
ion-side-menus
ion-pane(ion-side-menu-content)
Expand All @@ -25,14 +27,12 @@ script(id='views/app.html',type='text/ng-template')

ion-nav-view(name='menuContent', animation='slide-left-right')
ion-side-menu(side='left')
header.bar.bar-header.bar-stable(ng-if='isIOS')
header.bar.bar-header.bar-stable(ng-if=' ::isIOS')
h1.title Menu
ion-content(ng-class='{"has-header":isIOS}')
ion-content(ng-class=':: {"has-header":isIOS}')
+avatar2(true)
ion-list
// ion-item.menu-avatar(nav-clear, menu-close, href='#/app/profile')
// +avatar2()
each v,k in {'tasks/habits':'Tasks','profile/avatar':'Profile','inventory/inventory':'Inventory','stable/pets':'Stable','social/tavern':'Social',purchase: 'Purchase Gems',settings:'Settings',about:'About'}
each v,k in sideMenuItems
ion-item(nav-clear, menu-close, href='#/app/#{k}')
//-img(ng-src='assets/sidebar-icon-#{k}.png')
| #{v}
Expand Down
2 changes: 1 addition & 1 deletion views/app/chat.jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ script(id='views/app.chat.list.html',type='text/ng-template')
ion-item.item-text-wrap(ng-repeat='message in chat')
.pull-right(style='opacity:0.3;') {{moment(message.timestamp).format('MMM Do h:mma')}}
h2 {{message.user}}
markdown(ng-model='message.text')
markdown(text='message.text')
ion-infinite-scroll(on-infinite='loadMore(5)', distance='1%')

script(id='views/app.chat.html',type='text/ng-template')
Expand Down
21 changes: 12 additions & 9 deletions views/app/list.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mixin taskText
markdown.task-text(ng-model='task.text')
p(ng-if="task.date") {{task.date | date}}
markdown.task-text(text='task.text', remove-watch='true')

- var tasks = {habit:{name:'Habits',singular:'Habit'}, daily:{name:'Dailies',singular:'Daily'}, todo:{name:'To-Dos',singular:'To-Do'}, reward:{name:'Rewards',singular:'Reward'}}

Expand All @@ -17,12 +16,12 @@ mixin taskList(k)
.item.rewards-wallet
+wallet()

form.item.item-input-inset(ng-submit='addTask(newTask,"#{k}")',ng-show='_addingTask')
form.item.item-input-inset(ng-submit='addTask(newTask,"#{k}")',ng-if='_addingTask')
label.item-input-wrapper
input(type='text', placeholder='+ Add New #{nav.singular}', ng-model='newTask.text')
button.button.button-small(type='submit') Add

.card(ng-if='user.#{k}s.length == 0')
.card(ng-if=' ::user.#{k}s.length == 0')
.item.item-text-wrap
| No #{nav.name} found, add some above.

Expand All @@ -31,22 +30,26 @@ mixin taskList(k)
if k=='reward'
.item.item-divider Custom Rewards

ion-item.item-text-wrap(on-hold="actionSheet(task)", ng-click="viewTask(task)", ng-repeat='task in user.#{k}s | filter:taskFilter',ng-class='[getClass(task.value),"task-#{k}",(task.completed || notDue(task)) ? "completed" : ""]')
ion-item.item-text-wrap(on-hold="actionSheet(task)", ng-click="viewTask(task)", ng-repeat='task in user.#{k}s | filter:taskFilter',ng-class='::[getClass(task.value),"task-#{k}",(task.completed || notDue(task)) ? "completed" : ""]')
if k=='habit'
.item-button-right
.buttons
button.button.button-small.icon.ion-plus-round(ng-click='score(task,"up", $event)', ng-show='task.up')
button.button.button-small.icon.ion-minus-round(ng-click='score(task,"down", $event)', ng-show='task.down')
button.button.button-small.icon.ion-plus-round(ng-click='score(task,"up", $event)', ng-show=' ::task.up')
button.button.button-small.icon.ion-minus-round(ng-click='score(task,"down", $event)', ng-show=' ::task.down')
+taskText()
if k=='daily' || k=='todo'
.item-button-left
button.button.button-large.button-clear.button-positive.icon(ng-click='changeCheck(task, $event)')
i(ng-class="task.completed && 'icon ion-checkmark-circled' || !task.completed && 'checkbox-icon'")
i(ng-class=" ::{'icon ion-checkmark-circled': task.completed, 'checkbox-icon': !task.completed }")
+taskText()

if k=='todo'
p(ng-if=" ::isDateSet(task)") {{ ::task.date}}

if k=='reward'
.item-button-right
button.button.button-small.buy-button(ng-click='score(task,"down", $event)')
| {{task.value}}
| {{ ::task.value}}
span.shop_gold
+taskText()

Expand Down
6 changes: 3 additions & 3 deletions views/app/settings.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ script(id="views/app.settings.html",type='text/ng-template')
|Copy these for use in third party applications. However, think of your API Token like a password, and do not share it publicly. You may occasionally be asked for your User ID, but never post your API Token where others can see it, including on Github.
.item.item-button-right
strong UUID:&nbsp;
| {{settings.auth.apiId}}
| {{ ::settings.auth.apiId}}
button.button.button-positive(ng-click='copy("UUID", settings.auth.apiId)')
i.icon.ion-clipboard
.item.item-button-right
strong API Token:&nbsp;
| {{settings.auth.apiToken}}
| {{ ::settings.auth.apiToken}}
button.button.button-positive(ng-click='copy("API Token", settings.auth.apiToken)')
i.icon.ion-clipboard
.item
strong URL:&nbsp;
| {{settings.auth.apiEndpoint}}
| {{ ::settings.auth.apiEndpoint}}

//-.card(ng-if='!user.purchased.plan.customerId')
+premiumAndAds()
Expand Down
10 changes: 5 additions & 5 deletions views/notifications.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ div(ng-controller="NotificationCtrl")
span(ng-if='notification.type=="text"', ng-bind-html='notification.data')
span(ng-if='notification.type=="stats"')
span(ng-show='notification.data.hp')
| {{notification.data.hp}}&nbsp;
| {{ ::notification.data.hp}}&nbsp;
i.ion-heart
|&nbsp;
span(ng-show='notification.data.exp')
| {{notification.data.exp}}&nbsp;
| {{ ::notification.data.exp}}&nbsp;
i.ion-star
|&nbsp;
span(ng-show='notification.data.gp || notification.data.silver')
| {{notification.data.gp}}
| {{ ::notification.data.gp}}
span.shop_gold
| {{notification.data.silver}}
| {{ ::notification.data.silver}}
span.shop_silver
|&nbsp;
span(ng-show='notification.data.mp')
| {{notification.data.mp}}&nbsp;
| {{ ::notification.data.mp}}&nbsp;
i.ion-fireball

0 comments on commit be88a48

Please sign in to comment.