caboose-cms 0.8.57 → 0.8.58

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: 46cad8ef370ab797b7f36acf01536f50c4194d33
4
- data.tar.gz: 8f8db6b566034b216a86337aacf9aab8fdec23d7
3
+ metadata.gz: 440bc611b18b2f1eb2f0a621e820b72e6ececc79
4
+ data.tar.gz: e09a55fef27861960533f9c9d65b61c84d7ee055
5
5
  SHA512:
6
- metadata.gz: f6b53ec696e54189d76d3726f100e194d86a5161b7c840f6a04a18d729814745ca7bc81381aacd2d1760962beb26eaf93e62d12684a4cb0aeb4e042dc46276a7
7
- data.tar.gz: 10473972752dd1cd0f8aa7646aeff8501c72970ae4ca975613a8b689c5130b8cbe76592caecf289cc6c60d0bf45c8139cf060e926cc88454e94fb29f8742e47e
6
+ metadata.gz: f4b4168e893ce2587c56b7dfb4602d4115e769fbc6e5fb1d88fe238e3fb83456af91825214d6f2194317c80cf8fde4d564b088b6ce5f2e28c7c715e854b2ecdc
7
+ data.tar.gz: 3525e34ebdc132c1298bb0264d07f94304a1250535da8ee0c3c50d6f30639532eb870afceea4c98f1cb5144091c1f1cbabdd614630eb1b68005228bd69072753
@@ -45,6 +45,7 @@ PageContentController.prototype = {
45
45
 
46
46
  edit_block: function(block_id)
47
47
  {
48
+ console.log('PageContentController.edit_block');
48
49
  var that = this;
49
50
  var b = that.block_with_id(block_id);
50
51
  var modal_controller = '';
@@ -69,8 +70,8 @@ PageContentController.prototype = {
69
70
 
70
71
  new_block: function(parent_id, before_block_id, after_block_id)
71
72
  {
72
- var that = this;
73
- //console.log(parent_id);
73
+ console.log('PageContentController.new_block');
74
+ var that = this;
74
75
  //caboose_modal_url('/admin/pages/' + this.page_id + '/blocks/' + parent_id + '/new');
75
76
  that.modal = new BlockModalController({
76
77
  page_id: that.page_id,
@@ -226,7 +227,7 @@ PageContentController.prototype = {
226
227
 
227
228
  if (parent_allows_child_blocks && (!b.name || b.name.length == 0))
228
229
  {
229
- $('#block_' + b.id).prepend($('<div/>')
230
+ $('#block_' + b.id).before($('<div/>')
230
231
  .addClass('new_block_link')
231
232
  .append($('<div/>').addClass('line'))
232
233
  .append($('<a/>')
@@ -234,7 +235,7 @@ PageContentController.prototype = {
234
235
  .html("New Block")
235
236
  .click(function(e) {
236
237
  e.preventDefault(); e.stopPropagation();
237
- //caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + parent_id + '/new?before_id=' + b.id);
238
+ console.log('Adding new block...');
238
239
  that.new_block(parent_id, b.id);
239
240
  })
240
241
  )
@@ -243,7 +244,7 @@ PageContentController.prototype = {
243
244
  );
244
245
  if (is_last_child && is_last_child == true)
245
246
  {
246
- $('#block_' + b.id).append($('<div/>')
247
+ $('#block_' + b.id).after($('<div/>')
247
248
  .addClass('new_block_link')
248
249
  .append($('<div/>').addClass('line'))
249
250
  .append($('<a/>')
@@ -251,7 +252,7 @@ PageContentController.prototype = {
251
252
  .html("New Block")
252
253
  .click(function(e) {
253
254
  e.preventDefault(); e.stopPropagation();
254
- //caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + parent_id + '/new?after_id=' + b.id);
255
+ console.log('Adding new block...');
255
256
  that.new_block(parent_id, null, b.id);
256
257
  })
257
258
  )
@@ -385,16 +385,24 @@ var BlockModalController = ModalController.extend({
385
385
  );
386
386
  that.modal(div, 780);
387
387
  return;
388
- }
388
+ }
389
+ that.autosize("<p class='loading'>Adding block...</p>");
390
+
391
+ bt = false;
392
+ $.ajax({
393
+ url: '/admin/block-types/' + block_type_id + '/json',
394
+ type: 'get',
395
+ success: function(resp) { bt = resp; },
396
+ async: false
397
+ });
398
+ that.include_assets('caboose/block_modal_controllers/' + bt.name + '_modal_controller.js');
389
399
 
390
- that.autosize("<p class='loading'>Adding block...</p>");
391
400
  var h = {
392
401
  authenticity_token: that.authenticity_token,
393
402
  block_type_id: block_type_id
394
403
  };
395
404
  if (that.before_id ) h['before_id'] = that.before_id;
396
405
  if (that.after_id ) h['after_id' ] = that.after_id;
397
-
398
406
  $.ajax({
399
407
  url: '/admin/' + (that.page_id ? 'pages/' + that.page_id : 'posts/' + that.post_id) + '/blocks/' + that.block_id,
400
408
  type: 'post',
@@ -402,7 +410,7 @@ var BlockModalController = ModalController.extend({
402
410
  success: function(resp) {
403
411
  if (resp.error) that.autosize("<p class='note error'>" + resp.error + "</p>");
404
412
  if (resp.success)
405
- {
413
+ {
406
414
  that.parent_controller.refresh_blocks(function() {
407
415
  that.parent_controller.edit_block(resp.new_id);
408
416
  that.parent_controller.render_blocks();
@@ -233,7 +233,7 @@ module Caboose
233
233
  :controller_view_content => nil,
234
234
  :modal => false,
235
235
  :editing => true,
236
- :empty_text => params[:empty_text],
236
+ :empty_text => params[:empty_text] ? params[:empy_text] : '[Empty, click to edit]',
237
237
  :css => '|CABOOSE_CSS|',
238
238
  :js => '|CABOOSE_JAVASCRIPT|',
239
239
  :csrf_meta_tags => '|CABOOSE_CSRF|',
@@ -722,6 +722,10 @@ class Caboose::Schema < Caboose::Utilities::Schema
722
722
  [ :date_css_updated , :datetime ],
723
723
  [ :default_layout_id , :integer ],
724
724
  [ :login_fail_lock_count , :integer , { :default => 5 }]
725
+ #[ :custom_css , :text ],
726
+ #[ :custom_css_files , :text ],
727
+ #[ :custom_js , :text ],
728
+ #[ :custom_js_files , :text ]
725
729
  ],
726
730
  Caboose::SiteMembership => [
727
731
  [ :site_id , :integer ],
@@ -1,13 +1,53 @@
1
- <!DOCTYPE html>
1
+ <%
2
+ # See if we're using cloudflare
3
+ protocol = 'http://'
4
+ if request.env['HTTP_CF_VISITOR'] && request.env['HTTP_CF_VISITOR'].include?('https')
5
+ protocol = 'https://'
6
+ request.env['REQUEST_URI'] = "https://#{request.env['REQUEST_URI'][7..-1]}" if (request.env['REQUEST_URI'] =~ %r"http://") == 0
7
+ request.env['SERVER_PORT'] = '443' if request.env['SERVER_PORT'] == '80'
8
+ request.env['HTTP_REFERER'] = "https://#{request.env['HTTP_REFERER'][7..-1]}" if (request.env['HTTP_REFERER'] =~ %r"http://") == 0
9
+ request.env['rack.url_scheme'] = 'https'
10
+ request.env['HTTPS'] = 'on'
11
+ end
12
+
13
+ content_for :modal_css do
14
+ %><%= stylesheet_link_tag "caboose/modal", :media => "all" %><%
15
+ if File.exists?("#{Rails.root}/app/assets/stylesheets/modal.css")
16
+ %><%= stylesheet_link_tag "modal", :media => "all" %><%
17
+ end
18
+ %><%= yield :caboose_css %><%
19
+ end
20
+
21
+ css = yield(:modal_css)
22
+ css.gsub!("<link href=\"//", "<link href=\"#{protocol}")
23
+ css.gsub!("<link href='//" , "<link href='#{protocol}")
24
+ if protocol == 'https://'
25
+ css.gsub!("<link href=\"http://", "<link href=\"https://")
26
+ css.gsub!("<link href='http://" , "<link href='https://")
27
+ end
28
+
29
+ content_for :modal_js do
30
+ %><%= javascript_include_tag "caboose/modal" %><%
31
+ if File.exists?("#{Rails.root}/app/assets/javascripts/modal.js")
32
+ %><%= javascript_include_tag "modal" %><%
33
+ end
34
+ %><%= yield :caboose_js %><%
35
+ end
36
+
37
+ js = yield(:modal_js)
38
+ js.gsub!("<script src=\"//", "<script src=\"#{protocol}")
39
+ js.gsub!("<script src='//" , "<script src='#{protocol}")
40
+ if protocol == 'https://'
41
+ js.gsub!("<script src=\"http://", "<script src=\"https://")
42
+ js.gsub!("<script src='http://" , "<script src='https://")
43
+ end
44
+
45
+ %><!DOCTYPE html>
2
46
  <html class="no-js" lang="en">
3
47
  <head>
4
48
  <meta charset="utf-8" />
5
49
  <title>Modal Caboose</title>
6
- <%= stylesheet_link_tag "caboose/modal", :media => "all" %>
7
- <% if File.exists?("#{Rails.root}/app/assets/stylesheets/modal.css") %>
8
- <%= stylesheet_link_tag "modal", :media => "all" %>
9
- <% end %>
10
- <%= yield :caboose_css %>
50
+ <%= raw css %>
11
51
  <%= csrf_meta_tags %>
12
52
  <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
13
53
  </head>
@@ -19,10 +59,6 @@
19
59
 
20
60
  </div>
21
61
  </div>
22
- <%= javascript_include_tag "caboose/modal" %>
23
- <% if File.exists?("#{Rails.root}/app/assets/javascripts/modal.js") %>
24
- <%= javascript_include_tag "modal" %>
25
- <% end %>
26
- <%= yield :caboose_js %>
62
+ <%= raw js %>
27
63
  </body>
28
64
  </html>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.8.57'
2
+ VERSION = '0.8.58'
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.8.57
4
+ version: 0.8.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-29 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg