caboose-cms 0.2.57 → 0.2.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/stylesheets/caboose/admin.css +46 -0
  3. data/app/assets/stylesheets/caboose/register.css +1 -0
  4. data/app/controllers/caboose/pages_controller.rb +38 -51
  5. data/app/helpers/caboose/pages_helper.rb +25 -0
  6. data/app/models/caboose/page_plugin.rb +1 -1
  7. data/app/views/caboose/pages/_admin_footer.html.erb +2 -0
  8. data/app/views/caboose/pages/_admin_header.html.erb +28 -0
  9. data/app/views/caboose/pages/admin_edit_content.html.erb +30 -0
  10. data/app/views/caboose/pages/admin_edit_css.html.erb +28 -0
  11. data/app/views/caboose/pages/admin_edit_general.html.erb +46 -0
  12. data/app/views/caboose/pages/admin_edit_js.html.erb +28 -0
  13. data/app/views/caboose/pages/{edit_seo.html.erb → admin_edit_seo.html.erb} +3 -8
  14. data/app/views/caboose/pages/admin_index.html.erb +5 -0
  15. data/app/views/caboose/pages/{new.html.erb → admin_new.html.erb} +0 -0
  16. data/app/views/caboose/pages/admin_sitemap.html.erb +6 -0
  17. data/config/routes.rb +16 -18
  18. data/lib/caboose/version.rb +1 -1
  19. data/lib/tasks/caboose.rake +22 -0
  20. metadata +13 -13
  21. data/app/views/caboose/pages/edit.html.erb +0 -56
  22. data/app/views/caboose/pages/edit_content.html.erb +0 -59
  23. data/app/views/caboose/pages/edit_css.html.erb +0 -51
  24. data/app/views/caboose/pages/edit_js.html.erb +0 -51
  25. data/app/views/caboose/pages/edit_resources.html.erb +0 -41
  26. data/app/views/caboose/pages/edit_settings.html.erb +0 -51
  27. data/app/views/caboose/pages/edit_title.html.erb +0 -30
  28. data/app/views/caboose/pages/index.html.erb +0 -33
  29. data/app/views/caboose/pages/sitemap.html.erb +0 -12
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2NmODY1MTQ0YTliMGNiMjZiZDg0YzNhYmY5MTkxMWE2MTMzNDMxYw==
4
+ ZWFjMWM1MDg5OWE2NzQ2OGUwNGE2OTdiZTg5OTE2Y2ZhMDJlNTJkZg==
5
5
  data.tar.gz: !binary |-
6
- YmJhNjY1NDg1MTY1M2Q1YjQxNzZkNjNhZDYyZGU1YmVmZGMyZjM0MQ==
6
+ MDAwNTZkZDY4ODk1NjlmMWMxNGJkZjI4NDhlMGI3OGI5YTYxNDcxMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDdkMzc1N2JiZGZmM2U4YzlkNDhlMzU3OGI0ZTQwZWNkYTA4ZWFhNDIwZGMy
10
- OTBjNTIwNDBhN2JiOTdkZTEzNjczNTRiMjlmNjE2OWYzZTVhMjI4ZWE3NGRk
11
- OWNlOThmMzVhYWY4YWYzYjU1MDc0OGU2YzE2MTAxZGNlZGMxM2M=
9
+ Yjk4YmI4YmRjNWVkNjBkMTExYTVmZmQ0ZWRkNmFkYjJiYWNmMGI4MDE5ZjBh
10
+ NjhiMmFhNjQ5ODk1MjNhOTkzOTEwMTM2Y2VkZTkwNWRmYzI2ZTEzMjM4NmJk
11
+ YzYxZGIwZTdmNjcxYzlmYjA5YjljZWIyYmZlMzY2N2RhY2RiZjg=
12
12
  data.tar.gz: !binary |-
13
- ODZkZTQwZmZkYWU2OTVhMDVkNjExODU2ZmM4NDQ3NDVkOTllMWViNWIzODNm
14
- Zjk3YWQ4NzkzYjJmZDE4NjExNTEwNDU5NGQ4NDgzYjhmNTgyMTRlNDVkZjFj
15
- ZjQ4NjJjYmU3ZjdmMzI2NzM5OGY2YzZlZDJhYTQ4NGViZjU0ODc=
13
+ YTcwYjA2YzRmMzQ2OGU2N2RlZGRkN2ZmZTgzMmE5NzcwMjc5NGM3OGQ3NDhm
14
+ NjRlNWFmMTUwZTA2ODMxM2FkOTBjMTFjYTc0MzEzMjgwMGNhMzY0YmE3NTkw
15
+ NTFjMzZkNTM0NTY5ZjY3ZTg3ODI0MDY0MmEzNWNjNWMxNzJiY2M=
@@ -410,3 +410,49 @@ Page Bar Generator
410
410
 
