burp_cms 1.5.4 → 1.5.5

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: 6c245a07ab3e7d61e998392882ff7796abe1f9a3
4
- data.tar.gz: 96224cf1e3d17fb9a06fecc50bf8133688434616
3
+ metadata.gz: 1c13ef9c316a9bca2ecfc2a1fbfa50708ecb86a0
4
+ data.tar.gz: cc7daabdc05dbd01a448bccbae0dd740732a01f6
5
5
  SHA512:
6
- metadata.gz: ff15a3894891d54709fd4fcff5bea05d87e08ba364fc7746a23b52a6a0f104c7e245b3c219e8f429236c51806e1ef84a888a9b567256f3e4d254528db7db0e6f
7
- data.tar.gz: 800b5dbbd16174e30dfba506d9b792f3a6bdd67ce63d88a58ac3435567b9da7917a2a6b2441e8b31df0130aacccfb55f1f1cf2b38ac3f86732acb707e4cf33f9
6
+ metadata.gz: 6c9fb18edc49829ca6289270e20ac120dc264fa9936d573be52915722d931857ff621a56e44e260f55678371de6d8a845fced3fb27f89509706bf9612c597fd6
7
+ data.tar.gz: 52d1196315a1215cafc2cf7226d25dc1eae48d029ca69c296901ae61e3572df260a40e7b7a379f904273a02b47ae602b4e76ccb7a3f6d827ab9e81a7f2cc76c2
@@ -13,7 +13,7 @@ $(function() {
13
13
  var editor;
14
14
 
15
15
  function getPathFor(snippetName) {
16
- var path = window.burp_path || snippets().snippets[snippetName].pageId || window.location.pathname;
16
+ var path = snippets().snippets[snippetName].pageId || window.burp_path || window.location.pathname;
17
17
  if(path === "/") {
18
18
  path = "/$root";
19
19
  }
@@ -292,31 +292,39 @@ $(function() {
292
292
 
293
293
  $.adminDock.footer.addButton({ icon: 'save', text: 'Save', secondary: true, click:function() {
294
294
 
295
- var path = getPathFor(snippetName);
296
295
  snippetCache = {};
297
296
 
298
- $.ajax("/burp/pages/"+path,{
299
- cache: false,
300
- dataType: 'json',
301
- success: function(data) {
302
-
303
- data = data || {snippets:{}};
304
-
305
- $.each(snippetEditorState, function(snippetName, snippetState) {
306
- data.snippets[snippetName] = markdown2Html(snippetEditorState[snippetName]);
307
- });
308
-
309
- $.ajax("/burp/pages/"+path,{
310
- type:"post",
311
- data:{page:data,'_method':"put"},
312
- dataType:'json',
313
- success:function() {
314
- alert("The page has been saved!");
315
- }
316
- });
317
- }
297
+ var paths = {};
298
+
299
+ $.each(snippetEditorState, function(snippetName, data) {
300
+ var path = getPathFor(snippetName);
301
+ paths[path] = paths[path] || [];
302
+ paths[path].push(snippetName);
303
+ });
304
+
305
+
306
+ var ajaxRequests = [];
307
+
308
+ $.each(paths, function(path, snippetNames) {
309
+
310
+ var data = {snippets:{}};
311
+
312
+ $.each(snippetNames, function(index, snippetName) {
313
+ data.snippets[snippetName] = markdown2Html(snippetEditorState[snippetName]);
314
+ });
315
+
316
+ ajaxRequests.push($.ajax("/burp/pages/"+path,{
317
+ type:"post",
318
+ data:{page:data, '_method':"put"},
319
+ dataType:'json',
320
+ success:function() {}
321
+ }));
322
+
318
323
  });
319
324
 
325
+ $.when(ajaxRequests).done(function() {
326
+ alert("The page has been saved!");
327
+ });
320
328
 
321
329
  }});
322
330
 
@@ -2,6 +2,17 @@
2
2
 
3
3
  var $ = jQuery;
4
4
 
5
+ function getData(string) {
6
+ var data = {};
7
+
8
+ $.each(string.match(/data-(.*?)="(.*?)"/g) || [], function(index, value) {
9
+ var match = value.match(/data-(.*?)="(.*?)"/);
10
+ data[match[1]] = match[2];
11
+ });
12
+
13
+ return data;
14
+ }
15
+
5
16
  window.snippets = function() {
6
17
 
7
18
  var snippets = {names:[],snippets:{}};
@@ -15,15 +26,15 @@
15
26
  }
16
27
  });
17
28
 
18
- snippetComments.map(function() {
29
+ snippetComments.each(function() {
19
30
 
20
- var name = this.data.match(/data-name=\"(.*?)\"/)[1];
21
- var pageId = this.data.match(/data-page-id=\"(.*?)\"/)[1];
31
+ var data = getData(this.data);
22
32
 
23
- snippets.names.push(name);
33
+ snippets.names.push(data['name']);
24
34
 
25
- snippets.snippets[name] = {
26
- pageId:pageId,
35
+ snippets.snippets[data['name']] = {
36
+ pageId:data['page-id'],
37
+ data:data,
27
38
  comment:this,
28
39
  elements:function() {
29
40
 
data/lib/burp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Burp
2
- VERSION = "1.5.4"
2
+ VERSION = "1.5.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burp_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails