caboose-cms 0.9.228 → 0.9.229
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/admin.js +1 -1
- data/app/assets/javascripts/caboose/admin_main.js +1 -13
- data/app/assets/javascripts/caboose/admin_media_index.js +161 -158
- data/app/assets/javascripts/caboose/application.js +8 -7
- data/app/assets/javascripts/caboose/block_content_controller_dragdrop.js +60 -4
- data/app/assets/javascripts/caboose/block_modal_controllers/block_dd_modal_controller.js +3 -2
- data/app/assets/javascripts/caboose/block_modal_controllers/media_modal_controller.js +17 -6
- data/app/assets/javascripts/caboose/model/all.js +5 -1
- data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +2 -1
- data/app/assets/stylesheets/caboose/admin_edit_page_content_dragdrop.scss +71 -15
- data/app/assets/stylesheets/caboose/admin_main.css.scss +25 -29
- data/app/assets/stylesheets/caboose/admin_media_index.css.scss +26 -5
- data/app/assets/stylesheets/caboose/application.css +11 -5
- data/app/assets/stylesheets/caboose/login.scss +1 -0
- data/app/assets/stylesheets/caboose/model_binder.css +13 -4
- data/app/assets/stylesheets/caboose/page_bar_generator.css +2 -1
- data/app/controllers/caboose/admin_controller.rb +3 -4
- data/app/controllers/caboose/application_controller.rb +16 -19
- data/app/controllers/caboose/block_types_controller.rb +8 -6
- data/app/controllers/caboose/cart_controller.rb +2 -2
- data/app/controllers/caboose/change_logs_controller.rb +13 -0
- data/app/controllers/caboose/fonts_controller.rb +139 -2
- data/app/controllers/caboose/invoices_controller.rb +5 -4
- data/app/controllers/caboose/login_logs_controller.rb +5 -7
- data/app/controllers/caboose/media_categories_controller.rb +16 -2
- data/app/controllers/caboose/media_controller.rb +14 -11
- data/app/controllers/caboose/pages_controller.rb +104 -42
- data/app/controllers/caboose/posts_controller.rb +53 -7
- data/app/controllers/caboose/products_controller.rb +1 -1
- data/app/controllers/caboose/sites_controller.rb +25 -6
- data/app/controllers/caboose/sns_controller.rb +3 -3
- data/app/controllers/caboose/themes_controller.rb +30 -0
- data/app/controllers/caboose/users_controller.rb +17 -10
- data/app/controllers/caboose/variants_controller.rb +9 -9
- data/app/models/caboose/block.rb +98 -22
- data/app/models/caboose/block_type.rb +2 -1
- data/app/models/caboose/block_type_parser.rb +1 -1
- data/app/models/caboose/calendar_event_group.rb +2 -2
- data/app/models/caboose/change_log.rb +97 -0
- data/app/models/caboose/core_plugin.rb +4 -3
- data/app/models/caboose/font.rb +7 -2
- data/app/models/caboose/font_variant.rb +12 -0
- data/app/models/caboose/media.rb +15 -4
- data/app/models/caboose/media_category.rb +2 -4
- data/app/models/caboose/page.rb +316 -45
- data/app/models/caboose/page_bar_generator.rb +20 -10
- data/app/models/caboose/post.rb +108 -8
- data/app/models/caboose/product.rb +1 -1
- data/app/models/caboose/role.rb +2 -2
- data/app/models/caboose/schema.rb +73 -72
- data/app/models/caboose/site.rb +203 -1
- data/app/models/caboose/theme.rb +70 -5
- data/app/views/caboose/block_types/admin_edit.html.erb +6 -8
- data/app/views/caboose/blocks/_cached_block.html.erb +28 -0
- data/app/views/caboose/blocks/_file.html.erb +2 -2
- data/app/views/caboose/blocks/_ga.html.erb +1 -2
- data/app/views/caboose/blocks/_image.html.erb +4 -0
- data/app/views/caboose/blocks/_render_function.html.erb +9 -4
- data/app/views/caboose/change_logs/admin_index.html.erb +65 -0
- data/app/views/caboose/fonts/admin_family_edit.html.erb +63 -0
- data/app/views/caboose/fonts/admin_family_index.html.erb +42 -0
- data/app/views/caboose/fonts/admin_index.html.erb +55 -10
- data/app/views/caboose/fonts/admin_variant_edit.html.erb +84 -0
- data/app/views/caboose/invoices_mailer/customer_status_updated.html.erb +5 -14
- data/app/views/caboose/login_logs/admin_index_for_user.html.erb +1 -1
- data/app/views/caboose/media/admin_index.html.erb +14 -24
- data/app/views/caboose/my_account/index.html.erb +1 -0
- data/app/views/caboose/pages/_admin_header.html.erb +5 -0
- data/app/views/caboose/pages/admin_change_logs.html.erb +56 -0
- data/app/views/caboose/pages/admin_edit_content.html.erb +6 -2
- data/app/views/caboose/pages/admin_edit_general.html.erb +32 -4
- data/app/views/caboose/pages/compiled_asset.css.erb +0 -0
- data/app/views/caboose/pages/compiled_asset.js.erb +0 -0
- data/app/views/caboose/posts/_admin_header.html.erb +5 -0
- data/app/views/caboose/posts/admin_change_logs.html.erb +56 -0
- data/app/views/caboose/posts/admin_delete_form.html.erb +1 -1
- data/app/views/caboose/posts/admin_edit_content.html.erb +6 -2
- data/app/views/caboose/products/admin_group_variants.html.erb +1 -1
- data/app/views/caboose/products/admin_sort.html copy.erb +1 -1
- data/app/views/caboose/sites/admin_edit.html.erb +21 -0
- data/app/views/caboose/sites/compiled_asset.css.erb +0 -0
- data/app/views/caboose/sites/compiled_asset.js.erb +0 -0
- data/app/views/caboose/themes/admin_edit.html.erb +7 -3
- data/app/views/caboose/themes/admin_error_log.html.erb +9 -0
- data/app/views/caboose/themes/admin_js.html.erb +131 -0
- data/app/views/caboose/users/_admin_header.html.erb +4 -0
- data/app/views/caboose/users/admin_change_logs.html.erb +63 -0
- data/app/views/caboose/users/admin_edit_roles.html.erb +1 -0
- data/app/views/caboose/variants/admin_group.html.erb +1 -1
- data/app/views/layouts/caboose/admin.html.erb +9 -2
- data/app/views/layouts/caboose/application.html.erb +62 -92
- data/app/views/layouts/caboose/css.css.erb +44 -0
- data/app/views/layouts/caboose/footer_css.css.erb +41 -0
- data/app/views/layouts/caboose/footer_js.js.erb +31 -0
- data/app/views/layouts/caboose/js.js.erb +34 -0
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +3 -14
- metadata +23 -27
- data/app/controllers/caboose/assets_controller.rb +0 -65
- data/app/models/caboose/asset.rb +0 -23
- data/app/models/caboose/asset_manifest.rb +0 -91
- data/app/models/caboose/block_cache.rb +0 -105
- data/app/models/caboose/block_cache_file.rb +0 -22
- data/app/models/caboose/block_cache_image.rb +0 -53
- data/app/models/caboose/page_cache.rb +0 -12
- data/app/models/caboose/page_cacher.rb +0 -137
- data/app/views/caboose/pages/admin_new_old.html.erb +0 -46
- data/app/views/caboose/pages/test.html.erb +0 -64
@@ -7,12 +7,17 @@
|
|
7
7
|
*
|
8
8
|
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
9
|
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require colorbox-rails
|
12
|
-
*= require caboose/page_bar_generator
|
13
|
-
*= require caboose/model_binder
|
10
|
+
*
|
14
11
|
*/
|
15
12
|
|
13
|
+
|
14
|
+
|
15
|
+
/* Removed:; */
|
16
|
+
/*
|
17
|
+
require colorbox-rails
|
18
|
+
require caboose/page_bar_generator
|
19
|
+
require caboose/model_binder
|
20
|
+
|
16
21
|
#cboxLoadedContent { margin-bottom: 0; }
|
17
22
|
|
18
23
|
#cboxTopLeft,
|
@@ -24,4 +29,5 @@
|
|
24
29
|
#cboxTopCenter,
|
25
30
|
#cboxBottomCenter,
|
26
31
|
#cboxClose { background: #111; }
|
27
|
-
#cboxWrapper { border-radius: 7px !important; }
|
32
|
+
#cboxWrapper { border-radius: 7px !important; }
|
33
|
+
*/
|
@@ -1,7 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
#cboxLoadedContent { margin-bottom: 0; }
|
2
|
+
|
3
|
+
#cboxTopLeft,
|
4
|
+
#cboxTopRight,
|
5
|
+
#cboxBottomLeft,
|
6
|
+
#cboxBottomRight,
|
7
|
+
#cboxMiddleLeft,
|
8
|
+
#cboxMiddleRight,
|
9
|
+
#cboxTopCenter,
|
10
|
+
#cboxBottomCenter,
|
11
|
+
#cboxClose { background: #111; }
|
12
|
+
#cboxWrapper { border-radius: 7px !important; }
|
13
|
+
|
5
14
|
.mb_container {
|
6
15
|
width: 100%;
|
7
16
|
overflow: hidden;
|
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
1
|
module Caboose
|
3
2
|
class AdminController < ApplicationController
|
4
3
|
|
5
4
|
# @route GET /admin
|
6
|
-
def index
|
7
|
-
return if !
|
5
|
+
def index
|
6
|
+
return if !user_is_allowed_to('view', 'admin')
|
8
7
|
@return_url = params[:return_url].nil? ? '/admin/pages' : params[:return_url]
|
9
8
|
end
|
10
9
|
|
11
10
|
end
|
12
|
-
end
|
11
|
+
end
|
@@ -12,9 +12,7 @@ module Caboose
|
|
12
12
|
|
13
13
|
# Modify the built-in params array with URL params if necessary
|
14
14
|
parse_url_params if Caboose.use_url_params
|
15
|
-
|
16
|
-
# @use_page_cache = !request.fullpath.starts_with?('/admin')
|
17
|
-
|
15
|
+
|
18
16
|
# Get the site we're working with
|
19
17
|
@domain = Domain.where(:domain => request.host_with_port).first
|
20
18
|
@site = @domain ? @domain.site : nil
|
@@ -26,15 +24,17 @@ module Caboose
|
|
26
24
|
CabooseMailer.site = @site
|
27
25
|
|
28
26
|
# Make sure someone is logged in
|
29
|
-
if !logged_in? && @site
|
30
|
-
|
27
|
+
if !logged_in? && @site
|
28
|
+
elo_id = cookies[:caboose_elo_id]
|
29
|
+
if elo_id.blank?
|
30
|
+
elo_id = User.logged_out_user_id(@site.id)
|
31
|
+
cookies[:caboose_elo_id] = elo_id # Cache the site's ELO id in browser to prevent multiple lookups
|
32
|
+
end
|
33
|
+
elo = User.find(elo_id)
|
31
34
|
login_user(elo) if elo
|
32
35
|
end
|
33
36
|
|
34
|
-
session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
|
35
|
-
|
36
|
-
# Initialize AB Testing
|
37
|
-
AbTesting.init(request.session_options[:id]) if Caboose.use_ab_testing
|
37
|
+
session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
|
38
38
|
|
39
39
|
# Try to find the page
|
40
40
|
@request = request
|
@@ -47,13 +47,8 @@ module Caboose
|
|
47
47
|
@is_real_page = false
|
48
48
|
@ga_events = []
|
49
49
|
|
50
|
-
|
51
|
-
@page = Page.page_with_uri(request.host_with_port, request.fullpath)
|
52
|
-
# @crumb_trail = Caboose::Page.crumb_trail(@page)
|
53
|
-
#end
|
54
|
-
|
50
|
+
@page = Page.page_with_uri(request.host_with_port, request.fullpath)
|
55
51
|
|
56
|
-
|
57
52
|
# Sets an instance variable of the logged in user
|
58
53
|
@logged_in_user = logged_in_user
|
59
54
|
|
@@ -155,7 +150,12 @@ module Caboose
|
|
155
150
|
def logged_in?
|
156
151
|
validate_token
|
157
152
|
validate_cookie
|
158
|
-
|
153
|
+
elo_id = cookies[:caboose_elo_id]
|
154
|
+
if elo_id.blank?
|
155
|
+
elo_id = User.logged_out_user_id(@site.id)
|
156
|
+
cookies[:caboose_elo_id] = elo_id # Cache the site's ELO id in browser to prevent multiple lookups
|
157
|
+
end
|
158
|
+
return true if !session["app_user"].nil? && session["app_user"] != false && session["app_user"].id != -1 && session["app_user"].id.to_s != elo_id.to_s
|
159
159
|
return false
|
160
160
|
end
|
161
161
|
|
@@ -164,10 +164,8 @@ module Caboose
|
|
164
164
|
def validate_token
|
165
165
|
token = params[:token]
|
166
166
|
return false if token.nil?
|
167
|
-
|
168
167
|
user = User.validate_token(token)
|
169
168
|
return false if user.nil?
|
170
|
-
|
171
169
|
login_user(user)
|
172
170
|
return true
|
173
171
|
end
|
@@ -242,7 +240,6 @@ module Caboose
|
|
242
240
|
end
|
243
241
|
return false
|
244
242
|
end
|
245
|
-
|
246
243
|
@user = logged_in_user
|
247
244
|
unless @user.is_allowed(resource, action)
|
248
245
|
if json
|
@@ -155,7 +155,8 @@ module Caboose
|
|
155
155
|
|
156
156
|
# @route PUT /admin/block-types/:id
|
157
157
|
def admin_update
|
158
|
-
|
158
|
+
can_edit = (params[:site_id] && params[:site_id][0] && params[:site_id][0] == @site.id.to_s && logged_in_user.is_allowed('site_settings', 'edit')) || logged_in_user.is_super_admin?
|
159
|
+
render :json => false and return if !can_edit
|
159
160
|
|
160
161
|
resp = StdClass.new({'attributes' => {}})
|
161
162
|
bt = BlockType.find(params[:id])
|
@@ -186,7 +187,8 @@ module Caboose
|
|
186
187
|
when 'options_url' then bt.options_url = v
|
187
188
|
when 'default_constrain' then bt.default_constrain = v
|
188
189
|
when 'default_full_width' then bt.default_full_width = v
|
189
|
-
when '
|
190
|
+
when 'is_dynamic' then bt.is_dynamic = v
|
191
|
+
when 'default_included' then bt.default_included = v
|
190
192
|
when 'site_id' then resp.btsm_id = bt.toggle_site(v[0], v[1])
|
191
193
|
end
|
192
194
|
end
|
@@ -293,7 +295,7 @@ module Caboose
|
|
293
295
|
|
294
296
|
# @route GET /admin/block-type-site-memberships/:id/html
|
295
297
|
def admin_edit_btsm_html
|
296
|
-
redirect_to '/admin' and return if !logged_in_user.
|
298
|
+
redirect_to '/admin' and return if !logged_in_user.is_allowed('site_settings', 'edit')
|
297
299
|
@btsm = BlockTypeSiteMembership.find(params[:id])
|
298
300
|
if (@site.id != @btsm.site_id && !@site.is_master)
|
299
301
|
@error = "You are not allowed to edit this site."
|
@@ -304,7 +306,7 @@ module Caboose
|
|
304
306
|
|
305
307
|
# @route PUT /admin/block-type-site-memberships/:id/html
|
306
308
|
def admin_update_btsm_html
|
307
|
-
render :json => false and return if !logged_in_user.
|
309
|
+
render :json => false and return if !logged_in_user.is_allowed('site_settings', 'edit')
|
308
310
|
resp = StdClass.new
|
309
311
|
@btsm = BlockTypeSiteMembership.find(params[:id])
|
310
312
|
code = params['code'].blank? ? '' : params['code'].gsub('<%==','<%= raw')
|
@@ -317,7 +319,7 @@ module Caboose
|
|
317
319
|
|
318
320
|
# @route GET /admin/block-type-site-memberships/:id/css
|
319
321
|
def admin_edit_btsm_css
|
320
|
-
redirect_to '/admin' and return if !logged_in_user.
|
322
|
+
redirect_to '/admin' and return if !logged_in_user.is_allowed('site_settings', 'edit')
|
321
323
|
@btsm = BlockTypeSiteMembership.find(params[:id])
|
322
324
|
if (@site.id != @btsm.site_id && !@site.is_master)
|
323
325
|
@error = "You are not allowed to edit this site."
|
@@ -328,7 +330,7 @@ module Caboose
|
|
328
330
|
|
329
331
|
# @route PUT /admin/block-type-site-memberships/:id/css
|
330
332
|
def admin_update_btsm_css
|
331
|
-
render :json => false and return if !logged_in_user.
|
333
|
+
render :json => false and return if !logged_in_user.is_allowed('site_settings', 'edit')
|
332
334
|
resp = StdClass.new
|
333
335
|
@btsm = BlockTypeSiteMembership.find(params[:id])
|
334
336
|
@btsm.custom_css = params['code']
|
@@ -176,7 +176,7 @@ module Caboose
|
|
176
176
|
:invoice_action => InvoiceLog::ACTION_LINE_ITEM_CREATED
|
177
177
|
)
|
178
178
|
end
|
179
|
-
GA.delay(:queue => '
|
179
|
+
GA.delay(:queue => 'general', :priority => 20).event(@site.id, 'cart', 'add', "Product #{v.product.id}, Variant #{v.id}")
|
180
180
|
|
181
181
|
resp.success = true
|
182
182
|
resp.item_count = @invoice.item_count
|
@@ -320,7 +320,7 @@ module Caboose
|
|
320
320
|
|
321
321
|
resp.success = true
|
322
322
|
resp.invoice_total = @invoice.total
|
323
|
-
GA.delay(:queue => '
|
323
|
+
GA.delay(:queue => 'general', :priority => 20).event(@site.id, 'giftcard', 'add', "Giftcard #{gc.id}")
|
324
324
|
end
|
325
325
|
render :json => resp
|
326
326
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Caboose
|
2
|
+
class ChangeLogsController < Caboose::ApplicationController
|
3
|
+
|
4
|
+
# @route GET /admin/logs
|
5
|
+
def admin_index
|
6
|
+
return unless user_is_allowed('logs', 'view')
|
7
|
+
mc = "Media Category"
|
8
|
+
@logs = ChangeLog.where(:site_id => @site.id).where('(is_field = false and (action = ? OR action = ?)) OR (action != ? and action != ?) OR (is_field = true AND description ILIKE (?))','added','deleted','added','deleted',"%#{mc}%").order('timestamp desc, id desc').limit(500)
|
9
|
+
render :layout => 'caboose/admin'
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -16,6 +16,12 @@ module Caboose
|
|
16
16
|
if !@bfbi then @bfbi = Font.create(:site_id => @site.id, :name => "body-font-bold-italic", :family => "Open Sans", :variant => "600italic", :url => "http://fonts.gstatic.com/s/opensans/v13/PRmiXeptR36kaC0GEAetxpZ7xm-Bj30Bj2KNdXDzSZg.ttf") end
|
17
17
|
@btn = Font.where(:site_id => @site.id, :name => "button-font").last
|
18
18
|
if !@btn then @btn = Font.create(:site_id => @site.id, :name => "button-font", :family => "Open Sans", :variant => "regular", :url => "http://fonts.gstatic.com/s/opensans/v13/IgZJs4-7SA1XX_edsoXWog.ttf") end
|
19
|
+
@custom1 = Font.where(:site_id => @site.id, :name => "custom1-font").last
|
20
|
+
if !@custom1 then @custom1 = Font.create(:site_id => @site.id, :name => "custom1-font", :family => "Open Sans", :variant => "regular", :url => "http://fonts.gstatic.com/s/opensans/v13/IgZJs4-7SA1XX_edsoXWog.ttf") end
|
21
|
+
@custom2 = Font.where(:site_id => @site.id, :name => "custom2-font").last
|
22
|
+
if !@custom2 then @custom2 = Font.create(:site_id => @site.id, :name => "custom2-font", :family => "Open Sans", :variant => "regular", :url => "http://fonts.gstatic.com/s/opensans/v13/IgZJs4-7SA1XX_edsoXWog.ttf") end
|
23
|
+
@custom3 = Font.where(:site_id => @site.id, :name => "custom3-font").last
|
24
|
+
if !@custom3 then @custom3 = Font.create(:site_id => @site.id, :name => "custom3-font", :family => "Open Sans", :variant => "regular", :url => "http://fonts.gstatic.com/s/opensans/v13/IgZJs4-7SA1XX_edsoXWog.ttf") end
|
19
25
|
end
|
20
26
|
|
21
27
|
# @route PUT /admin/fonts
|
@@ -25,13 +31,15 @@ module Caboose
|
|
25
31
|
name = params[:name]
|
26
32
|
url = params[:url]
|
27
33
|
variant = params[:variant]
|
28
|
-
|
29
34
|
if !family.blank? && !name.blank? && !url.blank? && !variant.blank?
|
30
35
|
font = Font.where(:site_id => @site.id, :name => name).last
|
31
36
|
if font
|
37
|
+
fam = FontFamily.where(:name => family).first
|
38
|
+
var = fam ? FontVariant.where(:font_family_id => fam.id).where("CONCAT(style,weight) = ?", variant).first : nil
|
32
39
|
font.family = family
|
33
40
|
font.url = url
|
34
41
|
font.variant = variant
|
42
|
+
font.variant_id = var.id if var
|
35
43
|
font.save
|
36
44
|
resp.success = "Font saved!"
|
37
45
|
else
|
@@ -41,8 +49,137 @@ module Caboose
|
|
41
49
|
resp.error = "Error saving font"
|
42
50
|
end
|
43
51
|
render :json => resp
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Font Families
|
56
|
+
|
57
|
+
# @route GET /admin/font-families
|
58
|
+
def admin_family_index
|
59
|
+
return if !user_is_allowed('fonts', 'view')
|
60
|
+
end
|
61
|
+
|
62
|
+
# @route GET /admin/font-families/json
|
63
|
+
def admin_family_json
|
64
|
+
return if !user_is_allowed('fonts', 'view')
|
65
|
+
pager = PageBarGenerator.new(params, {
|
66
|
+
'name_like' => ''
|
67
|
+
},{
|
68
|
+
'model' => 'Caboose::FontFamily',
|
69
|
+
'sort' => 'name',
|
70
|
+
'desc' => false,
|
71
|
+
'base_url' => '/admin/font-families',
|
72
|
+
'items_per_page' => 50
|
73
|
+
})
|
74
|
+
render :json => {
|
75
|
+
:pager => pager,
|
76
|
+
:models => pager.items.as_json
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# @route GET /admin/font-families/:id/json
|
81
|
+
def admin_family_json_single
|
82
|
+
return if !user_is_allowed('fonts', 'view')
|
83
|
+
ff = FontFamily.find(params[:id])
|
84
|
+
render :json => ff.as_json
|
85
|
+
end
|
86
|
+
|
87
|
+
# @route POST /admin/font-families
|
88
|
+
def admin_family_add
|
89
|
+
return if !user_is_allowed('fonts', 'add')
|
90
|
+
resp = StdClass.new
|
91
|
+
if params[:name].blank?
|
92
|
+
resp.error = "Name is required."
|
93
|
+
render :json => resp and return
|
94
|
+
end
|
95
|
+
ff = FontFamily.new
|
96
|
+
ff.name = params[:name]
|
97
|
+
ff.save
|
98
|
+
resp.redirect = "/admin/font-families/#{ff.id}"
|
99
|
+
render :json => resp
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
# @route GET /admin/font-families/:id
|
104
|
+
def admin_family_edit
|
105
|
+
return if !user_is_allowed('fonts', 'add')
|
106
|
+
@ff = FontFamily.find(params[:id])
|
107
|
+
end
|
108
|
+
|
109
|
+
# @route GET /admin/font-variants/:id
|
110
|
+
def admin_variant_edit
|
111
|
+
return if !user_is_allowed('fonts', 'edit')
|
112
|
+
@variant = FontVariant.find(params[:id])
|
113
|
+
end
|
114
|
+
|
115
|
+
# @route POST /admin/font-variants
|
116
|
+
def admin_variant_add
|
117
|
+
return if !user_is_allowed('fonts', 'add')
|
118
|
+
resp = StdClass.new
|
119
|
+
if params[:variant].blank?
|
120
|
+
resp.error = "Variant Name is required."
|
121
|
+
render :json => resp and return
|
122
|
+
end
|
123
|
+
ff = FontVariant.new
|
124
|
+
ff.font_family_id = params[:family_id]
|
125
|
+
ff.weight = 'regular'
|
126
|
+
ff.variant = params[:variant]
|
127
|
+
ff.sort_order = 10
|
128
|
+
ff.save
|
129
|
+
resp.redirect = "/admin/font-variants/#{ff.id}"
|
130
|
+
render :json => resp
|
131
|
+
end
|
132
|
+
|
133
|
+
# @route PUT /admin/font-variants/:id
|
134
|
+
def admin_variant_update
|
135
|
+
return unless user_is_allowed_to 'edit', 'fonts'
|
136
|
+
resp = Caboose::StdClass.new
|
137
|
+
variant = FontVariant.find(params[:id])
|
138
|
+
params.each do |k,v|
|
139
|
+
case k
|
140
|
+
when "variant" then variant.variant = v
|
141
|
+
when "ttf_url" then (variant.ttf_url = v if (v.blank? || (v.include?('.ttf') && v.include?('http'))))
|
142
|
+
when "weight" then variant.weight = v
|
143
|
+
when "style" then variant.style = v
|
144
|
+
when "sort_order" then variant.sort_order = v
|
145
|
+
end
|
146
|
+
end
|
147
|
+
resp.success = variant.save
|
148
|
+
render :json => resp
|
149
|
+
end
|
150
|
+
|
151
|
+
# @route POST /admin/font-variants/:id/ttf-file
|
152
|
+
def admin_variant_update_ttf_file
|
153
|
+
return unless user_is_allowed_to 'edit', 'fonts'
|
154
|
+
resp = Caboose::StdClass.new
|
155
|
+
var = FontVariant.find(params[:id])
|
156
|
+
var.ttf_file = params[:ttf_file]
|
157
|
+
var.save
|
158
|
+
resp.success = true
|
159
|
+
resp.attributes = { 'ttf_file' => { 'value' => var.ttf_file.url }}
|
160
|
+
render :json => resp
|
161
|
+
end
|
44
162
|
|
163
|
+
# @route POST /admin/font-variants/:id/woff-file
|
164
|
+
def admin_variant_update_woff_file
|
165
|
+
return unless user_is_allowed_to 'edit', 'fonts'
|
166
|
+
resp = Caboose::StdClass.new
|
167
|
+
var = FontVariant.find(params[:id])
|
168
|
+
var.woff_file = params[:woff_file]
|
169
|
+
var.save
|
170
|
+
resp.success = true
|
171
|
+
resp.attributes = { 'woff_file' => { 'value' => var.woff_file.url }}
|
172
|
+
render :json => resp
|
45
173
|
end
|
46
|
-
|
174
|
+
|
175
|
+
# @route DELETE /admin/font-variants/:id
|
176
|
+
# def admin_variant_delete
|
177
|
+
# return unless user_is_allowed_to 'delete', 'fonts'
|
178
|
+
# var = FontVariant.find(params[:id])
|
179
|
+
# resp = Caboose::StdClass.new('redirect' => "/admin/font-variants/#{var.font_family_id}")
|
180
|
+
# var.destroy
|
181
|
+
# render :json => resp
|
182
|
+
# end
|
183
|
+
|
47
184
|
end
|
48
185
|
end
|
@@ -13,7 +13,7 @@ module Caboose
|
|
13
13
|
end
|
14
14
|
|
15
15
|
status = request.fullpath == '/admin/invoices' ? Caboose::Invoice::STATUS_PENDING : ''
|
16
|
-
|
16
|
+
#Caboose.log(params)
|
17
17
|
@pager = Caboose::PageBarGenerator.new(params, {
|
18
18
|
'site_id' => @site.id,
|
19
19
|
'customer_id' => params[:user_id] ? params[:user_id] : '',
|
@@ -24,7 +24,8 @@ module Caboose
|
|
24
24
|
'invoice_number' => '',
|
25
25
|
'total_lte' => '',
|
26
26
|
'total_gte' => ''
|
27
|
-
},
|
27
|
+
},
|
28
|
+
{
|
28
29
|
'model' => 'Caboose::Invoice',
|
29
30
|
'sort' => 'id',
|
30
31
|
'desc' => 1,
|
@@ -336,7 +337,7 @@ module Caboose
|
|
336
337
|
def admin_send_for_authorization
|
337
338
|
return if !user_is_allowed('invoices', 'edit')
|
338
339
|
invoice = Invoice.find(params[:id])
|
339
|
-
invoice.delay(:queue => '
|
340
|
+
invoice.delay(:queue => 'general', :priority => 12).send_payment_authorization_email
|
340
341
|
# invoice.send_payment_authorization_email
|
341
342
|
render :json => { :success => true }
|
342
343
|
end
|
@@ -345,7 +346,7 @@ module Caboose
|
|
345
346
|
def admin_send_receipt
|
346
347
|
return if !user_is_allowed('invoices', 'edit')
|
347
348
|
invoice = Invoice.find(params[:id])
|
348
|
-
invoice.delay(:queue => '
|
349
|
+
invoice.delay(:queue => 'general', :priority => 12).send_receipt_email
|
349
350
|
# invoice.send_receipt_email
|
350
351
|
render :json => { :success => true }
|
351
352
|
end
|