burp_cms 1.3.22 → 1.3.23

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: 6f0fb10d354b262a4418476e434a2e49fcf8174f
4
- data.tar.gz: bde87ac8d54cbe975170907d33e84a04342d6776
3
+ metadata.gz: 7eb5a2a04169b04a4ca36e4874d43359156d4ac7
4
+ data.tar.gz: c493348b8edb342492f771f94e19e319a669cbc2
5
5
  SHA512:
6
- metadata.gz: 6702dc61821c6d867c271c7c4071b2a9d2c7925cd30d0f737a6c0bafb1d7d59809d18d2481282f01ae3112b60884332fce0af513ab36cdbae4057c2e3e4d3d43
7
- data.tar.gz: 6a9da3b0243d2030c862f4f6562bc24a76e47629b204fb0cb1504f1cc67af14f9d4560ec54a8be3a80e36b058dc6675542b7605fde629c5e92d81c2ccb0aac8c
6
+ metadata.gz: 351d8d0f2bcc0657ffa87227776cacd733b0dc9489c051ee3c11e1ac989cd8c26b7b05f337b7d60b45f28b969ec72a9bd2cb5327203d52297963a36f5c27026f
7
+ data.tar.gz: 551b8d61164d2f5708b8ad1999fb2f13a2360146a33e9779601d4be9ac34b54db6b53f95868c2dcfbfc3ea573cba414ace675871c3956545205b1e5b878a8dde
@@ -1205,7 +1205,7 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
1205
1205
  if(window['jQuery']) {
1206
1206
  var csrf_token = jQuery('meta[name=csrf-token]').attr('content');
1207
1207
  if(csrf_token) {
1208
- xhr.setRequestHeader("X-CSRF-Token", encodeURIComponent(csrf_token));
1208
+ xhr.setRequestHeader("X-CSRF-Token", csrf_token);
1209
1209
  }
1210
1210
  }
1211
1211
 
@@ -28,6 +28,10 @@ body > .container {
28
28
  padding: 60px 0px 100px;
29
29
  }
30
30
 
31
+ .container > .row {
32
+ margin: 0px 20px;
33
+ }
34
+
31
35
  .controls > .input > textarea {
32
36
  width: 500px;
33
37
  }
@@ -50,6 +54,8 @@ span.buttons {
50
54
  display: block;
51
55
  }
52
56
 
57
+
58
+
53
59
  td {
54
60
  padding: 1px 50px 1px 0px;
55
61
  }
