From 85934c1b210b6a46dd9f19811520fae84c75b9b1 Mon Sep 17 00:00:00 2001 From: Johannes Baiter Date: Mon, 22 May 2017 13:55:11 +0200 Subject: [PATCH 01/30] Fix language detection for IE11 --- js/src/utils/jsonLd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/utils/jsonLd.js b/js/src/utils/jsonLd.js index 8ce2befc6c..f40ca67574 100644 --- a/js/src/utils/jsonLd.js +++ b/js/src/utils/jsonLd.js @@ -34,7 +34,7 @@ $.JsonLd = { getTextValue: function(propertyValue, language) { - var languages = window.navigator.languages || ['en']; + var languages = i18next.languages || ['en']; if (typeof language === 'string') { languages = [language].concat(languages); } else if (Array.isArray(language)) { From a64fe17f4cd65d09c7abe333abc5766cde387cb2 Mon Sep 17 00:00:00 2001 From: Matthias Lindinger Date: Fri, 2 Jun 2017 10:48:22 +0200 Subject: [PATCH 02/30] Add testcases for the default window buttons --- spec/workspaces/window.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/workspaces/window.test.js b/spec/workspaces/window.test.js index 62eb4dcc8f..a5aadd13cc 100644 --- a/spec/workspaces/window.test.js +++ b/spec/workspaces/window.test.js @@ -147,6 +147,12 @@ describe('Window', function() { expect(calls.first().args[0].appendTo.is(this.appendTo.find('.view-container'))).toBe(true); }); + it('should place default buttons in DOM', function(){ + expect(this.appendTo.find('.mirador-icon-view-type')).toExist(); + expect(this.appendTo.find('.mirador-icon-metadata-view')).toExist(); + expect(this.appendTo.find('.mirador-osd-fullscreen')).toExist(); + }); + it('should place user buttons in DOM', function(){ expect(this.appendTo.find('.mirador-icon-text')).toExist(); expect(this.appendTo.find('.mirador-icon-text').attr('href')).toBe('http://example.com'); From 43860685a22c2a646e754434f21475530c4ccb3a Mon Sep 17 00:00:00 2001 From: Matthias Lindinger Date: Fri, 2 Jun 2017 12:02:46 +0200 Subject: [PATCH 03/30] Make the language of the UI configurable --- js/src/viewer.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/src/viewer.js b/js/src/viewer.js index 3b7009fae0..039fa5a77b 100644 --- a/js/src/viewer.js +++ b/js/src/viewer.js @@ -43,15 +43,27 @@ init: function() { var _this = this; - //initialize i18next - i18next.use(i18nextXHRBackend).use(i18nextBrowserLanguageDetector).init({ + // i18next options + var i18nextOptions = { fallbackLng: 'en', load: 'unspecific', debug: false, backend: { loadPath: _this.state.getStateProperty('buildPath') + _this.state.getStateProperty('i18nPath')+'{{lng}}/{{ns}}.json' } - }, _this.setupViewer.bind(_this)); + }; + + // set the language from configuration + var configuredLanguage = _this.state.getStateProperty('language'); + if(configuredLanguage){ + i18nextOptions.lng = configuredLanguage; + } + + //initialize i18next + i18next.use(i18nextXHRBackend).use(i18nextBrowserLanguageDetector).init( + i18nextOptions, + _this.setupViewer.bind(_this) + ); // because this is a callback, we need to bind "_this" to explicitly retain the calling context of this function (the viewer object instance)); }, From 96b3df2da09df2b197dbc0fc4713e6cfe9da7647 Mon Sep 17 00:00:00 2001 From: Matthias Lindinger Date: Fri, 2 Jun 2017 12:03:21 +0200 Subject: [PATCH 04/30] Add testcase for configured language --- spec/mirador.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/mirador.test.js b/spec/mirador.test.js index e388e43945..8c62ad78eb 100644 --- a/spec/mirador.test.js +++ b/spec/mirador.test.js @@ -20,7 +20,8 @@ describe('Mirador | mirador.js', function() { "manifestUri": "spec/data/manifest2.json", "location": "Stanford University", "title": "Walters" - }] + }], + language: "de" }); testContext.mirador.viewer.eventEmitter.subscribe('manifestListItemRendered', function(data) { @@ -57,6 +58,10 @@ describe('Mirador | mirador.js', function() { expect(this.mirador.viewer).toBeDefined(); }); + it('should set the configured language', function(){ + expect(i18next.language).toBe('de') + }); + it('should select a manifest', function() { expect(this.viewerDiv.find('.addItemLink').first()).toExist(); this.viewerDiv.find('.addItemLink').first().click(); From ab5a5b78c52034b0a25e36bd308792d24e60d390 Mon Sep 17 00:00:00 2001 From: Javier de la Rosa Date: Mon, 8 May 2017 15:39:54 -0700 Subject: [PATCH 05/30] Fixes #1259. Adding support for tags coming from the config, and freely-added tags. --- Gruntfile.js | 2 + css/less/overrides/qtip.less | 9 +- .../annotations/tinymce-annotation-editor.js | 54 +++++++----- package.json | 1 + .../tinymce-annotation-editor.test.js | 87 +++++++++++++++++-- 5 files changed, 122 insertions(+), 31 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index a3a9c09bfe..49958af1a8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -49,6 +49,7 @@ module.exports = function(grunt) { 'js/lib/sanitize-html.min.js', 'node_modules/iiif-evented-canvas/dist/iiif-evented-canvas.umd.min.js', 'node_modules/iiif-layout-functions/dist/iiif-layout-functions.umd.min.js', + 'node_modules/select2/dist/js/select2.full.min.js' ], // source files @@ -96,6 +97,7 @@ module.exports = function(grunt) { 'css/jquery-ui.min.css', 'css/jquery.qtip.min.css', 'node_modules/spectrum-colorpicker/spectrum.css', + 'node_modules/select2/dist/css/select2.min.css', 'css/mirador.css', 'css/material-icons.css', 'bower_components/simplePagination.js/simplePagination.css' diff --git a/css/less/overrides/qtip.less b/css/less/overrides/qtip.less index 5e24f49161..8983ce5e05 100644 --- a/css/less/overrides/qtip.less +++ b/css/less/overrides/qtip.less @@ -68,7 +68,7 @@ /* background-color: black; */ } - .text-editor, .tags-editor { + .text-editor, .tags-editor, .select2-container { padding: 5px; display: block; margin: 6px 0px 6px 0px; @@ -77,6 +77,13 @@ box-shadow: inset 0 0 7px @gray; resize: vertical; border: 1px solid @gray; + width: 200px; + + .select2-selection--multiple { + border: none; + background-color: inherit; + font-size: 16px; + } } .annotation-display.annotation-tooltip .button-container { diff --git a/js/src/annotations/tinymce-annotation-editor.js b/js/src/annotations/tinymce-annotation-editor.js index 274f56026f..9dfee008b0 100644 --- a/js/src/annotations/tinymce-annotation-editor.js +++ b/js/src/annotations/tinymce-annotation-editor.js @@ -7,7 +7,8 @@ windowId: null, config: { plugins: '', - toolbar: '' + toolbar: '', + tags: [] } }, options); @@ -18,13 +19,13 @@ init: function() { var _this = this; var annoText = "", + selectedTags = [], tags = []; - if (!jQuery.isEmptyObject(_this.annotation)) { if (jQuery.isArray(_this.annotation.resource)) { jQuery.each(_this.annotation.resource, function(index, value) { if (value['@type'] === "oa:Tag") { - tags.push(value.chars); + selectedTags.push(value.chars); } else { annoText = value.chars; } @@ -33,10 +34,17 @@ annoText = _this.annotation.resource.chars; } } + (this.config.tags || []).forEach(function(item) { + if (selectedTags.indexOf(item) < 0) { + tags.push(item); + } + }); + tags = tags.concat(selectedTags); this.editorMarkup = this.editorTemplate({ content: annoText, - tags : tags.join(" "), + selectedTags : selectedTags, + tags: tags, windowId : _this.windowId }); }, @@ -55,6 +63,11 @@ setup: function(editor) { editor.on('init', function(args) { tinymce.execCommand('mceFocus', false, args.target.id); + jQuery('.tags-editor').select2({ + tags: true, + placeholder: "Add tags here..." + // tokenSeparators: [',', ' '] // spaces for backward compatibility + }); }); } }); @@ -65,13 +78,8 @@ }, createAnnotation: function() { - var tagText = this.editorContainer.find('.tags-editor').val(), - resourceText = tinymce.activeEditor.getContent(), - tags = []; - tagText = $.trimString(tagText); - if (tagText) { - tags = tagText.split(/\s+/); - } + var tags = this.editorContainer.find('.tags-editor').val(), + resourceText = tinymce.activeEditor.getContent(); var motivation = [], resource = [], @@ -101,13 +109,8 @@ }, updateAnnotation: function(oaAnno) { - var tagText = this.editorContainer.find('.tags-editor').val(), - resourceText = tinymce.activeEditor.getContent(), - tags = []; - tagText = $.trimString(tagText); - if (tagText) { - tags = tagText.split(/\s+/); - } + var selectedTags = this.editorContainer.find('.tags-editor').val(), + resourceText = tinymce.activeEditor.getContent(); var motivation = [], resource = []; @@ -120,9 +123,9 @@ return value["@type"] !== "oa:Tag"; }); //re-add tagging if we have them - if (tags.length > 0) { + if (selectedTags.length > 0) { oaAnno.motivation.push("oa:tagging"); - jQuery.each(tags, function(index, value) { + jQuery.each(selectedTags, function(index, value) { oaAnno.resource.push({ "@type": "oa:Tag", "chars": value @@ -138,7 +141,16 @@ editorTemplate: $.Handlebars.compile([ '', - '' + '' ].join('')) }; + + // Handlebars helper: Contains + // check if a value is contained in an array + $.Handlebars.registerHelper("ifContains", function( array, value, options ){ + array = ( array instanceof Array ) ? array : [array]; + return (array.indexOf(value) > -1) ? options.fn( this ) : ""; + }); }(Mirador)); diff --git a/package.json b/package.json index 0b1ea4baf9..3e4a566cb9 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "mousetrap": "^1.4.6", "openseadragon": "^2.2.1", "paper": "^0.10.2", + "select2": "^4.0.3", "spectrum-colorpicker": "^1.8.0", "tinymce": "^4.1.7", "urijs": "^1.16.1" diff --git a/spec/annotations/tinymce-annotation-editor.test.js b/spec/annotations/tinymce-annotation-editor.test.js index fe178c2870..e8c8d7105f 100644 --- a/spec/annotations/tinymce-annotation-editor.test.js +++ b/spec/annotations/tinymce-annotation-editor.test.js @@ -49,7 +49,10 @@ describe('TinyMCEAnnotationBodyEditor', function() { this.windowId = '380c9e54-7561-4010-a99f-f132f5dc13fd'; this.tinyMce = new Mirador.TinyMCEAnnotationBodyEditor({ annotation: this.annotation, - windowId: this.windowId + windowId: this.windowId, + config: { + tags: ["config1", "config2"] + } }); subject = this.tinyMce; subject.show('#mycontainer'); @@ -59,12 +62,12 @@ describe('TinyMCEAnnotationBodyEditor', function() { delete this.tinyMce; $('body').html(''); }); - + describe('Initialization', function() { it('should initialize', function() { expect(true).toBe(true); //Force beforeEach() setup to run expect(this.sandbox.find('.text-editor').val()).toEqual('

Waahoo

'); - expect(this.sandbox.find('.tags-editor').val()).toEqual('tagged silly'); + expect(this.sandbox.find('.tags-editor').val()).toEqual(['tagged', 'silly']); }); it('should initialize with legacy annotations', function() { this.annotation.resource = { @@ -80,7 +83,7 @@ describe('TinyMCEAnnotationBodyEditor', function() { expect(this.sandbox.find('.text-editor').val()).toEqual('Old stuff'); }); }); - + describe('isDirty', function() { var dirty; beforeEach(function() { @@ -109,9 +112,36 @@ describe('TinyMCEAnnotationBodyEditor', function() { }) }; }); - it('should create a full annotation', function() { + it('should create a full annotation with tags from config', function() { + this.sandbox.find('.text-editor').val('Sample annotation'); + this.sandbox.find('.tags-editor').val(['config1', 'config2']).trigger('change'); + expect(subject.createAnnotation()).toEqual({ + "@context": "http://iiif.io/api/presentation/2/context.json", + "@type": "oa:Annotation", + "motivation": ['oa:tagging', 'oa:commenting'], + "resource": [ + { + "@type": "oa:Tag", + "chars": "config1" + }, + { + "@type": "oa:Tag", + "chars": "config2" + }, + { + "@type": "dctypes:Text", + "format": "text/html", + "chars": "Sample annotation" + } + ] + }); + }); + + it('should create a full annotation with new tags', function() { this.sandbox.find('.text-editor').val('Sample annotation'); - this.sandbox.find('.tags-editor').val('tag nags'); + this.sandbox.find('.tags-editor').append(''); + this.sandbox.find('.tags-editor').append(''); + this.sandbox.find('.tags-editor').val(['tag', 'nags']).trigger('change'); expect(subject.createAnnotation()).toEqual({ "@context": "http://iiif.io/api/presentation/2/context.json", "@type": "oa:Annotation", @@ -144,7 +174,7 @@ describe('TinyMCEAnnotationBodyEditor', function() { }) }; }); - it('should update the given annotation', function() { + it('should update the given annotation with new tags', function() { var oaAnno = { "@context": "http://iiif.io/api/presentation/2/context.json", "@type": "oa:Annotation", @@ -156,7 +186,9 @@ describe('TinyMCEAnnotationBodyEditor', function() { }] }; this.sandbox.find('.text-editor').val('Sample annotation 2'); - this.sandbox.find('.tags-editor').val('tag2 nags2'); + this.sandbox.find('.tags-editor').append(''); + this.sandbox.find('.tags-editor').append(''); + this.sandbox.find('.tags-editor').val(['tag2', 'nags2']).trigger('change'); subject.updateAnnotation(oaAnno); expect(oaAnno).toEqual({ "@context": "http://iiif.io/api/presentation/2/context.json", @@ -179,5 +211,42 @@ describe('TinyMCEAnnotationBodyEditor', function() { ] }); }); + + it('should update the given annotation with tags from config', function() { + var oaAnno = { + "@context": "http://iiif.io/api/presentation/2/context.json", + "@type": "oa:Annotation", + "motivation": ['oa:commenting'], + "resource": [{ + "@type": "dctypes:Text", + "format": "text/html", + "chars": "Sample annotation" + }] + }; + this.sandbox.find('.text-editor').val('Sample annotation 2'); + this.sandbox.find('.tags-editor').val(['config1', 'config2']).trigger('change'); + subject.updateAnnotation(oaAnno); + expect(oaAnno).toEqual({ + "@context": "http://iiif.io/api/presentation/2/context.json", + "@type": "oa:Annotation", + "motivation": ['oa:commenting', 'oa:tagging'], + "resource": [ + { + "@type": "dctypes:Text", + "format": "text/html", + "chars": "Sample annotation 2" + }, + { + "@type": "oa:Tag", + "chars": "config1" + }, + { + "@type": "oa:Tag", + "chars": "config2" + } + ] + }); + }); + }); -}); +}); From 0f045e689bcf70840d058ef0cd75dd738fb42769 Mon Sep 17 00:00:00 2001 From: Scott Bailey Date: Tue, 30 May 2017 10:32:57 -0700 Subject: [PATCH 06/30] Add a default value for annotation tags --- js/src/settings.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/settings.js b/js/src/settings.js index 7e7e15e216..134c72458c 100644 --- a/js/src/settings.js +++ b/js/src/settings.js @@ -194,11 +194,12 @@ 'options': { config: { plugins: "image link media directionality", - toolbar: "bold italic | bullist numlist | link image media | removeformat | ltr rtl" + toolbar: "bold italic | bullist numlist | link image media | removeformat | ltr rtl", + tags: [] } } }, - + 'jsonStorageEndpoint': { 'name': 'JSONBlob API Endpoint', 'module': 'JSONBlobAPI', From ec8bde2f08fcc7e93849bc9906f857081dfe5ab6 Mon Sep 17 00:00:00 2001 From: Fabio Torchetti Date: Sun, 11 Jun 2017 15:48:07 -0400 Subject: [PATCH 07/30] Cleanup config before saving to local storage --- js/src/utils/saveController.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/js/src/utils/saveController.js b/js/src/utils/saveController.js index 757dbe3d4c..66a9e9defa 100755 --- a/js/src/utils/saveController.js +++ b/js/src/utils/saveController.js @@ -72,6 +72,7 @@ this.init(newConfig); }; + $.SaveController.prototype = { init: function(config) { @@ -372,6 +373,37 @@ }, + cleanup: function(obj) { + + /** + * Setup a Set to track the objects we have + * already cloned - this clean circular refs. + **/ + var clonedSet = new Set(); + + function cloner(obj) { + + if(obj === null || typeof(obj) != 'object') { + return obj; + } + + if (!clonedSet.has(obj)) { + clonedSet.add(obj); + var temp = Array.isArray(obj) ? [] : {}; + for(var key in obj) { + if (obj.hasOwnProperty(key)) { + temp[key] = cloner(obj[key]); + } + } + return temp; + } + + return undefined; + } + + return cloner(obj); + } + save: function() { var _this = this; @@ -379,7 +411,7 @@ // localStorage is a key:value store that // only accepts strings. - localStorage.setItem(_this.sessionID, JSON.stringify(_this.currentConfig)); + localStorage.setItem(_this.sessionID, JSON.stringify(_this.cleanup(_this.currentConfig))); } }; From 600fbc9d598ee53f9637b5a8ca6d57650456c821 Mon Sep 17 00:00:00 2001 From: Fabio Torchetti Date: Sun, 11 Jun 2017 15:58:44 -0400 Subject: [PATCH 08/30] Remove recursion when saving from bookmarkPanel --- js/src/utils/saveController.js | 44 +++++++++++++++++----------------- js/src/viewer/bookmarkPanel.js | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/js/src/utils/saveController.js b/js/src/utils/saveController.js index 66a9e9defa..368ce99041 100755 --- a/js/src/utils/saveController.js +++ b/js/src/utils/saveController.js @@ -373,36 +373,36 @@ }, - cleanup: function(obj) { + cleanup: function(obj) { - /** - * Setup a Set to track the objects we have - * already cloned - this clean circular refs. - **/ - var clonedSet = new Set(); + /** + * Setup a Set to track the objects we have + * already cloned - this clean circular refs. + **/ + var clonedSet = new Set(); - function cloner(obj) { + function cloner(obj) { - if(obj === null || typeof(obj) != 'object') { - return obj; - } + if(obj === null || typeof(obj) != 'object') { + return obj; + } - if (!clonedSet.has(obj)) { - clonedSet.add(obj); - var temp = Array.isArray(obj) ? [] : {}; - for(var key in obj) { - if (obj.hasOwnProperty(key)) { - temp[key] = cloner(obj[key]); + if (!clonedSet.has(obj)) { + clonedSet.add(obj); + var temp = Array.isArray(obj) ? [] : {}; + for(var key in obj) { + if (obj.hasOwnProperty(key)) { + temp[key] = cloner(obj[key]); + } } + return temp; } - return temp; - } - return undefined; - } + return undefined; + } - return cloner(obj); - } + return cloner(obj); + }, save: function() { var _this = this; diff --git a/js/src/viewer/bookmarkPanel.js b/js/src/viewer/bookmarkPanel.js index a14275d4b1..62a19b43d1 100644 --- a/js/src/viewer/bookmarkPanel.js +++ b/js/src/viewer/bookmarkPanel.js @@ -47,7 +47,7 @@ onConfigUpdated: function() { var _this = this; - _this.storageModule.save(_this.state.currentConfig) + _this.storageModule.save(_this.state.cleanup(_this.state.currentConfig)) .then(function(blobId) { var bookmarkURL = window.location.href.replace(window.location.hash, '') + "?json="+blobId; _this.element.find('#share-url').val(bookmarkURL).focus().select(); From b75c1aa5c96bbbd64f49f62d88ed2ff1b570e65a Mon Sep 17 00:00:00 2001 From: Fabio Torchetti Date: Sun, 11 Jun 2017 16:43:30 -0400 Subject: [PATCH 09/30] Added tests for cleanup function --- spec/utils/saveController.test.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/utils/saveController.test.js b/spec/utils/saveController.test.js index ab4acaeaf5..1ef0a79509 100644 --- a/spec/utils/saveController.test.js +++ b/spec/utils/saveController.test.js @@ -123,6 +123,32 @@ describe('SaveController', function () { }); }); + describe('Test Cleaning Up Objects', function () { + it('should remove circular references', function () { + + var saveController = new Mirador.SaveController(this.config); + + var object_a = { valid: 'This is a valid value' }; + var object_b = { valid: 'This is a valid value', invalid: object_a }; + object_a.object_b = object_b; + + var cleaned = saveController.cleanup(object_a); + + /** + * The original object should be untouched. + */ + expect(object_a.object_b.invalid).not.toBeUndefined(); + + /** + * object_a reference in cleaned should be the only + * value missing. + */ + expect(cleaned.valid).toBe('This is a valid value'); + expect(cleaned.object_b.invalid).toBeUndefined(); + expect(cleaned.object_b.valid).toBe('This is a valid value'); + }); + }); + describe('Event handling', function () { xit('should handle windowUpdated', function () { }); From 722a84f45a3b549ded1bd5eae89e4fd3fb633581 Mon Sep 17 00:00:00 2001 From: aeschylus Date: Mon, 19 Jun 2017 11:45:25 -0700 Subject: [PATCH 10/30] replace use of set with array --- js/src/utils/saveController.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/src/utils/saveController.js b/js/src/utils/saveController.js index 368ce99041..395df1161f 100755 --- a/js/src/utils/saveController.js +++ b/js/src/utils/saveController.js @@ -376,10 +376,11 @@ cleanup: function(obj) { /** - * Setup a Set to track the objects we have - * already cloned - this clean circular refs. + * Setup an array-based implementation of a Set + * to track the objects we have + * already cloned - this will generically clean circular refs. **/ - var clonedSet = new Set(); + var clonedSet = []; function cloner(obj) { @@ -387,8 +388,8 @@ return obj; } - if (!clonedSet.has(obj)) { - clonedSet.add(obj); + if (clonedSet.indexOf(obj) === -1) { + clonedSet.push(obj); var temp = Array.isArray(obj) ? [] : {}; for(var key in obj) { if (obj.hasOwnProperty(key)) { From 075c03c3d751fdc57b4b56021e867933f1a04a9e Mon Sep 17 00:00:00 2001 From: aeschylus Date: Mon, 26 Jun 2017 16:59:59 -0700 Subject: [PATCH 11/30] update merged code to use canvasModel for mirroring math, and update test mocks --- js/src/annotations/osd-region-draw-tool.js | 5 ++++- js/src/annotations/osd-svg-overlay.js | 2 +- spec/annotations/osd-svg-overlay.test.js | 4 ---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/js/src/annotations/osd-region-draw-tool.js b/js/src/annotations/osd-region-draw-tool.js index 08ef90c3e8..748385707d 100644 --- a/js/src/annotations/osd-region-draw-tool.js +++ b/js/src/annotations/osd-region-draw-tool.js @@ -157,6 +157,9 @@ showTooltipsFromMousePosition: function(event, location, absoluteLocation) { var _this = this; + var originWindow = this.state.getWindowObjectById(this.windowId); + var currentCanvasModel = originWindow.canvases[originWindow.canvasID]; + var hitOptions = { fill: true, stroke: true, @@ -165,7 +168,7 @@ var hoverColor = this.state.getStateProperty('drawingToolsSettings').hoverColor; var annotations = []; if (this.horizontallyFlipped) { - location.x = this.svgOverlay.viewer.tileSources.width - location.x; + location.x = currentCanvasModel.getBounds().width; } for (var key in _this.annotationsToShapesMap) { if (_this.annotationsToShapesMap.hasOwnProperty(key)) { diff --git a/js/src/annotations/osd-svg-overlay.js b/js/src/annotations/osd-svg-overlay.js index 8e05c6aa17..336d48e460 100644 --- a/js/src/annotations/osd-svg-overlay.js +++ b/js/src/annotations/osd-svg-overlay.js @@ -493,7 +493,7 @@ mousePosition.y = currentCanvasModel.getBounds().height; } if (this.horizontallyFlipped) { - mousePosition.x = this.viewer.tileSources.width - mousePosition.x; + mousePosition.x = currentCanvasModel.getBounds().width - mousePosition.x; } return mousePosition; }, diff --git a/spec/annotations/osd-svg-overlay.test.js b/spec/annotations/osd-svg-overlay.test.js index 1e8c61ebc2..38d60f99bd 100644 --- a/spec/annotations/osd-svg-overlay.test.js +++ b/spec/annotations/osd-svg-overlay.test.js @@ -370,10 +370,6 @@ describe('Overlay', function() { this.rectangle = new Mirador.Rectangle(); // TODO should use stubbed tool spyOn(this.rectangle, 'onMouseDown'); spyOn(this.rectangle, 'onDoubleClick'); - this.overlay.viewer.tileSources = { - 'width': 998, - 'height': 998 - } var event = getEvent({ 'x': 100, 'y': 100 From 37ed7f5d1b0788dfe46019d190dc716837f9be92 Mon Sep 17 00:00:00 2001 From: aeschylus Date: Tue, 27 Jun 2017 10:31:52 -0700 Subject: [PATCH 12/30] add back reflection offset for tooltip positioning --- js/src/annotations/osd-region-draw-tool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/annotations/osd-region-draw-tool.js b/js/src/annotations/osd-region-draw-tool.js index 748385707d..a86f1033f6 100644 --- a/js/src/annotations/osd-region-draw-tool.js +++ b/js/src/annotations/osd-region-draw-tool.js @@ -168,7 +168,7 @@ var hoverColor = this.state.getStateProperty('drawingToolsSettings').hoverColor; var annotations = []; if (this.horizontallyFlipped) { - location.x = currentCanvasModel.getBounds().width; + location.x = currentCanvasModel.getBounds().width - location.x; } for (var key in _this.annotationsToShapesMap) { if (_this.annotationsToShapesMap.hasOwnProperty(key)) { From 96fa9a85dee6ced1f97824da611dba1285f9d8a8 Mon Sep 17 00:00:00 2001 From: aeschylus Date: Tue, 27 Jun 2017 15:06:03 -0700 Subject: [PATCH 13/30] increment version number for 2.5.1 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e4a566cb9..7f13077137 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirador", - "version": "2.5.0", + "version": "2.5.1", "description": "Multi-window image viewer, a web-based tool to support researcher goals", "repository": { "type": "git", From 79685650966c384c12b38b220f68d72881715dcb Mon Sep 17 00:00:00 2001 From: Matthias Lindinger Date: Mon, 10 Jul 2017 09:59:07 +0200 Subject: [PATCH 14/30] Fix testcase --- spec/utils/jsonLd.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/utils/jsonLd.test.js b/spec/utils/jsonLd.test.js index 785c5d925c..a030e91313 100644 --- a/spec/utils/jsonLd.test.js +++ b/spec/utils/jsonLd.test.js @@ -5,13 +5,13 @@ describe('JsonLd', function () { expect(Mirador.JsonLd.getTextValue(null, 'txg')).toEqual(''); expect(Mirador.JsonLd.getTextValue(null)).toEqual(''); }); - + it('should return the same string when given a string', function() { expect(Mirador.JsonLd.getTextValue('waahoo', 'en')).toEqual('waahoo'); expect(Mirador.JsonLd.getTextValue('waahoo', 'xto')).toEqual('waahoo'); expect(Mirador.JsonLd.getTextValue('waahoo')).toEqual('waahoo'); }); - + it('should return the localized name when given an array of translations', function() { // Short sample var sample = [ @@ -32,7 +32,7 @@ describe('JsonLd', function () { //Should default to en expect(Mirador.JsonLd.getTextValue(sample)).toEqual("Alternate Title"); }); - + it('should return "@value" key when given an object', function() { var sample = { "@value": "Super waahoo", @@ -58,7 +58,7 @@ describe('JsonLd', function () { 'This is another value without a language.', {'@value': "C'est une valeur française.", '@language': "fr"}]; - window.navigator.languages = ['en-US', 'en'] + i18next.languages = ['en-US', 'en'] expect(Mirador.JsonLd.getTextValue(sample)).toEqual("This is an American value."); }); From caf3b0a54515ec85d6af3f854ef727d2eeacc0f2 Mon Sep 17 00:00:00 2001 From: regisrob Date: Tue, 18 Jul 2017 10:59:02 +0200 Subject: [PATCH 15/30] Small css improvements into metadata panel --- css/less/panels/metadata-view.less | 9 ++++++--- css/less/window.less | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/css/less/panels/metadata-view.less b/css/less/panels/metadata-view.less index 3b8ce22c8e..c9a71fe69e 100644 --- a/css/less/panels/metadata-view.less +++ b/css/less/panels/metadata-view.less @@ -1,10 +1,12 @@ .mirador-container { .mirador-viewer .sub-title { border-bottom: 2px solid @gray-cc; - color: @gray-66; + color: @black; font-weight: bold; margin: 10px 20px 5px 20px; padding: 0 5px 5px 0; + font-size: 120%; + text-transform: uppercase; } .mirador-viewer .metadata-listing { @@ -15,7 +17,7 @@ } .mirador-viewer .metadata-item { - padding: 5px 0; + padding: 10px 0 5px 0; } .mirador-viewer .metadata-label, .mirador-viewer .metadata-value { @@ -23,8 +25,9 @@ } .mirador-viewer .metadata-label { - color: @gray-55; + color: @gray-66; font-style: italic; + text-transform: uppercase; } .mirador-viewer .metadata-value { diff --git a/css/less/window.less b/css/less/window.less index 8b8a91a5b2..0c127491de 100644 --- a/css/less/window.less +++ b/css/less/window.less @@ -56,6 +56,7 @@ overflow-y: scroll; height: 80%; word-wrap: break-word; + font-size: 90%; } .thumbnail-view, .image-view, .book-view, .scroll-view { From 83a9edaaefec99cce6eea91a8178e9395205629b Mon Sep 17 00:00:00 2001 From: regisrob Date: Tue, 18 Jul 2017 18:42:15 +0200 Subject: [PATCH 16/30] Enhance styles in the side panel --- css/less/global.less | 23 ++++++ css/less/main.less | 1 + css/less/panels/layers-tab.less | 3 +- css/less/panels/manifest-select-menu.less | 9 --- css/less/panels/metadata-view.less | 4 +- css/less/panels/side-panel.less | 87 ++++++++++------------- js/src/widgets/searchWithinResults.js | 10 ++- 7 files changed, 70 insertions(+), 67 deletions(-) diff --git a/css/less/global.less b/css/less/global.less index 504ba63aba..399818cd09 100644 --- a/css/less/global.less +++ b/css/less/global.less @@ -157,4 +157,27 @@ /*color: @gray-91;*/ box-sizing: border-box; } + + input[type="submit"], + input[type="text"] { + height:25px; + border:1px solid @light-gray; + transition: border-color 0.3s ease-out; + } + + input:focus { + outline: none; + border-color: @deep-sky-blue; + } + + input[type="submit"] { + color: gray; + background: @white; + } + + input[type="submit"]:hover { + outline: none; + border-color: @deep-sky-blue; + color: @black-33; + } } diff --git a/css/less/main.less b/css/less/main.less index 7d1611e717..8b17ca5a64 100644 --- a/css/less/main.less +++ b/css/less/main.less @@ -24,3 +24,4 @@ @import 'panels/metadata-view'; @import 'panels/bottom-panel'; @import 'panels/layers-tab'; +@import 'panels/search-tab'; diff --git a/css/less/panels/layers-tab.less b/css/less/panels/layers-tab.less index 1d469b479a..0ea9dbb3dc 100644 --- a/css/less/panels/layers-tab.less +++ b/css/less/panels/layers-tab.less @@ -19,8 +19,7 @@ } .layers-list-item { .clearfix(); - border-top: 1px solid gray; - border-bottom: 1px solid gray; + border-top: 1px solid @gray-b1; padding: 10px 10px 10px 0; margin-right: 20px; &>h4 { diff --git a/css/less/panels/manifest-select-menu.less b/css/less/panels/manifest-select-menu.less index cf7e0833dc..6c5710a1f3 100644 --- a/css/less/panels/manifest-select-menu.less +++ b/css/less/panels/manifest-select-menu.less @@ -247,15 +247,6 @@ display: table; clear: both; } - - input { - height:25px; - border:1px solid @light-gray; - color: gray; - background:none; - border-radius: 2px; - transition: border-color 0.3s ease-out; - } } #manifest-search-form { diff --git a/css/less/panels/metadata-view.less b/css/less/panels/metadata-view.less index c9a71fe69e..7da12b1a9b 100644 --- a/css/less/panels/metadata-view.less +++ b/css/less/panels/metadata-view.less @@ -1,7 +1,7 @@ .mirador-container { .mirador-viewer .sub-title { - border-bottom: 2px solid @gray-cc; - color: @black; + border-bottom: 1px solid @gray-b1; + color: @black-33; font-weight: bold; margin: 10px 20px 5px 20px; padding: 0 5px 5px 0; diff --git a/css/less/panels/side-panel.less b/css/less/panels/side-panel.less index c1d3d071d3..7d278ef633 100644 --- a/css/less/panels/side-panel.less +++ b/css/less/panels/side-panel.less @@ -22,25 +22,30 @@ } .tab { - padding: 4px 6px; - border-left:0; - border-bottom: 2px solid @black; + padding: 8px; + margin-right: 2px; display: inline-block; cursor: pointer; - border-radius: 3px 3px 0 0; + background: @gray-dd; + border-width: 1px 1px 0 1px; + border-color: @gray-b1; + border-style: solid; + color: @gray-66; + font-size: .9em; } - + .tab:not(.selected):hover { - border: 2px solid @black-a30; - border-bottom: 2px solid @black; - padding:4px 4px; + background: @light-gray; + color: @black-33; } .tab.selected { - border: 2px solid @black; - border-bottom:0; - border-radius: 3px 3px 0 0; - margin: 0 -2px; + font-weight: bold; + color: @black-33; + background: @gray-ef; + border-top-width: 1px; + border-top-style: solid; + border-top-color: deepskyblue; } .annotationListItem { @@ -78,6 +83,18 @@ text-decoration: none; } + h2 { + font-size: 1em; + } + + h3 { + font-size: .9em; + } + + h4 { + font-size: .8em; + } + h1, h2, h3, h4 { margin:0; padding:0; @@ -86,21 +103,6 @@ h1:hover, h2:hover, h3:hover, h4:hover { } - - /* - h2 { - font-size: 1.5em; - } - h3 { - font-size: 1.25em; - } - h4 { - font-size: 1.0em; - } - h5 { - font-size: .75em; - } - */ } .sidePanel.minimized { @@ -120,6 +122,7 @@ box-sizing: border-box; overflow: hidden; transition: all 0.3s ease; + margin-top: 8px; } .annotationsPanel ul { @@ -127,23 +130,6 @@ margin:0; } - .search-results { - padding:0 5px 0 0; - margin:0; - position:absolute; - height: 100%; - - .search-results-container { - overflow-y: scroll; - position: absolute; - height: 70%; - } - - .search-results-list .result-wrapper .result-paragraph .highlight { - background-color: rgb(255, 255, 0); - } - } - .toc { margin:0; overflow-y: scroll; @@ -155,7 +141,7 @@ top:0px; bottom:0; list-style-type:none; - font-size: 75%; + margin-bottom: 30px; /* fix overflow-y bug when .tabGroup is present */ a.toc-link { color: black; @@ -186,6 +172,7 @@ position:relative; margin-left:8px; margin-bottom: 5px; + border-left: 4px solid @gray-ef; &.open { } @@ -197,6 +184,10 @@ transition: all 0.2s ease-out; } } + + > li { + margin-left: 0; + } } .toc-link i { @@ -273,9 +264,9 @@ color:black; } - .toc li:hover>h2 a.toc-link, .toc li:hover>h3 a.toc-link, .toc li:hover>h4 a.toc-link, .toc li:hover>h5 a.toc-link, .toc li:hover>h6 a.toc-link { - font-weight: bold; - } + // .toc li:hover>h2 a.toc-link, .toc li:hover>h3 a.toc-link, .toc li:hover>h4 a.toc-link, .toc li:hover>h5 a.toc-link, .toc li:hover>h6 a.toc-link { + // font-weight: bold; + // } /* .toc li:hover > h2 a { diff --git a/js/src/widgets/searchWithinResults.js b/js/src/widgets/searchWithinResults.js index 6768db46d6..7b5be56a3d 100644 --- a/js/src/widgets/searchWithinResults.js +++ b/js/src/widgets/searchWithinResults.js @@ -37,7 +37,7 @@ $.SearchWithinResults.prototype = { jQuery(this.appendTo).empty(); this.element = jQuery(this.template()).appendTo(this.appendTo); - jQuery("

Search results for: " + this.query_params.q + "


") + jQuery("

Search results for: " + this.query_params.q + "

") .appendTo(this.appendTo.find('.search-results-messages')); this.doSearchFromQuery(this.query_params); }, @@ -83,11 +83,11 @@ $.SearchWithinResults.prototype = { // show results list _this.processResults(searchResults); } else { - jQuery('.search-results-count').html("

No results


"); + jQuery('.search-results-count').html("

No results

"); } }) .fail(function() { - jQuery('.search-results-count').html("

No results


"); + jQuery('.search-results-count').html("

No results

"); }) .always(); }, @@ -112,7 +112,7 @@ $.SearchWithinResults.prototype = { endResultNumber = searchResults.startIndex + 1; } - jQuery('.search-results-count').html("

Showing " + startResultNumber + " - " + endResultNumber + " out of " + total + "


"); + jQuery('.search-results-count').html("

Showing " + startResultNumber + " - " + endResultNumber + " out of " + total + "

"); }, processResults: function(searchResults) { @@ -437,14 +437,12 @@ $.SearchWithinResults.prototype = { '{{canvaslabel}}', '', '{{#if annotations}}', - '
', 'Annotations: ', '{{#each annotations}}', '', '', '', '{{/each}}', - '
', '{{/if}}', '
', '{{#if hit.before}}', From d18ef391c654afc440aa631c0e2bd7af6c12288c Mon Sep 17 00:00:00 2001 From: regisrob Date: Tue, 18 Jul 2017 18:47:47 +0200 Subject: [PATCH 17/30] Add new translatable strings in the side panel Update english and french locales --- js/src/widgets/searchTab.js | 7 +++---- js/src/widgets/sidePanel.js | 6 +++--- locales/en/translation.json | 6 ++++++ locales/fr/translation.json | 18 +++++++++++++++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/js/src/widgets/searchTab.js b/js/src/widgets/searchTab.js index 24723e68d0..4c178e9dee 100644 --- a/js/src/widgets/searchTab.js +++ b/js/src/widgets/searchTab.js @@ -159,15 +159,14 @@ template: $.Handlebars.compile([ '
', '{{#if searchService}}', - '', '
', - '', + '', '', @@ -181,7 +180,7 @@ '
', '
', '{{else}}', - 'No search service available', + '{{t "searchNotAvailable"}}', '{{/if}}', '
', ].join('')) diff --git a/js/src/widgets/sidePanel.js b/js/src/widgets/sidePanel.js index 10abe9046b..6fd92ed7a1 100644 --- a/js/src/widgets/sidePanel.js +++ b/js/src/widgets/sidePanel.js @@ -29,7 +29,7 @@ options : { available: _this.tocTabAvailable, id:'tocTab', - label:'Index' + label: i18next.t('tabTitleIndex') } }, /*{ @@ -45,7 +45,7 @@ options : { available: _this.searchTabAvailable, id: 'searchTab', - label: 'Search' + label: i18next.t('tabTitleSearch') } }, { @@ -53,7 +53,7 @@ options : { available: _this.layersTabAvailable, id:'layersTab', - label:'Layers' + label: i18next.t('tabTitleLayers') } }, ], diff --git a/locales/en/translation.json b/locales/en/translation.json index 3eb4b1c76d..9eba6af16d 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -78,10 +78,16 @@ "saturationTooltip": "Adjust saturation", "save": "Save", "scrollView": "Scroll View", + "searchLabelSelect": "Select Search Service", + "searchNotAvailable": "No search service available", + "searchText": "Search text", "seeAlso": "See Also", "selectGrid": "Select a grid below", "sidePanelTooltip": "Toggle the side panel", "solid": "Solid", + "tabTitleIndex": "Index", + "tabTitleLayers": "Layers", + "tabTitleSearch": "Search", "thick": "Thick", "thickest": "Thickest", "thumbnailsView": "Gallery View", diff --git a/locales/fr/translation.json b/locales/fr/translation.json index 05f9029ba5..5619c8db40 100644 --- a/locales/fr/translation.json +++ b/locales/fr/translation.json @@ -11,7 +11,7 @@ "bookmark": "Sauvegarder / Partager", "bookmarkTitle": "Sauvegarder ou partager cet espace de travail Mirador", "bookmarkTooltip": "Obtenir le lien vers cet espace de travail Mirador", - "bookView": "Double page", + "bookView": "Vue livre", "borderColorTooltip": "Choisir la couleur de bordure", "borderTypeTooltip": "Choisir le style de bordure", "brightnessTooltip": "Luminosité", @@ -29,6 +29,8 @@ "deleteShape":"Voulez-vous supprimer cette forme", "description": "Description", "details": "Détails", + "disabledLayersTabMessage": "Les calques d'image ne sont accessibles que depuis la vue image", + "disabledOpacityMessage": "désactivé", "dotDashed":"Pointillés et traits", "dropToLoad": "Déposer ici pour ajouter l'objet", "edit": "Editer", @@ -36,6 +38,7 @@ "editModalBtnSaveWithoutShapes":"Enregistrer l'annotation sans aucune forme associée ?", "editModalSaveAnnotationWithNoShapesMsg":"Aucune forme n'est associée à cette annotation.", "ellipseTooltip": "Ovale", + "emptyTemplateMessage": "Il n'y a pas de calques d'image sur ce canevas", "fillColorTooltip": "Choisir une couleur de remplissage", "filterObjects": "Filtrer la liste", "freehandTooltip": "Tracé libre", @@ -44,7 +47,8 @@ "fullScreenWindowTooltip": "Ouvrir cette fenêtre en plein écran", "grayscaleTooltip": "Niveaux de gris", "imageManipulationTooltip": "Modifier les réglages de l'image", - "imageView": "Simple page", + "imagesFor": "Images pour", + "imageView": "Vue image", "invertTooltip": "Couleurs inversées", "item": "objet", "items": "objets", @@ -58,8 +62,9 @@ "more": "restants", "newObject": "Nouvel objet", "no": "Non", - "noIndex": "Pas de sommaire disponible", + "noIndex": "Aucun index disponible", "objectMetadata": "Métadonnées", + "opacityLabel": "opacité", "pinTooltip": "Marqueur", "pointerTooltip": "Pointeur", "polygonTooltip": "Polygone", @@ -73,16 +78,23 @@ "saturationTooltip": "Saturation", "save": "Enregistrer", "scrollView": "Défilement horizontal", + "searchLabelSelect": "Choisir le service", + "searchNotAvailable": "Aucun service de recherche disponible", + "searchText": "Rechercher", "seeAlso": "Voir aussi", "selectGrid": "Sélectionner la grille de votre choix", "sidePanelTooltip": "Ouvrir le panneau latéral", "solid":"Ligne continue", + "tabTitleIndex": "Index", + "tabTitleLayers": "Calques", + "tabTitleSearch": "Rechercher", "thick": "Epais", "thickest": "Plus épais", "thumbnailsView": "Mosaïque", "unspecified": "Non spécifié", "url": "URL", "viewTypeTooltip": "Changer le type de vue", + "visibleLabel": "visible", "within": "Fait partie de", "yes": "Oui" } From 2fc9efe10a66b97d1319b41ee5a6350662712f8e Mon Sep 17 00:00:00 2001 From: regisrob Date: Wed, 19 Jul 2017 09:00:26 +0200 Subject: [PATCH 18/30] Add new less file for search tab --- css/less/panels/search-tab.less | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 css/less/panels/search-tab.less diff --git a/css/less/panels/search-tab.less b/css/less/panels/search-tab.less new file mode 100644 index 0000000000..5fc6f36c17 --- /dev/null +++ b/css/less/panels/search-tab.less @@ -0,0 +1,44 @@ +.mirador-container { + + .search-results { + padding:0 5px 0 0; + margin:0; + position:absolute; + height: 100%; + + select { + margin: 5px 0 10px 0; + } + } + + .search-results-list { + position: relative; + height: 100%; + + .search-results-messages { + border-top: 1px solid @gray-b1; + padding-top: 10px; + margin-top: 10px; + } + + .search-results-count { + font-size: .85em; + } + + .search-results-container { + overflow-y: scroll; + position: absolute; + height: 70%; + } + + .result-wrapper { + margin-bottom: 5px; + + .result-paragraph { + .highlight { + background-color: rgb(255, 255, 0); + } + } + } + } +} \ No newline at end of file From 1345e405874f678a6739bce273215d711da0dc80 Mon Sep 17 00:00:00 2001 From: regisrob Date: Wed, 19 Jul 2017 09:21:31 +0200 Subject: [PATCH 19/30] Add manifest url in metadata view --- js/src/widgets/metadataView.js | 4 ++++ locales/en/translation.json | 1 + locales/fr/translation.json | 1 + 3 files changed, 6 insertions(+) diff --git a/js/src/widgets/metadataView.js b/js/src/widgets/metadataView.js index 06e2508eee..9c71f9ba6c 100755 --- a/js/src/widgets/metadataView.js +++ b/js/src/widgets/metadataView.js @@ -173,6 +173,10 @@ identifier: 'seeAlso', label: i18next.t('seeAlso'), value: this.stringifyRelated(jsonLd.seeAlso || '') + }, { + identifier: 'manifest', + label: i18next.t('manifest'), + value: this.stringifyRelated(jsonLd['@id'] || '') }, { identifier: 'within', label: i18next.t('within'), diff --git a/locales/en/translation.json b/locales/en/translation.json index 3eb4b1c76d..796f93c85a 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -57,6 +57,7 @@ "links": "Links", "load": "Load", "logo": "Logo", + "manifest": "IIIF Manifest", "metadataTooltip": "View information/metadata about this object", "mirrorTooltip": "Mirror image", "more": "more", diff --git a/locales/fr/translation.json b/locales/fr/translation.json index 05f9029ba5..19edb53450 100644 --- a/locales/fr/translation.json +++ b/locales/fr/translation.json @@ -53,6 +53,7 @@ "links": "Liens", "load": "Ajouter", "logo": "Logo", + "manifest": "Manifest IIIF", "metadataTooltip": "Afficher les informations/métadonnées", "mirrorTooltip": "Retourner l'image (axe horizontal)", "more": "restants", From 83cca8577f4bd7f3372f2b32b976773c153822da Mon Sep 17 00:00:00 2001 From: Rashmi Singhal Date: Fri, 28 Jul 2017 13:06:48 -0400 Subject: [PATCH 20/30] fix tests so they pass --- spec/widgets/metadataView.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/widgets/metadataView.test.js b/spec/widgets/metadataView.test.js index 91c0836317..585c0d4409 100644 --- a/spec/widgets/metadataView.test.js +++ b/spec/widgets/metadataView.test.js @@ -9,7 +9,7 @@ describe('MetadataView', function() { $('body').append('
'); this.sandbox = jQuery('#metadata-view-container'); this.windowId = '380c9e54-7561-4010-a99f-f132f5dc13fd'; - this.canvasID = 'https://oculus-dev.harvardx.harvard.edu/manifests/drs:5981093/canvas/canvas-5981522.json'; + this.canvasID = 'https://iiif.lib.harvard.edu/manifests/drs:5981093/canvas/canvas-5981522.json'; this.metadataView = new Mirador.MetadataView({ manifest: this.manifest, appendTo: this.sandbox, @@ -119,10 +119,12 @@ describe('MetadataView', function() { expect(subject.getMetadataLinks({ related: "http://news.example.net", seeAlso: "http://oodlepods.example.net", + '@id': "http://www.example.org/iiif/book1/manifest", within: "Oodlepods Monthly Issue #6" })).toEqual([ { identifier: 'related', label: 'related', value: 'http://news.example.net' }, { identifier: 'seeAlso', label: 'seeAlso', value: 'http://oodlepods.example.net' }, + { identifier: 'manifest', label: 'manifest', value: 'http://www.example.org/iiif/book1/manifest'}, { identifier: 'within', label: 'within', value: 'Oodlepods Monthly Issue #6' } ]); }); @@ -130,6 +132,7 @@ describe('MetadataView', function() { expect(subject.getMetadataLinks(this.manifest.jsonLd)).toEqual([ { identifier: 'related', label: 'related', value: '' }, { identifier: 'seeAlso', label: 'seeAlso', value: '' }, + { identifier: 'manifest', label: 'manifest', value: 'http://www.example.org/iiif/book1/manifest'}, { identifier: 'within', label: 'within', value: '' } ]); }); From 7b33d30bc697c1b93d417c0a2efae04a14c93292 Mon Sep 17 00:00:00 2001 From: Rashmi Singhal Date: Fri, 28 Jul 2017 13:36:52 -0400 Subject: [PATCH 21/30] add specific test for checking manifest id --- spec/widgets/metadataView.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/widgets/metadataView.test.js b/spec/widgets/metadataView.test.js index 585c0d4409..8cbe9d2a5f 100644 --- a/spec/widgets/metadataView.test.js +++ b/spec/widgets/metadataView.test.js @@ -115,6 +115,9 @@ describe('MetadataView', function() { }); describe('getMetadataLinks', function() { + it('should always display the manifest id', function() { + expect(subject.getMetadataLinks(this.manifest.jsonLd)[2].value).toContain('http://www.example.org/iiif/book1/manifest'); + }); it('should grab metadata links when present', function() { expect(subject.getMetadataLinks({ related: "http://news.example.net", From fdc706ef811c3ae69813c220a285ef90ae4dbcca Mon Sep 17 00:00:00 2001 From: knagasaki Date: Tue, 1 Aug 2017 18:15:55 +0900 Subject: [PATCH 22/30] Initial Commit --- css/less/views/gallery-view.less | 5 +++++ css/less/workspace.less | 4 ++++ index.html | 4 ++-- js/src/manifests/manifest.js | 4 ++++ js/src/widgets/bookView.js | 4 ++++ js/src/widgets/imageView.js | 8 ++++++-- js/src/widgets/scrollView.js | 4 ++++ js/src/widgets/thumbnailsView.js | 14 ++++++++++++- js/src/workspaces/window.js | 35 ++++++++++++++++++++++++++++++-- 9 files changed, 75 insertions(+), 7 deletions(-) diff --git a/css/less/views/gallery-view.less b/css/less/views/gallery-view.less index a5ea245383..cb1a26aeda 100644 --- a/css/less/views/gallery-view.less +++ b/css/less/views/gallery-view.less @@ -92,4 +92,9 @@ .hud-control .ui-slider-range { background: @deep-sky-blue; } + + .thumbnail-rtl{ + float: right !important; + } + } diff --git a/css/less/workspace.less b/css/less/workspace.less index 50b4499077..63ec968226 100644 --- a/css/less/workspace.less +++ b/css/less/workspace.less @@ -99,4 +99,8 @@ left: 0; display: none; } + + .v-direction-rtl { + direction: rtl; + } } diff --git a/index.html b/index.html index 8d9839d8bd..455ea0d1dd 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + Mirador Viewer