accurator/commit

Changed adding labels annotorious buttons.

authorChris Dijkshoorn
Fri Apr 15 16:57:31 2016 +0200
committerChris Dijkshoorn
Fri Apr 15 16:57:31 2016 +0200
commit19e62acce80d6d330ade0733b813833034181725
treebb41918a8f27a4e6cdab3bf78cef82341fb66930
parent3b0eb8ddfd9508cfba4d1d299da6da7206410a7b
Diff style: patch stat
diff --git a/rdf/ui/labels.ttl b/rdf/ui/labels.ttl
index 972ebdc..9a09d73 100644
--- a/rdf/ui/labels.ttl
+++ b/rdf/ui/labels.ttl
@@ -60,6 +60,8 @@ aui:item a auis:UI ;
 	aui:title "Tag image"@en ;
 	aui:itemBtnPrevious "Previous"@en ;
 	aui:itemBtnNext "Next"@en ;
+	aui:annoBtnDone "Done"@en ;
+	aui:annoBtnCancel "Cancel"@en ;
 	aui:navbarBtnRecommend "Recommended works"@en ;
 	aui:navbarBtnSearch "Search"@en ;
 	aui:itemHdrFirst "Your first tag!"@en ;
@@ -68,6 +70,8 @@ aui:item a auis:UI ;
 aui:title rdfs:subPropertyOf auis:uiLabel .
 aui:itemBtnPrevious rdfs:subPropertyOf auis:uiLabel .
 aui:itemBtnNext rdfs:subPropertyOf auis:uiLabel .
+aui:annoBtnDone rdfs:subPropertyOf auis:uiLabel .
+aui:annoBtnCancel rdfs:subPropertyOf auis:uiLabel .
 aui:navbarBtnRecommend rdfs:subPropertyOf auis:uiLabel .
 aui:navbarBtnSearch rdfs:subPropertyOf auis:uiLabel .
 aui:itemHdrFirst rdfs:subPropertyOf auis:uiLabel .
diff --git a/rdf/ui/labels_nl.ttl b/rdf/ui/labels_nl.ttl
index 58a7923..53c0c6e 100644
--- a/rdf/ui/labels_nl.ttl
+++ b/rdf/ui/labels_nl.ttl
@@ -38,6 +38,8 @@ aui:item a auis:UI ;
 	aui:title "Voeg informatie toe aan object"@nl ;
 	aui:itemBtnPrevious "Vorige"@nl ;
 	aui:itemBtnNext "Volgende"@nl ;
+	aui:annoBtnDone "Klaar"@nl ;
+	aui:annoBtnCancel "Annuleren"@nl ;
 	aui:navbarBtnRecommend "Aanbevolen werken"@nl ;
 	aui:navbarBtnSearch "Zoek"@nl ;
 	aui:itemHdrFirst "De eerste keer informatie toevoegen!"@nl ;
diff --git a/web/css/annotorious.css b/web/css/annotorious.css
index 9bf75b4..f1ad5a1 100644
--- a/web/css/annotorious.css
+++ b/web/css/annotorious.css
@@ -203,13 +203,13 @@
   padding-top:2px;
 }
 
