caboose-cms 0.2.23 → 0.2.24
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 +8 -8
- data/app/controllers/caboose/pages_controller.rb +277 -217
- data/app/controllers/caboose/roles_controller.rb +8 -8
- data/app/models/caboose/page.rb +2 -1
- data/app/views/caboose/pages/edit.html.erb +52 -8
- data/app/views/caboose/pages/edit_content.html.erb +49 -37
- data/app/views/caboose/pages/edit_css.html.erb +43 -28
- data/app/views/caboose/pages/edit_js.html.erb +42 -27
- data/app/views/caboose/pages/edit_resources.html.erb +41 -0
- data/app/views/caboose/pages/edit_seo.html.erb +6 -4
- data/app/views/caboose/pages/edit_settings.html.erb +6 -4
- data/app/views/caboose/pages/edit_title.html.erb +1 -0
- data/app/views/caboose/pages/show.html.erb +15 -0
- data/app/views/caboose/pages/sitemap.html.erb +4 -4
- data/app/views/caboose/roles/edit.html.erb +45 -4
- data/config/routes.rb +2 -0
- data/config/tinymce.yml +11 -0
- data/lib/caboose/caboose_helper.rb +1 -1
- data/lib/caboose/migration_version.rb +47 -0
- data/lib/caboose/migrations.rb +7 -0
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +75 -12
- metadata +6 -2
@@ -8,7 +8,7 @@ module Caboose
|
|
8
8
|
|
9
9
|
# GET /admin/roles
|
10
10
|
def index
|
11
|
-
return
|
11
|
+
return unless user_is_allowed('roles', 'view')
|
12
12
|
top_roles = Role.tree
|
13
13
|
arr = []
|
14
14
|
top_roles.each { |r| arr += add_role_options(r, 0) }
|
@@ -17,19 +17,19 @@ module Caboose
|
|
17
17
|
|
18
18
|
# GET /admin/roles/new
|
19
19
|
def new
|
20
|
-
return
|
20
|
+
return unless user_is_allowed('roles', 'add')
|
21
21
|
@role = Role.new
|
22
22
|
end
|
23
23
|
|
24
24
|
# GET /admin/roles/1/edit
|
25
25
|
def edit
|
26
|
-
return
|
26
|
+
return unless user_is_allowed('roles', 'edit')
|
27
27
|
@role = Role.find(params[:id])
|
28
28
|
end
|
29
29
|
|
30
30
|
# POST /admin/roles
|
31
31
|
def create
|
32
|
-
return
|
32
|
+
return unless user_is_allowed('roles', 'add')
|
33
33
|
|
34
34
|
resp = StdClass.new({
|
35
35
|
'error' => nil,
|
@@ -47,7 +47,7 @@ module Caboose
|
|
47
47
|
|
48
48
|
# PUT /admin/roles/1
|
49
49
|
def update
|
50
|
-
return
|
50
|
+
return unless user_is_allowed('roles', 'edit')
|
51
51
|
|
52
52
|
resp = StdClass.new
|
53
53
|
role = Role.find(params[:id])
|
@@ -89,7 +89,7 @@ module Caboose
|
|
89
89
|
|
90
90
|
# DELETE /admin/roles/1
|
91
91
|
def destroy
|
92
|
-
return
|
92
|
+
return unless user_is_allowed('roles', 'delete')
|
93
93
|
@role = Role.find(params[:id])
|
94
94
|
@role.destroy
|
95
95
|
render json: { 'redirect' => '/admin/roles' }
|
@@ -97,7 +97,7 @@ module Caboose
|
|
97
97
|
|
98
98
|
# GET /admin/roles/options
|
99
99
|
def options
|
100
|
-
return
|
100
|
+
return unless user_is_allowed('roles', 'view')
|
101
101
|
@top_roles = Role.tree
|
102
102
|
arr = [{
|
103
103
|
"value" => -1,
|
@@ -113,7 +113,7 @@ module Caboose
|
|
113
113
|
"text" => (" - " * level) + role.name
|
114
114
|
}]
|
115
115
|
role.children.each do |kid|
|
116
|
-
arr += add_role_options(kid, level+1)
|
116
|
+
arr += add_role_options(kid, level + 1)
|
117
117
|
end
|
118
118
|
return arr
|
119
119
|
end
|
data/app/models/caboose/page.rb
CHANGED
@@ -1,12 +1,56 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<h1 id='editmode_title_container' ><%= @page.title %></h1>
|
2
|
+
<div id='editmode_content_container' ><%= @page.content == nil || @page.content.length == 0 ? 'No content.' : (raw @page.content) %></div>
|
3
|
+
|
4
|
+
<% content_for :caboose_css do %>
|
5
|
+
<% @resources[:css].each do |r| %>
|
6
|
+
<!--link type='text/css' rel='stylesheet' href="<%= r %>" /-->
|
7
|
+
<%= stylesheet_link_tag r %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<style><%= raw @page.custom_css %></style>
|
11
|
+
<% end %>
|
12
|
+
|
3
13
|
<% content_for :caboose_js do %>
|
4
|
-
<script type='text/javascript'>
|
5
14
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
15
|
+
<% @resources[:js].each do |r| %>
|
16
|
+
<!--script type='text/javascript' src="<%= r %>" ></script-->
|
17
|
+
<%= javascript_include_tag r %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<script type='text/javascript'><%= raw @page.custom_js %></script>
|
10
21
|
|
11
|
-
|
22
|
+
<script type='text/javascript'>
|
23
|
+
$(document).ready(function() {
|
24
|
+
$('#editmode_title_container').click(function() {
|
25
|
+
$.colorbox({
|
26
|
+
href: '/pages/<%= @page.id %>/edit-title',
|
27
|
+
iframe: true,
|
28
|
+
initialWidth: 500,
|
29
|
+
initialHeight: 80,
|
30
|
+
innerWidth: 500,
|
31
|
+
innerHeight: 80,
|
32
|
+
scrolling: false,
|
33
|
+
transition: 'fade',
|
34
|
+
closeButton: false,
|
35
|
+
onComplete: fix_colorbox,
|
36
|
+
opacity: 0.50
|
37
|
+
});
|
38
|
+
});
|
39
|
+
$('#editmode_content_container').click(function() {
|
40
|
+
$.colorbox({
|
41
|
+
href: '/pages/<%= @page.id %>/edit-content',
|
42
|
+
iframe: true,
|
43
|
+
initialWidth: 600,
|
44
|
+
initialHeight: 400,
|
45
|
+
innerWidth: 600,
|
46
|
+
innerHeight: 400,
|
47
|
+
scrolling: false,
|
48
|
+
transition: 'fade',
|
49
|
+
closeButton: false,
|
50
|
+
onComplete: fix_colorbox,
|
51
|
+
opacity: 0.50
|
52
|
+
});
|
53
|
+
});
|
54
|
+
});
|
55
|
+
</script>
|
12
56
|
<% end %>
|
@@ -1,48 +1,60 @@
|
|
1
1
|
|
2
|
-
<
|
2
|
+
<textarea id='page_<%= @page.id %>_content' placeholder='Content' style='width:795px; height:545px;' class='tinymce'><%= raw @page.content %></textarea>
|
3
|
+
<br />
|
3
4
|
<div id='message'></div>
|
4
5
|
<div id='controls'>
|
5
6
|
<input type='button' value='Close' onclick="modal.close();" />
|
6
7
|
<input type='button' value='Update' onclick="updateContent();" />
|
7
8
|
</div>
|
8
9
|
|
9
|
-
<% content_for :
|
10
|
+
<% content_for :caboose_js do %>
|
10
11
|
|
11
|
-
|
12
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
13
|
+
<%= tinymce_assets %>
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<%= javascript_include_tag "tinymce-jquery.js" %>
|
19
|
-
<script type="text/javascript">
|
20
|
-
|
21
|
-
var modal = false;
|
22
|
-
$(document).ready(function() {
|
23
|
-
modal = new CabooseModal(600, 475);
|
24
|
-
});
|
25
|
-
|
26
|
-
function updateContent()
|
27
|
-
{
|
28
|
-
tinymce.triggerSave();
|
29
|
-
$.ajax({
|
30
|
-
url: '/pages/<%= @page.id %>',
|
31
|
-
type: 'put',
|
32
|
-
data: {
|
33
|
-
content: $('#page_<%= @page.id %>_content').val()
|
34
|
-
},
|
35
|
-
success: function(resp) {
|
36
|
-
if (resp.success)
|
37
|
-
{
|
38
|
-
parent.$('#editmode_content_container').html($('#page_<%= @page.id %>_content').val());
|
39
|
-
modal.close();
|
40
|
-
}
|
41
|
-
if (resp.error)
|
42
|
-
modal.autosize("<p class='note success'>" + resp.error + "</p>");
|
43
|
-
}
|
15
|
+
<script type="text/javascript">
|
16
|
+
|
17
|
+
var modal = false;
|
18
|
+
$(document).ready(function() {
|
19
|
+
modal = new CabooseModal(800, 700);
|
44
20
|
});
|
45
|
-
|
46
|
-
|
47
|
-
|
21
|
+
|
22
|
+
function updateContent()
|
23
|
+
{
|
24
|
+
tinymce.triggerSave();
|
25
|
+
|
26
|
+
function log(msg) {
|
27
|
+
setTimeout(function() {
|
28
|
+
throw new Error(msg);
|
29
|
+
}, 0);
|
30
|
+
}
|
31
|
+
// log($('#page_<%= @page.id %>_content').val());
|
32
|
+
|
33
|
+
$.ajax({
|
34
|
+
url: '/pages/<%= @page.id %>',
|
35
|
+
type: 'put',
|
36
|
+
data: {
|
37
|
+
authenticity_token: "<%= form_authenticity_token %>",
|
38
|
+
content: $('#page_<%= @page.id %>_content').val()
|
39
|
+
},
|
40
|
+
success: function(resp) {
|
41
|
+
if (resp.success)
|
42
|
+
{
|
43
|
+
contentVal = $('#page_<%= @page.id %>_content').val();
|
44
|
+
parent.$('#editmode_content_container').html(contentVal == null || contentVal.length == 0 ? 'No content.' : contentVal);
|
45
|
+
modal.close();
|
46
|
+
}
|
47
|
+
if (resp.error)
|
48
|
+
modal.autosize("<p class='note success'>" + resp.error + "</p>");
|
49
|
+
}
|
50
|
+
});
|
51
|
+
}
|
52
|
+
|
53
|
+
</script>
|
54
|
+
<%= tinymce :caboose,
|
55
|
+
width:'795px',
|
56
|
+
height:'545px'
|
57
|
+
# theme_advanced_source_editor_width: '100px',
|
58
|
+
# theme_advanced_source_editor_height: '100px'
|
59
|
+
%>
|
48
60
|
<% end %>
|
@@ -1,36 +1,51 @@
|
|
1
1
|
|
2
2
|
<h1>Page Settings</h1>
|
3
3
|
<div class='top_right_controls'>
|
4
|
-
<input type='button' value='General'
|
5
|
-
<input type='button' value='CSS'
|
6
|
-
<input type='button' value='JS'
|
7
|
-
<input type='button' value='SEO'
|
4
|
+
<input type='button' value='General' onclick="window.location='/pages/<%= @page.id %>/edit-settings';" />
|
5
|
+
<input type='button' value='CSS' onclick="window.location='/pages/<%= @page.id %>/edit-css';" disabled='true' />
|
6
|
+
<input type='button' value='JS' onclick="window.location='/pages/<%= @page.id %>/edit-js';" />
|
7
|
+
<input type='button' value='SEO' onclick="window.location='/pages/<%= @page.id %>/edit-seo';" />
|
8
|
+
<input type='button' value='Resources' onclick="window.location='/pages/<%= @page.id %>/edit-resources';" />
|
8
9
|
</div>
|
9
|
-
|
10
|
-
|
10
|
+
|
11
|
+
<textarea id='page_<%= @page.id %>_custom_css' placeholder='Custom CSS' style='width:795px; height:595px;'><%= raw @page.custom_css %></textarea>
|
12
|
+
<br />
|
13
|
+
<div id='message'></div>
|
14
|
+
<div id='controls'>
|
15
|
+
<input type='button' value='Close' onclick="modal.close();" />
|
16
|
+
<input type='button' value='Update' onclick="updateCustomCSS();" />
|
17
|
+
</div>
|
18
|
+
|
11
19
|
<% content_for :caboose_js do %>
|
12
|
-
<%= javascript_include_tag "caboose/model/all" %>
|
13
|
-
<script type="text/javascript">
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
21
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
22
|
+
<script type="text/javascript">
|
23
|
+
|
24
|
+
var modal = false;
|
25
|
+
$(document).ready(function() {
|
26
|
+
modal = new CabooseModal(800, 700);
|
27
|
+
});
|
28
|
+
|
29
|
+
function updateCustomCSS()
|
30
|
+
{
|
31
|
+
$.ajax({
|
32
|
+
url: '/pages/<%= @page.id %>',
|
33
|
+
type: 'put',
|
34
|
+
data: {
|
35
|
+
authenticity_token: "<%= form_authenticity_token %>",
|
36
|
+
custom_css: $('#page_<%= @page.id %>_custom_css').val()
|
37
|
+
},
|
38
|
+
success: function(resp) {
|
39
|
+
if (resp.success) {
|
40
|
+
contentVal = $('#page_<%= @page.id %>_custom_css').val();
|
41
|
+
// parent.$('#editmode_content_container').html(contentVal == null || contentVal.length == 0 ? 'No content.' : contentVal);
|
42
|
+
modal.close();
|
43
|
+
}
|
44
|
+
if (resp.error)
|
45
|
+
modal.autosize("<p class='note success'>" + resp.error + "</p>");
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
34
49
|
|
35
|
-
</script>
|
50
|
+
</script>
|
36
51
|
<% end %>
|
@@ -1,36 +1,51 @@
|
|
1
1
|
|
2
2
|
<h1>Page Settings</h1>
|
3
3
|
<div class='top_right_controls'>
|
4
|
-
<input type='button' value='General'
|
5
|
-
<input type='button' value='CSS'
|
6
|
-
<input type='button' value='JS'
|
7
|
-
<input type='button' value='SEO'
|
4
|
+
<input type='button' value='General' onclick="window.location='/pages/<%= @page.id %>/edit-settings';" />
|
5
|
+
<input type='button' value='CSS' onclick="window.location='/pages/<%= @page.id %>/edit-css';" />
|
6
|
+
<input type='button' value='JS' onclick="window.location='/pages/<%= @page.id %>/edit-js';" disabled='true' />
|
7
|
+
<input type='button' value='SEO' onclick="window.location='/pages/<%= @page.id %>/edit-seo';" />
|
8
|
+
<input type='button' value='Resources' onclick="window.location='/pages/<%= @page.id %>/edit-resources';" />
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<textarea id='page_<%= @page.id %>_custom_js' placeholder='Custom Javascript' style='width:795px; height:595px;'><%= raw @page.custom_js %></textarea>
|
12
|
+
<br />
|
13
|
+
<div id='message'></div>
|
14
|
+
<div id='controls'>
|
15
|
+
<input type='button' value='Close' onclick="modal.close();" />
|
16
|
+
<input type='button' value='Update' onclick="updateCustomJs();" />
|
8
17
|
</div>
|
9
|
-
<p><div id='page_<%= @page.id %>_custom_js'></div></p>
|
10
18
|
|
11
19
|
<% content_for :caboose_js do %>
|
12
|
-
<%= javascript_include_tag "caboose/model/all" %>
|
13
|
-
<script type="text/javascript">
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
21
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
22
|
+
<script type="text/javascript">
|
23
|
+
|
24
|
+
var modal = false;
|
25
|
+
$(document).ready(function() {
|
26
|
+
modal = new CabooseModal(800, 700);
|
27
|
+
});
|
28
|
+
|
29
|
+
function updateCustomJs()
|
30
|
+
{
|
31
|
+
$.ajax({
|
32
|
+
url: '/pages/<%= @page.id %>',
|
33
|
+
type: 'put',
|
34
|
+
data: {
|
35
|
+
authenticity_token: "<%= form_authenticity_token %>",
|
36
|
+
custom_js: $('#page_<%= @page.id %>_custom_js').val()
|
37
|
+
},
|
38
|
+
success: function(resp) {
|
39
|
+
if (resp.success) {
|
40
|
+
contentVal = $('#page_<%= @page.id %>_custom_js').val();
|
41
|
+
// parent.$('#editmode_content_container').html(contentVal == null || contentVal.length == 0 ? 'No content.' : contentVal);
|
42
|
+
modal.close();
|
43
|
+
}
|
44
|
+
if (resp.error)
|
45
|
+
modal.autosize("<p class='note success'>" + resp.error + "</p>");
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
34
49
|
|
35
|
-
</script>
|
50
|
+
</script>
|
36
51
|
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
<h1>Page Settings</h1>
|
3
|
+
<div class='top_right_controls'>
|
4
|
+
<input type='button' value='General' onclick="window.location='/pages/<%= @page.id %>/edit-settings';" />
|
5
|
+
<input type='button' value='CSS' onclick="window.location='/pages/<%= @page.id %>/edit-css';" />
|
6
|
+
<input type='button' value='JS' onclick="window.location='/pages/<%= @page.id %>/edit-js';" />
|
7
|
+
<input type='button' value='SEO' onclick="window.location='/pages/<%= @page.id %>/edit-seo';" />
|
8
|
+
<input type='button' value='Resources' onclick="window.location='/pages/<%= @page.id %>/edit-resources';" disabled='true' />
|
9
|
+
</div>
|
10
|
+
<p><div id='page_<%= @page.id %>_linked_resources'></div></p>
|
11
|
+
<p>Here you can provide paths to resources to be included in your page, such as css and javascript files.</p>
|
12
|
+
<br />
|
13
|
+
<p>Paths should be given on separate lines</p>
|
14
|
+
|
15
|
+
<% content_for :caboose_js do %>
|
16
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
17
|
+
<script type="text/javascript">
|
18
|
+
|
19
|
+
var modal = false;
|
20
|
+
$(document).ready(function() {
|
21
|
+
m = new ModelBinder({
|
22
|
+
name: 'Page',
|
23
|
+
id: <%= @page.id %>,
|
24
|
+
update_url: '/pages/<%= @page.id %>',
|
25
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
26
|
+
attributes: [
|
27
|
+
{
|
28
|
+
name: 'linked_resources',
|
29
|
+
nice_name: 'Linked Resources',
|
30
|
+
type: 'textarea',
|
31
|
+
width: 580,
|
32
|
+
height: 400,
|
33
|
+
value: <%= raw Caboose.json(@page.linked_resources) %>
|
34
|
+
}
|
35
|
+
]
|
36
|
+
});
|
37
|
+
modal = new CabooseModal(600, 460);
|
38
|
+
});
|
39
|
+
|
40
|
+
</script>
|
41
|
+
<% end %>
|
@@ -1,10 +1,11 @@
|
|
1
1
|
|
2
2
|
<h1>Page Settings</h1>
|
3
3
|
<div class='top_right_controls'>
|
4
|
-
<input type='button' value='General'
|
5
|
-
<input type='button' value='CSS'
|
6
|
-
<input type='button' value='JS'
|
7
|
-
<input type='button' value='SEO'
|
4
|
+
<input type='button' value='General' onclick="window.location='/pages/<%= @page.id %>/edit-settings';" />
|
5
|
+
<input type='button' value='CSS' onclick="window.location='/pages/<%= @page.id %>/edit-css';" />
|
6
|
+
<input type='button' value='JS' onclick="window.location='/pages/<%= @page.id %>/edit-js';" />
|
7
|
+
<input type='button' value='SEO' onclick="window.location='/pages/<%= @page.id %>/edit-seo';" disabled='true' />
|
8
|
+
<input type='button' value='Resources' onclick="window.location='/pages/<%= @page.id %>/edit-resources';" />
|
8
9
|
</div>
|
9
10
|
<p><div id='page_<%= @page.id %>_seo_title'></div></p>
|
10
11
|
<p><div id='page_<%= @page.id %>_meta_description'></div></p>
|
@@ -23,6 +24,7 @@ $(document).ready(function() {
|
|
23
24
|
name: 'Page',
|
24
25
|
id: <%= @page.id %>,
|
25
26
|
update_url: '/pages/<%= @page.id %>',
|
27
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
26
28
|
attributes: [
|
27
29
|
{ name: 'seo_title' , nice_name: 'SEO Title' , type: 'text' , value: <%= raw Caboose.json(@page.seo_title) %>, width: 580 },
|
28
30
|
{ name: 'meta_robots' , nice_name: 'Meta Robots' , type: 'text' , value: <%= raw Caboose.json(@page.meta_robots) %>, width: 580 },
|