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
@@ -1,105 +0,0 @@
|
|
1
|
-
module Caboose
|
2
|
-
class BlockCache
|
3
|
-
|
4
|
-
attr_accessor :id,
|
5
|
-
:page_id,
|
6
|
-
:parent_id,
|
7
|
-
:block_type_id,
|
8
|
-
:block_type_field_type,
|
9
|
-
:sort_order,
|
10
|
-
:name,
|
11
|
-
:value,
|
12
|
-
:file,
|
13
|
-
:image,
|
14
|
-
:children
|
15
|
-
|
16
|
-
def child_value(name)
|
17
|
-
b = self.child(name)
|
18
|
-
return nil if b.nil?
|
19
|
-
return b.image if b.block_type_field_type == 'image'
|
20
|
-
return b.file if b.block_type_field_type == 'file'
|
21
|
-
return b.value
|
22
|
-
end
|
23
|
-
|
24
|
-
def child(name)
|
25
|
-
self.children.each do |kid|
|
26
|
-
return kid if kid.name == name
|
27
|
-
end
|
28
|
-
return nil
|
29
|
-
end
|
30
|
-
|
31
|
-
def children_where(h)
|
32
|
-
arr = []
|
33
|
-
self.children.each do |b|
|
34
|
-
matches = true
|
35
|
-
h.each do |k,v|
|
36
|
-
if b.send(k) != v
|
37
|
-
matches = false
|
38
|
-
break
|
39
|
-
end
|
40
|
-
end
|
41
|
-
arr << b if matches
|
42
|
-
end
|
43
|
-
return nil if arr.count == 0
|
44
|
-
return arr
|
45
|
-
end
|
46
|
-
|
47
|
-
#def render(block, options = nil)
|
48
|
-
# block = self.child(block) if block && block.is_a?(String)
|
49
|
-
# eval("CabooseBlockRendering::render_block_type_#{block.block_type_id}(block)")
|
50
|
-
#end
|
51
|
-
|
52
|
-
def initialize(b)
|
53
|
-
self.id = b.id
|
54
|
-
self.page_id = b.page_id
|
55
|
-
self.parent_id = b.parent_id
|
56
|
-
self.block_type_id = b.block_type_id
|
57
|
-
self.block_type_field_type = b.block_type ? b.block_type.field_type : nil
|
58
|
-
self.sort_order = b.sort_order
|
59
|
-
self.name = b.name
|
60
|
-
self.value = b.value
|
61
|
-
self.file = BlockCacheFile.new(b.file)
|
62
|
-
self.image = BlockCacheImage.new(b.image)
|
63
|
-
self.children = b.children.collect{ |b2| BlockCache.new(b2) }
|
64
|
-
end
|
65
|
-
|
66
|
-
def page
|
67
|
-
return $page
|
68
|
-
end
|
69
|
-
|
70
|
-
def marshal_dump
|
71
|
-
[
|
72
|
-
self.id,
|
73
|
-
self.page_id,
|
74
|
-
self.parent_id,
|
75
|
-
self.block_type_id,
|
76
|
-
self.block_type_field_type,
|
77
|
-
self.sort_order,
|
78
|
-
self.name,
|
79
|
-
self.value,
|
80
|
-
Marshal.dump(self.file),
|
81
|
-
Marshal.dump(self.image),
|
82
|
-
self.children.collect{ |b| Marshal.dump(b) }
|
83
|
-
]
|
84
|
-
end
|
85
|
-
|
86
|
-
def marshal_load array
|
87
|
-
self.id,
|
88
|
-
self.page_id,
|
89
|
-
self.parent_id,
|
90
|
-
self.block_type_id,
|
91
|
-
self.block_type_field_type,
|
92
|
-
self.sort_order,
|
93
|
-
self.name,
|
94
|
-
self.value,
|
95
|
-
self.file,
|
96
|
-
self.image,
|
97
|
-
self.children = array
|
98
|
-
|
99
|
-
self.file = Marshal.load(self.file)
|
100
|
-
self.image = Marshal.load(self.image)
|
101
|
-
self.children = self.children.collect{ |kid| Marshal.load(kid) }
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
module Caboose
|
3
|
-
class BlockCacheFile
|
4
|
-
|
5
|
-
def initialize(file)
|
6
|
-
@_url = file.url
|
7
|
-
end
|
8
|
-
|
9
|
-
def url(style = nil)
|
10
|
-
return @_url
|
11
|
-
end
|
12
|
-
|
13
|
-
def marshal_dump
|
14
|
-
[@_url]
|
15
|
-
end
|
16
|
-
|
17
|
-
def marshal_load array
|
18
|
-
@url = array.first
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
|
2
|
-
module Caboose
|
3
|
-
class BlockCacheImage
|
4
|
-
|
5
|
-
def initialize(image)
|
6
|
-
@urls = {}
|
7
|
-
image.styles.each do |style|
|
8
|
-
@urls[style[0].to_s] = image.url(style[0])
|
9
|
-
end
|
10
|
-
#puts "--------------------------------------------"
|
11
|
-
#puts "Caboose::BlockCacheImage.initialize"
|
12
|
-
#puts "urls = #{@urls.inspect}"
|
13
|
-
#puts "--------------------------------------------"
|
14
|
-
end
|
15
|
-
|
16
|
-
def url(style = nil)
|
17
|
-
#puts "--------------------------------------------"
|
18
|
-
#puts "Caboose::BlockCacheImage.url"
|
19
|
-
#puts "urls = #{@urls.inspect}"
|
20
|
-
#puts "--------------------------------------------"
|
21
|
-
|
22
|
-
return @urls['thumb'] if style.nil?
|
23
|
-
return @urls[style.to_s]
|
24
|
-
end
|
25
|
-
|
26
|
-
def marshal_dump
|
27
|
-
arr = []
|
28
|
-
if @urls && @urls.count > 0
|
29
|
-
@urls.each do |k,v|
|
30
|
-
arr << k
|
31
|
-
arr << v
|
32
|
-
end
|
33
|
-
end
|
34
|
-
return arr
|
35
|
-
end
|
36
|
-
|
37
|
-
def marshal_load arr
|
38
|
-
@urls = {}
|
39
|
-
i = 0
|
40
|
-
count = arr.count
|
41
|
-
while i<count
|
42
|
-
k = arr[i]
|
43
|
-
@urls[k] = arr[i+1]
|
44
|
-
i = i + 2
|
45
|
-
end
|
46
|
-
#puts "--------------------------------------------"
|
47
|
-
#puts "Caboose::BlockCacheImage.marshal_load"
|
48
|
-
#puts "urls = #{@urls.inspect}"
|
49
|
-
#puts "--------------------------------------------"
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
|
2
|
-
module Caboose
|
3
|
-
class PageCacher
|
4
|
-
|
5
|
-
def self.refresh
|
6
|
-
PageCache.where(:refresh => true).all.each do |pc|
|
7
|
-
# self.delay(:queue => 'caboose_cache').cache(pc.page_id)
|
8
|
-
end
|
9
|
-
|
10
|
-
# Make sure all pages are cached
|
11
|
-
query = ["select id from pages where id not in (select distinct(page_id) from page_cache)"]
|
12
|
-
rows = ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
13
|
-
if rows
|
14
|
-
# rows.each{ |row| self.delay(:queue => 'caboose_cache').cache(row['id'].to_i) }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.cache_all
|
19
|
-
query = ["select id from pages order by id"]
|
20
|
-
rows = ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
21
|
-
if rows
|
22
|
-
# rows.each{ |row| self.delay(:queue => 'caboose_cache').cache(row['id'].to_i) }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.cache(page_id)
|
27
|
-
p = (page_id.is_a?(Integer) ? Page.where(:id => page_id).first : page_id)
|
28
|
-
return if p.nil?
|
29
|
-
return if p.site_id.nil?
|
30
|
-
return if p.site.nil?
|
31
|
-
return if p.block.nil?
|
32
|
-
|
33
|
-
@render_functions = {} if @render_functions.nil?
|
34
|
-
@page_render_functions = {} if @page_render_functions.nil?
|
35
|
-
@page_render_functions[p.id] = []
|
36
|
-
@dups = {}
|
37
|
-
|
38
|
-
self.cache_helper(p.site, p, p.block)
|
39
|
-
|
40
|
-
arr = @page_render_functions[p.id].collect do |bt_id|
|
41
|
-
"<% def render_block_type_#{bt_id}(block, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site) %>#{@render_functions[bt_id]}<% end %>"
|
42
|
-
end
|
43
|
-
|
44
|
-
dups = []
|
45
|
-
@dups.each{ |bt_id, arr| dups << "#{bt_id} => [#{arr.join(',')}]" }
|
46
|
-
dups = dups.join(', ')
|
47
|
-
|
48
|
-
str = arr.join("\n\n")
|
49
|
-
str << "<%\n"
|
50
|
-
str << "def dup_id(bt_id)\n"
|
51
|
-
str << " dups = {#{dups}}\n"
|
52
|
-
str << " dups.each do |bt_id2, arr|\n"
|
53
|
-
str << " return bt_id2 if arr.include?(bt_id)\n"
|
54
|
-
str << " end\n"
|
55
|
-
str << " return bt_id\n"
|
56
|
-
str << "end\n"
|
57
|
-
str << "def render_block_type(block, child_block, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site)\n"
|
58
|
-
str << " b = child_block && child_block.is_a?(String) ? block.child(child_block) : child_block\n"
|
59
|
-
str << " send(\"render_block_type_\#\{dup_id(b.block_type_id)\}\", b, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site)\n"
|
60
|
-
str << "end\n\n"
|
61
|
-
str << "render_block_type_#{p.block.block_type_id}(@block, @page, @view, @controller_view_content, @modal, @empty_text, @editing, @css, @js, @csrf_meta_tags, @csrf_meta_tags2, @logged_in_user, @site)\n"
|
62
|
-
str << "%>\n"
|
63
|
-
|
64
|
-
pc = PageCache.where(:page_id => p.id).first
|
65
|
-
pc = PageCache.new(:page_id => p.id) if pc.nil?
|
66
|
-
pc.render_function = str
|
67
|
-
pc.block = Marshal.dump(BlockCache.new(p.block))
|
68
|
-
pc.refresh = false
|
69
|
-
pc.save
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.cache_helper(site, p, block)
|
73
|
-
return if block.nil?
|
74
|
-
self.cache_helper2(site, p, block.block_type)
|
75
|
-
block.children.each{ |b2| self.cache_helper(site, p, b2) }
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.cache_helper2(site, p, bt)
|
79
|
-
return if bt.nil?
|
80
|
-
self.add_block_type(site, p, bt)
|
81
|
-
bt.children.each{ |bt2| self.cache_helper2(site, p, bt2) }
|
82
|
-
end
|
83
|
-
|
84
|
-
def self.add_block_type(site, p, bt)
|
85
|
-
return if bt.nil?
|
86
|
-
if !@render_functions.has_key?(bt.id)
|
87
|
-
f = ''
|
88
|
-
if bt.use_render_function && bt.render_function
|
89
|
-
f = bt.render_function
|
90
|
-
else
|
91
|
-
full_name = bt.full_name
|
92
|
-
full_name = "lksdjflskfjslkfjlskdfjlkjsdf" if full_name.nil? || full_name.length == 0
|
93
|
-
#if File.file?(Rails.root.join("sites/#{site.name}/blocks/_#{full_name}.html.erb" )) then f = Rails.root.join("sites/#{site.name}/blocks/_#{full_name}.html.erb")
|
94
|
-
#elsif File.file?(Rails.root.join("sites/#{site.name}/blocks/_#{bt.name}.html.erb" )) then f = Rails.root.join("sites/#{site.name}/blocks/_#{bt.name}.html.erb")
|
95
|
-
#elsif File.file?(Rails.root.join("sites/#{site.name}/blocks/_#{bt.field_type}.html.erb" )) then f = Rails.root.join("sites/#{site.name}/blocks/_#{bt.field_type}.html.erb")
|
96
|
-
if File.file?(Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{full_name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{full_name}.html.erb")
|
97
|
-
elsif File.file?(Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.name}.html.erb")
|
98
|
-
elsif File.file?(Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.field_type}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.field_type}.html.erb")
|
99
|
-
elsif File.file?(Rails.root.join("app/views/caboose/blocks/_#{full_name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/_#{full_name}.html.erb")
|
100
|
-
elsif File.file?(Rails.root.join("app/views/caboose/blocks/_#{bt.name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/_#{bt.name}.html.erb")
|
101
|
-
elsif File.file?(Rails.root.join("app/views/caboose/blocks/_#{bt.field_type}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/_#{bt.field_type}.html.erb")
|
102
|
-
elsif File.file?("#{Caboose.root}/app/views/caboose/blocks/_#{full_name}.html.erb" ) then f = "#{Caboose.root}/app/views/caboose/blocks/_#{full_name}.html.erb"
|
103
|
-
elsif File.file?("#{Caboose.root}/app/views/caboose/blocks/_#{bt.name}.html.erb" ) then f = "#{Caboose.root}/app/views/caboose/blocks/_#{bt.name}.html.erb"
|
104
|
-
elsif File.file?("#{Caboose.root}/app/views/caboose/blocks/_#{bt.field_type}.html.erb" ) then f = "#{Caboose.root}/app/views/caboose/blocks/_#{bt.field_type}.html.erb"
|
105
|
-
end
|
106
|
-
f = (f && f.to_s.strip.length > 0 ? File.read(f) : '')
|
107
|
-
end
|
108
|
-
f.gsub!(/block\.partial\((.*?),(.*?)\)/ , 'render :partial => \1')
|
109
|
-
f.gsub!(/block\.render\((.*?),(.*?)\)/ , 'render_block_type(block, \1, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site)')
|
110
|
-
f.gsub!(/\=\s*render_block_type\(/ , 'render_block_type(')
|
111
|
-
f.gsub!(/\=\s*raw render_block_type\(/ , 'render_block_type(')
|
112
|
-
f.gsub!(/block.children.where\(([^\)]*?)\)\.all/, 'block.children_where(\1)')
|
113
|
-
|
114
|
-
#@render_functions[bt.id] = "<% def render_block_type_#{bt.id}(block, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site) %>#{f}<% end %>"
|
115
|
-
|
116
|
-
@render_functions[bt.id] = f
|
117
|
-
end
|
118
|
-
|
119
|
-
is_dup = false
|
120
|
-
f = @render_functions[bt.id]
|
121
|
-
@render_functions.each do |bt_id, f2|
|
122
|
-
if f == f2 && @page_render_functions[p.id].include?(bt_id)
|
123
|
-
@dups[bt_id] = [] if !@dups.has_key?(bt_id)
|
124
|
-
@dups[bt_id] << bt.id if !@dups[bt_id].include?(bt.id)
|
125
|
-
is_dup = true
|
126
|
-
break
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
if !is_dup
|
131
|
-
@page_render_functions[p.id] = [] if !@page_render_functions.has_key?(p.id)
|
132
|
-
@page_render_functions[p.id] << bt.id if !@page_render_functions[p.id].include?(bt.id)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
<h1>New Page</h1>
|
2
|
-
<p>Parent: <%= @parent ? @parent.title : "Home" %></p>
|
3
|
-
|
4
|
-
<form action='/admin/pages' method='post' id='new_page_form' onsubmit="add_page(); return false;">
|
5
|
-
<input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
|
6
|
-
<input type='hidden' name='parent_id' value='<%= @parent_id %>' />
|
7
|
-
<p><input type='text' name='title' placeholder='Title' style="width: 400px;" /></p>
|
8
|
-
<p><select name='block_type_id'>
|
9
|
-
<option value=''>-- Select a layout --</option>
|
10
|
-
<% cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id } %>
|
11
|
-
<% Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, @site.id).reorder(:description).all.each do |bt| %>
|
12
|
-
<option value="<%= bt.id %>"><%= bt.description %></option>
|
13
|
-
<% end %>
|
14
|
-
</select></p>
|
15
|
-
<div id='message'></div>
|
16
|
-
<p>
|
17
|
-
<input type='button' value='< Back' onclick="window.location='/admin/pages';" />
|
18
|
-
<input type='submit' value='Add Page' />
|
19
|
-
</p>
|
20
|
-
</form>
|
21
|
-
|
22
|
-
<% content_for :caboose_js do %>
|
23
|
-
<%= javascript_include_tag "caboose/model/all" %>
|
24
|
-
<script type='text/javascript'>
|
25
|
-
|
26
|
-
var modal = false;
|
27
|
-
$(document).ready(function() {
|
28
|
-
modal = new CabooseModal(420);
|
29
|
-
});
|
30
|
-
|
31
|
-
function add_page()
|
32
|
-
{
|
33
|
-
modal.autosize("<p class='loading'>Adding page...</p>");
|
34
|
-
$.ajax({
|
35
|
-
url: '/admin/pages',
|
36
|
-
type: 'post',
|
37
|
-
data: $('#new_page_form').serialize(),
|
38
|
-
success: function(resp) {
|
39
|
-
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
40
|
-
if (resp.redirect) parent.window.location = resp.redirect
|
41
|
-
}
|
42
|
-
});
|
43
|
-
}
|
44
|
-
|
45
|
-
</script>
|
46
|
-
<% end %>
|
@@ -1,64 +0,0 @@
|
|
1
|
-
|
2
|
-
<h1>Edit Workout</h1>
|
3
|
-
|
4
|
-
<p><select name='day' onchange="window.location='/workouts/'+this.value+'/edit';">
|
5
|
-
<% @workouts.each do |w| %>
|
6
|
-
<%
|
7
|
-
text = "Day #{w.day}" + (w.name.nil? ? "" : " - #{w.name}")
|
8
|
-
selected = w.day == @workout.day ? " selected='true'" : ''
|
9
|
-
%>
|
10
|
-
<option value="<%= w.day %>"<%= selected %>><%= text %></option>
|
11
|
-
<% end %>
|
12
|
-
</select></p>
|
13
|
-
<hr />
|
14
|
-
<div id='workout_<%= @workout.id %>_container'></div>
|
15
|
-
|
16
|
-
<h2>Sets</h2>
|
17
|
-
<div id='set_listing_container'></div>
|
18
|
-
<h2>New Set</h2>
|
19
|
-
<div id='set_new_container'></div>
|
20
|
-
|
21
|
-
<% content_for :css do %>
|
22
|
-
<%= stylesheet_link_tag "workouts", :media => "all" %>
|
23
|
-
<% end %>
|
24
|
-
<% content_for :js do %>
|
25
|
-
<%= javascript_include_tag "model.form.set" %>
|
26
|
-
<script type="text/javascript">
|
27
|
-
$(document).ready(function() {
|
28
|
-
|
29
|
-
new Controller({
|
30
|
-
|
31
|
-
init: function()
|
32
|
-
{
|
33
|
-
var workout = new Model({
|
34
|
-
name: 'Workout',
|
35
|
-
id: <%= @workout.id %>,
|
36
|
-
attributes: [
|
37
|
-
{ name: 'name' , type: 'text' , value: <%= raw @workout.name.to_json %> },
|
38
|
-
{ name: 'description' , type: 'textarea' , value: <%= raw @workout.description.to_json %>, width: 400, height: 200 }
|
39
|
-
]
|
40
|
-
});
|
41
|
-
|
42
|
-
var set = new Model({
|
43
|
-
name: 'Set',
|
44
|
-
id: 'new',
|
45
|
-
form: 'Model.Form.Set',
|
46
|
-
post_add: function() {
|
47
|
-
set.listing();
|
48
|
-
$('#'+set.message).empty();
|
49
|
-
},
|
50
|
-
listing_url: '/sets/listing?workout_id=<%= @workout.id %>',
|
51
|
-
attributes: [
|
52
|
-
{ name: 'workout_id' , type: 'hidden' , value: <%= @workout.id %> },
|
53
|
-
{ name: 'category_id' , type: 'select' , value: -1, options_url: '/workouts/category-options' },
|
54
|
-
{ name: 'movement_id' , type: 'select' , value: -1, options_url: '/movements/options' },
|
55
|
-
{ name: 'qty' , type: 'text' , value: 1, show_reminder: false, css: { width: 40, textAlign: 'right' } },
|
56
|
-
{ name: 'reps' , type: 'text' , value: 10, show_reminder: false, css: { width: 40, textAlign: 'right' } },
|
57
|
-
{ name: 'per_unit' , type: 'text' , value: '', show_reminder: false, css: { width: 40, textAlign: 'right' } },
|
58
|
-
{ name: 'hold_time' , type: 'text' , value: '', show_reminder: false, css: { width: 40, textAlign: 'right' } }
|
59
|
-
]
|
60
|
-
});
|
61
|
-
|
62
|
-
});
|
63
|
-
</script>
|
64
|
-
<% end %>
|