caboose-cms 0.5.213 → 0.5.214

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTE3ZmMyZTkzMDU4NTMzOTRiZjc5ZDhmZDg0ZTBkYWEwYjIyZmMwMg==
4
+ YzFiYmRlZWU5Zjg3YTViMjZmNzZjZmEyMmFhZDQ3Zjc2MWI4Nzk3ZA==
5
5
  data.tar.gz: !binary |-
6
- ODhkMmI0NzA4YjM0MjQ2NDQyYmQ2MDM3YmUzODYyMWFiZGExNmIwMA==
6
+ MDQ1MzI3NTM2OTRmNzUxNzg0YjEyMWVhMjUzNzcyMzkxZDI1NWQ0Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDcwMjI0MGU3NGQ2YTE5OTExZmJlNWE4MWRlMDM2OTlkYzFiNjU3NGNlZGJi
10
- MWY0MzkwODIzZDk3Mjk0NTIxNWYxMWRlMjM1MGMxMGMzOTk3OTM3NTk0NTFj
11
- YWU5NzUwYTZhMDNmMTU5ZTljMDk5ZGI5ZGUxMWRmMDA2NWNjMjg=
9
+ ZWY2Y2NkYjE1YjQ3YmY2ZjhjZWEyZTBkOWI0NjM5MDczOTVkYWU2MmE0YjVh
10
+ MTUxMzc0NmVhNGZhOTZhMzU3NzI4Zjc2Nzc3Mjc1ZjRiOTE2YjgzYjZkNWYz
11
+ OGFkMGNhYTdmMmQ5M2FmYTMzZTI2NzA3MGQzZmUzYWIxMzk4MGU=
12
12
  data.tar.gz: !binary |-
13
- NzUzMTI0MDA0ZjQ1YmUzMzFhYzc1MmU1YzMxMjRjYzdiODliYTU3OWMwMzUz
14
- MGQ0NTNkYmYzZjI2MmZjOTA3OGQ2MDFhMTExNzY4ZDZmYjU5OGE0NDAxZTlk
15
- MDdkZmY0YTUyNWY0NzRhNWViMzAwZDg4Zjg1ZjIxMWQwMDcwZTE=
13
+ MWJiM2MxZGFiNGNhMmFjMjM0OTc0Y2Y5OTA5NjgxYjM1OWY0MTMyYmYxODlk
14
+ ZDBiZTVhZmNiNjcxZGMyZWYzYmEzMjNkNjZhZjE4MjJjM2I5MzBiNjdiN2Y1
15
+ Nzg1ZTU5N2FiYjU3NTg4MzMwZjcyZDlkMzhhZTE4ZjNiYWViM2E=
@@ -14,6 +14,8 @@
14
14
  //= require jquery
15
15
  //= require jquery_ujs
16
16
  //= require colorbox-rails
17
+ //= require caboose/jquery.datetimepicker
17
18
  //= require caboose/jquery.placeholder
18
19
  //= require caboose/jquery.detect
19
20
  //= require caboose/modal_integration
21
+ //= require caboose/admin_main
@@ -1,388 +1,11 @@
1
1
  /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
2
+ * /app/assets/stylesheets/caboose/modal.css
10
3
  *
4
+ *= require jquery-ui
5
+ *= require caboose/jquery.datetimepicker
11
6
  *= require colorbox-rails
12
7
  *= require caboose/fonts
13
8
  *= require caboose/caboose
14
9
  *= require caboose/model_binder
10
+ *= require caboose/modal_main
15
11
  */
16
-
17
- html { width: 100%; }
18
-
19
- @font-face {
20
- font-family: 'Avenir';
21
- src: url('//d1ygukj37mahb2.cloudfront.net/assets/avenir-medium.eot');
22
- src: url('//d1ygukj37mahb2.cloudfront.net/assets/avenir-medium.eot') format('embedded-opentype'),
23
- url('//d1ygukj37mahb2.cloudfront.net/assets/avenir-medium.woff') format('woff'),
24
- url('//d1ygukj37mahb2.cloudfront.net/assets/avenir-medium.ttf') format('truetype'),
25
- url('//d1ygukj37mahb2.cloudfront.net/assets/avenir-medium.svg') format('svg');
26
- font-weight: normal;
27
- font-style: normal;
28
- }
29
-
30
- body {
31
- background: #111111;
32
- margin: 0;
33
- padding: 0;
34
- color: #fff;
35
- width: 100%;
36
- font-family: "Avenir", Arial;
37
- }
38
-
39
- #modal_wrapper {
40
- width: 100%;
41
- position: relative;
42
- }
43
-
44
- #modal_content {
45
- width: 100%;
46
- max-width: 100%;
47
- padding: 0;
48
- }
49
-
50
- #modal_content h1 {
51
- margin: 0 0 12px 0;
52
- padding: 0;
53
- font-weight: normal;
54
- background: #111111;
55
- }
56
-
57
- #modal_content a {
58
- color: #ccc;
59
- text-decoration: none;
60
- border-bottom: #999 1px dotted;
61
- }
62
-
63
- #modal_content p.loading {
64
- background-image: url('/assets/caboose/loading_white_on_black.gif');
65
- background-position: 0 center;
66
- background-repeat: no-repeat;
67
- color: #ccc;
68
- font-weight: normal;
69
- font-size: 16pt;
70
- padding: 10px 10px 10px 40px;
71
- }
72
-
73
- #modal_content div.yesnobox {
74
- position: absolute;
75
- top: 0;
76
- left: 0;
77
- z-index: 22;
78
- background-color: rgba(0, 0, 0, 0.9);
79
- font-size: 20px;
80
- text-align: center;
81
- }
82
-
83
- #modal_content div.yesnobox div {
84
- padding: 20px;
85
- }
86
-
87
- #modal_content div.yesnobox input {
88
- width: auto;
89
- }
90
-
91
- div.model_attribute_text {
92
- color: #000;
93
- }
94
-
95
- #modal_content div.top_right_controls {
96
- position: absolute;
97
- top: 0;
98
- right: 0;
99
- }
100
-
101
- #modal_content div.top_right_controls a {
102
- display: inline-block;
103
- margin: 0;
104
- padding: 4px 8px;
105
- }
106
-
107
- input, select, textarea {
108
- font-family: "Avenir", Arial;
109
- border: 2px solid #ccc;
110
- background: #000;
111
- color: #fff;
112
- /*
113
- -moz-border-radius: 2px;
114
- -webkit-border-radius: 2px;
115
- border-radius: 2px; */
116
- padding: 4px 8px;
117
- height: 34px;
118
- font-size: 20px;
119
- z-index: 20;
120
- }
121
-
122
- input.dirty,
123
- textarea.dirty {
124
- background: #fff799;
125
- color: #000;
126
- }
127
-
128
- select {
129
- padding: 0;
130
- height: 44px;
131
- }
132
-
133
- option {
134
-
135
- }
136
-
137
- select.fake {
138
- background: transparent;
139
- position: absolute;
140
- top: 0;
141
- left: 0;
142
- color: transparent;
143
- }
144
-
145
- select.fake option {
146
- background: #fff;
147
- color: #000;
148
- }
149
-
150
- #modal_content .bound_input_check a,
151
- #modal_content .bound_input_cancel a {
152
- border: 1px solid #ccc;
153
- -moz-border-radius: 2px;
154
- -webkit-border-radius: 2px;
155
- border-radius: 2px;
156
-
157
- font-size: 28px;
158
- text-align: center;
159
- background: #00cc00;
160
- color: #fff;
161
-
162
- display: block;
163
- padding: 4px 0;
164
- height: 34px;
165
- }
166
-
167
- #modal_content .bound_input_check a.loading {
168
- background-image: url(/assets/caboose/loading_green.gif);
169
- background-color: #00cc00;
170
- background-repeat: no-repeat;
171
- background-position: 6px 5px;
172
- color: rgba(255, 255, 255, 0.0);
173
- }
174
-
175
- #modal_content .bound_textarea_controls a {
176
- display: inline-block;
177
- margin: 3px 0 0 1px;
178
- padding: 8px 0 6px 0;
179
- background: #ccc;
180
- color: #000;
181
- text-align: center;
182
- border: #666 1px solid;
183
- }
184
-
185
- #modal_content .bound_textarea_controls a.save { width: 60px; }
186
- #modal_content .bound_textarea_controls a.discard { width: 80px; }
187
-
188
- #modal_content .note,
189
- #modal_content .error {
190
- margin: 0;
191
- }
192
-
193
- #modal_content .placeholder {
194
- display: block;
195
- margin: 0;
196
- padding: 0 5px 0 0;
197
- height: 34px;
198
-
199
- position: absolute;
200
- top: 12px;
201
- left: 10px;
202
- z-index: 19;
203
- }
204
-
205
- #modal_content .placeholder span {
206
- display: block;
207
- font-size: 20px;
208
- color: #757575;
209
- }
210
-
211
- #modal_content input[type='checkbox'] {
212
- /*position: absolute;*/
213
- top: 4px;
214
- left: 0;
215
- z-index: 19;
216
-
217
- margin: 0;
218
- padding: 0;
219
- width: 20px;
220
- }
221
-
222
- #modal_content .search_form {
223
- position: absolute;
224
- top: 0;
225
- right: 0;
226
- }
227
-
228
- #modal_content table.data {
229
- border-collapse: collapse;
230
- }
231
-
232
- #modal_content table.data th {
233
- background: #000;
234
- border: #333 1px solid;
235
- color: #efefef;
236
- margin: 0;
237
- padding: 0;
238
- }
239
-
240
- #modal_content table.data th a {
241
- display: block;
242
- text-decoration: none;
243
- border: none;
244
- color: #fff;
245
- padding: 8px 12px;
246
- }
247
-
248
- #modal_content table.data th a:hover {
249
- color: #fff;
250
- background: #333;
251
- }
252
-
253
- #modal_content table.data td {
254
- background: #111111;
255
- border: #333 1px solid;
256
- color: #fff;
257
- margin: 0;
258
- padding: 8px 12px;
259
- }
260
-
261
- #modal_content table.data tr:nth-child(even) td {
262
- background-color: #000;
263
- }
264
-
265
-
266
- #modal_content table.data tr:nth-child(odd) td {
267
- background-color: transparent;
268
- }
269
-
270
- #modal_content table.data tr:hover td,
271
- #modal_content table.data tr:nth-child(even):hover td,
272
- #modal_content table.data tr:nth-child(odd):hover td {
273
- background: #333;
274
- color: #fff;
275
- }
276
-
277
- /*******************************************************************************
278
- Modeljs
279
- *******************************************************************************/
280
-
281
- #modal_content div.model_attribute_text {
282
- color: #fff;
283
- }
284
-
285
- #modal_content .model_attribute {
286
- background: none repeat scroll 0 0 transparent;
287
- display: block;
288
- padding: 2px 4px;
289
- text-decoration: none;
290
- }
291
-
292
- #modal_content .clear {
293
- clear: both;
294
- line-height: 0;
295
- }
296
-
297
- /*******************************************************************************
298
- Message boxes
299
- *******************************************************************************/
300
-
301
- #modal_content .note {
302
- padding: 20px;
303
- background: #fef49c;
304
- color: #000000;
305
- font-weight: bold;
306
- font-size: 1.4em;
307
- }
308
-
309
- #modal_content .note_small {
310
- display: block;
311
- padding: 4px 10px;
312
- background: #fef49c;
313
- color: #000000;
314
- font-size: 1em;
315
- }
316
-
317
- #modal_content .error {
318
- background: #9c171b;
319
- color: #ffffff;
320
- }
321
-
322
- #modal_content .error a {
323
- color: #fff;
324
- }
325
-
326
- #modal_content .error a:hover {
327
- color: #000;
328
- }
329
-
330
- #modal_content .success {
331
- background: #009900;
332
- color: #ffffff;
333
- }
334
-
335
- #modal_content .success a {
336
- color: #ffffff;
337
- }
338
-
339
- #cboxTopLeft,
340
- #cboxTopRight,
341
- #cboxBottomLeft,
342
- #cboxBottomRight,
343
- #cboxMiddleLeft,
344
- #cboxMiddleRight,
345
- #cboxTopCenter,
346
- #cboxBottomCenter,
347
- #cboxClose { background: #111 !important; }
348
-
349
- /*******************************************************************************
350
- Page Bar Generator
351
- *******************************************************************************/
352
-
353
- .page_links {
354
-
355
- }
356
-
357
- .page_links a {
358
- display: inline-block;
359
- margin: 0 2px;
360
- padding: 5px 8px 3px 8px;
361
-
362
- border: #505050 1px solid;
363
- background: #000;
364
- color: #505050;
365
- text-decoration: none;
366
- }
367
-
368
- .page_links a:hover {
369
- background: #505050;
370
- color: #fff;
371
- }
372
-
373
- .page_links .middle_links a {
374
-
375
- }
376
-
377
- .page_links span.current_page {
378
- display: inline-block;
379
- padding: 5px 8px 3px 8px;
380
-
381
- border: #ccc 1px solid;
382
- background: #ccc;
383
- color: #000;
384
- text-decoration: none;
385
- }
386
-
387
- #search_form input[type='text'] { height: 20px; padding: 6px 12px; }
388
- #search_form input[type='submit'] { height: 35px; padding: 0 12px; }
@@ -1,3 +1,7 @@
1
+ /*
2
+ * /app/assets/stylesheets/caboose/modal_main.css
3
+ */
4
+
1
5
  html { width: 100%; }
