From efa5ac15621e79b2f6b83b0d77f50b5c44f2df50 Mon Sep 17 00:00:00 2001 From: Arvind Date: Tue, 9 Sep 2014 19:17:51 +0530 Subject: [PATCH] Show the annotations of a image in the linked-data area, under the gallery view. --- swtr/static/js/main.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/swtr/static/js/main.js b/swtr/static/js/main.js index c9679f3..234eeab 100644 --- a/swtr/static/js/main.js +++ b/swtr/static/js/main.js @@ -786,8 +786,12 @@ var GalleryView = Backbone.View.extend({ el: $("#gallery"), + events: { + "click img":"onImgClick" + }, initialize: function() { this.template = _.template($("#gallery-item-template").html()); + this.cover_template = _.template($("#ocd-item-cover-template").html()); this.render(); }, render: function() { @@ -807,6 +811,20 @@ } $(this.el).html(''); + }, + onImgClick: function(e){ + var swts = swtr.LDs.filter(function(k) { + if(k.get('where') == $(e.currentTarget).attr('src')) { + return k; + } + }); + anno.makeAnnotatable($(e.currentTarget)[0]); + _.each(swts, function(swt) { + var anno_obj = swt.get('how'); + anno_obj['editable'] = false; + anno.addAnnotation(anno_obj); + }); + this.$(".annotorious-item-unfocus").css("opacity", '0.6'); } }); -- 1.7.10.4