add comments
[fnpeditor.git] / src / editor / views / attachments / attachments.js
index 258a143..31d8095 100644 (file)
@@ -28,22 +28,26 @@ var attachmentLibrary = function(callback, params) {
         dataType: 'json',
         success: function(data, status, jqxhr) {
             for (var i in data) {
         dataType: 'json',
         success: function(data, status, jqxhr) {
             for (var i in data) {
-                var img = $("<img style='margin-right: 1em'>")
+                var img = $("<img style='margin-right: 1em'>");
+                var input = $("<input type='radio' name='attachment'>");
+                var label = $("<label/>");
                 var div = $("<div style='border: 1px solid white'/>");
                 var div = $("<div style='border: 1px solid white'/>");
-                div.append(img);
-                div.append(data[i]['name'])
+                label.append(input);
+                label.append(img);
+                label.append(data[i]['name']);
                 img.attr("src", data[i]['thumbnail_url']);
                 img.attr("title", data[i]['name']);
                 img.attr("src", data[i]['thumbnail_url']);
                 img.attr("title", data[i]['name']);
+                input.attr('id', 'attachment' + i);
+                label.attr('for', 'attachment' + i);
+                div.append(label);
                 div.attr("data-output", 'file://' + data[i]['name']);
                 div.on('click', function() {
                 div.attr("data-output", 'file://' + data[i]['name']);
                 div.on('click', function() {
-                    $("div", body).attr('style', 'border: 1px solid white');
-                    $("div", body).removeClass('active');
-                    $(this).attr('style', 'border: 1px solid black');
+                    $("div.active", body).removeClass('active');
                     $(this).addClass('active');
                 });
                 body.append(div);
             }
                     $(this).addClass('active');
                 });
                 body.append(div);
             }
-            var editlink = $("<a target='_blank'>Manage attachments</a>");
+            var editlink = $("<a target='_blank'>" + gettext("Manage attachments") + "</a>");
             editlink.attr('href', config.documentGalleryUrl);
             body.append(editlink);
         },
             editlink.attr('href', config.documentGalleryUrl);
             body.append(editlink);
         },