rewrite: prep for adding filters, restructured html to allow separate

options / tasks
This commit is contained in:
Tyler Renelle 2013-08-28 18:11:00 -04:00
parent 72a26d35bb
commit b77021e745
6 changed files with 144 additions and 174 deletions

View file

@ -73,9 +73,6 @@ html
include ./shared/modals/index
include ./shared/header/header
app:filters:filters(ng-hide='_gamePane')
br
#notification-area(ng-controller='NotificationCtrl')
#wrap
@ -86,8 +83,8 @@ html
//if they hide the header, we still need user-menu visible
app:settings:menu(ng-show='user.preferences.hideHeader')
.exp-chart(ng-show='page.charts.exp')
#main.grid
div(ng-view)
#main(ng-view)
.container
h3

View file

@ -1,56 +1,57 @@
.module.full-width
span.option-box.pull-right.wallet
app:rewards:user-gems
.grid
.module.full-width
span.option-box.pull-right.wallet
app:rewards:user-gems
tabset
tab
tab-heading
i.icon-user
| Profile
include ./profile
tabset
tab
tab-heading
i.icon-user
| Profile
include ./profile
tab
tab-heading
i.icon-heart
| Groups
app:groups:groups-pane
tab
tab-heading
i.icon-heart
| Groups
app:groups:groups-pane
tab(ng-show='user.flags.dropsEnabled')
tab-heading
i.icon-gift
| Inventory
.row-fluid
.span6.border-right
h2 Inventory
app:avatar:inventory
.span6
h2 Market
app:game-pane:market
tab(ng-show='user.flags.dropsEnabled')
tab-heading
i.icon-gift
| Inventory
.row-fluid
.span6.border-right
h2 Inventory
app:avatar:inventory
.span6
h2 Market
app:game-pane:market
tab(ng-show='user.flags.dropsEnabled')
tab-heading
i.icon-leaf
| Stable
app:pets:stable
tab(ng-show='user.flags.dropsEnabled')
tab-heading
i.icon-leaf
| Stable
app:pets:stable
tab
tab-heading
i.icon-eye-close
| Tavern
app:groups:group(group='{_habitRPG}')
tab
tab-heading
i.icon-eye-close
| Tavern
app:groups:group(group='{_habitRPG}')
tab
tab-heading
i.icon-certificate
| Achievements
div(ng-controller='UserAvatarCtrl')
include ../shared/profiles/achievements
tab
tab-heading
i.icon-certificate
| Achievements
div(ng-controller='UserAvatarCtrl')
include ../shared/profiles/achievements
// <li><a data-toggle='tab' data-target="#profile-challenges" id='profile-challenges-tab-link' ><i class='icon-bullhorn'></i> Challenges</a></li>
// app:challenges:main
// <li><a data-toggle='tab' data-target="#profile-challenges" id='profile-challenges-tab-link' ><i class='icon-bullhorn'></i> Challenges</a></li>
// app:challenges:main
tab
tab-heading
i.icon-wrench
| Settings
include ./settings
tab
tab-heading
i.icon-wrench
| Settings
include ./settings

View file

