mockup/master: Merge branch 'master' into theme-filemanager-searching-featu

GitHub <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: mockup
Branch: refs/heads/master
Date: 2017-06-19T08:59:18-05:00
Author: Oshane Bailey (b4oshany) <[email protected]>
Commit: https://github.com/plone/mockup/commit/2ce3819e1a6eccbd88a5fc759c2d329c995ed034

Merge branch 'master' into theme-filemanager-searching-feature

Files changed:
M CHANGES.rst
M mockup/patterns/formunloadalert/pattern.js
M mockup/patterns/modal/pattern.js
M mockup/patterns/structure/js/views/tablerow.js
M mockup/patterns/structure/templates/tablerow.xml
M mockup/patterns/upload/pattern.js
M mockup/tests/pattern-structure-test.js

diff --git a/CHANGES.rst b/CHANGES.rst
index f42f4217..71ff57df 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,10 +14,8 @@ New features:
  - Search for text within files and opening the file upon click.
  - Added Bootstrap Dropdown menu to the UI views.
  - Added Anchor (a) tag to the UI views.
- 
- - make thumb size in folder contents listing adjustable/supressable
-   replace meaningless paper clip icon (fontello) with mime type icons
-   from mimetype registry
+ - Make thumb scale in folder contents listing adjustable/supressable.
+   Replace meaningless paper clip icon (fontello) with mime type icons from mimetype registry.
    https://github.com/plone/Products.CMFPlone/issues/1734
    [fgrcon]
 
@@ -56,6 +54,22 @@ New features:
 
 Bug fixes:
 
+- Upload pattern: Fix missing plone.protect authenticator token which led to broken uploads.
+  [thet]
+
+- fixed css-classes for thumb scales ...
+  https://github.com/plone/Products.CMFPlone/issues/2077
+  [fgrcon]
+
+- modal: Fixed duplicate window.confirm on form unload.
+  Fixes `issue 777 <https://github.com/plone/mockup/issues/777>`_.
+  [seanupton]
+
+- formunloadalert: Fixed incorrect use of Function.prototype.apply,
+  when call() was seemingly intended; fixes case where modal close leads to
+  exception.  Fixes `issue 776 <https://github.com/plone/mockup/issues/776>`_.
+  [seanupton]
+
 - In the insert link/image modal, pass use the correct related items widget options from the ``linkModal`` attribute.
   [thet]
 
diff --git a/mockup/patterns/formunloadalert/pattern.js b/mockup/patterns/formunloadalert/pattern.js
index 1988efaa..f79d3992 100644
--- a/mockup/patterns/formunloadalert/pattern.js
+++ b/mockup/patterns/formunloadalert/pattern.js
@@ -65,7 +65,7 @@ define([
         $modal.data('patternPloneModal').on('hide', function(e) {
           var modal = $modal.data('patternPloneModal');
           if (modal) {
-            modal._suppressHide = self._handleUnload.apply(self, e);
+            modal._suppressHide = self._handleUnload.call(self, e);
           }
         });
       } else {
diff --git a/mockup/patterns/modal/pattern.js b/mockup/patterns/modal/pattern.js
index 21673a4f..c3dbadea 100644
--- a/mockup/patterns/modal/pattern.js
+++ b/mockup/patterns/modal/pattern.js
@@ -872,6 +872,7 @@ define([
       }
       self.$wrapper.remove();
       if ($('.plone-modal', $('body')).size() < 1) {
+        self._suppressHide = undefined;
         self.backdrop.hide();
         $('body').removeClass('plone-modal-open');
         $(window.parent).off('resize.plone-modal.patterns');
diff --git a/mockup/patterns/structure/js/views/tablerow.js b/mockup/patterns/structure/js/views/tablerow.js
index 8f91671d..61f53551 100644
--- a/mockup/patterns/structure/js/views/tablerow.js
+++ b/mockup/patterns/structure/js/views/tablerow.js
@@ -57,7 +57,7 @@ define([
       data.portal_type = data.portal_type ? data.portal_type : '';
       data.contenttype = data.portal_type.toLowerCase().replace(/\.| /g, '-');
       data._authenticator = utils.getAuthenticator();
-      data.thumbSize = self.app.thumbSize;
+      data.thumb_scale = self.app.thumb_scale;
 
       var viewAction = self.app.typeToViewAction && self.app.typeToViewAction[data.attributes.portal_type] || '';
       data.viewURL = data.attributes.getURL + viewAction;
diff --git a/mockup/patterns/structure/templates/tablerow.xml b/mockup/patterns/structure/templates/tablerow.xml
index fb0f181a..cffb48d5 100644
--- a/mockup/patterns/structure/templates/tablerow.xml
+++ b/mockup/patterns/structure/templates/tablerow.xml
@@ -27,8 +27,8 @@
     </p>
     <% } %>
   </div>
-  <% if(attributes["getIcon"] && ( thumbSize != 'none') ){ %>
-    <img class="image-<%- thumbSize %> pull-right" src="<%- getURL %>/@@images/image/<%- thumbSize %>">
+  <% if(attributes["getIcon"] && thumb_scale) { %>
+    <img class="thumb-<%- thumb_scale %> pull-right" src="<%- getURL %>/@@images/image/<%- thumb_scale %>">
   <% } %>
 </td>
 
diff --git a/mockup/patterns/upload/pattern.js b/mockup/patterns/upload/pattern.js
index 554efb5b..87e05c25 100644
--- a/mockup/patterns/upload/pattern.js
+++ b/mockup/patterns/upload/pattern.js
@@ -48,9 +48,9 @@ define([
   'dropzone',
   'text!mockup-patterns-upload-url/templates/upload.xml',
   'text!mockup-patterns-upload-url/templates/preview.xml',
+  'mockup-utils',
   'translate'
-], function($, _, Base, RelatedItems, Dropzone,
-            UploadTemplate, PreviewTemplate, _t) {
+], function($, _, Base, RelatedItems, Dropzone, UploadTemplate, PreviewTemplate, utils, _t) {
   'use strict';
 
   /* we do not want this plugin to auto discover */
@@ -341,6 +341,10 @@ define([
       var options = $.extend({}, self.options);
       options.url = self.getUrl();
 
+      options.headers = {
+        'X-CSRF-TOKEN': utils.getAuthenticator()
+      };
+
       // XXX force to only upload one to the server at a time,
       // right now we don't support multiple for backends
       options.uploadMultiple = false;
@@ -442,7 +446,8 @@ define([
       window.tus.upload(file, {
         endpoint: self.dropzone.options.url,
         headers: {
-          'FILENAME': file.name
+          'FILENAME': file.name,
+          'X-CSRF-TOKEN': utils.getAuthenticator()
         },
         chunkSize: chunkSize
       }).fail(function() {
diff --git a/mockup/tests/pattern-structure-test.js b/mockup/tests/pattern-structure-test.js
index 0c3ad2e9..dcf2b148 100644
--- a/mockup/tests/pattern-structure-test.js
+++ b/mockup/tests/pattern-structure-test.js
@@ -610,7 +610,7 @@ define([
     });
 
     it('should display an icon for contents with images', function() {
-      this.app.thumbSize = 'tile';
+      this.app.thumb_scale = 'tile';
 
       var model = new Result({
           'Title': "Dummy Document",
@@ -628,7 +628,7 @@ define([
       var el = row.render().el;
 
       expect($('.title img', el).length).to.equal(1);
-      expect($('.title img', el).attr('class')).to.have.string('image-tile');
+      expect($('.title img', el).attr('class')).to.have.string('thumb-tile');
     });
 
     it('should display no icon for contents without images', function() {



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.