2
6
 
3
7
  @font-face {
@@ -153,6 +153,9 @@ module Caboose
153
153
  # Save the order
154
154
  @order.save
155
155
 
156
+ # Decrement quantities of variants
157
+ @order.decrement_quantities
158
+
156
159
  # Clear the cart and re-initialize
157
160
  session[:cart_id] = nil
158
161
  init_cart
@@ -363,15 +366,19 @@ module Caboose
363
366
 
364
367
  # Go ahead and capture funds if the order only contained downloadable items
365
368
  @order = Order.find(params[:order_id])
366
- if !@order.has_shippable_items?
367
- capture_resp = @order.capture_funds
368
- if capture_resp.error
369
- @resp.success = false
370
- @resp.error = capture_resp.error
371
- end
372
- end
373
369
 
374
- if @resp.success
370
+ if @resp.success
371
+ if !@order.has_shippable_items?
372
+ capture_resp = @order.capture_funds
373
+ if capture_resp.error
374
+ @resp.success = false
375
+ @resp.error = capture_resp.error
376
+ end
377
+ end
378
+
379
+ # Decrement quantities of variants
380
+ @order.decrement_quantities
381
+
375
382
  session[:cart_id] = nil
376
383
  init_cart
377
384
  end
@@ -9,7 +9,7 @@ module Caboose
9
9
  # GET /admin/roles
10
10
  def index
11
11
  return unless user_is_allowed('roles', 'view')
12
- top_roles = Role.tree
12
+ top_roles = Role.tree(@site.id)
13
13
  arr = []
14
14
  top_roles.each { |r| arr += add_role_options(r, 0) }
15
15
  @roles = arr
@@ -36,12 +36,18 @@ module Caboose
36
36
  'redirect' => nil
37
37
  })
38
38
 
39
- role = Role.new()
40
- role.parent_id = params[:parent_id]
41
- role.name = params[:name]
42
- role.save
43
-
44
- resp.redirect = "/admin/roles/#{role.id}/edit"
39
+ parent = Role.where(:id => params[:parent_id]).first
40
+ if parent.nil?
41
+ resp.error = "Parent role must be part of this site."
42
+ else
43
+ role = Role.new()
44
+ role.site_id = @site.id
45
+ role.parent_id = params[:parent_id]
46
+ role.name = params[:name]
47
+ role.save
48
+ resp.redirect = "/admin/roles/#{role.id}"
49
+ end
50
+
45
51
  render json: resp
46
52
  end
47
53
 
@@ -61,8 +67,12 @@ module Caboose
61
67
  role.description = value
62
68
  when "parent_id"
63
69
  value = value.to_i
70
+ p = Role.where(:id => value).first
64
71
  if role.id == value
65
72
  resp.error = "You can't set the parent to be this role."
73
+ save = false
74
+ elsif value != -1 && (p.nil? || p.site_id != role.site_id)
75
+ resp.error = "Invalid parent."
66
76
  save = false
67
77
  elsif role.is_ancestor_of?(value)
68
78
  resp.error = "You can't set the parent to be one of the child roles."
