caboose-cms 0.8.39 → 0.8.40
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22b48d7ce6d1545a3e67e1fa703b71738911a7e3
|
4
|
+
data.tar.gz: 1817cf46b3229a1f6952fd9827655831547caa00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c020e9dc6acc89b63678f551792d44b393a4771056b126d03d9b9952bbf57b8f0c4b4b8154032a8ecc6ace54e868ac4b22d4dc663c8e76b2bffed5582c856ac9
|
7
|
+
data.tar.gz: 6198d93c11ec8cbcc22984d2c65519de2b649207616072a26cc9961291525e1c2899af98da61bed77b5b7d4d5db90c99569d4d9ed7806b5f9c7cd6a0bcad6ef9
|
@@ -7,8 +7,7 @@ module Caboose
|
|
7
7
|
def before_action
|
8
8
|
@page = Page.page_with_uri(request.host_with_port, '/admin')
|
9
9
|
end
|
10
|
-
|
11
|
-
# @route_priority 9
|
10
|
+
|
12
11
|
# @route GET /admin/sites
|
13
12
|
def admin_index
|
14
13
|
return if !user_is_allowed('sites', 'view')
|
@@ -30,7 +29,35 @@ module Caboose
|
|
30
29
|
@sites = @pager.items
|
31
30
|
end
|
32
31
|
|
33
|
-
# @
|
32
|
+
# @route GET /admin/sites/json
|
33
|
+
def admin_json
|
34
|
+
return if !user_is_allowed('sites', 'view')
|
35
|
+
h = {
|
36
|
+
'name' => '',
|
37
|
+
'description' => '',
|
38
|
+
'name_like' => '',
|
39
|
+
'description_like' => '',
|
40
|
+
}
|
41
|
+
pager = Caboose::Pager.new(params, h, {
|
42
|
+
'model' => 'Caboose::Site',
|
43
|
+
'sort' => 'name',
|
44
|
+
'desc' => 'false',
|
45
|
+
'base_url' => "/admin/sites",
|
46
|
+
'items_per_page' => 1000
|
47
|
+
})
|
48
|
+
render :json => {
|
49
|
+
:pager => pager,
|
50
|
+
:models => pager.items.as_json(:include => :domains)
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# @route GET /admin/sites/:id/json
|
55
|
+
def admin_json_single
|
56
|
+
return if !user_is_allowed('sites', 'view')
|
57
|
+
site = Site.find(params[:id])
|
58
|
+
render :json => site.as_json(:include => :domains)
|
59
|
+
end
|
60
|
+
|
34
61
|
# @route GET /admin/sites/new
|
35
62
|
def admin_new
|
36
63
|
return if !user_is_allowed('sites', 'add')
|
@@ -41,22 +68,9 @@ module Caboose
|
|
41
68
|
|
42
69
|
@site = Site.new
|
43
70
|
end
|
71
|
+
|
44
72
|
|
45
|
-
# @route_priority 8
|
46
|
-
# @route GET /admin/sites/:id
|
47
|
-
def admin_edit
|
48
|
-
return if !user_is_allowed('sites', 'edit')
|
49
|
-
if !@site.is_master
|
50
|
-
@error = "You are not allowed to manage sites."
|
51
|
-
render :file => 'caboose/extras/error' and return
|
52
|
-
end
|
53
|
-
|
54
|
-
@site = Site.find(params[:id])
|
55
|
-
@site.init_users_and_roles
|
56
73
|
|
57
|
-
end
|
58
|
-
|
59
|
-
# @route_priority 6
|
60
74
|
# @route GET /admin/sites/:id/block-types
|
61
75
|
def admin_edit_block_types
|
62
76
|
return if !user_is_allowed('sites', 'edit')
|
@@ -67,8 +81,7 @@ module Caboose
|
|
67
81
|
|
68
82
|
@site = Site.find(params[:id])
|
69
83
|
end
|
70
|
-
|
71
|
-
# @route_priority 4
|
84
|
+
|
72
85
|
# @route GET /admin/sites/:id/css
|
73
86
|
def admin_edit_css
|
74
87
|
return if !user_is_allowed('sites', 'edit')
|
@@ -78,8 +91,7 @@ module Caboose
|
|
78
91
|
end
|
79
92
|
@site = Site.find(params[:id])
|
80
93
|
end
|
81
|
-
|
82
|
-
# @route_priority 5
|
94
|
+
|
83
95
|
# @route GET /admin/sites/:id/js
|
84
96
|
def admin_edit_js
|
85
97
|
return if !user_is_allowed('sites', 'edit')
|
@@ -89,8 +101,7 @@ module Caboose
|
|
89
101
|
end
|
90
102
|
@site = Site.find(params[:id])
|
91
103
|
end
|
92
|
-
|
93
|
-
# @route_priority 7
|
104
|
+
|
94
105
|
# @route GET /admin/sites/:id/delete
|
95
106
|
def admin_delete_form
|
96
107
|
return if !user_is_allowed('sites', 'edit')
|
@@ -101,7 +112,19 @@ module Caboose
|
|
101
112
|
@site = Site.find(params[:id])
|
102
113
|
end
|
103
114
|
|
104
|
-
# @
|
115
|
+
# @route GET /admin/sites/:id
|
116
|
+
def admin_edit
|
117
|
+
return if !user_is_allowed('sites', 'edit')
|
118
|
+
if !@site.is_master
|
119
|
+
@error = "You are not allowed to manage sites."
|
120
|
+
render :file => 'caboose/extras/error' and return
|
121
|
+
end
|
122
|
+
|
123
|
+
@site = Site.find(params[:id])
|
124
|
+
@site.init_users_and_roles
|
125
|
+
|
126
|
+
end
|
127
|
+
|
105
128
|
# @route POST /admin/sites
|
106
129
|
def admin_add
|
107
130
|
return if !user_is_allowed('sites', 'add')
|
@@ -203,25 +226,23 @@ module Caboose
|
|
203
226
|
|
204
227
|
# @route_priority 1
|
205
228
|
# @route GET /admin/sites/options
|
229
|
+
# @route GET /admin/sites/:field-options
|
230
|
+
# @route GET /admin/sites/:id/:field-options
|
206
231
|
def options
|
207
232
|
return if !user_is_allowed('sites', 'view')
|
208
|
-
render :json => { :error => "You are not allowed to manage sites." } and return if !logged_in_user.is_super_admin?
|
209
233
|
|
210
|
-
|
234
|
+
case params[:field]
|
235
|
+
when nil
|
236
|
+
options = logged_in_user.is_super_admin? ? Site.reorder('name').all.collect { |s| { 'value' => s.id, 'text' => s.name }} : []
|
237
|
+
when 'default-layout'
|
238
|
+
cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id }
|
239
|
+
block_types = Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, params[:id]).reorder(:description).all
|
240
|
+
options = block_types.collect do |bt|
|
241
|
+
{ 'value' => bt.id, 'text' => bt.description }
|
242
|
+
end
|
243
|
+
end
|
211
244
|
render :json => options
|
212
245
|
end
|
213
246
|
|
214
|
-
# @route_priority 3
|
215
|
-
# @route GET /admin/sites/:id/default-layout-options
|
216
|
-
def admin_default_layout_options
|
217
|
-
return if !user_is_allowed('sites', 'view')
|
218
|
-
cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id }
|
219
|
-
block_types = Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, params[:id]).reorder(:description).all
|
220
|
-
options = block_types.collect do |bt|
|
221
|
-
{ 'value' => bt.id, 'text' => bt.description }
|
222
|
-
end
|
223
|
-
render :json => options
|
224
|
-
end
|
225
|
-
|
226
247
|
end
|
227
248
|
end
|
data/app/models/caboose/site.rb
CHANGED
@@ -19,7 +19,29 @@ class Caboose::Site < ActiveRecord::Base
|
|
19
19
|
:large => '600x800>'
|
20
20
|
}
|
21
21
|
do_not_validate_attachment_file_type :logo
|
22
|
-
attr_accessible :id,
|
22
|
+
attr_accessible :id ,
|
23
|
+
:name ,
|
24
|
+
:description ,
|
25
|
+
:under_construction_html ,
|
26
|
+
:use_store ,
|
27
|
+
:use_fonts ,
|
28
|
+
:logo ,
|
29
|
+
:is_master ,
|
30
|
+
:allow_self_registration ,
|
31
|
+
:analytics_id ,
|
32
|
+
:use_retargeting ,
|
33
|
+
:date_js_updated ,
|
34
|
+
:date_css_updated ,
|
35
|
+
:default_layout_id ,
|
36
|
+
:login_fail_lock_count
|
37
|
+
|
38
|
+
before_save :validate_presence_of_store_config
|
39
|
+
|
40
|
+
def validate_presence_of_store_config
|
41
|
+
if self.use_store && !Caboose::StoreConfig.where(:site_id => self.id).exists?
|
42
|
+
Caboose::StoreConfig.create(:site_id => self.id)
|
43
|
+
end
|
44
|
+
end
|
23
45
|
|
24
46
|
def default_layout
|
25
47
|
return Caboose::BlockType.where(:id => self.default_layout_id).first if self.default_layout_id
|
@@ -39,6 +39,9 @@ $(document).ready(function() {
|
|
39
39
|
{ name: 'options_function' , sort: 'options_function' , show: false , bulk_edit: false, nice_name: 'Options Function' , type: 'textarea' , value: function(bt) { return bt.options_function; }, width: 400, height: 100 },
|
40
40
|
{ name: 'options' , sort: 'options' , show: false , bulk_edit: false, nice_name: 'Options' , type: 'textarea' , value: function(bt) { return bt.options; }, width: 400, height: 100 }
|
41
41
|
],
|
42
|
+
search_fields: [
|
43
|
+
{ name: 'name_like', nice_name: 'Name', type: 'text', width: 400 }
|
44
|
+
],
|
42
45
|
new_model_text: 'New Block Type',
|
43
46
|
new_model_fields: [
|
44
47
|
{ name: 'name', nice_name: 'Name', type: 'text', width: 400 }
|
@@ -1,31 +1,31 @@
|
|
1
1
|
<h1>Sites</h1>
|
2
2
|
|
3
|
-
<
|
4
|
-
<input type='text' name='name_like' placeholder='Name' />
|
5
|
-
<input type='submit' value='Search' />
|
6
|
-
</form>
|
3
|
+
<div id='sites'></div>
|
7
4
|
|
8
|
-
|
5
|
+
<% content_for :caboose_js do %>
|
6
|
+
<%= javascript_include_tag 'caboose/model/all' %>
|
7
|
+
<script type='text/javascript'>
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
9
|
+
$(document).ready(function() {
|
10
|
+
var that = this;
|
11
|
+
var table = new IndexTable({
|
12
|
+
form_authenticity_token: '<%= form_authenticity_token %>',
|
13
|
+
container: 'sites',
|
14
|
+
base_url: '/admin/sites',
|
15
|
+
fields: [
|
16
|
+
{ name: 'name' , sort: 'name' , show: true , bulk_edit: false, nice_name: 'Name' , type: 'text' , value: function(site) { return site.name; }, width: 400 },
|
17
|
+
{ name: 'description' , sort: 'description' , show: true , bulk_edit: false, nice_name: 'Description' , type: 'text' , value: function(site) { return site.description; }, width: 400 },
|
18
|
+
{ name: 'domains' , sort: 'name, description' , show: true , bulk_edit: false, nice_name: 'Domains' , type: 'text' , value: function(site) { return site.domains ? site.domains.map(function(d) { return d.id }) : []; }, text: function(site) { return site.domains ? site.domains.map(function(d) { return d.domain }).join('<br />') : ''; }, width: 400, height: 200, editable: false }
|
19
|
+
],
|
20
|
+
search_fields: [
|
21
|
+
{ name: 'name_like', nice_name: 'Name', type: 'text', width: 400 }
|
22
|
+
],
|
23
|
+
new_model_text: 'New Site',
|
24
|
+
new_model_fields: [
|
25
|
+
{ name: 'name', nice_name: 'Name', type: 'text', width: 400 }
|
26
|
+
],
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
</script>
|
31
31
|
<% end %>
|
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.8.
|
4
|
+
version: 0.8.40
|
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-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|