@@ -1,7 +1,7 @@
1
1
  .burp-pages-index {
2
2
 
3
3
  table {
4
- max-width: 600px;
4
+ max-width: 560px;
5
5
  margin: 0px 20px;
6
6
  }
7
7
 
@@ -16,6 +16,11 @@ module Burp
16
16
  @body_classes += " #{(request.user_agent || '').match(/(lion)/i) ? "noscrollbars" : "scrollbars"} "
17
17
  end
18
18
 
19
+ helper_method :menu
20
+ def menu
21
+ Burp.menu(request)
22
+ end
23
+
19
24
  private
20
25
 
21
26
  def access
@@ -35,7 +40,6 @@ module Burp
35
40
  username == Rails.application.config.burp_username && password == Rails.application.config.burp_password
36
41
  end
37
42
  end
38
-
39
43
  end
40
44
  end
41
45
 
@@ -106,5 +106,13 @@ module Burp
106
106
  to_hash.hash
107
107
  end
108
108
 
109
+ def self.bootstrap_nav(group)
110
+ %{
111
+ <ul class="nav">
112
+ #{group.children.map { |child| child.is_a?(Link) ? "<li class=\"#{child.css_class}\">#{child.to_html}</li>" : "" }.join("\n\t\t\t")}
113
+ </ul>
114
+ }.html_safe
115
+ end
116
+
109
117
  end
110
118
  end
data/app/lib/burp/link.rb CHANGED
@@ -3,11 +3,16 @@ module Burp
3
3
 
4
4
  attr_reader :id
5
5
  attr_accessor :url,:name
6
+ attr_accessor :css_class
6
7
 
7
- def initialize(options)
8
- self.name = options.keys.first
9
- self.url = options.values.first
10
-
8
+ def initialize(options)
9
+ self.name ||= options[:name]
10
+ self.url ||= options[:url]
11
+ self.css_class ||= options[:class]
12
+
13
+ self.name ||= options.keys.first
14
+ self.url ||= options.values.first
15
+
11
16
  raise ArgumentError.new("Missing a url") unless url
12
17
  raise ArgumentError.new("Missing a name") unless name
13
18
  end
@@ -21,7 +26,7 @@ module Burp
21
26
  end
22
27
 
23
28
  def to_html(request = nil,name = nil)
24
- %{<a class="#{current_class(request)}" #{id ? "id='#{id}'" : ""} href="#{url}">#{name || self.name}</a>}.html_safe
29
+ %{<a class="#{current_class(request)} #{css_class}" #{id ? "id='#{id}'" : ""} href="#{url}">#{name || self.name}</a>}.html_safe
25
30
  end
26
31
 
27
32
  def to_param
@@ -34,65 +34,63 @@
34
34
  </table>
35
35
 
36
36
 
37
-
38
- <script type="text/javascript" charset="utf-8">
39
-
40
- <% content_for :inline_javascript do %>
41
-
42
- var uploader = new qq.FileUploader({
43
- element: document.getElementById('file-uploader'),
44
- action: '/burp/files',
45
- sizeLimit: 1024 * 1024 * 40,
46
- onComplete: function(id, fileName, responseJSON){
47
- if(responseJSON.success) {
48
- $.get(document.location,function(data) {
49
- $('table').replaceWith($(data).find('table'));
50
- });
51
- } else {
52
- var errorMessage = "";
53
- $.each(responseJSON.errors,function(index,error) {
54
- $.each(error,function(key,value) {
55
- errorMessage += value;
56
- });
37
+ <% content_for :inline_javascript do %>
38
+ <script type="text/javascript" charset="utf-8">
39
+
40
+
41
+ var uploader = new qq.FileUploader({
42
+ element: document.getElementById('file-uploader'),
43
+ action: '/burp/files',
44
+ sizeLimit: 1024 * 1024 * 40,
45
+ onComplete: function(id, fileName, responseJSON){
46
+ if(responseJSON.success) {
47
+ $.get(document.location,function(data) {
48
+ $('table').replaceWith($(data).find('table'));
49
+ });
50
+ } else {
51
+ var errorMessage = "";
52
+ $.each(responseJSON.errors,function(index,error) {
53
+ $.each(error,function(key,value) {
54
+ errorMessage += value;
57
55
  });
58
- alert(errorMessage);
59
- }
60
- },
61
- template: '<div class="qq-uploader">' +
62
- '<div class="file-upload-drop-area" style="display: block;"><span>Drop files here to upload</span></div>' +
63
- '<div class="file-upload-button btn btn-large">Click here to upload</div>' +
64
- '<ul class="qq-upload-list"></ul>' +
65
- '</div>',
66
-
67
- // template for one item in file list
68
- fileTemplate: '<li>' +
69
- '<span class="qq-upload-file"></span>' +
70
- '<span class="qq-upload-spinner"></span>' +
71
- '<span class="qq-upload-size"></span>' +
72
- '<a class="qq-upload-cancel" href="#">Cancel</a>' +
73
- '<span class="qq-upload-failed-text">Failed</span>' +
74
- '</li>',
75
-
76
- classes: {
77
- // used to get elements from templates
78
- button: 'file-upload-button',
79
- drop: 'file-upload-drop-area',
80
- dropActive: 'file-upload-drop-area-active',
81
- list: 'qq-upload-list',
82
-
83
- file: 'qq-upload-file',
84
- spinner: 'qq-upload-spinner',
85
- size: 'qq-upload-size',
86
- cancel: 'qq-upload-cancel',
87
-
88
- // added to list item when upload completes
89
- // used in css to hide progress spinner
90
- success: 'qq-upload-success',
91
- fail: 'qq-upload-fail'
56
+ });
57
+ alert(errorMessage);
92
58
  }
93
- });
94
-
95
- <% end %>
59
+ },
60
+ template: '<div class="qq-uploader">' +
61
+ '<div class="file-upload-drop-area" style="display: block;"><span>Drop files here to upload</span></div>' +
62
+ '<div class="file-upload-button btn btn-large">Click here to upload</div>' +
63
+ '<ul class="qq-upload-list"></ul>' +
64
+ '</div>',
96
65
 
97
- </script>
66
+ // template for one item in file list
67
+ fileTemplate: '<li>' +
68
+ '<span class="qq-upload-file"></span>' +
69
+ '<span class="qq-upload-spinner"></span>' +
70
+ '<span class="qq-upload-size"></span>' +
71
+ '<a class="qq-upload-cancel" href="#">Cancel</a>' +
72
+ '<span class="qq-upload-failed-text">Failed</span>' +
73
+ '</li>',
74
+
75
+ classes: {
76
+ // used to get elements from templates
77
+ button: 'file-upload-button',
78
+ drop: 'file-upload-drop-area',
79
+ dropActive: 'file-upload-drop-area-active',
80
+ list: 'qq-upload-list',
81
+
82
+ file: 'qq-upload-file',
83
+ spinner: 'qq-upload-spinner',
84
+ size: 'qq-upload-size',
85
+ cancel: 'qq-upload-cancel',
86
+
87
+ // added to list item when upload completes
88
+ // used in css to hide progress spinner
89
+ success: 'qq-upload-success',
90
+ fail: 'qq-upload-fail'
91
+ }
92
+ });
93
+ </script>
94
+ <% end %>
95
+
98
96
 
@@ -70,10 +70,9 @@
70
70
  </div>
71
71
 
72
72
 
73
+ <% content_for :inline_javascript do %>
73
74
  <script type="text/javascript" charset="utf-8">
74
75
 
75
- <% content_for :inline_javascript do %>
76
-
77
76
  $(function() {
78
77
 
79
78
  // Popup for edit and new page
@@ -89,7 +88,6 @@
89
88
  });
90
89
  });
91
90
  });
92
-
93
- <% end %>
94
91
 
95
92
  </script>
93
+ <% end %>
@@ -22,12 +22,7 @@
22
22
  </a>
23
23
  <a class="brand" href="/burp/">Burp</a>
24
24
  <div class="nav-collapse collapse">
25
- <ul class="nav">
26
- <li><%= link_to "Pages", "/burp/pages" %></li>
27
- <li><%= Burp::Menu.count == 1 ? (link_to "Menu", edit_menu_path(Burp::Menu.all.first)) : (link_to "Menus", "/burp/menus") %></li>
28
- <li><%= link_to "Files", "/burp/files" %></li>
29
- <li class="markdown"><%= link_to "Help", "/burp/help" %></li>
30
- </ul>
25
+ <%= Burp::Group.bootstrap_nav(menu) %>
31
26
  </div>
32
27
  </div>
33
28
  </div>
@@ -35,6 +30,18 @@
35
30
 
36
31
  <div class="container">
37
32
 
33
+ <% if flash[:notice] %>
34
+ <div class="alert alert-success">
35
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
36
+ <%= flash[:notice] %>
37
+ </div>
38
+ <% elsif flash[:alert] %>
39
+ <div class="alert alert-error">
40
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
41
+ <%= flash[:alert] %>
42
+ </div>
43
+ <% end %>
44
+
38
45
  <div class="row">
39
46
  <%= yield %>
40
47
  </div>
@@ -49,9 +56,7 @@
49
56
  </div>
50
57
 
51
58
  <%= javascript_include_tag "burp/application" %>
52
- <script type="text/javascript" charset="utf-8">
53
- <%= raw yield :inline_javascript %>
54
- </script>
59
+ <%= raw yield :inline_javascript %>
55
60
  </body>
56
61
  </html>
57
62
 
data/config/routes.rb CHANGED
@@ -25,6 +25,6 @@ Burp::Engine.routes.draw do
25
25
  end
26
26
 
27
27
  Rails.application.routes.draw do
28
- mount Burp::Engine => "/burp"
28
+ mount Burp::Engine => "/burp", :as => "burp_engine"
29
29
  get '/:path' => 'burp/catch_all#show', :constraints => { :path => /.*/ }
30
30
  end
data/lib/burp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Burp
2
- VERSION = "1.3.22"
2
+ VERSION = "1.3.23"
3
3
  end
data/lib/burp_cms.rb CHANGED
@@ -69,5 +69,28 @@ module Burp
69
69
  Thread.current[:thread_local_content_directory] = path
70
70
  end
71
71
 
72
+ def self.menu(request)
73
+ group = Group.new("")
74
+ group.children << Link.new(:name => "Pages", :url => "/burp/pages")
75
+ if Burp::Menu.count == 1
76
+ group.children << Link.new(:name => "Menu", :url => "/burp/menus/#{Burp::Menu.all.first.name}/edit")
77
+ else
78
+ group.children << Link.new(:name => "Menus", :url => "/burp/menus")
79
+ end
80
+ group.children << Link.new(:name => "Files", :url => "/burp/files")
81
+ group.children << Link.new(:name => "Help", :url => "/burp/herp", :class => "markdown")
82
+
83
+ @@menu_processors.values.each do |block|
84
+ block.call(group, request)
85
+ end
86
+
87
+ group
88
+ end
89
+
90
+ @@menu_processors = {}
91
+
92
+ def self.add_menu_processor(name, &block)
93
+ @@menu_processors[name] = block
94
+ end
72
95
 
73
96
  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.3.22
4
+ version: 1.3.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-03 00:00:00.000000000 Z
11
+ date: 2013-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails