Skip to content

Commit

Permalink
Merge 92e9f19 into fe246c4
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Mar 21, 2017
2 parents fe246c4 + 92e9f19 commit 0f1ec65
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 39 deletions.
2 changes: 2 additions & 0 deletions Gruntfile.js
Expand Up @@ -47,6 +47,8 @@ module.exports = function(grunt) {

// source files
sources = [
'js/src/mirador.js',
'js/src/utils/handlebars.js',
'js/src/*.js',
'js/src/viewer/*.js',
'js/src/manifests/*.js',
Expand Down
4 changes: 2 additions & 2 deletions js/src/annotations/annotationTooltip.js
Expand Up @@ -433,7 +433,7 @@
},

//when this is being used to edit an existing annotation, insert them into the inputs
editorTemplate: Handlebars.compile([
editorTemplate: $.Handlebars.compile([
'<form id="annotation-editor-{{windowId}}" class="annotation-editor annotation-tooltip" {{#if id}}data-anno-id="{{id}}"{{/if}}>',
'<div>',
// need to add a delete, if permissions allow
Expand All @@ -445,7 +445,7 @@
'</form>'
].join('')),

viewerTemplate: Handlebars.compile([
viewerTemplate: $.Handlebars.compile([
'<div class="all-annotations" id="annotation-viewer-{{windowId}}">',
'{{#each annotations}}',
'<div class="annotation-display annotation-tooltip" data-anno-id="{{id}}">',
Expand Down
1 change: 1 addition & 0 deletions js/src/annotations/osd-svg-overlay.js
Expand Up @@ -121,6 +121,7 @@
setMouseTool: function() {
this.removeMouseTool();

this.paperScope.activate();
var mouseTool = new this.paperScope.Tool();
mouseTool.overlay = this;
mouseTool.onMouseUp = this.onMouseUp;
Expand Down
2 changes: 1 addition & 1 deletion js/src/annotations/tinymce-annotation-editor.js
Expand Up @@ -136,7 +136,7 @@
});
},

editorTemplate: Handlebars.compile([
editorTemplate: $.Handlebars.compile([
'<textarea class="text-editor" placeholder="{{t "comments"}}…">{{#if content}}{{content}}{{/if}}</textarea>',
'<input id="tags-editor-{{windowId}}" class="tags-editor" placeholder="{{t "addTagsHere"}}…" {{#if tags}}value="{{tags}}"{{/if}}>'
].join(''))
Expand Down
7 changes: 7 additions & 0 deletions js/src/utils/handlebars.js
@@ -0,0 +1,7 @@
(function($) {

$.Handlebars = (function() {
return Handlebars.create();
})();

}(Mirador));
6 changes: 3 additions & 3 deletions js/src/viewer.js
Expand Up @@ -62,10 +62,10 @@
this.element.css('background-color', '#333').css('background-image','url('+backgroundImage+')').css('background-position','left top')
.css('background-repeat','repeat');

//register Handlebars helper
Handlebars.registerHelper('t', function(i18n_key) {
//register $.Handlebars helper
$.Handlebars.registerHelper('t', function(i18n_key) {
var result = i18next.t(i18n_key);
return new Handlebars.SafeString(result);
return new $.Handlebars.SafeString(result);
});

//check all buttons in mainMenu. If they are all set to false, then don't show mainMenu
Expand Down
2 changes: 1 addition & 1 deletion js/src/viewer/bookmarkPanel.js
Expand Up @@ -62,7 +62,7 @@
jQuery(this.element).show({effect: "slide", direction: "up", duration: 300, easing: "swing"});
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div id="bookmark-panel">',
'<h3>{{t "bookmarkTitle"}}</h3>',
'<span>',
Expand Down
10 changes: 5 additions & 5 deletions js/src/viewer/mainMenu.js
Expand Up @@ -112,7 +112,7 @@
});
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'{{#if userLogo}}',
'<ul class="user-logo {{mainMenuCls}}">',
'{{userlogo userLogo}}',
Expand Down Expand Up @@ -244,14 +244,14 @@
}
};

Handlebars.registerHelper('userbtns', function (userButtons) {
return new Handlebars.SafeString(
$.Handlebars.registerHelper('userbtns', function (userButtons) {
return new $.Handlebars.SafeString(
jQuery('<ul class="user-buttons ' + this.mainMenuCls +'"></ul>').append(processUserButtons(userButtons)).get(0).outerHTML
);
});

Handlebars.registerHelper('userlogo', function (userLogo) {
return new Handlebars.SafeString(
$.Handlebars.registerHelper('userlogo', function (userLogo) {
return new $.Handlebars.SafeString(
processUserBtn(userLogo).get(0).outerHTML
);
});
Expand Down
4 changes: 2 additions & 2 deletions js/src/viewer/manifestListItem.js
Expand Up @@ -36,7 +36,7 @@
this.maxPreviewImagesWidth = this.resultsWidth - (this.repoWidth + this.margin + this.metadataWidth + this.margin + this.remainingWidth);
this.maxPreviewImagesWidth = this.maxPreviewImagesWidth * 0.95;

Handlebars.registerHelper('pluralize', function(count, singular, plural) {
$.Handlebars.registerHelper('pluralize', function(count, singular, plural) {
if (count === 1) {
return singular;
} else {
Expand Down Expand Up @@ -246,7 +246,7 @@
var _this = this;
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<li data-index-number={{index}}>',
'<div class="repo-image">',
'{{#if repoImage}}',
Expand Down
2 changes: 1 addition & 1 deletion js/src/viewer/manifestsPanel.js
Expand Up @@ -140,7 +140,7 @@
_this.element.find('#manifest-search').keyup();
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div id="manifest-select-menu">',
'<div class="container">',
'<div class="manifest-panel-controls">',
Expand Down
2 changes: 1 addition & 1 deletion js/src/viewer/workspacePanel.js
Expand Up @@ -111,7 +111,7 @@
_this.hide();
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div id="workspace-select-menu">',
'<h1>{{t "changeLayout"}}</h1>',
'<h3 class="grid-text"></h3>',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/annotationsTab.js
Expand Up @@ -180,7 +180,7 @@
this.element.hide();
}
},
template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="annotationsPanel">',
'<ul class="annotationSources">',
'{{#each annotationSources}}',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/bookView.js
Expand Up @@ -78,7 +78,7 @@
}
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="book-view">',
'</div>'
].join('')),
Expand Down
6 changes: 3 additions & 3 deletions js/src/widgets/contextControls.js
Expand Up @@ -250,7 +250,7 @@
});
},

annotationTemplate: Handlebars.compile([
annotationTemplate: $.Handlebars.compile([
'{{#if showEdit}}',
'<a class="mirador-osd-pointer-mode hud-control selected" title="{{t "pointerTooltip"}}">',
'<i class="fa fa-mouse-pointer"></i>',
Expand Down Expand Up @@ -290,7 +290,7 @@
'{{/if}}'
].join('')),

manipulationTemplate: Handlebars.compile([
manipulationTemplate: $.Handlebars.compile([
'{{#if showRotate}}',
'<a class="hud-control mirador-osd-rotate-right" title="{{t "rotateRightTooltip"}}">',
'<i class="fa fa-lg fa-rotate-right"></i>',
Expand Down Expand Up @@ -339,7 +339,7 @@
].join('')),

// for accessibility, make sure to add aria-labels just like above
editorTemplate: Handlebars.compile([
editorTemplate: $.Handlebars.compile([
'<div class="mirador-osd-context-controls hud-container">',
'<a class="mirador-osd-back hud-control" role="button">',
'<i class="fa fa-lg fa-arrow-left"></i>',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/hud.js
Expand Up @@ -206,7 +206,7 @@
});
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="mirador-hud">',
'{{#if showNextPrev}}',
'<a class="mirador-osd-previous hud-control ">',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/imageView.js
Expand Up @@ -90,7 +90,7 @@
}
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="image-view">',
'</div>'
].join('')),
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/layersTab.js
Expand Up @@ -97,7 +97,7 @@
}
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="layersPanel">',
'</div>',
].join(''))
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/metadataView.js
Expand Up @@ -237,7 +237,7 @@
return textWithLinks;
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="sub-title">{{t "details"}}:</div>',
'<div class="{{metadataListingCls}}">',
'{{#each details}}',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/sidePanel.js
Expand Up @@ -194,7 +194,7 @@
}
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="tabContentArea">',
'<ul class="tabGroup">',
'</ul>',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/tabs.js
Expand Up @@ -98,7 +98,7 @@
this.element.find(tabClass).addClass('selected');

},
template: Handlebars.compile([
template: $.Handlebars.compile([
'<ul class="tabGroup">',
'{{#each tabs}}',
'<li class="tab {{this.options.id}} {{#unless @index}}selected{{/unless}}" data-tabId="{{this.options.id}}">',
Expand Down
2 changes: 1 addition & 1 deletion js/src/widgets/thumbnailsView.js
Expand Up @@ -171,7 +171,7 @@
}
},

template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="{{thumbnailCls}}">',
'<ul class="{{listingCssCls}}" role="list" aria-label="Thumbnails">',
'{{#thumbs}}',
Expand Down
8 changes: 4 additions & 4 deletions js/src/widgets/toc.js
Expand Up @@ -372,7 +372,7 @@
});
},

emptyTemplate: Handlebars.compile([
emptyTemplate: $.Handlebars.compile([
'<ul class="toc">',
'<li class="leaf-item open">',
'<h2><span>{{t "noIndex"}}</span></h2>',
Expand All @@ -381,7 +381,7 @@

template: function(tplData) {

var template = Handlebars.compile([
var template = $.Handlebars.compile([
'<ul class="toc">',
'{{#nestedRangeLevel ranges}}',
'<li class="{{#if children}}has-child{{else}}leaf-item{{/if}}">',
Expand All @@ -398,7 +398,7 @@

var previousTemplate;

Handlebars.registerHelper('nestedRangeLevel', function(children, options) {
$.Handlebars.registerHelper('nestedRangeLevel', function(children, options) {
var out = '';

if (options.fn !== undefined) {
Expand All @@ -413,7 +413,7 @@
return out;
});

Handlebars.registerHelper('tocLevel', function(id, label, level, children) {
$.Handlebars.registerHelper('tocLevel', function(id, label, level, children) {
var caret = '<i class="fa fa-caret-right toc-caret"></i>',
cert = '<i class="fa fa-certificate star"></i>';
return '<h' + (level+1) + '><a class="toc-link" data-rangeID="' + id + '">' + caret + cert + '<span>' + label + '</span></a></h' + (level+1) + '>';
Expand Down
2 changes: 1 addition & 1 deletion js/src/workspaces/slot.js
Expand Up @@ -272,7 +272,7 @@
},

// template should be based on workspace type
template: Handlebars.compile([
template: $.Handlebars.compile([
'<div id="{{slotID}}" class="{{workspaceSlotCls}}">',
'<div class="slotIconContainer">',
// '<a href="javascript:;" class="mirador-btn mirador-icon-window-menu" title="Replace object"><i class="fa fa-table fa-lg fa-fw"></i>',
Expand Down
2 changes: 1 addition & 1 deletion js/src/workspaces/window.js
Expand Up @@ -927,7 +927,7 @@
},

// template should be based on workspace type
template: Handlebars.compile([
template: $.Handlebars.compile([
'<div class="window">',
'<div class="manifest-info">',
'<div class="window-manifest-navigation">',
Expand Down
2 changes: 2 additions & 0 deletions karma.conf.js
Expand Up @@ -38,6 +38,8 @@ module.exports = function(config) {
'node_modules/sinon/pkg/sinon.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
// app
'js/src/mirador.js',
'js/src/utils/handlebars.js',
'js/src/*.js',
'js/src/viewer/*.js',
'js/src/manifests/*.js',
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "mirador",
"version": "2.2.0",
"version": "2.2.1",
"description": "Multi-window image viewer, a web-based tool to support researcher goals",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions spec/annotations/osd-svg-overlay.test.js
Expand Up @@ -14,9 +14,9 @@ describe('Overlay', function() {

beforeEach(function() {
//register Handlebars helper
Handlebars.registerHelper('t', function(i18n_key) {
Mirador.Handlebars.registerHelper('t', function(i18n_key) {
var result = i18next.t(i18n_key);
return new Handlebars.SafeString(result);
return new Mirador.Handlebars.SafeString(result);
});

var id = 'test';
Expand Down
4 changes: 2 additions & 2 deletions spec/annotations/tinymce-annotation-editor.test.js
Expand Up @@ -2,9 +2,9 @@ describe('TinyMCEAnnotationBodyEditor', function() {
var subject;

beforeEach(function() {
Handlebars.registerHelper('t', function(i18n_key) {
Mirador.Handlebars.registerHelper('t', function(i18n_key) {
var result = i18next.t(i18n_key);
return new Handlebars.SafeString(result);
return new Mirador.Handlebars.SafeString(result);
});
subject = new Mirador.TinyMCEAnnotationBodyEditor();
});
Expand Down
Empty file added spec/utils/handlebars.test.js
Empty file.

0 comments on commit 0f1ec65

Please sign in to comment.