-.annotorious-editor-button {
+/*.annotorious-editor-button {
   float:right;
   line-height: normal;
   display:inline-block;
   text-align:center;
   text-decoration:none;
-  /*font-family:Verdana, Arial;*/
+  font-family:Verdana, Arial;
   font-size:10px;
   border:1px solid #777;
   color:#ddd;
@@ -229,6 +229,7 @@
 .annotorious-editor-button:hover {
   background:#999;
 }
+*/
 
 .annotorious-editor-field {
   border-bottom:1px solid #ccc;
diff --git a/web/js/components/deniche-plugin.js b/web/js/components/deniche-plugin.js
index 5df4968..0be6112 100644
--- a/web/js/components/deniche-plugin.js
+++ b/web/js/components/deniche-plugin.js
@@ -34,8 +34,8 @@
  *
  * */
 
-annotorious.plugin.DenichePlugin = function() {
-    /** @public **/
+annotorious.plugin.DenichePlugin = function(labels) {
+	/** @public **/
 	this.currentShape = null; // Should be accessible by cpack objects
 
 	/** @private **/
@@ -43,6 +43,7 @@ annotorious.plugin.DenichePlugin = function() {
 	this._dirtytag = null; // tag annotorious doesn't know yet
 	this._saveButtons = {}; // we have multiple buttons if we have multiple images per page
 	this._cancelButtons = {};
+	this._labels = labels; // labels for buttons
 }
 
 annotorious.plugin.DenichePlugin.states = {EMPTY:'empty', SOME:'some'};
@@ -137,7 +138,7 @@ annotorious.plugin.DenichePlugin.prototype.addAnnotation = function (annotation,
 	} else {
 		annotation.compound_text = [ annotation.text ];
 	}
-	
+
 	if (update) {
 		this._cleantags[annotation.targetId] = annotation;
 		this._anno.addAnnotation(annotation, old);
@@ -176,11 +177,13 @@ annotorious.plugin.DenichePlugin.prototype.installHandlers = function() {
 		// get the annotorious save and cancel button so we can manipulate them:
 		var node = oSelf.annotator.element;
 
+		// store buttons, change labels and change styling
 		oSelf._saveButtons[annotation.fieldsId] = $(".annotorious-editor-button-save").get(0);
+		oSelf._saveButtons[annotation.fieldsId].innerHTML = oSelf._labels.annoBtnDone;
 		oSelf._cancelButtons[annotation.fieldsId] = $(".annotorious-editor-button-cancel").get(0);
-		oSelf._saveButtons[annotation.fieldsId].innerHTML = "Done";
+		oSelf._cancelButtons[annotation.fieldsId].innerHTML = oSelf._labels.annoBtnCancel;
 
-		// Set focus on first field (exlude hint input field introduced by twitter typeahead)
+		// set focus on first field (exlude hint input field introduced by twitter typeahead)
 		$(".annotorious-editor input").not(".tt-hint")[0].focus();
 
 		oSelf._dirtytag = null;
diff --git a/web/js/components/field.js b/web/js/components/field.js
index 2088210..b7057e1 100644
--- a/web/js/components/field.js
+++ b/web/js/components/field.js
@@ -177,7 +177,7 @@ Field.prototype.addDropdownListeners = function() {
 		);
 	});
 
-	// Action upon pressing enter
+	// action upon pressing enter
 	inputField.on('keyup', function(event) {
 		// Check to see if typeahead cleared the field (so autocomplete was used)
 		if (inputField.val() && event.which == 13) {
@@ -195,7 +195,7 @@ Field.prototype.addDropdownListeners = function() {
 		}
 	});
 
-	// Action on pressing esc
+	// action on pressing esc
 	inputField.on('keyup', function(event) {
 		if (_field.fragmentField && event.which == 27) {
 			_field._anno._deniche.onFragmentCancel(event);
diff --git a/web/js/item.js b/web/js/item.js
index c1c3b40..09a1c24 100644
--- a/web/js/item.js
+++ b/web/js/item.js
@@ -51,7 +51,7 @@ function itemInit() {
 	});
 
 	function drawPage(userData) {
-		var ui, annotation_ui;
+		var ui, annotation_ui, labels;
 		var user = userData.user;
 		var userName = getUserName(userData.user);
 
@@ -65,7 +65,7 @@ function itemInit() {
 			return getLabels(locale, ui);
 		})
 		.then(function(labelData){
-			var labels = initLabels(labelData);
+			labels = initLabels(labelData);
 
 			// only show path and navigation when cluster is available
 			if ((localStorage.getItem("uris") !== null) &&
@@ -82,7 +82,7 @@ function itemInit() {
 		.then(function(metadata) {
 			displayMetadata(uri);
 			displayAnnotations(uri);
-			return addAnnotationFields(metadata, user, uri, locale, domain, annotation_ui);
+			return addAnnotationFields(metadata, user, uri, locale, domain, annotation_ui, labels);
 		});
 	}
 }
@@ -107,7 +107,9 @@ function initLabels(labelData) {
 
 	var labels = {
 		itemHdrFirst: labelData.itemHdrFirst,
-		itemTxtFirst: labelData.itemTxtFirst
+		itemTxtFirst: labelData.itemTxtFirst,
+		annoBtnCancel: labelData.annoBtnCancel,
+		annoBtnDone: labelData.annoBtnDone
 	};
 
 	return labels;
@@ -199,7 +201,7 @@ function addNavigationButtonEvents(uris, uri) {
 	}
 }
 
-function addAnnotationFields(metadata, user, uri, locale, domain, annotation_ui) {
+function addAnnotationFields(metadata, user, uri, locale, domain, annotation_ui, labels) {
 	// Retrieve the fields that should be added (based on save_user_info)
 	return $.getJSON("annotation_fields", {
 		locale:locale,
@@ -256,7 +258,7 @@ function addAnnotationFields(metadata, user, uri, locale, domain, annotation_ui)
 			$("#" + fragmentField.fieldsId).append(fragmentField.node);
 		}
 		// add the deniche plugin, which embeds the fields in annotorious
-		anno.addPlugin("DenichePlugin", {});
+		anno.addPlugin("DenichePlugin", labels);
 	});
 }