2013-05-11 23:05:13 +00:00
< main: >
< div >
2013-05-28 11:32:57 +00:00
< ul class = "nav nav-tabs" >
2013-05-28 10:59:09 +00:00
< li class = "active" > < a data-toggle = 'tab' data-target = "#challengesViewParty" > Party< / a > < / li >
2013-05-11 23:05:13 +00:00
< li > < a data-toggle = 'tab' data-target = "#challengesViewGuild" > Guild< / a > < / li >
< li > < a data-toggle = 'tab' data-target = "#challengesViewPublic" > Public< / a > < / li >
< / ul >
< div class = "tab-content" >
2013-05-28 10:59:09 +00:00
< div class = "tab-pane active" id = "challengesViewParty" >
2013-05-31 21:53:17 +00:00
{{#unless _party.id}}
Join a party first.
{{else}}
2013-05-31 13:36:00 +00:00
{#if _challenge.new}
< app:challenges:create-form / >
{else}
2013-05-31 21:53:17 +00:00
<!-- FIXME https://github.com/codeparty/derby/issues/267, see _guilds.challenges below -->
2013-05-31 13:36:00 +00:00
< app:challenges:create-button type = 'party' gid = {{_party.id}} text = 'Party' / >
{#each _party.challenges as :challenge}
< app:challenges:listing challenge = {:challenge} / >
{/}
2013-05-28 11:32:57 +00:00
{/}
2013-05-31 21:53:17 +00:00
{{/}}
2013-05-11 23:05:13 +00:00
< / div >
< div class = "tab-pane" id = "challengesViewGuild" >
2013-05-28 11:47:41 +00:00
< ul class = "nav nav-pills" >
{{#each _guilds as :guild}}
< li class = "{{#if equal($index,0)}}active{{/}}" > < a data-toggle = 'tab' data-target = "#challenges-guild-{:guild.id}" > {{:guild.name}}< / a > < / li >
{{/}}
< / ul >
< div class = "tab-content" >
{{#each _guilds as :guild}}
< div class = "tab-pane {{#if equal($index,0)}}active{{/}}" id = "challenges-guild-{:guild.id}" >
{#if _challenge.new}
< app:challenges:create-form / >
{else}
< app:challenges:create-button type = 'guild' gid = {{:guild.id}} text = 'Guild' / >
{#each :guild.challenges as :challenge}
2013-05-31 21:53:17 +00:00
< app:challenges:listing challenge = {groups[:guild.id].challenges[$index]} / >
2013-05-28 11:47:41 +00:00
{/}
< hr / >
{/}
< / div >
2013-05-27 20:14:04 +00:00
{/}
2013-05-28 11:47:41 +00:00
< / div >
2013-05-11 23:05:13 +00:00
< / div >
< div class = "tab-pane" id = "challengesViewPublic" >
2013-05-28 11:32:57 +00:00
{#if _challenge.new}
< app:challenges:create-form / >
{else}
< app:challenges:create-button type = 'public' gid = 'habitrpg' text = 'Public' / >
{#each _habitRPG.challenges as :challenge}
2013-05-31 21:53:17 +00:00
< app:challenges:listing challenge = {groups.habitrpg.challenges[$index]} / >
2013-05-28 11:32:57 +00:00
{/}
2013-05-27 20:14:04 +00:00
{/}
2013-05-11 23:05:13 +00:00
< / div >
< / div >
< / div >
2013-05-27 20:14:04 +00:00
< listing: >
2013-05-29 22:18:44 +00:00
< div class = "accordion-group" >
< div class = "accordion-heading" >
< span class = pull-right >
< a x-bind = "click:challengeUnsubscribe" class = 'btn btn-small btn-danger {#unless indexOf(_user.challenges,@challenge.id)}hidden{/}' > < i class = 'icon-ban-circle' > < / i > Unsubscribe< / a >
< a x-bind = "click:challengeSubscribe" class = 'btn btn-small btn-success {#if indexOf(_user.challenges,@challenge.id)}hidden{/}' > < i class = 'icon-ok' > < / i > Subscribe< / a >
< / span >
< a class = "accordion-toggle" data-toggle = "collapse" href = "#accordion-challenge-{{@challenge.id}}" > {@challenge.name} (by {@challenge.user})< / a >
2013-05-27 20:14:04 +00:00
< / div >
2013-05-29 22:18:44 +00:00
< div id = "accordion-challenge-{{@challenge.id}}" class = "accordion-body collapse in" >
< div class = "accordion-inner" >
2013-05-30 07:41:07 +00:00
{#if @challenge.prize}
< a class = "pull-right gem-wallet" >
< span class = "task-action-btn tile flush neutral" > < div class = "Gems" > < / div > {@challenge.prize} Gem Prize< / span >
< / a >
{/}
2013-05-29 22:18:44 +00:00
2013-05-29 22:33:47 +00:00
{#if _editing.challenges[@challenge.id]}
< a class = btn x-bind = 'click:toggleChallengeEdit' data-id = {{@challenge.id}} > Done< / a >
< div class = '-options' >
< input type = text class = 'option-content' value = {@challenge.name} / >
< textarea cols = 3 class = 'option-content' placeholder = 'Description' > {@challenge.description}< / textarea >
2013-05-29 22:40:13 +00:00
< input type = number class = 'option-content' placeholder = 'Gems Prize' value = {@challenge.prize} / >
2013-05-29 22:33:47 +00:00
< / div >
{/}
2013-05-30 07:41:07 +00:00
<!-- elseif breaks here, have to start a new if - -->
{#if and(not(_editing.challenges[@challenge.id]),equal(@challenge.uid,_user.id))}
< a class = btn x-bind = 'click:toggleChallengeEdit' data-id = {{@challenge.id}} > Edit< / a >
2013-05-29 22:40:13 +00:00
{/}
{#if @challenge.description}< div > {@challenge.description}< / div > {/}
2013-05-27 20:14:04 +00:00
2013-05-29 22:18:44 +00:00
< div class = "grid" >
< app:tasks:task-lists
habits={@challenge.habits}
dailys={@challenge.dailys}
todos={@challenge.todos}
rewards={@challenge.rewards} />
< / div >
2013-05-31 13:35:50 +00:00
< h3 > Statistics< / h3 >
{#each @challenge.users as :member}
< h4 > {:member.name}< / h4 >
< div class = "grid" >
< div class = "module" >
< app:challenges:stats header = Habits challenge = {@challenge} member = {:member} taskType = habit / >
< / div >
< div class = "module" >
< app:challenges:stats header = Dailies challenge = {@challenge} member = {:member} taskType = daily / >
< / div >
< div class = "module" >
< app:challenges:stats header = Todos challenge = {@challenge} member = {:member} taskType = todos / >
< / div >
< / div >
{/}
2013-05-29 22:18:44 +00:00
< / div >
2013-05-27 20:14:04 +00:00
< / div >
< / div >
2013-05-31 13:35:50 +00:00
< stats: >
< h5 > {@header}< / h5 >
2013-05-31 22:31:37 +00:00
< div >
2013-05-31 13:35:50 +00:00
{#each @challenge[@taskType]s as :task}
2013-05-31 22:31:37 +00:00
< table > < tr >
< td >
< strong > {:task.text}< / strong > : {round(@member[@taskType]s[:task.id].value)}
< / td >
< td >
< div style = 'margin-left: 10px' class = "challenge-{{@challenge.id}}-member-{{@member.id}}-history-{{:task.id}}" > < / div >
< / td >
< / tr > < / table >
2013-05-31 13:35:50 +00:00
{/}
2013-05-31 22:31:37 +00:00
< / div >
2013-05-31 13:35:50 +00:00
2013-05-28 11:32:57 +00:00
< create-button: >
< a x-bind = 'click:challengeCreate' class = 'btn btn-large btn-success' data-type = {{@type}} data-gid = {{@gid}} > Create {{@text}} Challenge< / a >
2013-05-11 23:05:13 +00:00
2013-05-28 11:32:57 +00:00
< create-form: >
< form x-bind = "submit:challengeSave" >
< div >
< input type = 'submit' class = 'btn btn-success' value = 'Save' / >
< input type = 'button' x-bind = 'click:challengeDiscard' class = 'btn btn-danger' value = Discard / >
< / div >
2013-05-17 22:33:24 +00:00
2013-05-28 11:32:57 +00:00
< div class = 'challenge-options' >
< input type = 'text' class = 'option-content' value = {_challenge.new.name} placeholder = "Challenge Title" required / >
< / div >
2013-05-17 22:33:24 +00:00
2013-05-28 11:32:57 +00:00
<!-- <fieldset>
< div >
< select >
< option selected = "{equal('party',_challenge.new.group.type)}" > Party< / option >
< option selected = "{equal('guild',_challenge.new.group.type)}" > Guild< / option >
< option selected = "{equal('public',_challenge.new.group.type)}" > Public< / option >
< / select >
< / div >
< div >
{#if equal(_challenge.new.assignTo,'Party')}
< div class = 'row-fluid' >
< div class = 'span4 well' >
< div > < input type = 'radio' name = 'challenge-party-selection' checked = {_challenge.new.partyAssignees} > All Party< / input > < / div >
< small > No individual privacy on the challenge, all party members can see progress even if they decline the challenge. Any new party members can subscribe to this challenge.< / small >
< / div >
< div class = 'span8 well' >
< div > < input type = 'radio' name = 'challenge-party-selection' checked = {not(_challenge.new.partyAssignees)} > Individual Members< / input > < / div >
< div >
< select multiple = "multiple" >
{{#each _party.members as :memberId}}
< option > {{username(_members[:memberId].auth,_members[:memberId].profile.name)}}< / option >
{{/}}
< / select >
< / div >
< div > < small > Only the invited party members can subscribe to this challenge. New party joins won't see this challenge.< / small > < / div >
< / div >
< / div >
{/}
{#if equal(_challenge.new.group.type,'guild')}
< select >
{{#each _guilds as :guild}}
< option selected = "{equal(:guild.id,_challenge.new.group.id)}" > {:guild.name}< / option >
{{/}}
< / select >
{/}
< / div >
< / fieldset > -->
2013-05-12 12:57:17 +00:00
2013-05-28 11:32:57 +00:00
< / form >
2013-05-11 23:05:13 +00:00
2013-05-28 11:32:57 +00:00
< div class = "grid" >
< app:tasks:task-lists
habits={_challenge.new.habits}
dailys={_challenge.new.dailys}
todos={_challenge.new.todos}
rewards={_challenge.new.rewards}
editable=true />
2013-05-11 23:05:13 +00:00
< / div >
2013-05-28 11:32:57 +00:00