-
Notifications
You must be signed in to change notification settings - Fork 1
/
Acronyms.html
224 lines (207 loc) · 8.95 KB
/
Acronyms.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<head>
<title>Sift&Sort</title>
<link href='style.css' rel='stylesheet'>
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src='js/tablesort.min.js'></script>
<script src="js/jquery.sieve.js"></script>
<script src="js/jquery.foundation.reveal.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("table.sieve").sieve();
});
</script>
</head>
<body>
<h2>Sift & Sort</h2>
<a class="acronym-btn" href="#" data-reveal-id="addAcronym">Add Acronym</a>
<div id="acronyms">
<table id="sorterer" class="sieve sort">
<thead>
<tr>
<th>Acronym</th>
<th class="no-sort">Meaning</th>
<th>Industry</th>
<th class="no-sort" colspan="2">Actions</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td class="id" style="display:none;">1</td>
<td class="acronym">RITE</td>
<td class="meaning">Rapid Iterative Testing and Evaluation</td>
<td class="system">Usability</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">2</td>
<td class="acronym">RUP</td>
<td class="meaning">Rational Unified Process</td>
<td class="system">Software Development</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">3</td>
<td class="acronym">SOA</td>
<td class="meaning">Service Oriented Architecture</td>
<td class="system">Software Development</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">4</td>
<td class="acronym">SoLoMo</td>
<td class="meaning">Social Local Mobile</td>
<td class="system">Startups</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">5</td>
<td class="acronym">SLA</td>
<td class="meaning">Service Level Agreement</td>
<td class="system">Information Technology</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">6</td>
<td class="acronym">LAMP</td>
<td class="meaning">Linux Apache MySQL PHP</td>
<td class="system">Programming</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">7</td>
<td class="acronym">OOP</td>
<td class="meaning">Object-Oriented Programming</td>
<td class="system">Programming</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">8</td>
<td class="acronym">DRY</td>
<td class="meaning">Don't Repeat Yourself</td>
<td class="system">Programming</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">9</td>
<td class="acronym">SDLC</td>
<td class="meaning">Software Development Life Cycle</td>
<td class="system">Information Technology</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</a></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
<tr>
<td class="id" style="display:none;">10</td>
<td class="acronym">UCD</td>
<td class="meaning">User-Centered Design</td>
<td class="system">Usability</td>
<td class="edit"><a class="edit-item-btn" data-reveal-id="addAcronym">Edit</button></td>
<td class="remove"><a class="remove-item-btn">Remove</a></td>
</tr>
</tbody>
</table>
<!-- Add Modal Start-->
<div id="addAcronym" class="reveal-modal">
<table id="addacro">
<td class="acronym">
<input type="hidden" id="id-field" />
<label>Acronym</label>
<input type="text" id="acronym-field" placeholder="Acronym" />
</td>
<td class="meaning">
<label>Meaning</label>
<input type="text" id="meaning-field" placeholder="Meaning" />
</td>
<td class="system">
<label>Industry</label>
<input type="text" id="system-field" placeholder="Industry" />
</td>
</table>
<div class="add">
<button class="add-modal-close" id="add-btn">Add</button>
<button class="add-modal-close" id="save-btn">Save</button>
</div>
<a class="add-modal-close close-btn-reveal">×</a>
</div>
<script>
new Tablesort(document.getElementById('sorterer'));
</script>
<script src="js/list.js"></script>
<script type="text/javascript">
/*
* Acronyms LIST
*/
// Define acronyms
var options = {
valueNames: [ 'id', 'acronym', 'meaning', 'system' ]
};
// Init list
var acronymList = new List('acronyms', options);
var idField = $('#id-field'),
acronymField = $('#acronym-field'),
meaningField = $('#meaning-field'),
systemField = $('#system-field'),
addBtn = $('#add-btn'),
saveBtn = $('#save-btn').hide(),
removeBtns = $('.remove-item-btn'),
editBtns = $('.edit-item-btn');
// Sets callbacks to the buttons in the list
refreshCallbacks();
addBtn.click(function() {
acronymList.add({
id: Math.floor(Math.random()*110000),
acronym: acronymField.val(),
meaning: meaningField.val(),
system: systemField.val()
});
clearFields();
refreshCallbacks();
});
saveBtn.click(function() {
var item = acronymList.get('id', idField.val());
item.values({
id:idField.val(),
acronym: acronymField.val(),
meaning: meaningField.val(),
system: systemField.val()
});
clearFields();
saveBtn.hide();
addBtn.show();
});
function refreshCallbacks() {
// Needed to add new buttons to jQuery-extended object
removeBtns = $(removeBtns.selector);
editBtns = $(editBtns.selector);
removeBtns.click(function() {
var itemId = $(this).closest('tr').find('.id').text();
acronymList.remove('id', itemId);
});
editBtns.click(function() {
var itemId = $(this).closest('tr').find('.id').text();
var itemValues = acronymList.get('id', itemId).values();
idField.val(itemValues.id);
acronymField.val(itemValues.acronym);
meaningField.val(itemValues.meaning);
systemField.val(itemValues.system);
saveBtn.show();
addBtn.hide();
});
}
function clearFields() {
acronymField.val('');
meaningField.val('');
systemField.val('');
}
</script>
<!-- End of List.js stuff -->
</body>
</html>