diff options
| -rw-r--r-- | res/templates/index.html | 5 | ||||
| -rw-r--r-- | src/client/util.js | 8 | ||||
| -rw-r--r-- | src/client/view/graph_view.js | 7 | ||||
| -rw-r--r-- | src/client/view/item_info.js | 10 |
4 files changed, 19 insertions, 11 deletions
diff --git a/res/templates/index.html b/res/templates/index.html index 4d83f943..887d2325 100644 --- a/res/templates/index.html +++ b/res/templates/index.html @@ -87,11 +87,6 @@ var RZ_VERSION = '{% include "fragment/version.txt" %}'; <div id="type"> <label class="info-card-attr">Type</label> <select id="edittype" class="select-dropdown"> - <option value="person">Person</option> - <option value="club">Club</option> - <option value="skill">Skill</option> - <option value="interest">Interest</option> - <option value="internship">Internship</option> </select><br> </div> <div id="status"> diff --git a/src/client/util.js b/src/client/util.js index 763623af..88226a4d 100644 --- a/src/client/util.js +++ b/src/client/util.js @@ -228,6 +228,12 @@ define(['jquery'], function($) { return ret; } + // String utilities + function capitalize(word) { + if (word.length == 0) return ''; + return word.slice(0, 1).toUpperCase() + word.slice(1, word.length); + } + // logging helpers function log_error(msg) { console.log('error: ' + msg); @@ -248,6 +254,8 @@ define(['jquery'], function($) { setSelection: setSelection, selectionStart: selectionStart, + capitalize: capitalize, + log_error: log_error, }; }); diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index 06f038c9..55131f11 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -55,11 +55,6 @@ function enableDebugViewOfDiffs(graph) }); } -function capitalize(word) { - if (word.length == 0) return ''; - return word.slice(0, 1).toUpperCase() + word.slice(1, word.length); -} - function init_checkboxes(update_view) { var // FIXME take filter names from index.html or both from graph db filter_states = _.object(_.map(model_types.nodetypes, function (type) { return [type, null]; })); @@ -73,7 +68,7 @@ function init_checkboxes(update_view) { input.attr("name", type); div.append(input); - div.append(capitalize(type)); + div.append(util.capitalize(type)); root.append(div); }); } diff --git a/src/client/view/item_info.js b/src/client/view/item_info.js index 757de261..719fe9f2 100644 --- a/src/client/view/item_info.js +++ b/src/client/view/item_info.js @@ -307,6 +307,16 @@ function hide(do_commit) { info_container.hide(); } +function first_time_init() { + // setup the special type select box based on the domain. + var root = info.find('#edittype'); + + model_types.nodetypes.forEach(function (nodetype) { + root.append($('<option value="' + nodetype + '">' + util.capitalize(nodetype) + '</option>')); + }); +} + +first_time_init(); init(); return { |
