caboose-cms 0.2.62 → 0.2.64

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWFjMWM1MDg5OWE2NzQ2OGUwNGE2OTdiZTg5OTE2Y2ZhMDJlNTJkZg==
4
+ MzgwMDA5N2FjZjllMDg4YTU3NjNkYjQ0NGZhNTI3MmRlNmU2MGZhNQ==
5
5
  data.tar.gz: !binary |-
6
- MDAwNTZkZDY4ODk1NjlmMWMxNGJkZjI4NDhlMGI3OGI5YTYxNDcxMA==
6
+ MTE0OWFlNmQwMGRkM2FkZmYxODNlYzRmZDFhOWNjYzY0MWViMDViZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Yjk4YmI4YmRjNWVkNjBkMTExYTVmZmQ0ZWRkNmFkYjJiYWNmMGI4MDE5ZjBh
10
- NjhiMmFhNjQ5ODk1MjNhOTkzOTEwMTM2Y2VkZTkwNWRmYzI2ZTEzMjM4NmJk
11
- YzYxZGIwZTdmNjcxYzlmYjA5YjljZWIyYmZlMzY2N2RhY2RiZjg=
9
+ Y2I2NzcwM2UzOWQ3OWUyZTNhZGFkY2ViYmNkYmQwNWI3ZGIyZGRlYjllZGU1
10
+ OTc2ZjBlMzg0MGE4MzUzZDE1ZGYwMDZjYTAzZTRhODkzM2U5NjNkNDc1Yjg1
11
+ NTUwODNiNjU1OGZiNjFjNzY1ZmQ4Njg3ODBlZDhmMGZlNjA5OTM=
12
12
  data.tar.gz: !binary |-
