burp_cms 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77768a62b23bf9637e0bb038ff41512870d7e7cd
4
- data.tar.gz: 805cc1e568243527f35ad5ab3b5e70296dc5b0fc
3
+ metadata.gz: b66d58dd292c111e95c3a40956ede7dec5d8b647
4
+ data.tar.gz: dc9b9619b4fa6c18e3e4d907adc9e301674ec7df
5
5
  SHA512:
6
- metadata.gz: 26c5128fe90a1b8f53f3ae83909181abb8a2481c02590f8531dfd369a2300a0ce6f9d0401cafdb1e13f9a4f0ecf3c241a1ad05d65069d49c9b3900875d8e4544
7
- data.tar.gz: ca901f5ba6dd870aa01fda17d271d1d55950397c8fd6f7ac84fb6e164429da75f84063eec37df8699cba0a82ca7cf8d42a61100deed8cc417b710910ba49a343
6
+ metadata.gz: 94489889d76ae8f8ff66d95d4e4b03d24f092cdc873730bd14402e93e96261fb6f2093cddcdd72552a1d1cfc30845dc115d23ad77354cc11d793ea49116d584d
7
+ data.tar.gz: 9738290fae41c0562b77a05dc90c1947bcd856b96d42d585a8edfa443fc65139704307a458d81ade8a1d65a44742c974e79d33f8d1af1269d1651430225bf6e5
@@ -16,14 +16,15 @@
16
16
  },
17
17
  append: function(snippetName, element) {
18
18
  console.debug('append', snippetName, element);
19
+ },
20
+ setPositionClass: function(className, element) {
21
+ console.debug('setPositionClass', className, element);
19
22
  }
20
23
  };
21
24
 
22
25
  if (typeof(options) === 'object') {
23
26
  this.onUpdate = options['update'];
24
27
  }
25
-
26
- this.init();
27
28
  }
28
29
 
29
30
  window.ContentDecorator = ContentDecorator;
@@ -32,10 +33,13 @@
32
33
  $('body > .dropbox').remove();
33
34
  }
34
35
 
35
- function initializeMovable(contentEditor, elements, createCallback) {
36
+ function initializeMovable(contentEditor, elements, cloneImage) {
36
37
  if (!$(elements).hasClass('movable')) {
37
38
 
38
39
  $(elements).addClass('movable');
40
+ if(typeof(cloneImage) === "undefined") {
41
+ cloneImage = false;
42
+ }
39
43
 
40
44
  $(elements).draggable({
41
45
  cursor: 'move',
@@ -142,28 +146,34 @@
142
146
  drop: function(event, ui) {
143
147
 
144
148
  if(!ui.draggable.data("removed")) {
145
- var className = $(this).removeClass('dropzone')[0].className;
146
- var img = createCallback(ui.draggable[0], className);
147
-
148
- initializeMovable(contentEditor, img, function(element, positionClass) {
149
- $(element).removeClass('left center right ui-droppable movable ui-draggable');
150
- $(element).addClass(positionClass);
151
- return element;
152
- });
153
-
149
+
150
+ var className = $(this).removeClass('dropzone ui-droppable')[0].className;
151
+ var imageElement = ui.draggable[0];
154
152
  var markdown = $(this).parent().data("target-element");
155
153
 
156
- var src = $(img).attr('src');
157
- if(src.match(/\/files\/small\//)) {
158
- $(img).attr('src',src.replace(/\/files\/small\//,'/files/large/'));
159
- }
154
+ $(imageElement).removeClass('left center right');
155
+ $(imageElement).addClass(className);
160
156
 
161
- if($(this).parent().is(".bottom-dropbox")) {
162
- snippets().snippets[contentEditor.snippetName].append(img);
163
- contentEditor.callbacks.append(contentEditor.snippetName, img);
164
- } else if(img !== markdown) {
165
- $(img).insertBefore(markdown);
166
- contentEditor.callbacks.insertBefore($(markdown), img);
157
+ if(markdown === imageElement) {
158
+ contentEditor.callbacks.setPositionClass(className, $(imageElement));
159
+ } else {
160
+
161
+ // var src = $(img).attr('src');
162
+ // if(src.match(/\/files\/small\//)) {
163
+ // $(img).attr('src', src.replace(/\/files\/small\//,'/files/large/'));
164
+ // }
165
+
166
+ if(cloneImage) {
167
+ imageElement = $(imageElement).clone();
168
+ }
169
+
170
+ if($(this).parent().is(".bottom-dropbox")) {
171
+ snippets().snippets[contentEditor.snippetName].append($(imageElement));
172
+ contentEditor.callbacks.append(contentEditor.snippetName, $(imageElement));
173
+ } else {
174
+ $(imageElement).insertBefore(markdown);
175
+ contentEditor.callbacks.insertBefore($(markdown), $(imageElement));
176
+ }
167
177
  }
168
178
 
169
179
  clearDropBoxes();
@@ -191,18 +201,6 @@
191
201
 
192
202
  $.extend(ContentDecorator.prototype, {
193
203
 
194
- init: function() {
195
- var contentEditor = this;
196
- $(this.element).find("> .movable").each(function() {
197
- $(this).removeClass('movable');
198
- initializeMovable(contentEditor, this, function(element, positionClass) {
199
- $(element).removeClass('left center right ui-droppable movable ui-draggable');
200
- $(element).addClass(positionClass);
201
- return element;
202
- });
203
- });
204
- },
205
-
206
204
  setSnippetName: function(snippetName) {
207
205
  this.snippetName = snippetName;
208
206
  },
@@ -270,8 +268,8 @@
270
268
  // },10);
271
269
  // },
272
270
 
273
- makeDroppable: function(elements, createCallback) {
274
- initializeMovable(this, elements, createCallback);
271
+ makeDroppable: function(elements, cloneImage) {
272
+ initializeMovable(this, elements, cloneImage);
275
273
  },
276
274
 
277
275
  addRemoveZone: function(element) {
@@ -90,9 +90,7 @@ $(function() {
90
90
  }
91
91
  });
92
92
 
93
- contentDecorator.makeDroppable('#gallery img', function(element, positionClass) {
94
- return $("<img src='" + $(element).attr('src') + "' class='" + positionClass + "' />");
95
- });
93
+ contentDecorator.makeDroppable('#gallery img', true);
96
94
 
97
95
  $('#gallery').trigger('reset');
98
96
  });
@@ -156,9 +154,7 @@ $(function() {
156
154
  domSnippetState[snippetName] = elements.clone();
157
155
  snippets().snippets[snippetName].update(elements);
158
156
 
159
- contentDecorator.makeDroppable(elements, function(element, positionClass) {
160
- return $("<img src='" + $(element).attr('src') + "' class='" + positionClass + "' />");
161
- });
157
+ contentDecorator.makeDroppable(elements, false);
162
158
  }
163
159
 
164
160
  function addEditor() {
@@ -348,13 +344,16 @@ $(function() {
348
344
  insertBefore: function(beforeElement, element) {
349
345
  $(element).removeClass('ui-droppable movable ui-draggable');
350
346
 
347
+ var remove_eid = element.attr('eid');
348
+ var remove_cssSelector = '[eid="'+ remove_eid +'"]';
349
+
351
350
  var eid = beforeElement.attr('eid');
352
351
  var snippetName = eid.split(/-/)[0];
353
-
354
352
  var cssSelector = '[eid="'+ eid +'"]';
355
353
 
356
354
  var root = $('<div></div>');
357
355
  root.append(domSnippetState[snippetName]);
356
+ root.find(remove_cssSelector).remove();
358
357
  element.insertBefore(root.find(cssSelector));
359
358
  domSnippetState[snippetName] = root.children();
360
359
 
@@ -369,6 +368,25 @@ $(function() {
369
368
 
370
369
  domSnippetState[snippetName] = $('<div></div>').append(domSnippetState[snippetName]).append(element).children();
371
370
 
371
+ snippetEditorState[snippetName] = Html2Markdown(removeIDs(domSnippetState[snippetName]));
372
+ loadSnippet(snippetName, function(snippet) {
373
+ editor.setValue(snippet);
374
+ editor.refresh();
375
+ });
376
+ },
377
+ setPositionClass: function(positionClassName, imageElement) {
378
+
379
+ var eid = $(imageElement).attr('eid');
380
+ var snippetName = eid.split(/-/)[0];
381
+
382
+ var cssSelector = '[eid="'+ eid +'"]';
383
+
384
+ var root = $('<div></div>');
385
+ root.append(domSnippetState[snippetName]);
386
+ root.find(cssSelector).removeClass("left right center");
387
+ root.find(cssSelector).addClass(positionClassName);
388
+ domSnippetState[snippetName] = root.children();
389
+
372
390
  snippetEditorState[snippetName] = Html2Markdown(removeIDs(domSnippetState[snippetName]));
373
391
  loadSnippet(snippetName, function(snippet) {
374
392
  editor.setValue(snippet);
data/lib/burp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Burp
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burp_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darwin