@@ -71,8 +81,7 @@ module Caboose
71
81
  role.parent_id = value
72
82
  if value == -1
73
83
  resp.attributes = { 'parent_id' => { 'text' => '[No parent]' }}
74
- else
75
- p = Role.find(value)
84
+ else
76
85
  resp.attributes = { 'parent_id' => { 'text' => p.name }}
77
86
  end
78
87
  end
@@ -114,7 +123,7 @@ module Caboose
114
123
  # GET /admin/roles/options
115
124
  def options
116
125
  return unless user_is_allowed('roles', 'view')
117
- @top_roles = Role.tree
126
+ @top_roles = Role.tree(@site.id)
118
127
  arr = [{
119
128
  "value" => -1,
120
129
  "text" => 'Top Level'
@@ -47,17 +47,9 @@ module Caboose
47
47
  render :file => 'caboose/extras/error' and return
48
48
  end
49
49
 
50
- @site = Site.find(params[:id])
51
-
52
- # Create an admin user for the account
53
- if !User.where(:username => 'admin', :site_id => @site.id).exists?
54
- admin_user = User.create(:username => 'admin', :email => 'admin@nine.is', :site_id => @site.id, :password => Digest::SHA1.hexdigest(Caboose::salt + 'caboose'))
55
- admin_role = Role.where(:name => 'Admin').first
56
- if admin_user && admin_role
57
- RoleMembership.create(:user_id => admin_user.id, :role_id => admin_role.id)
58
- end
59
- end
60
-
50
+ @site = Site.find(params[:id])
51
+ @site.init_users_and_roles
52
+
61
53
  end
62
54
 
63
55
  # GET /admin/sites/:id/block-types
@@ -117,17 +109,8 @@ module Caboose
117
109
  StoreConfig.create(:site_id => site.id)
118
110
  SmtpConfig.create( :site_id => site.id)
119
111
  resp.redirect = "/admin/sites/#{site.id}"
120
- end
121
-
122
- # Create an admin user for the account
123
- if !User.where(:username => 'admin', :site_id => site.id).exists?
124
- admin_user = User.create(:username => 'admin', :email => 'admin@nine.is', :site_id => site.id, :password => Digest::SHA1.hexdigest(Caboose::salt + 'caboose'))
125
- admin_role = Role.where(:name => 'Admin').first
126
- if admin_role
127
- RoleMembership.create(:user_id => admin_user.id, :role_id => admin_role.id)
128
- end
129
- end
130
-
112
+ end
113
+ site.init_users_and_roles
131
114
  render :json => resp
132
115
  end
133
116
 
@@ -48,7 +48,7 @@ module Caboose
48
48
  def edit
49
49
  return if !user_is_allowed('users', 'edit')
50
50
  @edituser = User.find(params[:id])
51
- @all_roles = Role.tree
51
+ @all_roles = Role.tree(@site.id)
52
52
  @roles = Role.roles_with_user(@edituser.id)
53
53
  end
54
54
 
@@ -1,19 +1,16 @@
1
1
 
2
2
  class Caboose::Role < ActiveRecord::Base
3
3
  self.table_name = "roles"
4
- belongs_to :parent, :class_name => "Caboose::Role"
5
-
6
- #has_and_belongs_to_many :users
4
+
5
+ belongs_to :site, :class_name => 'Caboose::Site'
6
+ belongs_to :parent, :class_name => "Caboose::Role"
7
7
  has_many :role_memberships
8
- has_many :users, :through => :role_memberships
9
-
10
- #has_and_belongs_to_many :permissions
8
+ has_many :users, :through => :role_memberships
11
9
  has_many :role_permissions
12
- has_many :permissions, :through => :role_permissions
13
-
10
+ has_many :permissions, :through => :role_permissions
14
11
  has_many :page_permissions
15
12
 
16
- attr_accessible :name, :description, :parent_id
13
+ attr_accessible :name, :description, :parent_id, :site_id
17
14
  attr_accessor :children
18
15
 
19
16
  def self.admin_role
@@ -71,13 +68,13 @@ class Caboose::Role < ActiveRecord::Base
71
68
  return self.where("users.id" => user_id).all(:include => :users)
72
69
  end
73
70
 
74
- def self.tree
75
- return self.where(:parent_id => -1).reorder("name").all
71
+ def self.tree(site_id)
72
+ return self.where(:parent_id => -1, :site_id => site_id).reorder("name").all
76
73
  end
77
74
 
78
- def self.flat_tree(prefix = '-')
75
+ def self.flat_tree(site_id, prefix = '-')
79
76
  arr = []
80
- self.tree.each do |r|
77
+ self.tree(site_id).each do |r|
81
78
  arr += self.flat_tree_helper(r, prefix, '')
82
79
  end
83
80
  return arr
@@ -556,6 +556,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
556
556
  [ :rating , :decimal ]
557
557
  ],
558
558
  Caboose::Role => [
559
+ [ :site_id , :integer ],
559
560
  [ :parent_id , :integer ],
560
561
  [ :name , :string ],
561
562
  [ :description , :string ]
@@ -106,4 +106,29 @@ class Caboose::Site < ActiveRecord::Base
106
106
  self.save
107
107
  end
108
108
 
109
+ def init_users_and_roles
110
+
111
+ admin_user = Caboose::User.where(:username => 'admin', :site_id => self.id).first
112
+ admin_user = Caboose::User.create(:username => 'admin', :email => 'admin@nine.is', :site_id => self.id, :password => Digest::SHA1.hexdigest(Caboose::salt + 'caboose')) if admin_user.nil?
113
+
114
+ admin_role = Caboose::Role.where(:site_id => self.id, :name => 'Admin').first
115
+ admin_role = Caboose::Role.create(:site_id => self.id, :parent_id => -1, :name => 'Admin') if admin_role.nil?
116
+
117
+ elo_role = Caboose::Role.where(:site_id => self.id, :name => 'Everyone Logged Out').first
118
+ elo_role = Caboose::Role.create(:site_id => self.id, :parent_id => -1, :name => 'Everyone Logged Out') if elo_role.nil?
119
+
120
+ eli_role = Caboose::Role.where(:site_id => self.id, :name => 'Everyone Logged In').first
121
+ eli_role = Caboose::Role.create(:site_id => self.id, :parent_id => elo_role.id, :name => 'Everyone Logged In') if eli_role.nil?
122
+
123
+ # Make sure the admin role has the admin "all" permission
124
+ admin_perm = Caboose::Permission.where(:resource => 'all', :action => 'all').first
125
+ rp = Caboose::RolePermission.where(:role_id => admin_role.id, :permission_id => admin_perm.id).first
126
+ rp = Caboose::RolePermission.create(:role_id => admin_role.id, :permission_id => admin_perm.id) if rp.nil?
127
+
128
+ # Make sure the admin user is a member of the admin role
129
+ rm = Caboose::RoleMembership.where(:role_id => admin_role.id, :user_id => admin_user.id).first
130
+ rm = Caboose::RoleMembership.create(:role_id => admin_role.id, :user_id => admin_user.id) if rm.nil?
131
+
132
+ end
133
+
109
134
  end
@@ -1,6 +1,7 @@
1
1
  class Caboose::User < ActiveRecord::Base
2
- self.table_name = "users"
3
- #has_and_belongs_to_many :roles
2
+ self.table_name = "users"
3
+
4
+ belongs_to :site, :class_name => 'Caboose::Site'
4
5
  has_many :role_memberships
5
6
  has_many :roles, :through => :role_memberships
6
7
  has_attached_file :image,
@@ -5,7 +5,7 @@
5
5
 
6
6
  <table class='data' id='viewers'>
7
7
  <tr><th>Role</th><th>View</th><th>Edit</th></tr>
8
- <% Caboose::Role.flat_tree(' - ').each do |r| %>
8
+ <% Caboose::Role.flat_tree(@site.id, ' - ').each do |r| %>
9
9
  <% next if r.id == 1 %>
10
10
  <% may_view = Caboose::PagePermission.where(:role_id => r.id, :page_id => @page.id, :action => 'view').exists? %>
11
11
  <% may_edit = Caboose::PagePermission.where(:role_id => r.id, :page_id => @page.id, :action => 'edit').exists? %>
@@ -1,20 +1,30 @@
1
1
 
2
2
  <h1>Editing Role</h1>
3
+
4
+ <p><input type='button' value='< Back' onclick="window.location='/admin/roles';" /></p>
5
+
3
6
  <div id="role_<%= @role.id %>_name"></div>
4
7
  <div id="role_<%= @role.id %>_parent_id"></div>
5
8
  <div id="role_<%= @role.id %>_description"></div>
9
+
6
10
  <h3>Members</h3>
7
- <div id='members'>
8
- <table class='data'>
9
- <% Caboose::User.reorder("last_name, first_name").all.each do |u| %>
10
- <% is_member = Caboose::RoleMembership.where(:role_id => @role.id, :user_id => u.id).exists? %>
11
- <tr>
12
- <td><input type='checkbox' name='user<%= u.id %>' <%= raw is_member ? "checked='true'" : '' %> onclick="toggle_role(<%= u.id %>, <%= @role.id %>, $(this).prop('checked'));" /></td>
13
- <td><%= u.first_name %> <%= u.last_name %> (<%= u.email %>)</td>
14
- </tr>
15
- <% end %>
16
- </table>
17
- </div>
11
+ <% users = Caboose::User.where(:site_id => @site.id).reorder("last_name, first_name").all %>
12
+ <% if users && users.count > 0 %>
13
+ <div id='members'>
14
+ <table class='data'>
15
+ <% users.each do |u| %>
16
+ <% is_member = Caboose::RoleMembership.where(:role_id => @role.id, :user_id => u.id).exists? %>
17
+ <tr>
18
+ <td><input type='checkbox' name='user<%= u.id %>' <%= raw is_member ? "checked='true'" : '' %> onclick="toggle_role(<%= u.id %>, <%= @role.id %>, $(this).prop('checked'));" /></td>
19
+ <td><%= u.first_name %> <%= u.last_name %> (<%= u.email %>)</td>
20
+ </tr>
21
+ <% end %>
22
+ </table>
23
+ </div>
24
+ <% else %>
25
+ <p>There are no users for this site.</p>
26
+ <% end %>
27
+
18
28
  <h3>Permissions</h3>
19
29
  <div id='permissions'>
20
30
  <table class='data'>
@@ -27,6 +37,7 @@
27
37
  <% end %>
28
38
  </table>
29
39
  </div>
40
+
30
41
  <div id="role_<%= @role.id %>_members"></div>
31
42
  <div id="role_<%= @role.id %>_permissions"></div>
32
43
  <div id="message"></div>
@@ -42,11 +53,6 @@
42
53
  <%= javascript_include_tag "caboose/model/all" %>
43
54
  <script type="text/javascript">
44
55
 
45
- var modal = false;
46
- $(window).load(function() {
47
- modal = new CabooseModal(600, 600);
48
- });
49
-
50
56
  $(document).ready(function() {
51
57
  new ModelBinder({
52
58
  name: 'Role',
@@ -59,8 +65,7 @@ $(document).ready(function() {
59
65
  { name: 'parent_id' , nice_name: 'Parent' , type: 'select', value: <%= @role.parent_id %>, text: "<%= @role.parent.nil? ? '[No parent]' : @role.parent.name %>", show_controls: true, loading_message: 'Getting roles...', options_url: '/admin/roles/options', width: 590, message: 'message' },
60
66
  { name: 'name' , nice_name: 'Name' , type: 'text' , value: "<%= @role.name %>" , width: 590 , message: 'message' },
61
67
  { name: 'description' , nice_name: 'Description' , type: 'text' , value: "<%= @role.description %>" , width: 590 , message: 'message' }
62
- ],
63
- on_load: function() { modal.autosize(); }
68
+ ]
64
69
  });
65
70
  });
66
71
 
@@ -5,7 +5,7 @@
5
5
  <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
6
6
  <p><select name='parent_id'>
7
7
  <option value=''>-- Select a parent role --</option>
8
- <% Caboose::Role.flat_tree(' - ').each do |r| %>
8
+ <% Caboose::Role.flat_tree(@site.id, ' - ').each do |r| %>
9
9
  <option value='<%= r.id %>'><%= r.name %></option>
10
10
  <% end %>
11
11
  </select></p>
@@ -10,7 +10,7 @@ pic = "http://gravatar.com/avatar/#{gravatar_id}.png?s=150" #&d=/assets/caboose/
10
10
  <p><div id='user_<%= @edituser.id %>_email' ></div></p>
11
11
  <div id='roles'>
12
12
  <table class='data'>
13
- <% Caboose::Role.flat_tree.each do |r| %>
13
+ <% Caboose::Role.flat_tree(@site.id).each do |r| %>
14
14
  <% is_member = Caboose::RoleMembership.where(:role_id => r.id, :user_id => @edituser.id).exists? %>
15
15
  <tr><td><input type='checkbox' name='role<%= r.id %>' <%= is_member ? "checked='true'" : '' %> onclick="toggle_role(<%= @edituser.id %>, <%= r.id %>, $(this).prop('checked'));" /></td><td><%= r.name %></td></tr>
16
16
  <% end %>
@@ -32,10 +32,6 @@ pic = "http://gravatar.com/avatar/#{gravatar_id}.png?s=150" #&d=/assets/caboose/
32
32
  <% content_for :caboose_js do %>
33
33
  <%= javascript_include_tag "caboose/model/all" %>
34
34
  <script type="text/javascript">
35
- var modal = false;
36
- $(window).load(function() {
37
- modal = new CabooseModal(500);
38
- });
39
35
 
40
36
  $(document).ready(function() {
41
37
  new ModelBinder({
@@ -48,8 +44,7 @@ $(document).ready(function() {
48
44
  { name: 'last_name' , nice_name: 'Last name' , type: 'text', value: <%= raw Caboose.json(@edituser.last_name) %>, width: 280 },
49
45
  { name: 'username' , nice_name: 'Username' , type: 'text', value: <%= raw Caboose.json(@edituser.username) %>, width: 280 },
50
46
  { name: 'email' , nice_name: 'Email' , type: 'text', value: <%= raw Caboose.json(@edituser.email) %>, width: 280 }
51
- ],
52
- on_load: function() { modal.autosize(); }
47
+ ]
53
48
  });
54
49
  });
55
50
 
@@ -23,7 +23,7 @@
23
23
  %>
24
24
  </tr>
25
25
  <% @users.each do |user| %>
26
- <tr onclick="window.location='/admin/users/<%= user.id %>/edit';">
26
+ <tr onclick="window.location='/admin/users/<%= user.id %>';">
27
27
  <td><%= user.first_name %></td>
28
28
  <td><%= user.last_name %></td>
29
29
  <td><%= user.username %></td>
@@ -36,8 +36,6 @@
36
36
 
37
37
  <% content_for :caboose_js do %>
38
38
  <script type='text/javascript'>
39
- $(document).ready(function() {
40
- var modal = new CabooseModal(500);
41
- });
39
+
42
40
  </script>
43
41
  <% end %>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.213'
2
+ VERSION = '0.5.214'
3
3
  end
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.5.213
4
+ version: 0.5.214
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -939,6 +939,7 @@ files:
939
939
  - app/views/layouts/caboose/empty.html.erb
940
940
  - app/views/layouts/caboose/error404.html.erb
941
941
  - app/views/layouts/caboose/modal.html.erb
942
+ - app/views/layouts/caboose/no_layout.html.erb
942
943
  - app/views/layouts/caboose/store/_banner.html.erb
943
944
  - app/views/layouts/caboose/store/_banner2.html.erb
944
945
  - app/views/layouts/caboose/store/_footer.html.erb