caboose-cms 0.9.214 → 0.9.215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/caboose/sites_controller.rb +23 -28
- data/app/models/caboose/core_plugin.rb +2 -0
- data/app/models/caboose/site.rb +0 -2
- data/app/views/caboose/sites/_admin_header.html.erb +2 -6
- data/app/views/caboose/sites/admin_edit_block_types.html.erb +20 -6
- data/app/views/caboose/sites/admin_edit_code.html.erb +64 -0
- data/app/views/caboose/sites/admin_edit_contact.html.erb +4 -3
- data/app/views/caboose/sites/admin_edit_css.html.erb +32 -2
- data/app/views/caboose/sites/admin_edit_js.html.erb +32 -3
- data/lib/caboose/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e78cdfe6661eb28b6f2def6670fb647f04b3203f5b4b24d55a3f6438a02114a1
|
4
|
+
data.tar.gz: 514ec0cd029cfd0dc08e550c2cd33c7a52013972cce05caa91319943667cdffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0470d3d8278c51474f46dc0a7173ad5d7b2d162fd99d1bfc0d5758d608d81d209bb635e896e8ae91622d43efed021133d044c6f4fc067ac0ac92e593cd9954b8
|
7
|
+
data.tar.gz: b023cd761cee7067d36fe2f9a5399a312a75a2cafb2c5898ba9fd7d5d61c243a88aaea7bc49e39be35db38decc39ab4fc90175c0788da47a33ea198c09843bb9
|
@@ -90,36 +90,26 @@ module Caboose
|
|
90
90
|
# @route GET /admin/sites/:id/block-types
|
91
91
|
def admin_edit_block_types
|
92
92
|
return if !user_is_allowed('sites', 'edit')
|
93
|
-
if (
|
93
|
+
if (!logged_in_user.is_super_admin?)
|
94
94
|
@error = "You are not allowed to edit this site."
|
95
95
|
render :file => 'caboose/extras/error' and return
|
96
96
|
end
|
97
97
|
@site = Site.find(params[:id])
|
98
98
|
end
|
99
99
|
|
100
|
-
# @route GET /admin/
|
100
|
+
# @route GET /admin/custom-css
|
101
101
|
def admin_edit_css
|
102
|
-
return if !user_is_allowed('
|
103
|
-
if (@site.id.to_s != params[:id] && !@site.is_master)
|
104
|
-
@error = "You are not allowed to edit this site."
|
105
|
-
render :file => 'caboose/extras/error' and return
|
106
|
-
end
|
107
|
-
@site = Site.find(params[:id])
|
102
|
+
return if !user_is_allowed('code', 'edit')
|
108
103
|
end
|
109
104
|
|
110
|
-
# @route GET /admin/
|
105
|
+
# @route GET /admin/custom-js
|
111
106
|
def admin_edit_js
|
112
|
-
return if !user_is_allowed('
|
113
|
-
if (@site.id.to_s != params[:id] && !@site.is_master)
|
114
|
-
@error = "You are not allowed to edit this site."
|
115
|
-
render :file => 'caboose/extras/error' and return
|
116
|
-
end
|
117
|
-
@site = Site.find(params[:id])
|
107
|
+
return if !user_is_allowed('code', 'edit')
|
118
108
|
end
|
119
109
|
|
120
110
|
# @route GET /admin/sites/:id/contact
|
121
111
|
def admin_edit_contact
|
122
|
-
return if !user_is_allowed('
|
112
|
+
return if !user_is_allowed('contactinfo', 'edit')
|
123
113
|
if (@site.id.to_s != params[:id] && !@site.is_master)
|
124
114
|
@error = "You are not allowed to edit this site."
|
125
115
|
render :file => 'caboose/extras/error' and return
|
@@ -127,20 +117,20 @@ module Caboose
|
|
127
117
|
@site = Site.find(params[:id])
|
128
118
|
end
|
129
119
|
|
130
|
-
# @route GET /admin/sites/:id/codes
|
131
|
-
def admin_edit_codes
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
120
|
+
# # @route GET /admin/sites/:id/codes
|
121
|
+
# def admin_edit_codes
|
122
|
+
# return if !user_is_allowed('sites', 'edit')
|
123
|
+
# if (@site.id.to_s != params[:id] && !@site.is_master)
|
124
|
+
# @error = "You are not allowed to edit this site."
|
125
|
+
# render :file => 'caboose/extras/error' and return
|
126
|
+
# end
|
127
|
+
# @site = Site.find(params[:id])
|
128
|
+
# end
|
139
129
|
|
140
130
|
# @route GET /admin/sites/:id/delete
|
141
131
|
def admin_delete_form
|
142
|
-
return if !user_is_allowed('sites', '
|
143
|
-
if (
|
132
|
+
return if !user_is_allowed('sites', 'delete')
|
133
|
+
if (!logged_in_user.is_super_admin?)
|
144
134
|
@error = "You are not allowed to edit this site."
|
145
135
|
render :file => 'caboose/extras/error' and return
|
146
136
|
end
|
@@ -150,12 +140,17 @@ module Caboose
|
|
150
140
|
# @route GET /admin/sites/:id
|
151
141
|
def admin_edit
|
152
142
|
return if !user_is_allowed('sites', 'edit')
|
153
|
-
if (
|
143
|
+
if (!logged_in_user.is_super_admin?)
|
154
144
|
@error = "You are not allowed to edit this site."
|
155
145
|
render :file => 'caboose/extras/error' and return
|
156
146
|
end
|
157
147
|
@site = Site.find(params[:id])
|
158
148
|
end
|
149
|
+
|
150
|
+
# @route GET /admin/code
|
151
|
+
def admin_edit_code
|
152
|
+
return if !user_is_allowed('code', 'edit')
|
153
|
+
end
|
159
154
|
|
160
155
|
# @route POST /admin/sites
|
161
156
|
def admin_add
|
@@ -29,6 +29,8 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
|
|
29
29
|
item['children'] << { 'id' => 'smtp' , 'text' => 'SMTP (Mail)' , 'href' => '/admin/smtp' , 'modal' => false } if user.is_allowed('smtp' , 'view')
|
30
30
|
item['children'] << { 'id' => 'social' , 'text' => 'Social Media' , 'href' => '/admin/social' , 'modal' => false } if user.is_allowed('social' , 'view')
|
31
31
|
item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view')
|
32
|
+
item['children'] << { 'id' => 'code' , 'icon' => 'stack', 'text' => 'Custom Code' , 'href' => '/admin/code' , 'modal' => false } if user.is_allowed('code' , 'edit')
|
33
|
+
item['children'] << { 'id' => 'contactinfo' , 'icon' => 'plane', 'text' => 'Contact Information' , 'href' => "/admin/sites/#{site.id}/contact" , 'modal' => false } if user.is_allowed('contactinfo' , 'edit')
|
32
34
|
item['children'] << { 'id' => 'theme' , 'icon' => 'sites', 'text' => 'Theme' , 'href' => '/admin/theme' , 'modal' => false } if user.is_allowed('theme' , 'view') if !site.theme.nil? && user.is_super_admin?
|
33
35
|
# item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
|
34
36
|
item['children'] << { 'id' => 'my-account' , 'text' => 'My Account' , 'href' => '/my-account' , 'modal' => false }
|
data/app/models/caboose/site.rb
CHANGED
@@ -171,7 +171,6 @@ class Caboose::Site < ActiveRecord::Base
|
|
171
171
|
def custom_js
|
172
172
|
resp = HTTParty.get('https:' + self.custom_js_url)
|
173
173
|
if resp.nil? || resp.code.to_i == 403
|
174
|
-
self.custom_js = ""
|
175
174
|
return ""
|
176
175
|
end
|
177
176
|
return resp.body
|
@@ -180,7 +179,6 @@ class Caboose::Site < ActiveRecord::Base
|
|
180
179
|
def custom_css
|
181
180
|
resp = HTTParty.get('https:' + self.custom_css_url)
|
182
181
|
if resp.nil? || resp.code.to_i == 403
|
183
|
-
self.custom_css = ""
|
184
182
|
return ""
|
185
183
|
end
|
186
184
|
return resp.body
|
@@ -24,12 +24,8 @@
|
|
24
24
|
<ul id='tabs'>
|
25
25
|
<%
|
26
26
|
tabs = {
|
27
|
-
'General' => "/admin/sites/#{@site.id}",
|
28
|
-
'Contact Info' => "/admin/sites/#{@site.id}/contact",
|
27
|
+
'General' => "/admin/sites/#{@site.id}",
|
29
28
|
'Block Types' => "/admin/sites/#{@site.id}/block-types",
|
30
|
-
'Custom CSS' => "/admin/sites/#{@site.id}/css",
|
31
|
-
'Custom JS' => "/admin/sites/#{@site.id}/js",
|
32
|
-
'Embedded HTML' => "/admin/sites/#{@site.id}/codes",
|
33
29
|
'Delete Site' => "/admin/sites/#{@site.id}/delete"
|
34
30
|
}
|
35
31
|
|
@@ -43,4 +39,4 @@ tabs = {
|
|
43
39
|
<li class="back"><input type="button" onclick="window.location='/admin';" value="< Back" />
|
44
40
|
<% end %>
|
45
41
|
</ul>
|
46
|
-
<div id='content2'>
|
42
|
+
<div id='content2'>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
s = @site
|
3
|
+
seen_btids = [0]
|
3
4
|
%>
|
4
5
|
<%= render :partial => 'caboose/sites/admin_header' %>
|
5
6
|
|
@@ -7,23 +8,36 @@ s = @site
|
|
7
8
|
<div id='block_types'>
|
8
9
|
<table class='data'>
|
9
10
|
<tr><th> </th><th>Name</th><th>Description</th><th></th></tr>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
<%# bt_ids = @site.block_type_site_memberships.collect{ |bt| bt.block_type_id } %>
|
12
|
+
|
13
|
+
<% Caboose::BlockType.joins(:sites).where(:parent_id => nil).where("sites.id = ?", @site.id).order(:name).all.each do |bt| %>
|
14
|
+
<tr id="bt_<%= bt.id %>">
|
15
|
+
<td align='center'><input type='checkbox' name='block_type_id_<%= bt.id %>' checked='true' onclick="toggle_block_type_site_membership(<%= @site.id %>, <%= bt.id %>, $(this).prop('checked'));" /></td>
|
14
16
|
<td><%= bt.name %></td>
|
15
17
|
<td><%= bt.description %></td>
|
16
18
|
<td>
|
17
|
-
|
19
|
+
|
18
20
|
<% btsm = @site.block_type_site_memberships.where(:block_type_id => bt.id).first %>
|
19
21
|
<a style="margin-right:5px;" href="/admin/block-type-site-memberships/<%= btsm.id %>/html" class="caboose-btn">Custom Render Function</a>
|
20
22
|
<% if @site.theme %>
|
21
23
|
<a href="/admin/block-type-site-memberships/<%= btsm.id %>/css" class="caboose-btn">Custom SCSS</a>
|
22
24
|
<% end %>
|
23
|
-
|
25
|
+
|
24
26
|
</td>
|
25
27
|
</tr>
|
28
|
+
<% seen_btids << bt.id %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% Caboose::BlockType.where(:parent_id => nil).where("id not in (?)", seen_btids).order(:name).all.each do |bt| %>
|
32
|
+
<tr id="bt_<%= bt.id %>">
|
33
|
+
<td align='center'><input type='checkbox' name='block_type_id_<%= bt.id %>' onclick="toggle_block_type_site_membership(<%= @site.id %>, <%= bt.id %>, $(this).prop('checked'));" /></td>
|
34
|
+
<td><%= bt.name %></td>
|
35
|
+
<td><%= bt.description %></td>
|
36
|
+
<td> </td>
|
37
|
+
</tr>
|
26
38
|
<% end %>
|
39
|
+
|
40
|
+
|
27
41
|
</table><br/>
|
28
42
|
</div>
|
29
43
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<% content_for :caboose_js do %>
|
2
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<h1 id='page_title'>Edit Code</h1>
|
6
|
+
<ul id='tabs'>
|
7
|
+
<%
|
8
|
+
tabs = {
|
9
|
+
'Custom CSS' => "/admin/custom-css",
|
10
|
+
'Custom JS' => "/admin/custom-js",
|
11
|
+
'Embedded HTML' => "/admin/code"
|
12
|
+
}
|
13
|
+
|
14
|
+
%>
|
15
|
+
<% tabs.each do |text, href| %>
|
16
|
+
<li<%= raw request.fullpath == href ? " class='selected'" : '' %>><a href='<%= href %>'><%= raw text %></a></li>
|
17
|
+
<% end %>
|
18
|
+
<% if @site.is_master %>
|
19
|
+
<li class="back"><input type="button" onclick="window.location='/admin/sites';" value="< Back" />
|
20
|
+
<% else %>
|
21
|
+
<li class="back"><input type="button" onclick="window.location='/admin';" value="< Back" />
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
<div id='content2'>
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
<h5 style="margin:0;font-size:18px;">Embedded HTML</h5>
|
29
|
+
|
30
|
+
<p><div id='site_<%= @site.id %>_head_code'></div></p>
|
31
|
+
<p><div id='site_<%= @site.id %>_body_open_code'></div></p>
|
32
|
+
<p><div id='site_<%= @site.id %>_body_close_code'></div></p>
|
33
|
+
|
34
|
+
<br style='clear: left; line-height: 0;' />
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<% content_for :caboose_css do %>
|
38
|
+
<style>
|
39
|
+
textarea {
|
40
|
+
font-family: monospace;
|
41
|
+
font-size: 13px;
|
42
|
+
line-height: 18px;
|
43
|
+
}
|
44
|
+
</style>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<% content_for :caboose_js do %>
|
48
|
+
<script type="text/javascript">
|
49
|
+
|
50
|
+
$(document).ready(function() {
|
51
|
+
new ModelBinder({
|
52
|
+
name: 'Site',
|
53
|
+
id: <%= @site.id %>,
|
54
|
+
update_url: '/admin/sites/<%= @site.id %>',
|
55
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
56
|
+
attributes: [
|
57
|
+
{ name: 'head_code', nice_name: 'Code for <head>', type: 'textarea', value: <%== Caboose.json(@site.head_code.blank? ? '' : @site.head_code.gsub('</script>','<end/script>')) %>, width: 600, height: 300 },
|
58
|
+
{ name: 'body_open_code', nice_name: 'Code for after <body>', type: 'textarea', value: <%== Caboose.json(@site.body_open_code.blank? ? '' : @site.body_open_code.gsub('</script>','<end/script>')) %>, width: 600, height: 300 },
|
59
|
+
{ name: 'body_close_code', nice_name: 'Code for before </body>', type: 'textarea', value: <%== Caboose.json(@site.body_close_code.blank? ? '' : @site.body_close_code.gsub('</script>','<end/script>')) %>, width: 600, height: 300 }
|
60
|
+
]
|
61
|
+
});
|
62
|
+
});
|
63
|
+
</script>
|
64
|
+
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= render :partial => 'caboose/sites/admin_header' %>
|
2
1
|
|
3
|
-
|
2
|
+
|
3
|
+
<h1>Contact Information</h1>
|
4
4
|
|
5
5
|
<p><div id='site_<%= @site.id %>_main_phone'></div></p>
|
6
6
|
<p><div id='site_<%= @site.id %>_alt_phone'></div></p>
|
@@ -12,10 +12,11 @@
|
|
12
12
|
<p><div id='site_<%= @site.id %>_fax'></div></p>
|
13
13
|
<p><div id='site_<%= @site.id %>_contact_email'></div></p>
|
14
14
|
|
15
|
-
|
15
|
+
<a href="/admin" class="caboose-btn">Back</a>
|
16
16
|
|
17
17
|
|
18
18
|
<% content_for :caboose_js do %>
|
19
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
19
20
|
<script type="text/javascript">
|
20
21
|
|
21
22
|
$(document).ready(function() {
|
@@ -1,10 +1,33 @@
|
|
1
|
+
<% content_for :caboose_js do %>
|
2
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<h1 id='page_title'>Edit Code</h1>
|
6
|
+
<ul id='tabs'>
|
7
|
+
<%
|
8
|
+
tabs = {
|
9
|
+
'Custom CSS' => "/admin/custom-css",
|
10
|
+
'Custom JS' => "/admin/custom-js",
|
11
|
+
'Embedded HTML' => "/admin/code"
|
12
|
+
}
|
1
13
|
|
2
|
-
|
14
|
+
%>
|
15
|
+
<% tabs.each do |text, href| %>
|
16
|
+
<li<%= raw request.fullpath == href ? " class='selected'" : '' %>><a href='<%= href %>'><%= raw text %></a></li>
|
17
|
+
<% end %>
|
18
|
+
<% if @site.is_master %>
|
19
|
+
<li class="back"><input type="button" onclick="window.location='/admin/sites';" value="< Back" />
|
20
|
+
<% else %>
|
21
|
+
<li class="back"><input type="button" onclick="window.location='/admin';" value="< Back" />
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
<div id='content2'>
|
3
25
|
|
4
26
|
<div class="editor-wrapper">
|
5
27
|
|
6
28
|
<div class="holder">
|
7
29
|
<div class="clearfix buttons">
|
30
|
+
<p class="warning">WARNING: This code will apply to the entire website. Edit with caution.</p>
|
8
31
|
<a href="#" onclick="save();return false;" class="caboose-btn green">Save</a>
|
9
32
|
<span id="modified">Modified</span>
|
10
33
|
<div id="message"></div>
|
@@ -19,6 +42,12 @@
|
|
19
42
|
|
20
43
|
<% content_for :caboose_css do %>
|
21
44
|
<style>
|
45
|
+
p.warning {
|
46
|
+
color: #d43030;
|
47
|
+
font-size: 14px;
|
48
|
+
font-weight: bold;
|
49
|
+
margin: 0 0 8px 0;
|
50
|
+
}
|
22
51
|
p#tips {
|
23
52
|
display: inline-block;
|
24
53
|
float: right;
|
@@ -118,4 +147,5 @@ span#modified {
|
|
118
147
|
<% end %>
|
119
148
|
|
120
149
|
|
121
|
-
|
150
|
+
<br style='clear: left; line-height: 0;' />
|
151
|
+
</div><!-- modal_content2 -->
|
@@ -1,10 +1,33 @@
|
|
1
|
+
<% content_for :caboose_js do %>
|
2
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
3
|
+
<% end %>
|
1
4
|
|
2
|
-
|
5
|
+
<h1 id='page_title'>Edit Code</h1>
|
6
|
+
<ul id='tabs'>
|
7
|
+
<%
|
8
|
+
tabs = {
|
9
|
+
'Custom CSS' => "/admin/custom-css",
|
10
|
+
'Custom JS' => "/admin/custom-js",
|
11
|
+
'Embedded HTML' => "/admin/code"
|
12
|
+
}
|
3
13
|
|
14
|
+
%>
|
15
|
+
<% tabs.each do |text, href| %>
|
16
|
+
<li<%= raw request.fullpath == href ? " class='selected'" : '' %>><a href='<%= href %>'><%= raw text %></a></li>
|
17
|
+
<% end %>
|
18
|
+
<% if @site.is_master %>
|
19
|
+
<li class="back"><input type="button" onclick="window.location='/admin/sites';" value="< Back" />
|
20
|
+
<% else %>
|
21
|
+
<li class="back"><input type="button" onclick="window.location='/admin';" value="< Back" />
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
<div id='content2'>
|
25
|
+
|
4
26
|
<div class="editor-wrapper">
|
5
27
|
|
6
28
|
<div class="holder">
|
7
29
|
<div class="clearfix buttons">
|
30
|
+
<p class="warning">WARNING: This code will apply to the entire website. Edit with caution.</p>
|
8
31
|
<a href="#" onclick="save();return false;" class="caboose-btn green">Save</a>
|
9
32
|
<span id="modified">Modified</span>
|
10
33
|
<div id="message"></div>
|
@@ -19,6 +42,12 @@
|
|
19
42
|
|
20
43
|
<% content_for :caboose_css do %>
|
21
44
|
<style>
|
45
|
+
p.warning {
|
46
|
+
color: #d43030;
|
47
|
+
font-size: 14px;
|
48
|
+
font-weight: bold;
|
49
|
+
margin: 0 0 8px 0;
|
50
|
+
}
|
22
51
|
p#tips {
|
23
52
|
display: inline-block;
|
24
53
|
float: right;
|
@@ -117,6 +146,6 @@ span#modified {
|
|
117
146
|
</script>
|
118
147
|
<% end %>
|
119
148
|
|
120
|
-
|
121
|
-
|
149
|
+
<br style='clear: left; line-height: 0;' />
|
150
|
+
</div><!-- modal_content2 -->
|
122
151
|
|
data/lib/caboose/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.215
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -1169,6 +1169,7 @@ files:
|
|
1169
1169
|
- app/views/caboose/sites/admin_delete_form.html.erb
|
1170
1170
|
- app/views/caboose/sites/admin_edit.html.erb
|
1171
1171
|
- app/views/caboose/sites/admin_edit_block_types.html.erb
|
1172
|
+
- app/views/caboose/sites/admin_edit_code.html.erb
|
1172
1173
|
- app/views/caboose/sites/admin_edit_codes.html.erb
|
1173
1174
|
- app/views/caboose/sites/admin_edit_contact.html.erb
|
1174
1175
|
- app/views/caboose/sites/admin_edit_css.html.erb
|