411
411
  #search_form input[type='text'] { height: 20px; padding: 6px 12px; }
412
412
  #search_form input[type='submit'] { height: 35px; padding: 0 12px; }
413
+
414
+
415
+ /******************************************************************************/
416
+
417
+ #tabs {
418
+ width: 200px;
419
+ float: left;
420
+ /*
421
+ position: absolute;
422
+ top: 41px;
423
+ left: 0;
424
+ */
425
+ list-style: none;
426
+ margin: -20px 0 0 -30px;
427
+ padding: 0;
428
+ border-top: #ccc 0px solid;
429
+ }
430
+ #tabs ul li {
431
+ list-style: none;
432
+ margin: 0;
433
+ padding: 0;
434
+ }
435
+ #tabs li.back {
436
+ padding: 10px;
437
+ }
438
+ #tabs a {
439
+ display: block;
440
+ margin: 0;
441
+ padding: 16px 12px 12px 12px;
442
+ text-decoration: none;
443
+ background: #efefef;
444
+ border-bottom: #ccc 1px solid;
445
+ color: #000;
446
+ }
447
+ #tabs a:hover {
448
+ background: #666;
449
+ color: #fff;
450
+ }
451
+ #tabs li.selected a {
452
+ background: transparent;
453
+ color: #000;
454
+ font-weight: bold;
455
+ }
456
+ #content2 {
457
+ margin-left: 220px;
458
+ }
@@ -8,6 +8,7 @@
8
8
  input#first_name,
9
9
  input#last_name,
10
10
  input#email,
11
+ input#phone,
11
12
  input#pass1,
12
13
  input#pass2 {
13
14
  font-size: 18px;
@@ -4,11 +4,7 @@ module Caboose
4
4
 
5
5
  def before_action
6
6
  @page = Page.page_with_uri('/admin')
7
- end
8
-
9
- # GET /pages
10
- def index
11
- end
7
+ end
12
8
 
13
9
  # GET /pages/:id
14
10
  def show
@@ -90,77 +86,68 @@ module Caboose
90
86
 
91
87
  end
92
88
 
93
- # GET /pages/new
94
- def new
95
- return unless user_is_allowed('pages', 'add')
96
- @parent_id = params[:parent_id].nil? ? params[:parent_id] : 1
97
- @parent = Page.find(@parent_id)
98
- render :layout => 'caboose/modal'
99
- end
100
-
101
89
  # GET /pages/1/redirect
102
90
  def redirect
103
91
  @page = Page.find(params[:id])
104
92
  redirect_to "/#{@page.uri}"
105
93
  end
106
94
 
107
- # GET /pages/1/edit
108
- def edit
109
- return unless user_is_allowed('pages', 'edit')
110
- @page = Page.find(params[:id])
111
- end
95
+ #===========================================================================
96
+ # Admin actions
97
+ #===========================================================================
112
98
 
113
- # GET /pages/1/edit-title
114
- def edit_title
115
- return unless user_is_allowed('pages', 'edit')
116
- @page = Page.find(params[:id])
117
- render :layout => 'caboose/modal'
99
+ # GET /admin/pages
100
+ def admin_index
101
+ return if !user_is_allowed('pages', 'view')
102
+ @home_page = Page.find(1)
103
+ render :layout => 'caboose/admin'
118
104
  end
119
-
120
- # GET /pages/1/edit-content
121
- def edit_content
122
- return unless user_is_allowed('pages', 'edit')
123
- @page = Page.find(params[:id])
124
- render :layout => 'caboose/modal'
105
+
106
+ # GET /admin/pages/new
107
+ def admin_new
108
+ return unless user_is_allowed('pages', 'add')
109
+ @parent_id = params[:parent_id].nil? ? params[:parent_id] : 1
110
+ @parent = Page.find(@parent_id)
111
+ render :layout => 'caboose/admin'
125
112
  end
126
113
 
127
- # GET /pages/1/edit-settings
128
- def edit_settings
114
+ # GET /admin/pages/1/edit
115
+ def admin_edit_general
129
116
  return unless user_is_allowed('pages', 'edit')
130
117
  @page = Page.find(params[:id])
131
- render :layout => 'caboose/modal'
118
+ render :layout => 'caboose/admin'
132
119
  end
133
-
134
- # GET /pages/1/edit-css
135
- def edit_css
120
+
121
+ # GET /admin/pages/1/content
122
+ def admin_edit_content
136
123
  return unless user_is_allowed('pages', 'edit')
137
124
  @page = Page.find(params[:id])
138
- render :layout => 'caboose/modal'
125
+ render :layout => 'caboose/admin'
139
126
  end
140
127
 
141
- # GET /pages/1/edit-js
142
- def edit_js
128
+ # GET /admin/pages/1/css
129
+ def admin_edit_css
143
130
  return unless user_is_allowed('pages', 'edit')
