guilds: got all groups html generalized (using same party html as

tavern, will add guilds soon)
This commit is contained in:
Tyler Renelle
2013-05-26 20:21:07 +01:00
parent e32ee04baa
commit 0f8dbd044e
3 changed files with 150 additions and 144 deletions
+13 -20
View File
@@ -84,12 +84,17 @@ module.exports.app = (appExports, model, app) ->
Chat Functionality
###
sendChat = (path, input) ->
chat = model.at path
text = model.get input
model.on 'unshift', '_party.chat', -> $('.chat-message').tooltip()
model.on 'unshift', '_habitrpg.chat', -> $('.chat-message').tooltip()
appExports.sendChat = (e,el) ->
text = model.get '_chatMessage'
# Check for non-whitespace characters
return unless /\S/.test text
model.set(input, '')
group = e.at()
chat = group.at('chat')
model.set('_chatMessage', '')
message =
id: model.id()
@@ -114,24 +119,12 @@ module.exports.app = (appExports, model, app) ->
chat.set messages
else
chat.remove(200)
type = $(el).attr('data-type')
model.set '_user.party.lastMessageSeen', chat.get()[0].id if group.get('type') is 'party'
model.on 'unshift', '_party.chat', -> $('.chat-message').tooltip()
model.on 'unshift', '_habitrpg.chat', -> $('.chat-message').tooltip()
appExports.partySendChat = ->
sendChat('_party.chat', '_chatMessage')
model.set '_user.party.lastMessageSeen', model.get('_party.chat')[0].id
appExports.tavernSendChat = ->
sendChat('_habitRPG.chat', '_tavernMessage')
appExports.partyMessageKeyup = (e, el, next) ->
appExports.chatKeyup = (e, el, next) ->
return next() unless e.keyCode is 13
appExports.partySendChat()
appExports.tavernMessageKeyup = (e, el, next) ->
return next() unless e.keyCode is 13
appExports.tavernSendChat()
appExports.sendChat(e, el)
appExports.deleteChatMessage = (e) ->
if confirm("Delete chat message?") is true
+19 -83
View File
@@ -6,23 +6,21 @@
</span>
<ul class="nav nav-tabs game-tabs">
<li class="active"><a data-toggle='tab' data-target="#profileCustomize"><i class='icon-user'></i> Profile</a></li>
<li><a data-toggle='tab' data-target="#profileParty" id='party-tab-link'><i class='icon-heart'></i> Party</a></li>
<li class="active"><a data-toggle='tab' data-target="#profile-customize"><i class='icon-user'></i> Profile</a></li>
<li><a data-toggle='tab' data-target="#profile-groups" id='party-tab-link'><i class='icon-heart'></i> Groups</a></li>
{#if _user.flags.dropsEnabled}
<li><a data-toggle='tab' data-target="#profileInventory"><i class='icon-gift'></i> Inventory</a></li>
<li><a data-toggle='tab' data-target="#profileStable"><i class='icon-leaf'></i> Stable</a></li>
<li><a data-toggle='tab' data-target="#profile-inventory"><i class='icon-gift'></i> Inventory</a></li>
<li><a data-toggle='tab' data-target="#profile-stable"><i class='icon-leaf'></i> Stable</a></li>
{/if}
<li><a data-toggle='tab' data-target="#profileTavern"><i class='icon-eye-close'></i> Tavern</a></li>
<li><a data-toggle='tab' data-target="#profileAchievements"><i class='icon-certificate'></i> Achievements</a></li>
<li><a data-toggle='tab' data-target="#profileChallenges"><i class='icon-bullhorn'></i> Challenges</a></li>
{{#if _loggedIn}}
<li><a data-toggle='tab' data-target="#profileSettings"><i class='icon-wrench'></i> Settings</a></li>
{{/}}
<li><a data-toggle='tab' data-target="#profile-tavern"><i class='icon-eye-close'></i> Tavern</a></li>
<li><a data-toggle='tab' data-target="#profile-achievements"><i class='icon-certificate'></i> Achievements</a></li>
<li><a data-toggle='tab' data-target="#profile-challenges"><i class='icon-bullhorn'></i> Challenges</a></li>
<li><a data-toggle='tab' data-target="#profile-settings"><i class='icon-wrench'></i> Settings</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="profileCustomize">
<div class="tab-pane active" id="profile-customize">
<div class='row-fluid'>
<div class='span4 border-right'>
<app:avatar:customize />
@@ -36,15 +34,15 @@
</div>
</div>
<div class="tab-pane" id="profileParty">
<app:groups:party />
<div class="tab-pane" id="profile-groups">
<app:groups:groups-pane />
</div>
<div class="tab-pane" id="profileAchievements">
<div class="tab-pane" id="profile-achievements">
<app:avatar:achievements profile="{{_user}}" />
</div>
<div class="tab-pane" id="profileInventory">
<div class="tab-pane" id="profile-inventory">
<div class='row-fluid'>
<div class='span6 border-right'>
<h2>Inventory</h2>
@@ -57,87 +55,25 @@
</div>
</div>
<div class="tab-pane" id="profileStable">
<div class="tab-pane" id="profile-stable">
<app:pets:stable />
</div>
<div class="tab-pane" id="profileTavern">
<app:game-pane:tavern />
<div class="tab-pane" id="profile-tavern">
<app:groups:group group={_habitRPG} />
</div>
<div class="tab-pane" id="profileChallenges">
<div class="tab-pane" id="profile-challenges">
<app:challenges:main />
</div>
<div class="tab-pane" id="profileSettings">
{{#if _loggedIn}}
<app:settings:settings-pane />
{{/}}
<div class="tab-pane" id="profile-settings">
<app:settings:settings-pane />
</div>
</div>
</div>
<tavern:>
<div class='row-fluid'>
<div class='span4 border-right'>
<div class='tavern-pane'>
<table><tr>
<td><div class='NPC-Daniel'></div></td>
<td>
<div class="popover static-popover fade right in">
<div class="arrow"></div>
<h3 class="popover-title">Daniel Johansson</h3>
<div class="popover-content">
Welcome to the Tavern! I'm <a target="_blank" href="http://www.kickstarter.com/profile/2014640723">Daniel</a>, the bar keep. If you want to rest a while (going on vacation? sudden illness?), I'll set you up at the inn - dailies won't hurt you while you're resting. Stay a while & meet the locals.
<div><button x-bind="click:toggleResting" class='btn btn-large btn-success {#if _user.flags.rest}active{/}'>{#if _user.flags.rest}Check Out of Inn{else}Rest In The Inn{/}</button></div>
</div>
</div>
</td>
</tr></table>
</div>
<div class='alert alert-info {#unless _user.flags.rest}hidden{/}'>Whilst resting your dailies are saved and aren't effected by day turn-over. Whether you check out tomorrow or in a weeks time you'll continue in the same state as when you checked in.</div>
<div class=well>
<h3>Resources</h3>
<ul class=unstyled>
<li><h4><a target="_blank" href="http://community.habitrpg.com/forums/lfg">LFG Posts</a></h4></li>
<li><h4><a target="_blank" href="http://www.youtube.com/watch?feature=player_embedded&v=cT5ghzZFfao">Tutorial</a></h4></li>
<li><h4><a target="_blank" href="http://community.habitrpg.com/faq-page">FAQ</a></h4></li>
<li><h4><a target="_blank" href="https://github.com/lefnire/habitrpg/issues?state=open">Report a Problem</a></h4></li>
<li><h4><a target="_blank" href="https://trello.com/board/habitrpg/50e5d3684fe3a7266b0036d6">Request a Feature</a></h4></li>
<li><h4><a target="_blank" href="http://community.habitrpg.com/forum">Community Forum</a></h4></li>
</ul>
</div>
</div>
<div class='span8'>
<h3>Tavern Talk & LFG</h3>
<div class='row-fluid'>
<div class='span3'>
<ul class='unstyled buttonList'>
<li><a class='btn btn-info' style='width:100%' target="_blank" href="http://community.habitrpg.com/faq-page">FAQ</a></li>
<li><a class='btn btn-info' style='width:100%' target="_blank" href="https://github.com/lefnire/habitrpg/issues?state=open">Report a Problem</a></li>
<li><a class='btn btn-info' style='width:100%' target="_blank" href="https://trello.com/board/habitrpg/50e5d3684fe3a7266b0036d6">Request a Feature</a></li>
</ul>
</div>
<div class=span9>
<form x-bind='submit:tavernSendChat'>
<textarea class="span6" rows="3" x-bind='keyup:tavernMessageKeyup'>{_tavernMessage}</textarea><br/>
<input class=btn type=submit value="Send Chat" />
</form>
</div>
</div>
<ul class='unstyled tavern-chat'>
{#each _habitRPG.chat as :message}
<app:groups:chat-message message={{:message}} />
{/}
</ul>
</div>
</div>
<market:>
<!-- pets pane -->
+118 -41
View File
@@ -1,11 +1,87 @@
<party:>
{#if _party.members}
<div class='row-fluid'>
<div class="span6 border-right">
<h3>{{_party.name}}</h3>
<groups-pane:>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle='tab' data-target="#groups-party">Party</a></li>
<li><a data-toggle='tab' data-target="#groups-guilds">Guilds</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="groups-party">
{#if _party.id} <!-- user in a party? -->
<app:groups:group group={_party} />
{else if _user.party.invitation}
<!-- TODO show by whom -->
<h2>You're Invited To {_party.name}</h2>
<a class='btn btn-success' x-bind="click: partyAccept">Accept</a>
<a class='btn btn-danger' x-bind="click: partyReject">Reject</a>
{else}
<h2>Create A Party</h2>
<!-- Not in a party , no invites - create a new one -->
<p>You are not in a party. You can either create one and invite friends, or if you want to join an existing party, have them enter:</p>
<pre class=prettyprint>{_user.id}</pre>
<form class=form-inline x-bind="submit: partyCreate">
{#if _partyError}
<div class='alert alert-danger'>{_partyError}</div>
{/}
<div class=control-group>
<input type="text" class="input-medium" placeholder="Party Name" value="{_newParty}" />
<input type="submit" class="btn" value="Create" />
</div>
</form>
{/}
</div>
<div class='tab-pane' id="groups-guilds">
<ul class="nav nav-pills">
{#each _guilds as :guild}
<li class="active"><a data-toggle='tab' data-target="#groups-party-{:guild.id}">{:guild.name}</a></li>
{/}
</ul>
{#each _guilds as :guild}
<div class="tab-pane" id="groups-guild-{:guild.id}">
<app:groups:group group={:guild} />
</div>
{/}
</div>
</div>
<group:>
<div class='row-fluid'>
<div class='span4 border-right'>
{{#if equal(@group.id,'habitrpg')}}
<div class='tavern-pane'>
<table><tr>
<td><div class='NPC-Daniel'></div></td>
<td>
<div class="popover static-popover fade right in">
<div class="arrow"></div>
<h3 class="popover-title">Daniel Johansson</h3>
<div class="popover-content">
Welcome to the Tavern! I'm <a target="_blank" href="http://www.kickstarter.com/profile/2014640723">Daniel</a>, the bar keep. If you want to rest a while (going on vacation? sudden illness?), I'll set you up at the inn - dailies won't hurt you while you're resting. Stay a while & meet the locals.
<div><button x-bind="click:toggleResting" class='btn btn-large btn-success {#if _user.flags.rest}active{/}'>{#if _user.flags.rest}Check Out of Inn{else}Rest In The Inn{/}</button></div>
</div>
</div>
</td>
</tr></table>
</div>
<div class='alert alert-info {#unless _user.flags.rest}hidden{/}'>Whilst resting your dailies are saved and aren't effected by day turn-over. Whether you check out tomorrow or in a weeks time you'll continue in the same state as when you checked in.</div>
<div class=well>
<h3>Resources</h3>
<ul class=unstyled>
<li><h4><a target="_blank" href="http://community.habitrpg.com/forums/lfg">LFG Posts</a></h4></li>
<li><h4><a target="_blank" href="http://www.youtube.com/watch?feature=player_embedded&v=cT5ghzZFfao">Tutorial</a></h4></li>
<li><h4><a target="_blank" href="http://community.habitrpg.com/faq-page">FAQ</a></h4></li>
<li><h4><a target="_blank" href="https://github.com/lefnire/habitrpg/issues?state=open">Report a Problem</a></h4></li>
<li><h4><a target="_blank" href="https://trello.com/board/habitrpg/50e5d3684fe3a7266b0036d6">Request a Feature</a></h4></li>
<li><h4><a target="_blank" href="http://community.habitrpg.com/forum">Community Forum</a></h4></li>
</ul>
</div>
{{else}}
<h3>{{@group.name}}</h3>
<table class="table table-striped">
{{#each _party.members as :memberId}}
<tr><td>{{username(_party[:memberId].auth, _party[:memberId].profile.name)}}</td><td>({{:memberId}})</td></tr>
{{#each @group.members as :memberId}}
<tr><td>{{username(_members[:memberId].auth, _members[:memberId].profile.name)}}</td><td>({{:memberId}})</td></tr>
{{/}}
</table>
<form class=form-inline x-bind="submit: partyInvite">
@@ -18,44 +94,45 @@
</div>
</form>
<a class='btn btn-danger' x-bind="click: partyLeave">Leave</a>
</div>
<div class="span6">
<h3>Chat</h3>
<form x-bind='submit:partySendChat'>
<textarea class="span6" rows="3" x-bind='keyup:partyMessageKeyup'>{_chatMessage}</textarea><br/>
<input class=btn type=submit value=Submit />
</form>
<ul class='party-chat unstyled'>
{#each _party.chat as :message}
<app:groups:chat-message message={{:message}} />
{/}
</ul>
</div>
{{/}}
</div>
<div class='span8'>
{else if _user.party.invitation}
<!-- TODO show by whom -->
<h2>You're Invited To {_party.name}</h2>
<a class='btn btn-success' x-bind="click: partyAccept">Accept</a>
<a class='btn btn-danger' x-bind="click: partyReject">Reject</a>
{{#if equal(@group.id,'habitrpg')}}
<h3>Tavern Talk & LFG</h3>
<div class='row-fluid'>
<div class='span3'>
<ul class='unstyled buttonList'>
<li><a class='btn btn-info' style='width:100%' target="_blank" href="http://community.habitrpg.com/faq-page">FAQ</a></li>
<li><a class='btn btn-info' style='width:100%' target="_blank" href="https://github.com/lefnire/habitrpg/issues?state=open">Report a Problem</a></li>
<li><a class='btn btn-info' style='width:100%' target="_blank" href="https://trello.com/board/habitrpg/50e5d3684fe3a7266b0036d6">Request a Feature</a></li>
</ul>
</div>
<div class=span9>
<app:groups:chat-box group={@group} />
</div>
</div>
{{else}}
<h3>Chat</h3>
<app:groups:chat-box group={@group} />
{{/}}
{else}
<h2>Create A Party</h2>
<!-- Not in a party , no invites - create a new one -->
<p>You are not in a party. You can either create one and invite friends, or if you want to join an existing party, have them enter:</p>
<pre class=prettyprint>{_user.id}</pre>
<form class=form-inline x-bind="submit: partyCreate">
{#if _partyError}
<div class='alert alert-danger'>{_partyError}</div>
{/}
<div class=control-group>
<input type="text" class="input-medium" placeholder="Party Name" value="{_newParty}" />
<input type="submit" class="btn" value="Create" />
</div>
</form>
{/}
<ul class='unstyled tavern-chat'>
{#each @group.chat as :message}
<app:groups:chat-message message={{:message}} />
{/}
</ul>
</div>
</div>
<chat-box:>
{{#with @group as :group}}
<form x-bind='submit:sendChat'>
<textarea class="span6" rows="3" x-bind='keyup:chatKeyup'>{_chatMessage}</textarea><br/>
<input class=btn type=submit value="Send Chat" />
</form>
{{/}}
<chat-message:>
<li class="{{#if indexOf(:message.text, username(_user.auth, _user.profile.name))}}highlight{{/if}}">