13
- YTcwYjA2YzRmMzQ2OGU2N2RlZGRkN2ZmZTgzMmE5NzcwMjc5NGM3OGQ3NDhm
14
- NjRlNWFmMTUwZTA2ODMxM2FkOTBjMTFjYTc0MzEzMjgwMGNhMzY0YmE3NTkw
15
- NTFjMzZkNTM0NTY5ZjY3ZTg3ODI0MDY0MmEzNWNjNWMxNzJiY2M=
13
+ NjY2NzQ2Y2EwYjMzMDBlOWQyZDNlMjcyY2JlODY1MjBlNWVhZTMzYjVkNGFj
14
+ ODljNjlkNjNkOWM3ZDNjZjk2NzczMjJhNTA4ODMzNDBlZDUyYTJhOTY5OWMz
15
+ YmExNjcxMTBiYzdjZDEwOGUyNjVlMWRiNThkYmNlMWFkNDY4OWQ=
@@ -39,7 +39,15 @@ BoundRichText = BoundControl.extend({
39
39
 
40
40
  setTimeout(function() {
41
41
  var ed = tinymce.EditorManager.get(this2.el);
42
- ed.on('blur', function(e) { this2.save(); });
42
+ ed.on('blur', function(e) { this2.save(); });
43
+ ed.on('keyup', function(e) {
44
+ tinymce.triggerSave();
45
+ if (e.keyCode == 27) this2.cancel(); // Escape
46
+ if ($('#'+this2.el).val() != this2.attribute.value_clean)
47
+ ed.getBody().style.backgroundColor = "#fff799";
48
+ else
49
+ ed.getBody().style.backgroundColor = "#fff";
50
+ });
43
51
  }, 1500);
44
52
  },
45
53
 
@@ -97,6 +105,8 @@ BoundRichText = BoundControl.extend({
97
105
  this2.show_check(500);
98
106
  $('#'+this2.el).val(this2.attribute.value);
99
107
  $('#'+this2.el).removeClass('dirty');
108
+ var ed = tinymce.EditorManager.get(this2.el);
109
+ ed.getBody().style.backgroundColor = "#fff";
100
110
 
101
111
  if (this2.binder.success)
102
112
  this2.binder.success(this2);
@@ -22,7 +22,7 @@ BoundSelect = BoundControl.extend({
22
22
  .css('position', 'relative')
23
23
  );
24
24
  $('#'+this.el+'_container').empty();
25
- if (this.attribute.fixe_placeholder)
25
+ if (this.attribute.fixed_placeholder)
26
26
  {
27
27
  $('#'+this.el+'_container').append($('<div/>')
28
28
  .attr('id', this.placeholder)
@@ -23,3 +23,7 @@ h3 { font-size: inherit; }
23
23
  h4 { font-size: inherit; }
24
24
  h5 { font-size: inherit; }
25
25
  h6 { font-size: inherit; }
26
+
27
+ body.dirty {
28
+ background: #fff799;
29
+ }
@@ -309,23 +309,15 @@ module Caboose
309
309
  render json: resp
310
310
  end
311
311
 
312
- def sitemap
313
- parent_id = params[:parent_id]
314
- top_page = Page.index_page
315
- p = !parent_id.nil? ? Page.find(parent_id) : top_page
316
- options = []
317
- sitemap_helper2(top_page, options)
318
- @options = options
319
- end
320
-
321
- def sitemap_helper2(page, options, prefix = '')
322
- options << { 'value' => page.id, 'text' => prefix + page.title }
323
- page.children.each do |kid|
324
- sitemap_helper(kid, options, prefix + ' - ')
325
- end
312
+ # GET /admin/pages/1/sitemap
313
+ def admin_sitemap
314
+ return unless user_is_allowed('pages', 'delete')
315
+ @page = Page.find(params[:id])
316
+ render :layout => 'caboose/admin'
326
317
  end
327
318
 
328
- def sitemap_options
319
+ # GET /admin/pages/sitemap-options
320
+ def admin_sitemap_options
329
321
  parent_id = params[:parent_id]
330
322
  top_page = Page.index_page
331
323
  p = !parent_id.nil? ? Page.find(parent_id) : top_page
@@ -342,7 +334,8 @@ module Caboose
342
334
  end
343
335
  end
344
336
 
345
- def robots_options
337
+ # GET /admin/pages/robots-options
338
+ def admin_robots_options
346
339
  options = [
347
340
  { 'value' => 'index' , 'text' => 'index' },
348
341
  { 'value' => 'noindex' , 'text' => 'noindex' },
@@ -355,7 +348,8 @@ module Caboose
355
348
  render json: options
356
349
  end
357
350
 
358
- def content_format_options
351
+ # GET /admin/pages/format-options
352
+ def admin_content_format_options
359
353
  options = [
360
354
  { 'value' => 'html', 'text' => 'html' },
361
355
  { 'value' => 'text', 'text' => 'text' },
@@ -34,7 +34,7 @@ module Caboose
34
34
  options.each { |key, val| @options[key] = val }
35
35
  @params.each { |key, val| @params[key] = post_get[key].nil? ? val : post_get[key] }
36
36
  @options.each { |key, val| @options[key] = post_get[key].nil? ? val : post_get[key] }
37
- fix_desc
37
+ fix_desc
38
38
  @options['item_count'] = @options['model'].constantize.where(where).count
39
39
  end
40
40
 
@@ -149,35 +149,44 @@ module Caboose
149
149
 
150
150
  def where
151
151
  sql = []
152
- values = []
152
+ values = []
153
153
  @params.each do |k,v|
154
154
  next if v.nil? || v.length == 0
155
+
156
+ sql2 = ""
155
157
  if k.ends_with?('_gte')
156
- sql << "#{k[0..-5]} >= ?"
158
+ sql2 = "#{k[0..-5]} >= ?"
157
159
  elsif k.ends_with?('_gt')
158
- sql << "#{k[0..-4]} > ?"
160
+ sql2 = "#{k[0..-4]} > ?"
159
161
  elsif k.ends_with?('_lte')
160
- sql << "#{k[0..-5]} <= ?"
162
+ sql2 = "#{k[0..-5]} <= ?"
161
163
  elsif k.ends_with?('_lt')
162
- sql << "#{k[0..-4]} < ?"
164
+ sql2 = "#{k[0..-4]} < ?"
163
165
  elsif k.ends_with?('_bw')
164
- sql << "upper(#{k[0..-4]}) like ?"
165
- v = "#{v}%".upcase
166
+ sql2 = "upper(#{k[0..-4]}) like ?"
167
+ v = v.kind_of?(Array) ? v.collect{ |v2| "#{v2}%".upcase } : "#{v}%".upcase
166
168
  elsif k.ends_with?('_ew')
167
- sql << "upper(#{k[0..-4]}) like ?"
168
- v = "%#{v}".upcase
169
+ sql2 = "upper(#{k[0..-4]}) like ?"
170
+ v = v.kind_of?(Array) ? v.collect{ |v2| "%#{v2}".upcase } : "%#{v}".upcase
169
171
  elsif k.ends_with?('_like')
170
- sql << "upper(#{k[0..-6]}) like ?"
171
- v = "%#{v}%".upcase
172
- else
173
- sql << "#{k} = ?"
172
+ sql2 = "upper(#{k[0..-6]}) like ?"
173
+ v = v.kind_of?(Array) ? v.collect{ |v2| "%#{v2}%".upcase } : "%#{v}%".upcase
174
+ else
175
+ sql2 = "#{k} = ?"
174
176
  end
175
- values << v
177
+
178
+ if v.kind_of?(Array)
179
+ sql2 = "(" + v.collect{ |v2| "#{sql2}" }.join(" or ") + ")"
180
+ v.each { |v2| values << v2 }
181
+ else
182
+ values << v
183
+ end
184
+ sql << sql2
176
185
  end
177
186
  sql_str = sql.join(' and ')
178
187
  sql = [sql_str]
179
- values.each { |v| sql << v }
180
- return sql
188
+ values.each { |v| sql << v }
189
+ return sql
181
190
  end
182
191
 
183
192
  def limit
@@ -70,7 +70,7 @@ module Caboose
70
70
  vars = get_vars()
71
71
  page = @options["page"].to_i
72
72
 
73
- Caboose.log(@options)
73
+ #Caboose.log(@options)
74
74
 
75
75
  # Max links to show (must be odd)
76
76
  total_links = 5
@@ -1,9 +1,7 @@
1
1
  <% content_for :caboose_css do %>
2
- <%= stylesheet_link_tag "caboose/pages" %>
3
2
  <% end %>
4
3
  <% content_for :caboose_js do %>
5
4
  <%= javascript_include_tag "caboose/model/all" %>
6
- <%= javascript_include_tag "caboose/pages" %>
7
5
  <% end %>
8
6
 
9
7
  <h1>Edit Page</h1>
@@ -16,7 +14,7 @@ tabs = {
16
14
  "/admin/pages/#{@page.id}/js" => 'Custom JS',
17
15
  "/admin/pages/#{@page.id}/seo" => 'SEO',
18
16
  "/admin/pages/#{@page.id}/sitemap" => 'Sitemap',
19
- "/admin/pages/#{@page.id}/delete" => 'Delete Product'
17
+ "/admin/pages/#{@page.id}/delete" => 'Delete Page'
20
18
  }
21
19
 
22
20
  %>
@@ -0,0 +1,30 @@
1
+
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
4
+ <div id='message'>
5
+ <p class='note warning'>Are you sure you want to delet the page? This can't be undone.<br /><br />
6
+ <input type='button' onclick='delete_page(<%= @page.id %>, true);' />
7
+ <input type='button' onclick="window.location='/admin/pages/<%= @page.id %>/edit';" />
8
+ </p>
9
+ </div>
10
+
11
+ <%= render :partial => 'caboose/pages/admin_footer' %>
12
+ <% content_for :caboose_js do %>
13
+ <%= javascript_include_tag "caboose/model/all" %>
14
+ <script type="text/javascript">
15
+
16
+ function delete_page(page_id, confirm)
17
+ {
18
+ $('#message').html("<p class='loading'>Deleting page...</p>");
19
+ $.ajax({
20
+ url: '/admin/pages/' + page_id + '/delete',
21
+ type: 'delete',
22
+ success: function(resp) {
23
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
24
+ if (resp.redirect) window.location = resp.redirect
25
+ }
26
+ });
27
+ }
28
+
29
+ </script>
30
+ <% end %>
@@ -1,6 +1,6 @@
1
1
 
2
- <style type='text/css'>
3
- #content li.hidden a { color: #990000; }
4
- </style>
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
5
3
 
6
- <%= raw pages_list(@page) %>
4
+ <p><%= raw pages_list(@page) %></p>
5
+
6
+ <%= render :partial => 'caboose/pages/admin_footer' %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.2.62'
2
+ VERSION = '0.2.64'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.62
4
+ version: 0.2.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-08 00:00:00.000000000 Z
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -217,6 +217,7 @@ files:
217
217
  - app/views/caboose/login/index.html.erb
218
218
  - app/views/caboose/pages/_admin_footer.html.erb
219
219
  - app/views/caboose/pages/_admin_header.html.erb
220
+ - app/views/caboose/pages/admin_delete.html.erb
220
221
  - app/views/caboose/pages/admin_edit_content.html.erb
221
222
  - app/views/caboose/pages/admin_edit_css.html.erb
222
223
  - app/views/caboose/pages/admin_edit_general.html.erb