144
131
  @page = Page.find(params[:id])
145
- render :layout => 'caboose/modal'
132
+ render :layout => 'caboose/admin'
146
133
  end
147
134
 
148
- # GET /pages/1/edit-seo
149
- def edit_seo
135
+ # GET /admin/pages/1/js
136
+ def admin_edit_js
150
137
  return unless user_is_allowed('pages', 'edit')
151
138
  @page = Page.find(params[:id])
152
- render :layout => 'caboose/modal'
139
+ render :layout => 'caboose/admin'
153
140
  end
154
141
 
155
- # GET /pages/1/edit-resources
156
- def edit_resources
142
+ # GET /admin/pages/1/seo
143
+ def admin_edit_seo
157
144
  return unless user_is_allowed('pages', 'edit')
158
145
  @page = Page.find(params[:id])
159
- render :layout => 'caboose/modal'
146
+ render :layout => 'caboose/admin'
160
147
  end
161
148
 
162
- # POST /pages
163
- def create
149
+ # POST /admin/pages
150
+ def admin_create
164
151
  return unless user_is_allowed('pages', 'add')
165
152
 
166
153
  resp = Caboose::StdClass.new({
@@ -211,8 +198,8 @@ module Caboose
211
198
  render json: resp
212
199
  end
213
200
 
214
- # PUT /pages/1
215
- def update
201
+ # PUT /admin/pages/1
202
+ def admin_update
216
203
  return unless user_is_allowed('pages', 'edit')
217
204
 
218
205
  resp = StdClass.new({'attributes' => {}})
@@ -310,8 +297,8 @@ module Caboose
310
297
  render json: resp
311
298
  end
312
299
 
313
- # DELETE /pages/1
314
- def destroy
300
+ # DELETE /admin/pages/1
301
+ def admin_destroy
315
302
  return unless user_is_allowed('pages', 'delete')
316
303
  user = Page.find(params[:id])
317
304
  user.destroy
@@ -0,0 +1,25 @@
1
+ module Caboose
2
+ module PagesHelper
3
+
4
+ def pages_list(page)
5
+ str = "<ul>"
6
+ str << pages_list_helper(page)
7
+ str << "</ul>"
8
+ return str
9
+ end
10
+
11
+ def pages_list_helper(page)
12
+ str = "<li><a href='/admin/pages/#{page.id}/edit'>#{page.title}</a>"
13
+ if page.children && page.children.count > 0
14
+ str << "<ul>"
15
+ page.children.each do |p|
16
+ str << pages_list_helper(p)
17
+ end
18
+ str << "</ul>"
19
+ end
20
+ str << "</li>"
21
+ return str
22
+ end
23
+
24
+ end
25
+ end
@@ -15,7 +15,7 @@ class Caboose::PagePlugin < Caboose::CaboosePlugin
15
15
  if (actions.include?('edit') || is_admin)
16
16
  item['children'] << { 'href' => "/pages/#{page.id}/sitemap" , 'text' => 'Site Map This Page' }
17
17
  item['children'] << { 'href' => "/pages/#{page.id}/edit" , 'text' => 'Edit Page Content' }
18
- item['children'] << { 'href' => "/pages/#{page.id}/edit-settings" , 'text' => 'Edit Page Settings', 'modal' => true }
18
+ item['children'] << { 'href' => "/pages/#{page.id}/edit-settings" , 'text' => 'Edit Page Settings', 'modal' => false }
19
19
 
20
20
  #uru = session['use_redirect_urls'].nil? ? true : session['use_redirect_urls']
21
21
  #item['children'] << { 'id' => 'use_redirect_urls', 'href' => '#', 'text' => '' + (uru ? 'Disable' : 'Enable') + ' Redirect Urls' }
@@ -0,0 +1,2 @@
1
+ <br style='clear: left; line-height: 0;' />
2
+ </div><!-- modal_content2 -->
@@ -0,0 +1,28 @@
1
+ <% content_for :caboose_css do %>
2
+ <%= stylesheet_link_tag "caboose/pages" %>
3
+ <% end %>
4
+ <% content_for :caboose_js do %>
5
+ <%= javascript_include_tag "caboose/model/all" %>
6
+ <%= javascript_include_tag "caboose/pages" %>
7
+ <% end %>
8
+
9
+ <h1>Edit Page</h1>
10
+ <ul id='tabs'>
11
+ <%
12
+ tabs = {
13
+ "/admin/pages/#{@page.id}/edit" => 'General',
14
+ "/admin/pages/#{@page.id}/content" => 'Content',
15
+ "/admin/pages/#{@page.id}/css" => 'Custom CSS',
16
+ "/admin/pages/#{@page.id}/js" => 'Custom JS',
17
+ "/admin/pages/#{@page.id}/seo" => 'SEO',
18
+ "/admin/pages/#{@page.id}/sitemap" => 'Sitemap',
19
+ "/admin/pages/#{@page.id}/delete" => 'Delete Product'
20
+ }
21
+
22
+ %>
23
+ <% tabs.each do |href,text| %>
24
+ <li<%= raw request.fullpath == href ? " class='selected'" : '' %>><a href='<%= href %>'><%= raw text %></a></li>
25
+ <% end %>
26
+ <li class='back'><input type='button' value='< Back' onclick="window.location='/admin/pages';" /></li>
27
+ </ul>
28
+ <div id='content2'>
@@ -0,0 +1,30 @@
1
+
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
4
+ <p><div id='page_<%= @page.id %>_content'></div></p>
5
+
6
+ <%= render :partial => 'caboose/pages/admin_footer' %>
7
+ <% content_for :caboose_js do %>
8
+ <script type='text/javascript'>
9
+
10
+ var modal = false;
11
+ $(window).load(function() {
12
+ modal = new CabooseModal(800);
13
+ });
14
+
15
+ $(document).ready(function() {
16
+ m = new ModelBinder({
17
+ name: 'Page',
18
+ id: <%= @page.id %>,
19
+ update_url: '/admin/pages/<%= @page.id %>',
20
+ authenticity_token: '<%= form_authenticity_token %>',
21
+ attributes: [
22
+ { name: 'content', nice_name: 'Page Content', type: 'richtext', value: <%= raw Caboose.json(@page.content) %>, width: 800, height: 500 }
23
+ ]
24
+ });
25
+ });
26
+
27
+ </script>
28
+ <%= tinymce_assets %>
29
+ <%= tinymce :caboose, width: '800px', height:'400px' %>
30
+ <% end %>
@@ -0,0 +1,28 @@
1
+
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
4
+ <p><div id='page_<%= @page.id %>_custom_css'></div></p>
5
+
6
+ <%= render :partial => 'caboose/pages/admin_footer' %>
7
+ <% content_for :caboose_js do %>
8
+ <script type='text/javascript'>
9
+
10
+ var modal = false;
11
+ $(window).load(function() {
12
+ modal = new CabooseModal(800);
13
+ });
14
+
15
+ $(document).ready(function() {
16
+ m = new ModelBinder({
17
+ name: 'Page',
18
+ id: <%= @page.id %>,
19
+ update_url: '/admin/pages/<%= @page.id %>',
20
+ authenticity_token: '<%= form_authenticity_token %>',
21
+ attributes: [
22
+ { name: 'custom_css', nice_name: 'Custom CSS', type: 'textarea', value: <%= raw Caboose.json(@page.custom_css) %>, width: 800, height: 400 }
23
+ ]
24
+ });
25
+ });
26
+
27
+ </script>
28
+ <% end %>
@@ -0,0 +1,46 @@
1
+
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
4
+ <p><div id='page_<%= @page.id %>_title' ></div></p>
5
+ <p><div id='page_<%= @page.id %>_menu_title' ></div></p>
6
+ <p><div id='page_<%= @page.id %>_parent_id' ></div></p>
7
+ <p><div id='page_<%= @page.id %>_slug' ></div></p>
8
+ <p><div id='page_<%= @page.id %>_alias' ></div></p>
9
+ <p><div id='page_<%= @page.id %>_redirect_url' ></div></p>
10
+ <p><div id='page_<%= @page.id %>_hide' ></div></p>
11
+ <p><div id='page_<%= @page.id %>_layout' ></div></p>
12
+ <p><div id='page_<%= @page.id %>_custom_sort_children' ></div></p>
13
+ <p><div id='page_<%= @page.id %>_content_format' ></div></p>
14
+
15
+ <%= render :partial => 'caboose/pages/admin_footer' %>
16
+ <% content_for :caboose_js do %>
17
+ <script type='text/javascript'>
18
+
19
+ var modal = false;
20
+ $(window).load(function() {
21
+ modal = new CabooseModal(800);
22
+ });
23
+
24
+ $(document).ready(function() {
25
+ m = new ModelBinder({
26
+ name: 'Page',
27
+ id: <%= @page.id %>,
28
+ update_url: '/admin/pages/<%= @page.id %>',
29
+ authenticity_token: '<%= form_authenticity_token %>',
30
+ attributes: [
31
+ { name: 'title' , nice_name: 'Title' , type: 'text' , value: <%= raw Caboose.json(@page.title ) %> , width: 400 },
32
+ { name: 'parent_id' , nice_name: 'Parent' , type: 'select' , value: <%= @page.parent_id %> , width: 400, text: <%= raw (@page.parent_id == -1 ? "[No Parent]" : @page.parent.title).to_json %>, options_url: '/pages/sitemap-options' },
33
+ { name: 'menu_title' , nice_name: 'Menu title' , type: 'text' , value: <%= raw Caboose.json(@page.menu_title ) %> , width: 400 },
34
+ { name: 'slug' , nice_name: 'Slug' , type: 'text' , value: <%= raw Caboose.json(@page.slug ) %> , width: 400 },
35
+ { name: 'alias' , nice_name: 'Alias' , type: 'text' , value: <%= raw Caboose.json(@page.alias ) %> , width: 400 },
36
+ { name: 'redirect_url' , nice_name: 'Redirect URL' , type: 'text' , value: <%= raw Caboose.json(@page.redirect_url ) %> , width: 400 },
37
+ { name: 'hide' , nice_name: 'Hide' , type: 'checkbox' , value: <%= raw @page.hide %> , width: 400 },
38
+ { name: 'layout' , nice_name: 'Layout' , type: 'text' , value: <%= raw Caboose.json(@page.layout ) %> , width: 400 },
39
+ { name: 'custom_sort_children' , nice_name: 'Custom sort children' , type: 'checkbox' , value: <%= raw @page.custom_sort_children %> , width: 400 },
40
+ { name: 'content_format' , nice_name: 'Content format' , type: 'select' , value: <%= raw Caboose.json(@page.content_format) %>, width: 400, text: <%= raw Caboose.json(@page.content_format) %>, options_url: '/pages/format-options' },
41
+ ]
42
+ });
43
+ });
44
+
45
+ </script>
46
+ <% end %>
@@ -0,0 +1,28 @@
1
+
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
4
+ <p><div id='page_<%= @page.id %>_custom_js'></div></p>
5
+
6
+ <%= render :partial => 'caboose/pages/admin_footer' %>
7
+ <% content_for :caboose_js do %>
8
+ <script type='text/javascript'>
9
+
10
+ var modal = false;
11
+ $(window).load(function() {
12
+ modal = new CabooseModal(800);
13
+ });
14
+
15
+ $(document).ready(function() {
16
+ m = new ModelBinder({
17
+ name: 'Page',
18
+ id: <%= @page.id %>,
19
+ update_url: '/admin/pages/<%= @page.id %>',
20
+ authenticity_token: '<%= form_authenticity_token %>',
21
+ attributes: [
22
+ { name: 'custom_js', nice_name: 'Custom Javascript', type: 'textarea', value: <%= raw Caboose.json(@page.custom_js) %>, width: 800, height: 400 }
23
+ ]
24
+ });
25
+ });
26
+
27
+ </script>
28
+ <% end %>
@@ -1,12 +1,6 @@
1
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';" disabled='true' />
8
- <input type='button' value='Resources' onclick="window.location='/pages/<%= @page.id %>/edit-resources';" />
9
- </div>
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
10
4
  <p><div id='page_<%= @page.id %>_seo_title'></div></p>
11
5
  <p><div id='page_<%= @page.id %>_meta_description'></div></p>
12
6
  <p><div id='page_<%= @page.id %>_meta_robots'></div></p>
@@ -14,6 +8,7 @@
14
8
  <p><div id='page_<%= @page.id %>_fb_description'></div></p>
15
9
  <p><div id='page_<%= @page.id %>_gp_description'></div></p>
16
10
 
11
+ <%= render :partial => 'caboose/pages/admin_footer' %>
17
12
  <% content_for :caboose_js do %>
18
13
  <%= javascript_include_tag "caboose/model/all" %>
19
14
  <script type="text/javascript">
@@ -0,0 +1,5 @@
1
+ <h1>Pages</h1>
2
+
3
+ <p><a href='/pages/new'>New Page</a></p>
4
+
5
+ <%= raw pages_list(@home_page) %>
@@ -0,0 +1,6 @@
1
+
2
+ <style type='text/css'>
3
+ #content li.hidden a { color: #990000; }
4
+ </style>
5
+
6
+ <%= raw pages_list(@page) %>
@@ -44,25 +44,23 @@ Caboose::Engine.routes.draw do
44
44
  post "admin/settings" => "settings#create"
45
45
  delete "admin/settings/:id" => "settings#destroy"
46
46
 
47
- get "pages" => "pages#index"
48
- get "pages/sitemap-options" => "pages#sitemap_options"
49
- get "pages/robots-options" => "pages#robots_options"
50
- get "pages/format-options" => "pages#content_format_options"
51
- get "pages/new" => "pages#new"
52
- get "pages/:id/sitemap" => "pages#sitemap"
53
- get "pages/:id/redirect" => "pages#redirect"
54
- get "pages/:id/edit-settings" => "pages#edit_settings"
55
- get "pages/:id/edit-css" => "pages#edit_css"
56
- get "pages/:id/edit-js" => "pages#edit_js"
57
- get "pages/:id/edit-seo" => "pages#edit_seo"
58
- get "pages/:id/edit-resources" => "pages#edit_resources"
59
- get "pages/:id/edit-content" => "pages#edit_content"
60
- get "pages/:id/edit-title" => "pages#edit_title"
61
- get "pages/:id/edit" => "pages#edit"
47
+ #get "pages" => "pages#index"
62
48
  get "pages/:id" => "pages#show"
63
- put "pages/:id" => "pages#update"
64
- post "pages" => "pages#create"
65
- delete "pages/:id" => "pages#destroy"
49
+ get "pages/:id/redirect" => "pages#redirect"
50
+ get "admin/pages/sitemap-options" => "pages#admin_sitemap_options"
51
+ get "admin/pages/robots-options" => "pages#admin_robots_options"
52
+ get "admin/pages/format-options" => "pages#admin_content_format_options"
53
+ get "admin/pages/new" => "pages#admin_new"
54
+ get "admin/pages/:id/sitemap" => "pages#admin_sitemap"
55
+ get "admin/pages/:id/edit" => "pages#admin_edit_general"
56
+ get "admin/pages/:id/css" => "pages#admin_edit_css"
57
+ get "admin/pages/:id/js" => "pages#admin_edit_js"
58
+ get "admin/pages/:id/seo" => "pages#admin_edit_seo"
59
+ get "admin/pages/:id/content" => "pages#admin_edit_content"
60
+ put "admin/pages/:id" => "pages#admin_update"
61
+ get "admin/pages" => "pages#admin_index"
62
+ post "admin/pages" => "pages#admin_create"
63
+ delete "admin/pages/:id" => "pages#admin_destroy"
66
64
 
67
65
  match '*path' => 'pages#show'
68
66
  root :to => 'pages#show'
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.2.57'
2
+ VERSION = '0.2.62'
3
3
  end
@@ -33,6 +33,28 @@ namespace :caboose do
33
33
 
34
34
  desc "Performs caboose migrations to transition from the current version to the latest installed version"
35
35
  task :migrate => :migrate_between
36
+
37
+ desc "Sync production db to development"
38
+ task :sync_dev_db do
39
+
40
+ ddb = Rails.application.config.database_configuration['development']
41
+ pdb = Rails.application.config.database_configuration['production']
42
+
43
+ dump_file = "#{Rails.root}/db/backups/#{pdb['database']}_#{DateTime.now.strftime('%FT%T')}.dump"
44
+ if !File.exists?("#{Rails.root}/db/backups")
45
+ `mkdir -p #{Rails.root}/db/backups`
46
+ end
47
+
48
+ puts "Capturing production database..."
49
+ `heroku pgbackups:capture`
50
+
51
+ puts "Downloading production database dump file..."
52
+ `curl -o #{dump_file} \`heroku pgbackups:url\``
53
+
54
+ puts "Restoring development database from dump file..."
55
+ `pg_restore --verbose --clean --no-acl --no-owner -h #{ddb['host']} -U #{ddb['username']} -d #{ddb['database']} #{dump_file}`
56
+
57
+ end
36
58
 
37
59
  #=============================================================================
38
60
 
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.2.57
4
+ version: 0.2.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-07 00:00:00.000000000 Z
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -187,6 +187,7 @@ files:
187
187
  - app/controllers/caboose/station_controller.rb
188
188
  - app/controllers/caboose/users_controller.rb
189
189
  - app/helpers/caboose/application_helper.rb
190
+ - app/helpers/caboose/pages_helper.rb
190
191
  - app/helpers/caboose/permissions_helper.rb
191
192
  - app/models/caboose/approval_request.rb
192
193
  - app/models/caboose/asset.rb
@@ -214,18 +215,17 @@ files:
214
215
  - app/views/caboose/extras/error.html.erb
215
216
  - app/views/caboose/extras/error404.html.erb
216
217
  - app/views/caboose/login/index.html.erb
217
- - app/views/caboose/pages/edit.html.erb
218
- - app/views/caboose/pages/edit_content.html.erb
219
- - app/views/caboose/pages/edit_css.html.erb
220
- - app/views/caboose/pages/edit_js.html.erb
221
- - app/views/caboose/pages/edit_resources.html.erb
222
- - app/views/caboose/pages/edit_seo.html.erb
223
- - app/views/caboose/pages/edit_settings.html.erb
224
- - app/views/caboose/pages/edit_title.html.erb
225
- - app/views/caboose/pages/index.html.erb
226
- - app/views/caboose/pages/new.html.erb
218
+ - app/views/caboose/pages/_admin_footer.html.erb
219
+ - app/views/caboose/pages/_admin_header.html.erb
220
+ - app/views/caboose/pages/admin_edit_content.html.erb
221
+ - app/views/caboose/pages/admin_edit_css.html.erb
222
+ - app/views/caboose/pages/admin_edit_general.html.erb
223
+ - app/views/caboose/pages/admin_edit_js.html.erb
224
+ - app/views/caboose/pages/admin_edit_seo.html.erb
225
+ - app/views/caboose/pages/admin_index.html.erb
226
+ - app/views/caboose/pages/admin_new.html.erb
227
+ - app/views/caboose/pages/admin_sitemap.html.erb
227
228
  - app/views/caboose/pages/show.html.erb
228
- - app/views/caboose/pages/sitemap.html.erb
229
229
  - app/views/caboose/pages/test.html.erb
230
230
  - app/views/caboose/pages/update_pic.html.erb
231
231
  - app/views/caboose/pages/update_resume.html.erb
@@ -1,56 +0,0 @@
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
- <% @page.linked_resources_map[: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
-
13
- <% content_for :caboose_js do %>
14
-
15
- <% @page.linked_resources_map[: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>
21
-
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>
56
- <% end %>
@@ -1,59 +0,0 @@
1
-
2
- <textarea id='page_<%= @page.id %>_content' placeholder='Content' style='width:795px; height:545px;' class='tinymce'><%= raw @page.content %></textarea>
3
- <br />
4
- <div id='message'></div>
5
- <div id='controls'>
6
- <input type='button' value='Close' onclick="modal.close();" />
7
- <input type='button' value='Update' onclick="updateContent();" />
8
- </div>
9
-
10
- <% content_for :caboose_js do %>
11
-
12
- <%= javascript_include_tag "caboose/model/all" %>
13
-
14
- <script type="text/javascript">
15
-
16
- var modal = false;
17
- $(document).ready(function() {
18
- modal = new CabooseModal(800, 700);
19
- });
20
-
21
- function updateContent()
22
- {
23
- tinymce.triggerSave();
24
-
25
- function log(msg) {
26
- setTimeout(function() {
27
- throw new Error(msg);
28
- }, 0);
29
- }
30
- // log($('#page_<%= @page.id %>_content').val());
31
-
32
- $.ajax({
33
- url: '/pages/<%= @page.id %>',
34
- type: 'put',
35
- data: {
36
- authenticity_token: "<%= form_authenticity_token %>",
37
- content: $('#page_<%= @page.id %>_content').val()
38
- },
39
- success: function(resp) {
40
- if (resp.success)
41
- {
42
- contentVal = $('#page_<%= @page.id %>_content').val();
43
- parent.$('#editmode_content_container').html(contentVal == null || contentVal.length == 0 ? 'No content.' : contentVal);
44
- modal.close();
45
- }
46
- if (resp.error)
47
- modal.autosize("<p class='note success'>" + resp.error + "</p>");
48
- }
49
- });
50
- }
51
-
52
- </script>
53
- <%= tinymce :caboose,
54
- width:'795px',
55
- height:'545px'
56
- # theme_advanced_source_editor_width: '100px',
57
- # theme_advanced_source_editor_height: '100px'
58
- %>
59
- <% end %>
@@ -1,51 +0,0 @@
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';" 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';" />
9
- </div>
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
-
19
- <% content_for :caboose_js do %>
20
-
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
- }
49
-
50
- </script>
51
- <% end %>
@@ -1,51 +0,0 @@
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';" 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();" />
17
- </div>
18
-
19
- <% content_for :caboose_js do %>
20
-
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
- }
49
-
50
- </script>
51
- <% end %>
@@ -1,41 +0,0 @@
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,51 +0,0 @@
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';" disabled='true' />
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';" />
9
- </div>
10
- <div style='float: left; width: 310px;'>
11
- <p><div id='page_<%= @page.id %>_parent_id' ></div></p>
12
- <p><div id='page_<%= @page.id %>_menu_title' ></div></p>
13
- <p><div id='page_<%= @page.id %>_slug' ></div></p>
14
- <p><div id='page_<%= @page.id %>_alias' ></div></p>
15
- <p><div id='page_<%= @page.id %>_redirect_url' ></div></p>
16
- </div>
17
- <div style='float: left;'>
18
- <p><div id='page_<%= @page.id %>_hide' ></div></p>
19
- <p><div id='page_<%= @page.id %>_layout' ></div></p>
20
- <p><div id='page_<%= @page.id %>_custom_sort_children' ></div></p>
21
- <p><div id='page_<%= @page.id %>_content_format' ></div></p>
22
- </div>
23
-
24
- <% content_for :caboose_js do %>
25
- <%= javascript_include_tag "caboose/model/all" %>
26
- <script type="text/javascript">
27
-
28
- var modal = false;
29
- $(document).ready(function() {
30
- m = new ModelBinder({
31
- name: 'Page',
32
- id: <%= @page.id %>,
33
- update_url: '/pages/<%= @page.id %>',
34
- authenticity_token: '<%= form_authenticity_token %>',
35
- attributes: [
36
- { name: 'parent_id' , nice_name: 'Parent' , type: 'select' , value: <%= @page.parent_id %> , width: 270, text: <%= raw (@page.parent_id == -1 ? "[No Parent]" : @page.parent.title).to_json %>, options_url: '/pages/sitemap-options' },
37
- { name: 'menu_title' , nice_name: 'Menu title' , type: 'text' , value: <%= raw Caboose.json(@page.menu_title ) %> , width: 270 },
38
- { name: 'slug' , nice_name: 'Slug' , type: 'text' , value: <%= raw Caboose.json(@page.slug ) %> , width: 270 },
39
- { name: 'alias' , nice_name: 'Alias' , type: 'text' , value: <%= raw Caboose.json(@page.alias ) %> , width: 270 },
40
- { name: 'redirect_url' , nice_name: 'Redirect URL' , type: 'text' , value: <%= raw Caboose.json(@page.redirect_url ) %> , width: 270 },
41
- { name: 'hide' , nice_name: 'Hide' , type: 'checkbox' , value: <%= raw @page.hide %> , width: 270 },
42
- { name: 'layout' , nice_name: 'Layout' , type: 'text' , value: <%= raw Caboose.json(@page.layout ) %> , width: 270 },
43
- { name: 'custom_sort_children' , nice_name: 'Custom sort children' , type: 'checkbox' , value: <%= raw @page.custom_sort_children %> , width: 270 },
44
- { name: 'content_format' , nice_name: 'Content format' , type: 'select' , value: <%= raw Caboose.json(@page.content_format) %>, width: 270, text: <%= raw Caboose.json(@page.content_format) %>, options_url: '/pages/format-options' },
45
- ]
46
- });
47
- modal = new CabooseModal(600, 344);
48
- });
49
-
50
- </script>
51
- <% end %>
@@ -1,30 +0,0 @@
1
- <p><div id='page_<%= @page.id %>_title'></div></p>
2
-
3
- <% content_for :caboose_js do %>
4
- <%= javascript_include_tag "caboose/model/all" %>
5
- <script type="text/javascript">
6
-
7
- var modal = false;
8
- $(document).ready(function() {
9
- m = new ModelBinder({
10
- name: 'Page',
11
- id: <%= @page.id %>,
12
- update_url: '/pages/<%= @page.id %>',
13
- authenticity_token: '<%= form_authenticity_token %>',
14
- attributes: [{
15
- name: 'title',
16
- nice_name: 'Title',
17
- type: 'text',
18
- value: <%= raw Caboose.json(@page.title) %>,
19
- width: 480
20
- }],
21
- success: function(control) {
22
- parent.$.fn.colorbox.close();
23
- parent.$('#editmode_title_container').html(control.attribute.value);
24
- }
25
- });
26
- modal = new CabooseModal(500, 80);
27
- });
28
-
29
- </script>
30
- <% end %>
@@ -1,33 +0,0 @@
1
- <h1>Users</h1>
2
-
3
- <p><a href='/users/new'>New User</a></p>
4
-
5
- <form action='/users' method='get'>
6
- <table cellpadding='4' cellspacing='0' border='0'>
7
- <tr><td>First name: </td><td><input type='text' name='first_name' value='<%= @gen.params['first_name'] %>' style='width: 200px;' /></td></tr>
8
- <tr><td>Last name: </td><td><input type='text' name='last_name' value='<%= @gen.params['last_name'] %>' style='width: 200px;' /></td></tr>
9
- <tr><td>Username: </td><td><input type='text' name='username' value='<%= @gen.params['username'] %>' style='width: 200px;' /></td></tr>
10
- </table><br />
11
- <p><input type='submit' value='Search' /></p>
12
- </form>
13
-
14
- <table class='data'>
15
- <tr>
16
- <%= raw @gen.sortable_table_headings({
17
- 'first_name' => 'First Name',
18
- 'last_name, first_name' => 'Last Name',
19
- 'username' => 'Username',
20
- 'email' => 'Email'
21
- }) %>
22
- </tr>
23
- <% @users.each do |user| %>
24
- <tr onclick="window.location='/users/<%= user.id %>/edit';">
25
- <td><%= user.first_name %></td>
26
- <td><%= user.last_name %></td>
27
- <td><%= user.username %></td>
28
- <td><%= user.email %></td>
29
- </tr>
30
- <% end %>
31
- </table>
32
-
33
- <p><%= raw @gen.generate %></p>
@@ -1,12 +0,0 @@
1
-
2
- <style type='text/css'>
3
- #content li.hidden a { color: #990000; }
4
- </style>
5
-
6
- <h1>Page Sitemap</h1>
7
-
8
- <ul>
9
- <% @options.each do |option| %>
10
- <li><%= link_to option['text'], pages_path + '/' + option['value'].to_s %></li>
11
- <% end %>
12
- </ul>