From c16eb894ade649b0f1b2454e21e2a2bda2c0a384 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Thu, 4 Dec 2014 21:13:27 +0200 Subject: move nodetypes to consts, add descriptions. Fixes #48 --- src/consts.js | 14 ++++++++++++++ src/textanalysis.js | 2 +- src/textanalysis.ui.js | 9 +++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/consts.js b/src/consts.js index cfcdd1c2..4b21dc70 100644 --- a/src/consts.js +++ b/src/consts.js @@ -1,11 +1,25 @@ "use strict" define(function() { + + var nodetypes = ["person", "club", "skill", "interest", "third-internship-proposal", "internship"]; + + var description = { + person: 'Depict a person, real or fictional', + club: undefined, + skill: 'Depicts a specific ability of expertise a person can have', + interest: undefined, + 'third-internship-proposal': undefined, + internship: undefined, + }; + // TODO: enums, sometime return { KEYSTROKE_WHERE_EDIT_NODE: 'keystroke_where_edit_node', KEYSTROKE_WHERE_DOCUMENT: 'keystroke_where_document', KEYSTROKE_WHERE_TEXTANALYSIS: 'keystroke_where_textanalysis', INPUT_WHERE_TEXTANALYSIS: 'input_where_textanalysis', + nodetypes: nodetypes, + description: description, }; }); diff --git a/src/textanalysis.js b/src/textanalysis.js index 44765916..98ca8aea 100644 --- a/src/textanalysis.js +++ b/src/textanalysis.js @@ -4,7 +4,7 @@ define(['rz_core', 'model/core', 'model/util', 'model/diff', 'rz_bus', 'consts'] function(rz_core, model_core, model_util, model_diff, rz_bus, consts) { var typeindex = 0; -var nodetypes = ["person", "club", "skill", "interest", "third-internship-proposal", "internship"]; +var nodetypes = consts.nodetypes; var typeStack = []; var lastnode; diff --git a/src/textanalysis.ui.js b/src/textanalysis.ui.js index 5756fce0..b7863271 100644 --- a/src/textanalysis.ui.js +++ b/src/textanalysis.ui.js @@ -7,7 +7,8 @@ var text = "", // Last text of sentence element_name = '#textanalyser', element = $(element_name), suggestionChange, - plus_button = $('.add-button'); + plus_button = $('.add-button'), + description = consts.description; var typeselection = function TypeSelectionDialog() { var e = $('.typeselection'), @@ -27,7 +28,11 @@ var typeselection = function TypeSelectionDialog() { e.css('left', 0); } typeselection.showChosenType = function(nodetype) { - e.html('
' + "Chosen Type: " + nodetype + '
'); + var desc = description[nodetype]; + e.html('' + + (desc ? '' : '') + + '
' + + "Chosen Type: " + nodetype + '
' + desc + '
'); } return typeselection; }(); -- cgit v1.3.1