@ -1,61 +0,0 @@
<filters:>
<div class="filters">
<div class="pull-left filter-description">
Tags:
</div>
<ul class="nav nav-pills">
<li>
<a rel=tooltip title='Edit Tags' x-bind="click:toggleEditingTags"><i class='{#if _editingTags}icon-ok{else}icon-pencil{/}'></i></a>
</li>
{#each _user.tags as :tag}
<li class="{#if users[_userId].filters[:tag.id]}active{/}" style='position:relative;'>
{#if and(_editingTags,not(:tag.challenge))}
<div class="input-append option-group tag-editing" >
<input class="input input-small option-content tag-editing-pill" type="text" value='{:tag.name}' />
<span class="add-on tag-editing-pill"><a class='pull-right' x-bind=click:filtersDeleteTag data-index="{$index}"><i class='icon-trash'></i></a></span>
</div>
{else}
<a data-tag-id="{{:tag.id}}" x-bind="click:toggleFilterByTag">{:tag.name}</a>
{/}
</li>
{/}
<li>
{#if _editingTags}
<form class='form-inline' x-bind="submit:filtersNewTag">
<div class="input-append tag-editing">
<input class="span2 tag-editing-pill" type="text" value={_newTag} placeholder="New Tag" />
<button class="add-on tag-editing-pill" type="submit">Add</button>
</div>
</form>
{/}
</li>
<!--<li class="{#unless activeFilters(users[_userId].filters)}hidden{/}">-->
<li>
<a rel=tooltip title='Clear Filters' x-bind="click:clearFilters"><i class='icon-remove-sign'></i></a>
</li>
</ul>
</div>
<applied-filters:>
<i rel=tooltip title="{appliedTags(users[_userId].tags, :task.tags)}" class='{#if noTags(:task.tags)}hidden{/} icon-tags'></i>
<!-- At first we showed all applied tags, but it gets really cluttered: http://gyazo.com/fce50f91fd0f1d64cab9774f755e95c1 -->
<!-- There's a very strange bug where live-bound #each here loses model.at reference on _{type}List alter -->
<!--&nbsp;
{{#each users[_userId].tags as :tag}}
<small>
{#if :task.tags[:tag.id]}
<small data-tag-id="{{:tag.id}}" x-bind="click:toggleFilterByTag" class="label tag-label {#if users[_userId].filters[:tag.id]}label-info{/}">{:tag.name}</small>
{/}
</small>
{{/}}-->
<filter-fieldgroup:>
<fieldset class='option-group'>
<legend class="option-title">Tags</legend>
{#each users[_userId].tags as :tag}
<label class="checkbox">
<input type="checkbox" checked="{:task.tags[:tag.id]}"> {:tag.name}
</label>
{/}
</fieldset>

23
views/tasks/filters.jade Normal file
View file

@ -0,0 +1,23 @@
.filters
.pull-left.filter-description
| Tags:
ul.nav.nav-pills
li
a(rel='tooltip', title='Edit Tags', x-bind='click:toggleEditingTags')
i(ng-class='{"icon-ok": _editingTags, "icon-pencil": !_editingTags}')
li(ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', style='position: relative;')
.input-append.option-group.tag-editing(ng-show='_editingTags && !tag.challenge')
input.input.input-small.option-content.tag-editing-pill(type='text', ng-model='tag.name')
span.add-on.tag-editing-pill
a.pull-right(x-bind='click:filtersDeleteTag', data-index='{{$index}}')
i.icon-trash
a(ng-hide='_editingTags && !tag.challenge', data-tag-id='{{tag.id}}', x-bind='click:toggleFilterByTag') {{tag.name}}
li
form.form-inline(ng-show='_editingTags', x-bind='submit:filtersNewTag')
.input-append.tag-editing
input.span2.tag-editing-pill(type='text', ng-model='_newTag', placeholder='New Tag')
button.add-on.tag-editing-pill(type='submit') Add
// <li class="{#unless activeFilters(users[_userId].filters)}hidden{/}">
li
a(rel='tooltip', title='Clear Filters', x-bind='click:clearFilters')
i.icon-remove-sign

View file

@ -1,69 +1,71 @@
div(ng-controller='TasksCtrl')
.module(ng-controller='TasksCtrl', ng-repeat='list in taskLists', ng-class='{"rewards-module": list.type==="reward"}')
.task-column(class='{{list.type}}s')
include ./filters
.grid
.module(ng-controller='TasksCtrl', ng-repeat='list in taskLists', ng-class='{"rewards-module": list.type==="reward"}')
.task-column(class='{{list.type}}s')
// Todos export/graph options
span.option-box.pull-right(ng-if='list.main && list.type=="todo"')
a.option-action(ng-show='user.history.todos', x-bind='click:toggleChart', data-id='todos', tooltip='Progress')
i.icon-signal
a.option-action(ng-href='/v1/users/{{user.id}}/calendar.ics?apiToken={{user.apiToken}}', tooltip='iCal')
i.icon-calendar
// <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>
// Todos export/graph options
span.option-box.pull-right(ng-if='list.main && list.type=="todo"')
a.option-action(ng-show='user.history.todos', x-bind='click:toggleChart', data-id='todos', tooltip='Progress')
i.icon-signal
//-a.option-action(ng-href='/v1/users/{{user.id}}/calendar.ics?apiToken={{user.apiToken}}', tooltip='iCal')
i.icon-calendar
// <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='list.main && list.type=="reward"')
.money
| {{gold(user.stats.gp)}}
span.shop_gold(tooltip='Gold')
.money
| {{silver(user.stats.gp)}}
span.shop_silver(tooltip='Silver')
// Gold & Gems
span.option-box.pull-right.wallet(ng-if='list.main && list.type=="reward"')
.money
| {{gold(user.stats.gp)}}
span.shop_gold(tooltip='Gold')
.money
| {{silver(user.stats.gp)}}
span.shop_silver(tooltip='Silver')
// Header
h2.task-column_title {{list.header}}
// Header
h2.task-column_title {{list.header}}
// Todo Chart
.todos-chart(ng-if='list.type == "todo"', ng-show='_page.charts.todos')
// Todo Chart
.todos-chart(ng-if='list.type == "todo"', ng-show='_page.charts.todos')
// Add New
form.addtask-form.form-inline.new-task-form(name='new{{list.type}}form', ng-show='list.editable', ng-hide='list.showCompleted && list.type=="todo"', data-task-type='{{list.type}}', ng-submit='addTask(list)')
span.addtask-field
input(type='text', ng-model='list.newTask', placeholder='{{list.placeHolder}}', required)
input.addtask-btn(type='submit', value='', ng-disabled='new{{list.type}}form.$invalid')
hr
// Add New
form.addtask-form.form-inline.new-task-form(name='new{{list.type}}form', ng-show='list.editable', ng-hide='list.showCompleted && list.type=="todo"', data-task-type='{{list.type}}', ng-submit='addTask(list)')
span.addtask-field
input(type='text', ng-model='list.newTask', placeholder='{{list.placeHolder}}', required)
input.addtask-btn(type='submit', value='', ng-disabled='new{{list.type}}form.$invalid')
hr
// Actual List
ul(class='{{list.type}}s', ng-show='user[list.type + "s"]', habitrpg-sortable)
include ./task
// Actual List
ul(class='{{list.type}}s', ng-show='user[list.type + "s"]', habitrpg-sortable)
include ./task
// Static Rewards
ul.items(ng-show='list.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
span.task-notes(popover-trigger='mouseenter', popover-placement='left', popover='{{item.notes}}', popover-title='{{item.text}}')
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')
i.icon-repeat
a.money.btn-buy.item-btn(ng-if='item.type!="reroll"', ng-click='buy(item.type)')
span.reward-cost {{item.value}}
span.shop_gold
// main content
span(ng-class='{"shop_{{item.classes}} shop-sprite item-img": true}')
p.task-text {{item.text}}
// Static Rewards
ul.items(ng-show='list.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
span.task-notes(popover-trigger='mouseenter', popover-placement='left', popover='{{item.notes}}', popover-title='{{item.text}}')
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')
i.icon-repeat
a.money.btn-buy.item-btn(ng-if='item.type!="reroll"', ng-click='buy(item.type)')
span.reward-cost {{item.value}}
span.shop_gold
// main content
span(ng-class='{"shop_{{item.classes}} shop-sprite item-img": true}')
p.task-text {{item.text}}
br
br
include ./ads
include ./ads
// Todo Tabs
div(ng-if='list.type=="todo"', ng-class='{"tabbable tabs-below": list.type=="todo"}')
button.task-action-btn.tile.spacious.bright(ng-show='_showCompleted', x-bind='click:clearCompleted') Clear Completed
// remaining/completed tabs
ul.nav.nav-tabs
li(ng-class='{active: !list.showCompleted}')
a(ng-click='list.showCompleted = false') Remaining
li(ng-class='{active: list.showCompleted}')
a(ng-click='list.showCompleted= true') Complete
// Todo Tabs
div(ng-if='list.type=="todo"', ng-class='{"tabbable tabs-below": list.type=="todo"}')
button.task-action-btn.tile.spacious.bright(ng-show='_showCompleted', x-bind='click:clearCompleted') Clear Completed
// remaining/completed tabs
ul.nav.nav-tabs
li(ng-class='{active: !list.showCompleted}')
a(ng-click='list.showCompleted = false') Remaining
li(ng-class='{active: list.showCompleted}')
a(ng-click='list.showCompleted= true') Complete

View file

@ -5,7 +5,9 @@ li(ng-repeat='task in user[list.type + "s"]', class='task {{taskClasses(task,use
span(ng-show='task.streak') {{task.streak}}
span(tooltip='Streak Counter')
i.icon-forward
app:filters:applied-filters
i.icon-tags(tooltip='{{appliedTags(user.tags, task.tags)}}', ng-hide='notTags(task.tags)')
// edit
a(ng-click='task._editing = !task._editing', tooltip='Edit')
i.icon-pencil
@ -122,7 +124,13 @@ li(ng-repeat='task in user[list.type + "s"]', class='task {{taskClasses(task,use
fieldset.option-group(ng-if='task.type=="todo"')
legend.option-title Due Date
input.option-content.datepicker(type='text', value='{{task.date}}', data-date-format='mm/dd/yyyy')
app:filters:filter-fieldgroup(ng-if='list.main')
fieldset.option-group(ng-if='list.main')
legend.option-title Tags
label.checkbox(ng-repeat='tag in user.tags')
input(type='checkbox', ng-model='task.tags[tag.id]')
| {{tag.name}}
// Advanced Options
span(ng-if='task.type!="reward"')
p.option-title.mega(ng-click='task._advanced = !task._advanced') Advanced Options