caboose-cms 0.4.124 → 0.4.125
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/controllers/caboose/domains_controller.rb +64 -0
- data/app/controllers/caboose/pages_controller.rb +13 -1
- data/app/controllers/caboose/sites_controller.rb +40 -39
- data/app/models/caboose/domain.rb +1 -1
- data/app/models/caboose/page.rb +1 -1
- data/app/models/caboose/schema.rb +7 -5
- data/app/models/caboose/site.rb +1 -1
- data/app/views/caboose/application/under_construction.html.erb +15 -0
- data/app/views/caboose/blocks/admin_edit.html.erb +2 -2
- data/app/views/caboose/blocks/{admin_edit_richtext.html.erb → admin_edit_richtextold.html.erb} +2 -2
- data/app/views/caboose/posts/admin_edit_content.html.erb +2 -2
- data/app/views/caboose/sites/admin_edit.html.erb +17 -4
- data/config/routes.rb +4 -4
- data/lib/caboose/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzY3YzUzMzFlMjA4YjNkM2VjMmU4NjY1ZmY4YmE1ZjYyZGI1NjAyNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjQ2ODg1Njk5YjExMTIxYzBmNzE5NjQ3ZTFmZTM4OGJjOWQ2NGRmZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWUxNTkyYmM1NGQ1MjNmYjM1MWU5MmFmY2M5MWNlZDJlYjk4YzI1ZDdiZjQ5
|
10
|
+
MGYwNGZlNDRkMWNmNjY3NTZjNDY4ZTBiNjI3NmUyZTBmNzEzYmIwMWIzNzAy
|
11
|
+
OGI2ODdiMDQxODEyMmE1NmM5YmJiNmRhMjZjNzk2Mjc4YzdlMGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDE1ZmQ5NmRmNWMzNTA3NDRiNzZlNzMyNTM4YTQwNTk0YzNhYmFhZDgyZTA5
|
14
|
+
ODU2NjY2NjIyM2MxZWYzNzNjOWM4MDg3NTVhNzVjODAyYmEyMWY5MzAxNDEw
|
15
|
+
N2Y3MTBhN2VhOWYzOTdkOTYzYWU2YzI1ZmQyNWQwNzNiZGQwMTk=
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Caboose
|
4
|
+
class DomainsController < ApplicationController
|
5
|
+
layout 'caboose/admin'
|
6
|
+
|
7
|
+
def before_action
|
8
|
+
@page = Page.page_with_uri(request.host_with_port, '/admin')
|
9
|
+
end
|
10
|
+
|
11
|
+
# POST /admin/sites/:site_id/domains
|
12
|
+
def admin_add
|
13
|
+
return if !user_is_allowed('domains', 'edit')
|
14
|
+
|
15
|
+
resp = Caboose::StdClass.new
|
16
|
+
d = Domain.where(:domain => params[:domain]).first
|
17
|
+
|
18
|
+
if d && d.site_id != params[:site_id]
|
19
|
+
resp.error = "That domain is already associated with another site."
|
20
|
+
elsif d && d.site_id == params[:site_id]
|
21
|
+
resp.refresh = true
|
22
|
+
elsif d.nil?
|
23
|
+
primary = Domain.where(:site_id => params[:site_id]).count == 0
|
24
|
+
d = Domain.create(:site_id => params[:site_id], :domain => params[:domain], :primary => primary)
|
25
|
+
resp.refresh = true
|
26
|
+
end
|
27
|
+
render :json => resp
|
28
|
+
end
|
29
|
+
|
30
|
+
# PUT /admin/sites/:site_id/domains/:id
|
31
|
+
def admin_update
|
32
|
+
return if !user_is_allowed('domains', 'edit')
|
33
|
+
|
34
|
+
resp = StdClass.new
|
35
|
+
d = Domain.find(params[:id])
|
36
|
+
|
37
|
+
save = true
|
38
|
+
params.each do |name,value|
|
39
|
+
case name
|
40
|
+
when 'site_id' then d.site_id = value
|
41
|
+
when 'domain' then d.domain = value
|
42
|
+
when 'under_construction' then d.under_construction = value
|
43
|
+
when 'primary' then
|
44
|
+
d.primary = value
|
45
|
+
Domain.where(:site_id => params[:site_id]).all.each do |d2|
|
46
|
+
d2.primary = d2.id == d.id ? true : false
|
47
|
+
d2.save
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
resp.success = save && d.save
|
53
|
+
render :json => resp
|
54
|
+
end
|
55
|
+
|
56
|
+
# DELETE /admin/sites/:site_id/domains/:id
|
57
|
+
def admin_delete
|
58
|
+
return if !user_is_allowed('sites', 'delete')
|
59
|
+
Domain.find(params[:id]).destroy
|
60
|
+
render :json => { 'redirect' => "/admin/sites/#{params[:site_id]}" }
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -13,8 +13,20 @@ module Caboose
|
|
13
13
|
|
14
14
|
# Find the page with an exact URI match
|
15
15
|
page = Page.page_with_uri(request.host_with_port, request.fullpath, false)
|
16
|
-
|
16
|
+
|
17
17
|
if (!page)
|
18
|
+
|
19
|
+
# Make sure we're not under construction
|
20
|
+
d = Caboose::Domain.where(:domain => request.host_with_port).first
|
21
|
+
if d.under_construction == true
|
22
|
+
if d.site.under_construction_html && d.site.under_construction_html.strip.length > 0
|
23
|
+
render :text => d.site.under_construction_html
|
24
|
+
else
|
25
|
+
render :file => 'caboose/application/under_construction', :layout => false
|
26
|
+
end
|
27
|
+
return
|
28
|
+
end
|
29
|
+
|
18
30
|
asset
|
19
31
|
return
|
20
32
|
end
|
@@ -64,8 +64,9 @@ module Caboose
|
|
64
64
|
save = true
|
65
65
|
params.each do |name,value|
|
66
66
|
case name
|
67
|
-
when 'name'
|
68
|
-
when 'description'
|
67
|
+
when 'name' then site.name = value
|
68
|
+
when 'description' then site.description = value
|
69
|
+
when 'under_construction_html' then site.under_construction_html = value
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
@@ -103,47 +104,47 @@ module Caboose
|
|
103
104
|
end
|
104
105
|
|
105
106
|
# POST /admin/sites/:id/domains
|
106
|
-
def admin_add_domain
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
107
|
+
#def admin_add_domain
|
108
|
+
# return if !user_is_allowed('sites', 'edit')
|
109
|
+
#
|
110
|
+
# resp = Caboose::StdClass.new
|
111
|
+
# d = Domain.where(:domain => params[:domain]).first
|
112
|
+
#
|
113
|
+
# if d && d.site_id != params[:id]
|
114
|
+
# resp.error = "That domain is already associated with another site."
|
115
|
+
# elsif d && d.site_id == params[:id]
|
116
|
+
# resp.refresh = true
|
117
|
+
# elsif d.nil?
|
118
|
+
# primary = Domain.where(:site_id => params[:id]).count == 0
|
119
|
+
# d = Domain.create(:site_id => params[:id], :domain => params[:domain], :primary => primary)
|
120
|
+
# resp.refresh = true
|
121
|
+
# end
|
122
|
+
# render :json => resp
|
123
|
+
#end
|
123
124
|
|
124
125
|
# PUT /admin/sites/:id/domains/:domain_id/set-primary
|
125
|
-
def admin_set_primary_domain
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
end
|
126
|
+
#def admin_set_primary_domain
|
127
|
+
# return if !user_is_allowed('sites', 'edit')
|
128
|
+
#
|
129
|
+
# domain_id = params[:domain_id].to_i
|
130
|
+
# Domain.where(:site_id => params[:id]).all.each do |d|
|
131
|
+
# d.primary = d.id == domain_id ? true : false
|
132
|
+
# d.save
|
133
|
+
# end
|
134
|
+
# render :json => true
|
135
|
+
#end
|
135
136
|
|
136
137
|
# DELETE /admin/sites/:id/domains/:domain_id
|
137
|
-
def admin_remove_domain
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
end
|
138
|
+
#def admin_remove_domain
|
139
|
+
# return if !user_is_allowed('sites', 'edit')
|
140
|
+
# Domain.find(params[:domain_id]).destroy
|
141
|
+
# if Domain.where(:site_id => params[:id]).count == 1
|
142
|
+
# d = Domain.where(:site_id => params[:id]).first
|
143
|
+
# d.primary = true
|
144
|
+
# d.save
|
145
|
+
# end
|
146
|
+
# render :json => { 'refresh' => true }
|
147
|
+
#end
|
147
148
|
|
148
149
|
# GET /admin/sites/options
|
149
150
|
def options
|
data/app/models/caboose/page.rb
CHANGED
@@ -67,7 +67,7 @@ class Caboose::Page < ActiveRecord::Base
|
|
67
67
|
def self.page_with_uri(host_with_port, uri, get_closest_parent = true)
|
68
68
|
|
69
69
|
d = Caboose::Domain.where(:domain => host_with_port).first
|
70
|
-
return false if d.nil?
|
70
|
+
return false if d.nil? || d.under_construction == true
|
71
71
|
site_id = d.site_id
|
72
72
|
|
73
73
|
uri = uri.to_s.gsub(/^(.*?)\?.*?$/, '\1')
|
@@ -181,9 +181,10 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
181
181
|
[ :updated_at , :datetime , :null => true ]
|
182
182
|
],
|
183
183
|
Caboose::Domain => [
|
184
|
-
[ :site_id
|
185
|
-
[ :domain
|
186
|
-
[ :primary
|
184
|
+
[ :site_id , :integer ],
|
185
|
+
[ :domain , :string ],
|
186
|
+
[ :primary , :boolean, { :default => false }],
|
187
|
+
[ :under_construction , :boolean, { :default => false }]
|
187
188
|
],
|
188
189
|
Caboose::MediaCategory => [
|
189
190
|
[ :parent_id , :integer ],
|
@@ -280,8 +281,9 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
280
281
|
[ :value , :text ]
|
281
282
|
],
|
282
283
|
Caboose::Site => [
|
283
|
-
[ :name
|
284
|
-
[ :description
|
284
|
+
[ :name , :string ],
|
285
|
+
[ :description , :text ],
|
286
|
+
[ :under_construction_html , :text ]
|
285
287
|
],
|
286
288
|
Caboose::SiteMembership => [
|
287
289
|
[ :site_id , :integer ],
|
data/app/models/caboose/site.rb
CHANGED
@@ -5,7 +5,7 @@ class Caboose::Site < ActiveRecord::Base
|
|
5
5
|
has_many :site_memberships, :class_name => 'Caboose::SiteMembership', :dependent => :delete_all
|
6
6
|
has_many :domains, :class_name => 'Caboose::Domain', :dependent => :delete_all
|
7
7
|
has_many :post_categories, :class_name => 'Caboose::PostCategory'
|
8
|
-
attr_accessible :id, :name, :description
|
8
|
+
attr_accessible :id, :name, :description, :under_construction_html
|
9
9
|
|
10
10
|
def smtp_config
|
11
11
|
c = Caboose::SmtpConfig.where(:site_id => self.id).first
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Under Construction</title>
|
5
|
+
<style type='text/css'>
|
6
|
+
body { margin: 0; padding: 0; text-align: center; }
|
7
|
+
#container { font-size: 24pt; }
|
8
|
+
</style>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="container">
|
12
|
+
<p>We apologize for the inconvenience, but we're in the process of upgrading our site. We'll be finished very soon!</p>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -123,9 +123,9 @@ $(document).ready(function() {
|
|
123
123
|
});
|
124
124
|
|
125
125
|
</script>
|
126
|
-
<% if @block.block_type.field_type == 'richtext' %>
|
126
|
+
<% if @block.block_type.field_type == 'richtext' %>
|
127
127
|
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
|
128
|
-
<%=
|
128
|
+
<%= raw caboose_tinymce %>
|
129
129
|
<% end %>
|
130
130
|
|
131
131
|
<% end %>
|
@@ -27,6 +27,6 @@ $(window).load(function() {
|
|
27
27
|
});
|
28
28
|
|
29
29
|
</script>
|
30
|
-
|
31
|
-
<%= tinymce :caboose, 'width' => '575px', 'height' => '240px' %>
|
30
|
+
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
|
31
|
+
<%= tinymce :caboose, 'width' => '575px', 'height' => '240px' %>
|
32
32
|
<% end %>
|
@@ -9,6 +9,7 @@ user_ids = [] if user_ids.nil?
|
|
9
9
|
|
10
10
|
<p><div id='site_<%= @site.id %>_name' ></div></p>
|
11
11
|
<p><div id='site_<%= @site.id %>_description' ></div></p>
|
12
|
+
<p><div id='site_<%= @site.id %>_under_construction_html' ></div></p>
|
12
13
|
|
13
14
|
<h2>Domains</h2>
|
14
15
|
<p><a href='#' onclick="add_domain(<%= @site.id %>);">New Domain</a></p>
|
@@ -18,13 +19,15 @@ user_ids = [] if user_ids.nil?
|
|
18
19
|
<tr>
|
19
20
|
<th>Domain</th>
|
20
21
|
<th>Primary</th>
|
22
|
+
<th>Under Construction</th>
|
21
23
|
<th>Delete</th>
|
22
24
|
</tr>
|
23
25
|
<% @site.domains.all.each do |d| %>
|
24
26
|
<tr>
|
25
27
|
<td><%= d.domain %></td>
|
26
|
-
<td align='center'><input type='radio'
|
27
|
-
<td align='center'><input type='
|
28
|
+
<td align='center'><input type='radio' name='primary_domain' <%= d.primary? ? "checked='true'" : '' %> onclick="set_primary_domain(<%= s.id %>, <%= d.id %>);" /></td>
|
29
|
+
<td align='center'><input type='checkbox' name='under_construction_<%= d.id %>' <%= d.under_construction ? "checked='true'" : '' %> onclick="set_under_construction(<%= s.id %>, <%= d.id %>, $(this).prop('checked'));" /></td>
|
30
|
+
<td align='center'><input type='button' value='Delete' onclick="delete_domain(<%= @site.id %>, <%= d.id %>);" /></td>
|
28
31
|
</tr>
|
29
32
|
<% end %>
|
30
33
|
</table>
|
@@ -71,8 +74,9 @@ $(document).ready(function() {
|
|
71
74
|
update_url: '/admin/sites/<%= @site.id %>',
|
72
75
|
authenticity_token: '<%= form_authenticity_token %>',
|
73
76
|
attributes: [
|
74
|
-
{ name: 'name'
|
75
|
-
{ name: 'description'
|
77
|
+
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@site.name) %>, width: 400 },
|
78
|
+
{ name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(@site.description) %>, width: 600, height: 75 },
|
79
|
+
{ name: 'under_construction_html' , nice_name: 'Under Construction HTML' , type: 'textarea' , value: <%= raw Caboose.json(@site.under_construction_html) %>, width: 600, height: 75 }
|
76
80
|
]
|
77
81
|
});
|
78
82
|
});
|
@@ -99,6 +103,15 @@ function delete_site(site_id, confirm)
|
|
99
103
|
});
|
100
104
|
}
|
101
105
|
|
106
|
+
function set_under_construction(site_id, domain_id, checked)
|
107
|
+
{
|
108
|
+
$.ajax({
|
109
|
+
url: '/admin/sites/' + site_id + '/domains/' + domain_id,
|
110
|
+
type: 'put',
|
111
|
+
data: { under_construction: checked ? 1 : 0 }
|
112
|
+
});
|
113
|
+
}
|
114
|
+
|
102
115
|
function add_site_membership(site_id, user_id, role)
|
103
116
|
{
|
104
117
|
$.ajax({
|
data/config/routes.rb
CHANGED
@@ -23,10 +23,10 @@ Caboose::Engine.routes.draw do
|
|
23
23
|
|
24
24
|
post "admin/sites/:id/members" => "sites#admin_add_member"
|
25
25
|
delete "admin/sites/:id/members/:user_id" => "sites#admin_remove_member"
|
26
|
-
|
27
|
-
post "admin/sites/:
|
28
|
-
put "admin/sites/:
|
29
|
-
delete "admin/sites/:
|
26
|
+
|
27
|
+
post "admin/sites/:site_id/domains" => "domains#admin_add"
|
28
|
+
put "admin/sites/:site_id/domains/:id" => "domains#admin_update"
|
29
|
+
delete "admin/sites/:site_id/domains/:id" => "domains#admin_delete"
|
30
30
|
|
31
31
|
get "admin/sites/options" => "sites#options"
|
32
32
|
get "admin/sites" => "sites#admin_index"
|
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.4.
|
4
|
+
version: 0.4.125
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- app/controllers/caboose/block_types_controller.rb
|
272
272
|
- app/controllers/caboose/blocks_controller.rb
|
273
273
|
- app/controllers/caboose/calendars_controller.rb
|
274
|
+
- app/controllers/caboose/domains_controller.rb
|
274
275
|
- app/controllers/caboose/event_groups_controller.rb
|
275
276
|
- app/controllers/caboose/events_controller.rb
|
276
277
|
- app/controllers/caboose/images_controller.rb
|
@@ -349,6 +350,7 @@ files:
|
|
349
350
|
- app/views/caboose/ab_variants/admin_new.html.erb
|
350
351
|
- app/views/caboose/admin/index.html.erb
|
351
352
|
- app/views/caboose/application/show.html.erb
|
353
|
+
- app/views/caboose/application/under_construction.html.erb
|
352
354
|
- app/views/caboose/block_type_sources/admin_edit.html.erb
|
353
355
|
- app/views/caboose/block_type_sources/admin_index.html.erb
|
354
356
|
- app/views/caboose/block_type_sources/admin_new.html.erb
|
@@ -393,7 +395,7 @@ files:
|
|
393
395
|
- app/views/caboose/blocks/admin_edit_h5.html.erb
|
394
396
|
- app/views/caboose/blocks/admin_edit_h6.html.erb
|
395
397
|
- app/views/caboose/blocks/admin_edit_heading.html
|
396
|
-
- app/views/caboose/blocks/
|
398
|
+
- app/views/caboose/blocks/admin_edit_richtextold.html.erb
|
397
399
|
- app/views/caboose/blocks/admin_new.html.erb
|
398
400
|
- app/views/caboose/blocks/admin_render_second_level.json.erb
|
399
401
|
- app/views/caboose/calendars/admin_edit.html.erb
|