caboose-cms 0.9.193 → 0.9.194

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/caboose/main.js +35 -34
  3. data/app/assets/stylesheets/caboose/login.scss +95 -0
  4. data/app/controllers/caboose/application_controller.rb +1 -1
  5. data/app/controllers/caboose/block_type_categories_controller.rb +25 -2
  6. data/app/controllers/caboose/block_types_controller.rb +34 -35
  7. data/app/controllers/caboose/login_controller.rb +33 -37
  8. data/app/controllers/caboose/pages_controller.rb +2 -7
  9. data/app/controllers/caboose/register_controller.rb +12 -14
  10. data/app/controllers/caboose/users_controller.rb +40 -46
  11. data/app/mailers/caboose/login_mailer.rb +3 -2
  12. data/app/models/caboose/authenticator.rb +2 -2
  13. data/app/models/caboose/block_type_category.rb +4 -2
  14. data/app/models/caboose/schema.rb +4 -2
  15. data/app/views/caboose/block_type_categories/admin_edit.html.erb +43 -0
  16. data/app/views/caboose/block_type_categories/admin_index.html.erb +23 -0
  17. data/app/{assets/javascripts/caboose/testing.js → views/caboose/block_type_categories/admin_new.html.erb} +0 -0
  18. data/app/views/caboose/block_types/admin_edit.html.erb +8 -8
  19. data/app/views/caboose/extras/error.html.erb +1 -1
  20. data/app/views/caboose/login/forgot_password_form.html.erb +38 -51
  21. data/app/views/caboose/login/index.html.erb +41 -64
  22. data/app/views/caboose/login/reset_password_form.html.erb +35 -35
  23. data/app/views/caboose/register/index.html.erb +51 -44
  24. data/lib/caboose/version.rb +1 -1
  25. metadata +6 -8
  26. data/app/assets/javascripts/caboose/cart_old.js +0 -184
  27. data/app/assets/javascripts/caboose/checkout_old.js +0 -151
  28. data/app/assets/javascripts/caboose/product_new.js +0 -306
  29. data/app/assets/javascripts/caboose/product_old.js +0 -324
  30. data/app/assets/stylesheets/caboose/login.css +0 -134
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc6206c9e67d2d3297d21563ecb2d7a89e6031a6
4
- data.tar.gz: 60f7d494a0debe8fde6c9501ace78325b1098c91
3
+ metadata.gz: bf3d9753758ba664b6736b5756ecb4c4fc398499
4
+ data.tar.gz: 6eb53a89f67dde04a4fe88223d3d11aaeb7dcb81
5
5
  SHA512:
6
- metadata.gz: 1ee995af0058f6fed0da180d93e5fc8daabc651e1feb2af6417868e5434cf06879a830dffff0c8fd94803a682e6b8094e303c4a2df447a465bfd74f8ef094424
7
- data.tar.gz: 0f6cce388e3102441ece39f71e92fdbbab073b596534c9df486fb1f820af4a4da397e000bdecd0e63c4135a3c18da588a1715d43602d8717b27d009d58e5d35d
6
+ metadata.gz: bfbde88b45b6c9cba1c63b25883fb15998bcefd7a5c00f6a02207d69f1acc3aa0a988aa826f7dfafe566df8639363047cded4ea0423aad5310c2cd0395e2422f
7
+ data.tar.gz: a33f9b2094e41767a3a5a759ccc151db972219d6e2edeecc9e981ea3eed0e7963ff86a26d24c34b12862a2344d4cbab294ba8aac54e3db0dc7a1fa83d7dfdd54
@@ -12,20 +12,20 @@ var Caboose = function() {
12
12
  self.initialize = function() {
13
13
  self.loggedIn = window.loggedIn || false;
14
14
 
15
- $('a[href="/register"], [caboose=register]').click(function(event) {
16
- event.preventDefault();
17
- self.register( $(window).width() < 1024 );
18
- });
15
+ // $('a[href="/register"], [caboose=register]').click(function(event) {
16
+ // event.preventDefault();
17
+ // self.register( $(window).width() < 1024 );
18
+ // });
19
19
 
20
- $('a[href="/login"], [caboose=login]').click(function(event) {
21
- event.preventDefault();
22
- self.login( $(window).width() < 1024 );
23
- });
20
+ // $('a[href="/login"], [caboose=login]').click(function(event) {
21
+ // event.preventDefault();
22
+ // self.login( $(window).width() < 1024 );
23
+ // });
24
24
 
25
- $('a[href="/logout"], [caboose=logout]').click(function(event) {
26
- event.preventDefault();
27
- self.logout( $(window).width() < 1024 );
28
- });
25
+ // $('a[href="/logout"], [caboose=logout]').click(function(event) {
26
+ // event.preventDefault();
27
+ // self.logout( $(window).width() < 1024 );
28
+ // });
29
29
  };
30
30
 
31
31
  //
@@ -69,18 +69,19 @@ var Caboose = function() {
69
69
  //
70
70
 
71
71
  self.login = function() {
72
- if ($.browser.mobile) window.location.href = '/login?return_url=' + window.location.pathname;
72
+ window.location = '/login?return_url=' + window.location.pathname;
73
+ // if ($.browser.mobile) window.location.href = '/login?return_url=' + window.location.pathname;
73
74
 
74
- $.colorbox({
75
- href: '/login?return_url=' + window.location.pathname,
76
- iframe: true,
77
- innerWidth: 200,
78
- innerHeight: 50,
79
- scrolling: false,
80
- transition: 'fade',
81
- closeButton: false,
82
- opacity: 0.50
83
- });
75
+ // $.colorbox({
76
+ // href: '/login?return_url=' + window.location.pathname,
77
+ // iframe: true,
78
+ // innerWidth: 200,
79
+ // innerHeight: 50,
80
+ // scrolling: false,
81
+ // transition: 'fade',
82
+ // closeButton: false,
83
+ // opacity: 0.50
84
+ // });
84
85
  };
85
86
 
86
87
  //
@@ -96,18 +97,18 @@ var Caboose = function() {
96
97
  //
97
98
 
98
99
  self.register = function(callback) {
99
- if ($.browser.mobile) window.location.href = '/register?return_url=' + window.location.pathname;
100
+ window.location = '/register?return_url=' + window.location.pathname;
100
101
 
101
- $.colorbox({
102
- href: '/register?return_url=' + window.location.pathname,
103
- iframe: true,
104
- innerWidth: 200,
105
- innerHeight: 50,
106
- scrolling: false,
107
- transition: 'fade',
108
- closeButton: false,
109
- opacity: 0.50
110
- });
102
+ // $.colorbox({
103
+ // href: '/register?return_url=' + window.location.pathname,
104
+ // iframe: true,
105
+ // innerWidth: 200,
106
+ // innerHeight: 50,
107
+ // scrolling: false,
108
+ // transition: 'fade',
109
+ // closeButton: false,
110
+ // opacity: 0.50
111
+ // });
111
112
  };
112
113
 
113
114
  // Init and return
@@ -0,0 +1,95 @@
1
+ .caboose-login-wrapper {
2
+ padding: 40px 2%;
3
+ text-align: center;
4
+ background-color: rgba(255,255,255,0.5);
5
+ display: block;
6
+ width: 100%;
7
+ margin: 0;
8
+ .caboose-login-form-wrapper {
9
+ max-width: 400px;
10
+ margin: 0 auto;
11
+ padding: 30px;
12
+ background: #fff;
13
+ border: 1px solid #e6e6e6;
14
+ h5 {
15
+ margin: 0 0 20px 0;
16
+ color: #282828;
17
+ text-align: center;
18
+ }
19
+ & > p {
20
+ font-family: "Roboto";
21
+ font-weight: 300;
22
+ font-size: 15px;
23
+ margin-bottom: 20px;
24
+ text-align: left;
25
+ line-height: 20px;
26
+ }
27
+ & > form {
28
+ text-align: right;
29
+ &#caboose-register-form {
30
+ .field {
31
+ margin-bottom: 15px;
32
+ }
33
+ }
34
+ .field {
35
+ margin-bottom: 25px;
36
+ text-align: left;
37
+ label {
38
+ text-align: left;
39
+ margin-bottom: 4px;
40
+ display: block;
41
+ font-family: "Roboto";
42
+ font-weight: 300;
43
+ font-size: 13px;
44
+ font-style: normal;
45
+ color: #282828;
46
+ }
47
+ }
48
+ input[type="text"], input[type="password"], input[type="email"] {
49
+ display: block;
50
+ width: 100%;
51
+ font-family: "Roboto";
52
+ font-weight: 300;
53
+ font-size: 16px;
54
+ border: 1px solid #d8d8d8;
55
+ height: 36px;
56
+ padding: 6px;
57
+ font-style: normal;
58
+ background-color: transprent;
59
+ -webkit-appearance: none;
60
+ border-radius: 0;
61
+ line-height: 36px;
62
+ text-align: left;
63
+ &:focus {
64
+ outline-width: 0;
65
+ border-color: #b1d9f5;
66
+ }
67
+ }
68
+ .caboose-links {
69
+ margin-bottom: 15px;
70
+ }
71
+ .caboose-links > a {
72
+ font-size: 14px;
73
+ color: #282828;
74
+ text-decoration: none;
75
+ display: block;
76
+ margin-bottom: 8px;
77
+ font-family: "Roboto";
78
+ font-weight: 300;
79
+ font-size: 14px;
80
+ &:hover {
81
+ color: #bf4e4e;
82
+ }
83
+ &:focus {
84
+ outline-width: 0;
85
+ }
86
+ &:last-of-type {
87
+ margin-bottom: 0;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ #caboose-login-message {
93
+ clear: both;
94
+ }
95
+ }
@@ -260,7 +260,7 @@ module Caboose
260
260
  # Redirects to login if not logged in.
261
261
  def verify_logged_in
262
262
  if !logged_in?
263
- redirect_to "/modal/login?return_url=" + URI.encode(request.fullpath)
263
+ redirect_to "/login?return_url=" + URI.encode(request.fullpath)
264
264
  return false
265
265
  end
266
266
  return true
@@ -1,13 +1,36 @@
1
-
2
1
  module Caboose
3
2
  class BlockTypeCategoriesController < ApplicationController
4
-
3
+
4
+ # @route GET /admin/block-type-categories
5
+ def admin_index
6
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
7
+ @btc = BlockTypeCategory.where(:parent_id => nil).order(:sort_order).all
8
+ render :layout => 'caboose/admin'
9
+ end
10
+
5
11
  # @route GET /admin/block-type-categories/tree-options
6
12
  def admin_tree_options
7
13
  return unless user_is_allowed('pages', 'edit')
8
14
  render :json => BlockTypeCategory.tree
9
15
  end
10
16
 
17
+ # @route GET /admin/block-type-categories/:id
18
+ def admin_edit
19
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
20
+ @btc = BlockTypeCategory.find(params[:id])
21
+ render :layout => 'caboose/admin'
22
+ end
23
+
24
+ # @route PUT /admin/block-type-categories/:id
25
+ def admin_update
26
+ render :json => false and return if !logged_in_user.is_super_admin?
27
+ end
28
+
29
+ # @route DELETE /admin/block-type-categories/:id
30
+ def admin_delete
31
+ render :json => false and return if !logged_in_user.is_super_admin?
32
+ end
33
+
11
34
  # @route GET /admin/block-type-categories/:id/options
12
35
  def admin_options
13
36
  btc = BlockTypeCategory.find(params[:id])
@@ -8,13 +8,14 @@ module Caboose
8
8
 
9
9
  # @route GET /admin/block-types
10
10
  def admin_index
11
- return if !user_is_allowed('pages', 'view')
11
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
12
12
  @block_types = BlockType.where("parent_id is null or parent_id = 0").reorder(:name).all
13
13
  render :layout => 'caboose/admin'
14
14
  end
15
15
 
16
16
  # @route GET /admin/block-types/json
17
17
  def admin_json
18
+ render :json => false and return if !logged_in_user.is_super_admin?
18
19
  h = {
19
20
  'name' => '',
20
21
  'description' => '',
@@ -43,20 +44,20 @@ module Caboose
43
44
 
44
45
  # @route GET /admin/block-types/:id/json
45
46
  def admin_json_single
46
- return if !user_is_allowed('pages', 'view')
47
+ render :json => false and return if !logged_in_user.is_super_admin?
47
48
  block_type = BlockType.find(params[:id])
48
49
  render :json => block_type.as_json(:include => :sites)
49
50
  end
50
51
 
51
52
  # @route GET /admin/block-types/parse
52
53
  def admin_parse_form
53
- return if !user_is_allowed('blocktypeparser', 'view')
54
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
54
55
  render :layout => 'caboose/admin'
55
56
  end
56
57
 
57
58
  # @route POST /admin/block-types/parse-tags
58
59
  def admin_parse_tags
59
- return if !user_is_allowed('blocktypeparser', 'view')
60
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
60
61
  children = params[:children] && params[:children] != 'false' ? params[:children] : nil
61
62
  resp = BlockTypeParser.parse_html(params[:html], params[:tags], children)
62
63
  render :json => resp
@@ -65,7 +66,7 @@ module Caboose
65
66
  # @route GET /admin/block-types/new
66
67
  # @route GET /admin/block-types/:id/new
67
68
  def admin_new
68
- return unless user_is_allowed('pages', 'add')
69
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
69
70
  @block_type = BlockType.new
70
71
  @parent_id = params[:id]
71
72
  render :layout => 'caboose/admin'
@@ -73,28 +74,28 @@ module Caboose
73
74
 
74
75
  # @route GET /admin/block-types/:id/icon
75
76
  def admin_edit_icon
76
- return unless user_is_allowed('pages', 'edit')
77
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
77
78
  @block_type = BlockType.find(params[:id])
78
79
  render :layout => 'caboose/modal'
79
80
  end
80
81
 
81
82
  # @route GET /admin/block-types/:id
82
83
  def admin_edit
83
- return unless user_is_allowed('pages', 'edit')
84
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
84
85
  @block_type = BlockType.find(params[:id])
85
86
  render :layout => 'caboose/admin'
86
87
  end
87
88
 
88
89
  # @route GET /admin/block-types/:id/render-function
89
90
  def admin_edit_render_function
90
- return unless user_is_allowed('sites', 'edit')
91
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
91
92
  @block_type = BlockType.find(params[:id])
92
93
  render :layout => 'caboose/admin'
93
94
  end
94
95
 
95
96
  # @route PUT /admin/block-types/:id/render-function
96
97
  def admin_update_render_function
97
- return if !user_is_allowed('sites', 'edit')
98
+ render :json => false and return if !logged_in_user.is_super_admin?
98
99
  resp = StdClass.new
99
100
  @block_type = BlockType.find(params[:id])
100
101
  code = params['code'].blank? ? '' : params['code'].gsub('<%==','<%= raw')
@@ -107,14 +108,14 @@ module Caboose
107
108
 
108
109
  # @route GET /admin/block-types/:id/sass
109
110
  def admin_edit_sass
110
- return unless user_is_allowed('sites', 'edit')
111
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
111
112
  @block_type = BlockType.find(params[:id])
112
113
  render :layout => 'caboose/admin'
113
114
  end
114
115
 
115
116
  # @route PUT /admin/block-types/:id/sass
116
117
  def admin_update_sass
117
- return if !user_is_allowed('sites', 'edit')
118
+ render :json => false and return if !logged_in_user.is_super_admin?
118
119
  resp = StdClass.new
119
120
  @block_type = BlockType.find(params[:id])
120
121
  @block_type.custom_sass = params['code']
@@ -126,20 +127,18 @@ module Caboose
126
127
 
127
128
  # @route GET /admin/block-types/:id/errors
128
129
  def admin_error_log
129
- return unless user_is_allowed('sites', 'edit')
130
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
130
131
  @block_type = BlockType.find(params[:id])
131
132
  render :layout => 'caboose/admin'
132
133
  end
133
134
 
134
135
  # @route POST /admin/block-types
135
136
  def admin_create
136
- return unless user_is_allowed('pages', 'add')
137
-
137
+ render :json => false and return if !logged_in_user.is_super_admin?
138
138
  resp = Caboose::StdClass.new({
139
139
  'error' => nil,
140
140
  'redirect' => nil
141
141
  })
142
-
143
142
  bt = BlockType.new(
144
143
  :parent_id => params[:parent_id] ? params[:parent_id] : nil,
145
144
  :name => params[:name].downcase.gsub(' ', '_'),
@@ -148,8 +147,7 @@ module Caboose
148
147
  :allow_child_blocks => false,
149
148
  :icon => 'checkbox-unchecked'
150
149
  )
151
- bt.save
152
-
150
+ bt.save
153
151
  # Send back the response
154
152
  resp.redirect = "/admin/block-types/#{bt.id}"
155
153
  render :json => resp
@@ -157,7 +155,7 @@ module Caboose
157
155
 
158
156
  # @route PUT /admin/block-types/:id
159
157
  def admin_update
160
- return unless user_is_allowed('pages', 'edit')
158
+ render :json => false and return if !logged_in_user.is_super_admin?
161
159
 
162
160
  resp = StdClass.new({'attributes' => {}})
163
161
  bt = BlockType.find(params[:id])
@@ -193,18 +191,24 @@ module Caboose
193
191
  end
194
192
  end
195
193
 
196
- # Trigger the page cache to be updated
197
- # query = ["update page_cache set refresh = true where page_id in (select distinct(page_id) from blocks where block_type_id = ?)", bt.id]
198
- # ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
199
- # PageCacher.delay(:queue => 'caboose_cache').refresh
200
-
201
194
  resp.success = save && bt.save
202
195
  render :json => resp
203
196
  end
197
+
198
+ # @route DELETE /admin/block-types/bulk
199
+ def admin_bulk_delete
200
+ render :json => false and return if !logged_in_user.is_super_admin?
201
+ params[:model_ids].each do |bt_id|
202
+ block_type = BlockType.where(:id => bt_id).first
203
+ block_type.destroy if block_type
204
+ end
205
+ resp = Caboose::StdClass.new('success' => true)
206
+ render :json => resp
207
+ end
204
208
 
205
209
  # @route DELETE /admin/block-types/:id
206
210
  def admin_delete
207
- return unless user_is_allowed('pages', 'delete')
211
+ render :json => false and return if !logged_in_user.is_super_admin?
208
212
  BlockType.find(params[:id]).destroy
209
213
  resp = StdClass.new({
210
214
  'redirect' => "/admin/block-types"
@@ -215,12 +219,7 @@ module Caboose
215
219
  # @route_priority 1
216
220
  # @route GET /admin/block-types/new-options
217
221
  def admin_options_for_new_block
218
- return unless user_is_allowed('blocktypes', 'edit')
219
- #cats = BlockTypeCategory.where("parent_id is not null and name != ?", 'Layouts').all.collect{ |cat| {
220
- # :block_type_category => cat,
221
- # :block_types => Caboose::BlockType.includes(:block_type_site_memberships).where(:parent_id => nil, :block_type_category_id => cat.id).where("block_type_site_memberships.site_id = ?", @site.id).reorder(:description).all
222
- #}}
223
-
222
+ return unless user_is_allowed('pages', 'edit')
224
223
  cats = BlockTypeCategory.where("name != ?", 'Layouts').all.collect{ |cat| {
225
224
  :block_type_category => cat,
226
225
  :block_types => Caboose::BlockType.includes(:block_type_site_memberships)
@@ -285,7 +284,7 @@ module Caboose
285
284
  render :json => options
286
285
  end
287
286
 
288
- def admin_tree_options_helper(options, bt, prefix)
287
+ def admin_tree_options_helper(options, bt, prefix)
289
288
  options << { 'value' => bt.id, 'text' => "#{prefix}#{bt.description}" }
290
289
  bt.children.each do |bt2|
291
290
  admin_tree_options_helper(options, bt2, " - #{prefix}")
@@ -294,7 +293,7 @@ module Caboose
294
293
 
295
294
  # @route GET /admin/block-type-site-memberships/:id/html
296
295
  def admin_edit_btsm_html
297
- return if !user_is_allowed_to('edit', 'sites')
296
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
298
297
  @btsm = BlockTypeSiteMembership.find(params[:id])
299
298
  if (@site.id != @btsm.site_id && !@site.is_master)
300
299
  @error = "You are not allowed to edit this site."
@@ -305,7 +304,7 @@ module Caboose
305
304
 
306
305
  # @route PUT /admin/block-type-site-memberships/:id/html
307
306
  def admin_update_btsm_html
308
- return if !user_is_allowed_to('edit', 'sites')
307
+ render :json => false and return if !logged_in_user.is_super_admin?
309
308
  resp = StdClass.new
310
309
  @btsm = BlockTypeSiteMembership.find(params[:id])
311
310
  code = params['code'].blank? ? '' : params['code'].gsub('<%==','<%= raw')
@@ -318,7 +317,7 @@ module Caboose
318
317
 
319
318
  # @route GET /admin/block-type-site-memberships/:id/css
320
319
  def admin_edit_btsm_css
321
- return if !user_is_allowed_to('edit', 'sites')
320
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
322
321
  @btsm = BlockTypeSiteMembership.find(params[:id])
323
322
  if (@site.id != @btsm.site_id && !@site.is_master)
324
323
  @error = "You are not allowed to edit this site."
@@ -329,7 +328,7 @@ module Caboose
329
328
 
330
329
  # @route PUT /admin/block-type-site-memberships/:id/css
331
330
  def admin_update_btsm_css
332
- return if !user_is_allowed_to('edit', 'sites')
331
+ render :json => false and return if !logged_in_user.is_super_admin?
333
332
  resp = StdClass.new
334
333
  @btsm = BlockTypeSiteMembership.find(params[:id])
335
334
  @btsm.custom_css = params['code']