Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 1 commit
  • 3 files changed
  • 0 comments
  • 1 contributor
Sep 08, 2012
Sarah Vessels Listing buff source, delete button in dashboard
Consolidating DM scratchpad and party buff tabs into one dashboard.
Adding delete button with confirmation to buff list in dashboard.
Defaulting 'enemy?' checkbox to checked for Jon's sake.  Displaying the
source character name for buffs in buff list.  Removing some debug
statements.
0eb53cd
37  client/dnd.css
@@ -7,12 +7,15 @@
7 7
     border-top-color: #DBC300
8 8
 }
9 9
 body.dm {
10  
-
11 10
 }
12 11
 	body.dm div.dm,
13 12
 	body.dm fieldset.dm,
  13
+	body.dm div.tab-pane.active.dm,
14 14
 	body.dm .row-fluid .dm[class*="span"] {
15  
-	    display: block
  15
+	    display: block;
  16
+	}
  17
+	body.dm li.dm {
  18
+		display: list-item;
16 19
 	}
17 20
 	body.dm .navbar .brand {
18 21
 	    color: #D0EEB8
@@ -43,6 +46,24 @@ body.dm {
43 46
 .btn + .btn {
44 47
     margin-left: 5px
45 48
 }
  49
+.buff-list {
  50
+	padding-left: 0;
  51
+	margin-left: 0;
  52
+	list-style: none;
  53
+}
  54
+	.buff-list li + li {
  55
+		border-top: 1px solid #dddddd;
  56
+		margin-top: 5px;
  57
+		padding-top: 5px;
  58
+	}
  59
+.buff-name {
  60
+	font-weight: bold;
  61
+	display: block;
  62
+}
  63
+.buff-sep {
  64
+}
  65
+.buff-source {
  66
+}
46 67
 .character-blinded.control-group label {
47 68
     background-image: url('/icon-blind.svg');
48 69
     -o-background-size: 16px 100%;
@@ -82,6 +103,10 @@ body.dm {
82 103
     background-image: url('/icon-sleep.png');
83 104
     padding-left: 20px;
84 105
 }
  106
+div.dm,
  107
+div.dm.tab-pane.active {
  108
+	display: none;
  109
+}
85 110
 td.char-damage {
86 111
     font-size: 200%;
87 112
     font-weight: 700;
@@ -128,7 +153,7 @@ div.control-group.dm,
128 153
 fieldset.dm,
129 154
 .navbar fieldset.dm,
130 155
 .row-fluid .dm[class*="span"] {
131  
-    display: none
  156
+    display: none;
132 157
 }
133 158
 footer {
134 159
     color: #B4B4B4
@@ -181,6 +206,9 @@ input.error {
181 206
 label[for] {
182 207
     cursor: pointer
183 208
 }
  209
+li.dm {
  210
+	display: none;
  211
+}
184 212
 .navbar-inner {
185 213
     -webkit-border-radius: 0;
186 214
     -moz-border-radius: 0;
@@ -324,6 +352,9 @@ input[type="number"] {
324 352
 .sub-enemy-name-form {
325 353
     display: none
326 354
 }
  355
+.tab-pane ul {
  356
+	margin-top: 0.5em;
  357
+}
327 358
 td.dm,
328 359
 th.dm {
329 360
     display: none
75  client/dnd.html
@@ -93,7 +93,7 @@
93 93
     	<input type="number" id="char-dmg" placeholder="~Dmg">
94 94
 		</div>
95 95
 		<div class="control-group">
96  
-			<input type="checkbox" id="new-enemy">
  96
+			<input type="checkbox" id="new-enemy" checked="checked">
97 97
 			<label for="new-enemy">Enemy?</label>
98 98
 		</div>
99 99
 		<div class="form-actions">
@@ -117,60 +117,57 @@
117 117
 	</tr>
118 118
 </template>
119 119
 
120  
-<template name="scratch_pad">
  120
+<template name="dashboard">
121 121
 	<div class="icon-save" id="scratch-pad-save-indicator"></div>
122 122
 	<ul class="nav nav-tabs">
123  
-		<li class="active"><a href="#scratch-pad-tab" data-toggle="tab">Editor</a></li>
124  
-		<li><a href="#scratch-pad-revisions-tab" data-toggle="tab">History</a></li>
  123
+		<li class="dm"><a href="#scratch-pad-tab" data-toggle="tab">Editor</a></li>
  124
+		<li class="dm"><a href="#scratch-pad-revisions-tab" data-toggle="tab">History</a></li>
  125
+		<li class="active"><a href="#party-buffs-tab" data-toggle="tab">Buffs</a></li>
125 126
 	</ul>
126 127
 	<div class="tab-content">
127  
-		<div class="tab-pane active" id="scratch-pad-tab">
128  
-			<textarea id="scratch-pad" rows="5"></textarea>
  128
+		<div class="tab-pane" id="scratch-pad-tab">
  129
+			<div class="dm">
  130
+				<textarea id="scratch-pad" rows="5"></textarea>
  131
+			</div>
129 132
 		</div>
130 133
 		<div class="tab-pane" id="scratch-pad-revisions-tab">
131  
-			<table class="table table-striped scratch-pad-revisions">
132  
-				<thead>
133  
-					<tr>
134  
-						<th>Date</th>
135  
-						<th>Content</th>
136  
-					</tr>
137  
-				</thead>
138  
-				<tbody>
139  
-					{{#each scratchPadRevisions}}
140  
-						{{> scratch_pad_revision}}
141  
-					{{/each}}
142  
-				</tbody>
143  
-			</table>
  134
+			<div class="dm">
  135
+				<table class="table table-striped scratch-pad-revisions">
  136
+					<thead>
  137
+						<tr>
  138
+							<th>Date</th>
  139
+							<th>Content</th>
  140
+						</tr>
  141
+					</thead>
  142
+					<tbody>
  143
+						{{#each scratchPadRevisions}}
  144
+							{{> scratch_pad_revision}}
  145
+						{{/each}}
  146
+					</tbody>
  147
+				</table>
  148
+			</div>
  149
+		</div>
  150
+		<div class="tab-pane active" id="party-buffs-tab">
  151
+			<ul class="buff-list">
  152
+				{{#each allPartyBuffs}}
  153
+					<li class="clearfix">
  154
+						<a href="#remove-buff" class="pull-right delete btn btn-danger"><i class="icon-white icon-trash"></i></a>
  155
+						<span class="buff-name">{{name}}</span>
  156
+						<span class="buff-sep">from</span>
  157
+						<span class="buff-source">{{getBuffSource}}</span>
  158
+					</li>
  159
+				{{/each}}
  160
+			</ul>
144 161
 		</div>
145 162
 	</div>
146 163
 </template>
147 164
 
148  
-<template name="dashboard">
149  
-	<h2>Party Dashboard</h2>
150  
-	<div class="icon-save" id="scratch-pad-save-indicator"></div>
151  
-	<ul class="nav nav-tabs">
152  
-		<li class="active"><a href="#pary-buffs" data-toggle="tab">Buffs</a></li>
153  
-	</ul>
154  
-	<table class="table table-hover">
155  
-		<tbody>
156  
-			{{#each allPartyBuffs}}
157  
-				<tr class="success">
158  
-					<td>{{name}}</td>
159  
-				</tr>
160  
-			{{/each}}
161  
-		</tbody>
162  
-	</table>
163  
-</template>
164  
-
165 165
 <template name="characters">
166 166
 	<section id="characters-view">
167 167
 		<div class="row-fluid">
168 168
 			<div class="span9" id="character-list-span">
169 169
 				{{> character_list}}
170 170
 			</div>
171  
-			<div class="span3 dm" id="scratch-pad-span">
172  
-				{{> scratch_pad}}
173  
-			</div>
174 171
 			<div class="span3" id="dashboard-span">
175 172
 				{{> dashboard}}
176 173
 			</div>
39  client/dnd.js
@@ -161,10 +161,6 @@ var getRowSpanForEnemyInDMView = function(charID) {
161 161
 		}).count() + 1;
162 162
 	};
163 163
 
164  
-var getPartyBuffForCharacter = function(charID) {
165  
-		return PartyBuffList.find({charID: charID});
166  
-	};
167  
-
168 164
 var getAllPartyBuffs = function() {
169 165
 		var allCharInGame = CharacterList.find({char_in_game:true});
170 166
 		var ids = new Array();
@@ -242,7 +238,7 @@ var setupScratchPad = function() {
242 238
 			resizable: false
243 239
 		});
244 240
 		var timeout = null;
245  
-		var editBody = $($('#scratch-pad-span .el-rte .workzone iframe')[0].contentDocument.body);
  241
+		var editBody = $($('#dashboard-span .el-rte .workzone iframe')[0].contentDocument.body);
246 242
 		editBody.keypress(function() {
247 243
 			clearTimeout(timeout);
248 244
 			timeout = setTimeout(function() {
@@ -284,7 +280,23 @@ Template.footer.events = {
284 280
 	}
285 281
 };
286 282
 
287  
-Template.scratch_pad.scratchPadRevisions = function() {
  283
+Template.dashboard.events = {
  284
+	'click a[href=#remove-buff]': function() {
  285
+		if (confirm("Are you sure you want to remove this buff?")) {
  286
+			PartyBuffList.remove({_id: this._id});
  287
+		}
  288
+		return false;
  289
+	}
  290
+};
  291
+
  292
+Template.dashboard.getBuffSource = function() {
  293
+	var character = CharacterList.findOne({
  294
+		_id: this.charID
  295
+	});
  296
+	return character.name
  297
+};
  298
+
  299
+Template.dashboard.scratchPadRevisions = function() {
288 300
 	return ScratchPadList.find({
289 301
 	}, {
290 302
 		sort: {
@@ -388,7 +400,7 @@ Template.character_status_effects.events = {
388 400
 };
389 401
 
390 402
 var resetCharacterForm = function() {
391  
-		$('#new-enemy').attr('checked', false);
  403
+		$('#new-enemy').attr('checked', true);
392 404
 		$("#char-ac").val('');
393 405
 		$("#char-fort").val('');
394 406
 		$("#char-ref").val('');
@@ -498,8 +510,7 @@ Template.character_list.characters = function() {
498 510
 
499 511
 
500 512
 Template.character.partyBuffs = function() {
501  
-	console.debug(this._id+" "+(PartyBuffList.find({charID:this._id})).count());
502  
-	return getPartyBuffForCharacter(this._id);
  513
+	return PartyBuffList.find({charID: this._id});
503 514
 };
504 515
 
505 516
 Template.dashboard.allPartyBuffs = function() {
@@ -693,16 +704,14 @@ Template.character.events = {
693 704
 		});
694 705
 		return false;
695 706
 	},
696  
-		'click a[href=#create-new-buff]': function(event) {
  707
+	'click a[href=#create-new-buff]': function(event) {
697 708
 		var link = $(event.currentTarget);
698 709
 		var charID = this.charID;
699  
-		var name = this.name;		
700  
-
  710
+		var name = this.name;
701 711
 		PartyBuffList.insert({
702 712
 			charID: this._id,
703 713
 			name: "New Buff"
704 714
 		});
705  
-		console.debug("INSERT "+PartyBuffList.find().count());
706 715
 		return false;
707 716
 	},
708 717
 	'click a[href=#show-all-buffs]': function(event) {
@@ -759,10 +768,6 @@ Template.out_character.events = {
759 768
 };
760 769
 
761 770
 Template.char_buff_row.events = {
762  
-	'click a[href=#remove-buff]': function() {
763  
-		PartyBuffList.remove({_id: this._id});
764  
-		return false;
765  
-	},
766 771
 	'click .char-buff': function(event) {
767 772
 		var charBuffSpan = $(event.currentTarget);
768 773
 		if (charBuffSpan.hasClass('editing')) {

No commit comments for this range

Something went wrong with that request. Please try again.