diff --git a/compile_handlebars.sh b/compile_handlebars.sh new file mode 100755 index 000000000..afd97dc68 --- /dev/null +++ b/compile_handlebars.sh @@ -0,0 +1 @@ +handlebars handlebars --min -f game/static/game/js/templates.js diff --git a/game/static/game/js/button.js b/game/static/game/js/button.js index eb3337a95..bb9530710 100644 --- a/game/static/game/js/button.js +++ b/game/static/game/js/button.js @@ -42,8 +42,8 @@ var ocargo = ocargo || {}; ocargo.button = {}; // Returns the html code for a button which closes the popup using handlebars precompiled templates -ocargo.button.getDismissButtonHtml = function(label){ - return Handlebars.templates['button-dismiss']({label: label}); +ocargo.button.getDismissButtonHtml = function(id, label){ + return Handlebars.templates['button-dismiss']({label: label, id: id}); } // Returns the html code for a button which redirects to location using handlebars precompiled templates @@ -53,5 +53,5 @@ ocargo.button.getRedirectButtonHtml = function(location, label){ // Returns the html code for a button which shows the try again message and closes the popup ocargo.button.getTryAgainButtonHtml = function(){ - return ocargo.button.getDismissButtonHtml(ocargo.messages.tryagainLabel) + return ocargo.button.getDismissButtonHtml('try_again_button', ocargo.messages.tryagainLabel) } \ No newline at end of file diff --git a/game/static/game/js/drawing.js b/game/static/game/js/drawing.js index f2850a7e5..1d8c4fb2c 100644 --- a/game/static/game/js/drawing.js +++ b/game/static/game/js/drawing.js @@ -938,7 +938,7 @@ ocargo.Drawing.startPopup = function(title, subtitle, message, mascot, buttons, if(buttons){ $('#modal-buttons').html(buttons); } else { - $('#modal-buttons').html(ocargo.button.getDismissButtonHtml("Close")); + $('#modal-buttons').html(ocargo.button.getDismissButtonHtml('close_button', 'Close')); } setTimeout( function() { $('#myModal').foundation('reveal', 'open'); }, delay); diff --git a/game/static/game/js/game.js b/game/static/game/js/game.js index d554cee4f..ac7d021e8 100644 --- a/game/static/game/js/game.js +++ b/game/static/game/js/game.js @@ -103,7 +103,7 @@ ocargo.Game.prototype.setup = function() { } } ocargo.Drawing.startPopup(title, LESSON, - loggedOutWarning, true, ocargo.button.getDismissButtonHtml('Play')); + loggedOutWarning, true, ocargo.button.getDismissButtonHtml('play_button', 'Play')); }; ocargo.Game.prototype.reset = function() { diff --git a/game/static/game/js/templates.js b/game/static/game/js/templates.js index a7edcd831..3bc1b0dc7 100644 --- a/game/static/game/js/templates.js +++ b/game/static/game/js/templates.js @@ -1,38 +1 @@ -/* -Code for Life - -Copyright (C) 2015, Ocado Limited - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . - -ADDITIONAL TERMS – Section 7 GNU General Public Licence - -This licence does not grant any right, title or interest in any “Ocado” logos, -trade names or the trademark “Ocado” or any other trademarks or domain names -owned by Ocado Innovation Limited or the Ocado group of companies or any other -distinctive brand features of “Ocado” as may be secured from time to time. You -must not distribute any modification of this program using the trademark -“Ocado” or claim any affiliation or association with Ocado or its employees. - -You are not authorised to use the name Ocado (or any of its trade names) or -the names of any author or contributor in advertising or for publicity purposes -pertaining to the distribution of this program, without the prior written -authorisation of Ocado. - -Any propagation, distribution or conveyance of this program must include this -copyright notice and these terms. You must not misrepresent the origins of this -program; modified versions of the program must be marked as such and not -identified as the original program. -*/ -!function(){var n=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["button-dismiss"]=n({compiler:[6,">= 2.0.0-beta.1"],main:function(n,a,t,l){var e;return'\n"},useData:!0}),a["button-redirect"]=n({compiler:[6,">= 2.0.0-beta.1"],main:function(n,a,t,l){var e,o=a.helperMissing,s="function",i=this.escapeExpression;return'\n"},useData:!0})}(); +!function(){var n=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["button-dismiss"]=n({compiler:[6,">= 2.0.0-beta.1"],main:function(n,a,l,t){var e,o=a.helperMissing,i="function",s=this.escapeExpression;return'"},useData:!0}),a["button-redirect"]=n({compiler:[6,">= 2.0.0-beta.1"],main:function(n,a,l,t){var e,o=a.helperMissing,i="function",s=this.escapeExpression;return'"},useData:!0})}(); \ No newline at end of file diff --git a/handlebars/button-dismiss.handlebars b/handlebars/button-dismiss.handlebars new file mode 100644 index 000000000..82cfa161d --- /dev/null +++ b/handlebars/button-dismiss.handlebars @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/handlebars/button-redirect.handlebars b/handlebars/button-redirect.handlebars new file mode 100644 index 000000000..51c8d7a1b --- /dev/null +++ b/handlebars/button-redirect.handlebars @@ -0,0 +1,3 @@ + \ No newline at end of file