caboose-cms 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/caboose/page_custom_field_values_controller.rb +22 -0
- data/app/controllers/caboose/page_custom_fields_controller.rb +132 -0
- data/app/controllers/caboose/pages_controller.rb +8 -0
- data/app/models/caboose/core_plugin.rb +2 -1
- data/app/models/caboose/page.rb +18 -0
- data/app/models/caboose/page_custom_field.rb +21 -0
- data/app/models/caboose/page_custom_field_value.rb +14 -0
- data/app/models/caboose/schema.rb +16 -0
- data/app/views/caboose/page_custom_fields/admin_edit.html.erb +40 -0
- data/app/views/caboose/page_custom_fields/admin_index.html.erb +40 -0
- data/app/views/caboose/pages/admin_edit_content.html.erb +3 -2
- data/app/views/caboose/pages/admin_edit_custom_fields.html.erb +45 -0
- data/config/routes.rb +16 -1
- data/lib/caboose/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e6f3997789d5f79d8f6a9ca3cf6aae4659b0096
|
4
|
+
data.tar.gz: 015785dca3640c8f002b0da75b565936539e5cc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa51f2cc0c88e18d7e3d9b074e8883beffe4bb9a340c52d9dadf2413c9c8fee71489cf3f4a1909e63dcac49bb17041cfaa0a3d510a275420cadfbe2173b159df
|
7
|
+
data.tar.gz: 3165baf5b25f0c03bc07e673245be41b6e8ec1388acb4d81b8cc2a4135ef8b71fcf4728b8ffee0fbc7fb3648bccd627466be3496c6287c3f0300ab9f76528c16
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Caboose
|
2
|
+
class PageCustomFieldValuesController < ApplicationController
|
3
|
+
|
4
|
+
# PUT /admin/page-custom-field-values/:id
|
5
|
+
def admin_update
|
6
|
+
return if !user_is_allowed('pagecustomfieldvalues', 'edit')
|
7
|
+
|
8
|
+
resp = Caboose::StdClass.new
|
9
|
+
fv = PageCustomFieldValue.find(params[:id])
|
10
|
+
|
11
|
+
save = true
|
12
|
+
params.each do |k, v|
|
13
|
+
case k
|
14
|
+
when 'value' then fv.value = v
|
15
|
+
end
|
16
|
+
end
|
17
|
+
resp.success = save && fv.save
|
18
|
+
render :json => resp
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
module Caboose
|
2
|
+
class PageCustomFieldsController < ApplicationController
|
3
|
+
|
4
|
+
helper :application
|
5
|
+
|
6
|
+
# GET /admin/page-custom-fields
|
7
|
+
def admin_index
|
8
|
+
return if !user_is_allowed_to 'view', 'pagecustomfields'
|
9
|
+
render :layout => 'caboose/admin'
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /admin/page-custom-fields/json
|
13
|
+
def admin_json
|
14
|
+
return if !user_is_allowed_to 'view', 'pagecustomfields'
|
15
|
+
pager = self.fields_pager
|
16
|
+
render :json => {
|
17
|
+
:pager => pager,
|
18
|
+
:models => pager.items
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def fields_pager
|
23
|
+
return Caboose::Pager.new(params, {
|
24
|
+
'site_id' => @site.id,
|
25
|
+
'key_like' => '',
|
26
|
+
'name_like' => ''
|
27
|
+
}, {
|
28
|
+
'model' => 'Caboose::PageCustomField',
|
29
|
+
'sort' => 'key',
|
30
|
+
'desc' => 'false',
|
31
|
+
'items_per_page' => 100,
|
32
|
+
'base_url' => '/admin/page-custom-fields'
|
33
|
+
})
|
34
|
+
end
|
35
|
+
|
36
|
+
# GET /admin/page-custom-fields/:id/json
|
37
|
+
def admin_json_single
|
38
|
+
return if !user_is_allowed_to 'view', 'pagecustomfields'
|
39
|
+
f = PageCustomField.find(params[:id])
|
40
|
+
render :json => f
|
41
|
+
end
|
42
|
+
|
43
|
+
# GET /admin/page-custom-fields/:id
|
44
|
+
def admin_edit
|
45
|
+
return if !user_is_allowed('pagecustomfields', 'edit')
|
46
|
+
@page_custom_field = PageCustomField.find(params[:id])
|
47
|
+
render :layout => 'caboose/admin'
|
48
|
+
end
|
49
|
+
|
50
|
+
# PUT /admin/page-custom-fields/:id
|
51
|
+
def admin_update
|
52
|
+
return if !user_is_allowed('pagecustomfields', 'edit')
|
53
|
+
|
54
|
+
resp = Caboose::StdClass.new
|
55
|
+
f = PageCustomField.find(params[:id])
|
56
|
+
|
57
|
+
save = true
|
58
|
+
params.each do |name, value|
|
59
|
+
case name
|
60
|
+
when 'key' then f.key = value
|
61
|
+
when 'name' then f.name = value
|
62
|
+
when 'field_type' then f.field_type = value
|
63
|
+
when 'default_value' then f.default_value = value
|
64
|
+
when 'options' then f.options = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
resp.success = save && f.save
|
68
|
+
render :json => resp
|
69
|
+
end
|
70
|
+
|
71
|
+
# POST /admin/page-custom-fields
|
72
|
+
def admin_add
|
73
|
+
return if !user_is_allowed('pagecustomfields', 'add')
|
74
|
+
|
75
|
+
resp = Caboose::StdClass.new
|
76
|
+
|
77
|
+
f = PageCustomField.new
|
78
|
+
f.name = params[:key]
|
79
|
+
|
80
|
+
if f.name.nil? || f.name.length == 0
|
81
|
+
resp.error = 'A field key is required.'
|
82
|
+
else
|
83
|
+
f.site_id = @site.id
|
84
|
+
f.key = f.name.gsub(' ', '_').gsub('-', '_').downcase
|
85
|
+
f.field_type = PageCustomField::FIELD_TYPE_TEXT
|
86
|
+
f.save
|
87
|
+
resp.redirect = "/admin/page-custom-fields/#{f.id}"
|
88
|
+
end
|
89
|
+
|
90
|
+
render :json => resp
|
91
|
+
end
|
92
|
+
|
93
|
+
# DELETE /admin/page-custom-fields/:id
|
94
|
+
def admin_delete
|
95
|
+
return if !user_is_allowed('pagecustomfields', 'edit')
|
96
|
+
|
97
|
+
if params[:id] == 'bulk'
|
98
|
+
params[:model_ids].each do |fid|
|
99
|
+
PageCustomFieldValue.where(:page_custom_field_id => fid).destroy_all
|
100
|
+
PageCustomField.where(:id => fid).destroy_all
|
101
|
+
end
|
102
|
+
else
|
103
|
+
fid = params[:id]
|
104
|
+
PageCustomFieldValue.where(:page_custom_field_id => fid).destroy_all
|
105
|
+
PageCustomField.where(:id => fid).destroy_all
|
106
|
+
end
|
107
|
+
|
108
|
+
render :json => { 'redirect' => '/admin/page-custom-fields' }
|
109
|
+
end
|
110
|
+
|
111
|
+
# GET /admin/page-custom-fields/:field-options
|
112
|
+
def admin_options
|
113
|
+
return if !user_is_allowed_to 'view', 'pagecustomfields'
|
114
|
+
options = []
|
115
|
+
case params[:field]
|
116
|
+
when nil
|
117
|
+
arr = PageCustomField.where(:site_id => @site.id).reorder(:key).all
|
118
|
+
options = arr.collect{ |a| { 'value' => a.id, 'text' => a.name }}
|
119
|
+
when 'field-type'
|
120
|
+
options = [
|
121
|
+
{ 'value' => PageCustomField::FIELD_TYPE_TEXT , 'text' => 'Text' },
|
122
|
+
{ 'value' => PageCustomField::FIELD_TYPE_SELECT , 'text' => 'Select' },
|
123
|
+
{ 'value' => PageCustomField::FIELD_TYPE_CHECKBOX , 'text' => 'Checkbox' },
|
124
|
+
{ 'value' => PageCustomField::FIELD_TYPE_DATE , 'text' => 'Date' },
|
125
|
+
{ 'value' => PageCustomField::FIELD_TYPE_DATETIME , 'text' => 'Datetime' }
|
126
|
+
]
|
127
|
+
end
|
128
|
+
render :json => options
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
@@ -162,6 +162,14 @@ module Caboose
|
|
162
162
|
render :layout => 'caboose/admin'
|
163
163
|
end
|
164
164
|
|
165
|
+
# GET /admin/page/:id/custom-fields
|
166
|
+
def admin_edit_custom_fields
|
167
|
+
return if !user_is_allowed('pages', 'edit')
|
168
|
+
@page = Page.find(params[:id])
|
169
|
+
@page.verify_custom_field_values_exist
|
170
|
+
render :layout => 'caboose/modal'
|
171
|
+
end
|
172
|
+
|
165
173
|
# GET /admin/pages/:id/permissions
|
166
174
|
def admin_edit_permissions
|
167
175
|
return unless user_is_allowed('pages', 'edit')
|
@@ -11,7 +11,8 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
|
|
11
11
|
item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') if site.is_master == true
|
12
12
|
item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') if site.use_fonts == true
|
13
13
|
item['children'] << { 'id' => 'redirects' , 'text' => 'Permanent Redirects' , 'href' => '/admin/redirects' , 'modal' => false } if user.is_allowed('redirects' , 'view')
|
14
|
-
item['children'] << { 'id' => 'permissions' , 'text' => 'Permissions' , 'href' => '/admin/permissions' , 'modal' => false } if user.is_allowed('permissions' , 'view')
|
14
|
+
item['children'] << { 'id' => 'permissions' , 'text' => 'Permissions' , 'href' => '/admin/permissions' , 'modal' => false } if user.is_allowed('permissions' , 'view')
|
15
|
+
item['children'] << { 'id' => 'pagecustomfields' , 'text' => 'Page Custom Fields' , 'href' => '/admin/page-custom-fields' , 'modal' => false } if user.is_allowed('pagecustomfields' , 'view')
|
15
16
|
item['children'] << { 'id' => 'post_categories' , 'text' => 'Post Categories' , 'href' => '/admin/post-categories' , 'modal' => false } if user.is_allowed('post_categories' , 'view')
|
16
17
|
item['children'] << { 'id' => 'postcustomfields' , 'text' => 'Post Custom Fields' , 'href' => '/admin/post-custom-fields' , 'modal' => false } if user.is_allowed('postcustomfields' , 'view')
|
17
18
|
item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view')
|
data/app/models/caboose/page.rb
CHANGED
@@ -9,6 +9,7 @@ class Caboose::Page < ActiveRecord::Base
|
|
9
9
|
has_many :blocks, :order => 'sort_order'
|
10
10
|
has_many :page_tags, :class_name => 'Caboose::PageTag', :dependent => :delete_all, :order => 'tag'
|
11
11
|
has_one :page_cache
|
12
|
+
has_many :page_custom_field_values
|
12
13
|
attr_accessible :id ,
|
13
14
|
:site_id ,
|
14
15
|
:parent_id ,
|
@@ -360,5 +361,22 @@ class Caboose::Page < ActiveRecord::Base
|
|
360
361
|
def self.pages_with_tag(parent_id, tag)
|
361
362
|
self.includes(:page_tags).where(:hide => false, :parent_id => 1, :page_tags => { :tag => tag }).reorder('sort_order, title').all
|
362
363
|
end
|
364
|
+
|
365
|
+
def custom_field_value(key)
|
366
|
+
fv = Caboose::PageCustomFieldValue.where(:page_id => self.id, :key => key).first
|
367
|
+
if fv.nil?
|
368
|
+
f = Caboose::PageCustomField.where(:site_id => self.site_id, :key => key).first
|
369
|
+
return nil if f.nil?
|
370
|
+
fv = Caboose::PageCustomFieldValue.create(:page_id => self.id, :page_custom_field_id => f.id, :key => key, :value => f.default_value, :sort_order => f.sort_order)
|
371
|
+
end
|
372
|
+
return fv.value
|
373
|
+
end
|
374
|
+
|
375
|
+
def verify_custom_field_values_exist
|
376
|
+
Caboose::PageCustomField.where(:site_id => self.site_id).all.each do |f|
|
377
|
+
fv = Caboose::PageCustomFieldValue.where(:page_id => self.id, :page_custom_field_id => f.id).first
|
378
|
+
Caboose::PageCustomFieldValue.create(:page_id => self.id, :page_custom_field_id => f.id, :key => f.key, :value => f.default_value, :sort_order => f.sort_order) if fv.nil?
|
379
|
+
end
|
380
|
+
end
|
363
381
|
|
364
382
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
class Caboose::PageCustomField < ActiveRecord::Base
|
3
|
+
self.table_name = "page_custom_fields"
|
4
|
+
|
5
|
+
belongs_to :site
|
6
|
+
attr_accessible :id ,
|
7
|
+
:site_id ,
|
8
|
+
:key ,
|
9
|
+
:name ,
|
10
|
+
:field_type ,
|
11
|
+
:default_value ,
|
12
|
+
:options ,
|
13
|
+
:sort_order
|
14
|
+
|
15
|
+
FIELD_TYPE_TEXT = 'text'
|
16
|
+
FIELD_TYPE_SELECT = 'select'
|
17
|
+
FIELD_TYPE_CHECKBOX = 'checkbox'
|
18
|
+
FIELD_TYPE_DATE = 'date'
|
19
|
+
FIELD_TYPE_DATETIME = 'datetime'
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
class Caboose::PageCustomFieldValue < ActiveRecord::Base
|
3
|
+
self.table_name = "page_custom_field_values"
|
4
|
+
|
5
|
+
belongs_to :page
|
6
|
+
belongs_to :page_custom_field
|
7
|
+
attr_accessible :id ,
|
8
|
+
:page_id ,
|
9
|
+
:page_custom_field_id ,
|
10
|
+
:key ,
|
11
|
+
:value ,
|
12
|
+
:sort_order
|
13
|
+
|
14
|
+
end
|
@@ -463,6 +463,22 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
463
463
|
[ :block , :binary ],
|
464
464
|
[ :refresh , :boolean , { :default => false }]
|
465
465
|
],
|
466
|
+
Caboose::PageCustomField => [
|
467
|
+
[ :site_id , :integer ],
|
468
|
+
[ :key , :string ],
|
469
|
+
[ :name , :string ],
|
470
|
+
[ :field_type , :string ],
|
471
|
+
[ :default_value , :text ],
|
472
|
+
[ :options , :text ],
|
473
|
+
[ :sort_order , :integer , { :default => 0 }]
|
474
|
+
],
|
475
|
+
Caboose::PageCustomFieldValue => [
|
476
|
+
[ :page_id , :integer ],
|
477
|
+
[ :page_custom_field_id , :integer ],
|
478
|
+
[ :key , :string ],
|
479
|
+
[ :value , :text ],
|
480
|
+
[ :sort_order , :integer , { :default => 0 }]
|
481
|
+
],
|
466
482
|
Caboose::PagePermission => [
|
467
483
|
[ :role_id , :integer ],
|
468
484
|
[ :page_id , :integer ],
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
f = @page_custom_field
|
3
|
+
%>
|
4
|
+
|
5
|
+
<h1>Edit Page Custom Field</h1>
|
6
|
+
|
7
|
+
<p><div id='pagecustomfield_<%= f.id %>_key' ></div></p>
|
8
|
+
<p><div id='pagecustomfield_<%= f.id %>_name' ></div></p>
|
9
|
+
<p><div id='pagecustomfield_<%= f.id %>_field_type' ></div></p>
|
10
|
+
<p><div id='pagecustomfield_<%= f.id %>_default_value' ></div></p>
|
11
|
+
<p><div id='pagecustomfield_<%= f.id %>_options' ></div></p>
|
12
|
+
|
13
|
+
<div id='message'></div>
|
14
|
+
|
15
|
+
<p>
|
16
|
+
<input type='button' value='< Back' onclick="window.location='/admin/page-custom-fields';" />
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<% content_for :caboose_js do %>
|
20
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
21
|
+
<script type="text/javascript">
|
22
|
+
|
23
|
+
$(document).ready(function() {
|
24
|
+
m = new ModelBinder({
|
25
|
+
name: 'PageCustomField',
|
26
|
+
id: <%= f.id %>,
|
27
|
+
update_url: '/admin/page-custom-fields/<%= f.id %>',
|
28
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
29
|
+
attributes: [
|
30
|
+
{ name: 'key' , nice_name: 'Key' , type: 'text' , value: <%= raw Caboose.json(f.key ) %>, width: 800 },
|
31
|
+
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(f.name ) %>, width: 800 },
|
32
|
+
{ name: 'field_type' , nice_name: 'Type' , type: 'select' , value: <%= raw Caboose.json(f.field_type ) %>, width: 800 , options_url: '/admin/page-custom-fields/field-type-options' },
|
33
|
+
{ name: 'default_value' , nice_name: 'Default Value' , type: 'text' , value: <%= raw Caboose.json(f.default_value ) %>, width: 800 },
|
34
|
+
{ name: 'options' , nice_name: 'Options' , type: 'textarea' , value: <%= raw Caboose.json(f.options ) %>, width: 800 , height: 200 }
|
35
|
+
]
|
36
|
+
});
|
37
|
+
});
|
38
|
+
|
39
|
+
</script>
|
40
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
<h1>Page Custom Fields</h1>
|
3
|
+
|
4
|
+
<div id='pagecustomfields'></div>
|
5
|
+
|
6
|
+
<% content_for :caboose_js do %>
|
7
|
+
<%= javascript_include_tag 'caboose/model/all' %>
|
8
|
+
<script type='text/javascript'>
|
9
|
+
|
10
|
+
$(document).ready(function() {
|
11
|
+
var that = this;
|
12
|
+
var table = new IndexTable({
|
13
|
+
form_authenticity_token: '<%= form_authenticity_token %>',
|
14
|
+
container: 'pagecustomfields',
|
15
|
+
base_url: '/admin/page-custom-fields',
|
16
|
+
allow_bulk_edit: true,
|
17
|
+
allow_bulk_delete: true,
|
18
|
+
allow_duplicate: false,
|
19
|
+
allow_advanced_edit: true,
|
20
|
+
allow_bulk_import: false,
|
21
|
+
fields: [
|
22
|
+
{ show: true, name: 'key' , nice_name: 'Key' , sort: 'key' , type: 'text' , value: function(f) { return f.key }, width: 150, align: 'left', bulk_edit: true },
|
23
|
+
{ show: true, name: 'name' , nice_name: 'Name' , sort: 'name' , type: 'text' , value: function(f) { return f.name }, width: 150, align: 'left', bulk_edit: true },
|
24
|
+
{ show: true, name: 'field_type' , nice_name: 'Type' , sort: 'field_type' , type: 'select' , value: function(f) { return f.field_type }, width: 150, align: 'left', bulk_edit: true , options_url: '/admin/page-custom-fields/field-type-options' },
|
25
|
+
{ show: true, name: 'default_value' , nice_name: 'Default Value' , sort: 'default_value' , type: 'text' , value: function(f) { return f.default_value }, width: 150, align: 'left', bulk_edit: true },
|
26
|
+
{ show: true, name: 'options' , nice_name: 'Options' , sort: 'options' , type: 'text' , value: function(f) { return f.options }, width: 150, align: 'left', bulk_edit: true }
|
27
|
+
],
|
28
|
+
new_model_text: 'New Custom Field',
|
29
|
+
new_model_fields: [
|
30
|
+
{ name: 'key', nice_name: 'Key', type: 'text', width: 400 }
|
31
|
+
],
|
32
|
+
search_fields: [
|
33
|
+
{ name: 'key', nice_name: 'Key', type: 'text', width: 150, align: 'left' }
|
34
|
+
],
|
35
|
+
no_models_text: "There are no custom fields right now."
|
36
|
+
});
|
37
|
+
});
|
38
|
+
|
39
|
+
</script>
|
40
|
+
<% end %>
|
@@ -63,8 +63,9 @@ $(document).ready(function() {
|
|
63
63
|
$('body').append($('<div/>')
|
64
64
|
.attr('id', 'tiny_header')
|
65
65
|
.append($('<a/>').attr('href', '/admin/pages').html("< Back"))
|
66
|
-
.append($('<a/>').attr('href', '/admin/pages/<%= @page.id %>/
|
67
|
-
.append($('<a/>').attr('href', '/admin/pages/<%= @page.id
|
66
|
+
.append($('<a/>').attr('href', '#').html('Custom Fields').click(function(e) { e.preventDefault(); caboose_modal_url('/admin/pages/<%= @page.id %>/custom-fields'); }))
|
67
|
+
.append($('<a/>').attr('href', '/admin/pages/<%= @page.id %>/layout').html("Layout"))
|
68
|
+
.append($('<a/>').attr('href', '/admin/pages/<%= @page.id %>').html("Settings"))
|
68
69
|
);
|
69
70
|
});
|
70
71
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
<h1>Custom Fields</h1>
|
3
|
+
<% @page.page_custom_field_values.each do |fv| %>
|
4
|
+
<p><div id='pagecustomfieldvalue_<%= fv.id %>_value'></div></p>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<p><input type='button' value='Close' onclick="modal.close();" /></p>
|
8
|
+
|
9
|
+
<% content_for :caboose_js do %>
|
10
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
11
|
+
<script type='text/javascript'>
|
12
|
+
|
13
|
+
var modal = false;
|
14
|
+
$(window).load(function() {
|
15
|
+
modal = new CabooseModal(800);
|
16
|
+
setTimeout(function() { modal.autosize(); }, 1000);
|
17
|
+
});
|
18
|
+
|
19
|
+
$(document).ready(function() {
|
20
|
+
<% @page.page_custom_field_values.each do |fv| %>
|
21
|
+
<% f = fv.page_custom_field %>
|
22
|
+
new ModelBinder({
|
23
|
+
name: 'PageCustomFieldValue',
|
24
|
+
id: <%= fv.id %>,
|
25
|
+
update_url: '/admin/page-custom-field-values/<%= fv.id %>',
|
26
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
27
|
+
attributes: [
|
28
|
+
{
|
29
|
+
name: 'value',
|
30
|
+
nice_name: <%= raw Caboose.json(f.name) %>,
|
31
|
+
type: <%= raw Caboose.json(f.field_type) %>,
|
32
|
+
value: <%= raw Caboose.json(fv.value) %>,
|
33
|
+
width: 600,
|
34
|
+
after_update: function() { parent.controller.render_blocks(); },
|
35
|
+
after_cancel: function() { parent.controller.render_blocks(); }
|
36
|
+
<% if f.field_type == 'select' %>, options_url: '/admin/page-custom-fields/<%= f.id %>/options'<% end %>
|
37
|
+
}
|
38
|
+
],
|
39
|
+
on_load: function() { if (modal) modal.autosize(); }
|
40
|
+
});
|
41
|
+
<% end %>
|
42
|
+
});
|
43
|
+
|
44
|
+
</script>
|
45
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -265,10 +265,11 @@ Caboose::Engine.routes.draw do
|
|
265
265
|
get "/admin/pages/robots-options" => "pages#admin_robots_options"
|
266
266
|
get "/admin/pages/format-options" => "pages#admin_content_format_options"
|
267
267
|
get "/admin/pages/new" => "pages#admin_new"
|
268
|
-
get "/admin/pages/:id/block-options" => "pages#admin_block_options"
|
268
|
+
get "/admin/pages/:id/block-options" => "pages#admin_block_options"
|
269
269
|
get "/admin/pages/:id/uri" => "pages#admin_page_uri"
|
270
270
|
get "/admin/pages/:id/delete" => "pages#admin_delete_form"
|
271
271
|
get "/admin/pages/:id/sitemap" => "pages#admin_sitemap"
|
272
|
+
get "/admin/pages/:id/custom-fields" => "pages#admin_edit_custom_fields"
|
272
273
|
get "/admin/pages/:id/permissions" => "pages#admin_edit_permissions"
|
273
274
|
get "/admin/pages/:id/css" => "pages#admin_edit_css"
|
274
275
|
get "/admin/pages/:id/js" => "pages#admin_edit_js"
|
@@ -429,6 +430,20 @@ Caboose::Engine.routes.draw do
|
|
429
430
|
get "/admin/post-custom-fields" => "post_custom_fields#admin_index"
|
430
431
|
post "/admin/post-custom-fields" => "post_custom_fields#admin_add"
|
431
432
|
delete "/admin/post-custom-fields/:id" => "post_custom_fields#admin_delete"
|
433
|
+
|
434
|
+
#=============================================================================
|
435
|
+
# Page Custom Fields and Values
|
436
|
+
#=============================================================================
|
437
|
+
|
438
|
+
put "/admin/page-custom-field-values/:id" => "page_custom_field_values#admin_update"
|
439
|
+
get "/admin/page-custom-fields/json" => "page_custom_fields#admin_json"
|
440
|
+
get "/admin/page-custom-fields/:field-options" => "page_custom_fields#admin_options"
|
441
|
+
get "/admin/page-custom-fields/:id/json" => "page_custom_fields#admin_json_single"
|
442
|
+
get "/admin/page-custom-fields/:id" => "page_custom_fields#admin_edit"
|
443
|
+
put "/admin/page-custom-fields/:id" => "page_custom_fields#admin_update"
|
444
|
+
get "/admin/page-custom-fields" => "page_custom_fields#admin_index"
|
445
|
+
post "/admin/page-custom-fields" => "page_custom_fields#admin_add"
|
446
|
+
delete "/admin/page-custom-fields/:id" => "page_custom_fields#admin_delete"
|
432
447
|
|
433
448
|
#=============================================================================
|
434
449
|
# Google Spreadsheets
|
data/lib/caboose/version.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.9
|
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-10-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -721,6 +721,8 @@ files:
|
|
721
721
|
- app/controllers/caboose/order_packages_controller.rb
|
722
722
|
- app/controllers/caboose/order_reports_controller.rb
|
723
723
|
- app/controllers/caboose/orders_controller.rb
|
724
|
+
- app/controllers/caboose/page_custom_field_values_controller.rb
|
725
|
+
- app/controllers/caboose/page_custom_fields_controller.rb
|
724
726
|
- app/controllers/caboose/page_permissions_controller.rb
|
725
727
|
- app/controllers/caboose/pages_controller.rb
|
726
728
|
- app/controllers/caboose/permissions_controller.rb
|
@@ -814,6 +816,8 @@ files:
|
|
814
816
|
- app/models/caboose/page_bar_generator.rb
|
815
817
|
- app/models/caboose/page_cache.rb
|
816
818
|
- app/models/caboose/page_cacher.rb
|
819
|
+
- app/models/caboose/page_custom_field.rb
|
820
|
+
- app/models/caboose/page_custom_field_value.rb
|
817
821
|
- app/models/caboose/page_permission.rb
|
818
822
|
- app/models/caboose/page_tag.rb
|
819
823
|
- app/models/caboose/pager.rb
|
@@ -1012,6 +1016,8 @@ files:
|
|
1012
1016
|
- app/views/caboose/orders_mailer/fulfillment_new_order.html.erb
|
1013
1017
|
- app/views/caboose/orders_mailer/shipping_order_ready.html.erb
|
1014
1018
|
- app/views/caboose/orders_mailer/test_email.html.erb
|
1019
|
+
- app/views/caboose/page_custom_fields/admin_edit.html.erb
|
1020
|
+
- app/views/caboose/page_custom_fields/admin_index.html.erb
|
1015
1021
|
- app/views/caboose/pages/_admin_footer.html.erb
|
1016
1022
|
- app/views/caboose/pages/_admin_header.html.erb
|
1017
1023
|
- app/views/caboose/pages/_content.html.erb
|
@@ -1020,6 +1026,7 @@ files:
|
|
1020
1026
|
- app/views/caboose/pages/admin_edit_child_sort_order.html.erb
|
1021
1027
|
- app/views/caboose/pages/admin_edit_content.html.erb
|
1022
1028
|
- app/views/caboose/pages/admin_edit_css.html.erb
|
1029
|
+
- app/views/caboose/pages/admin_edit_custom_fields.html.erb
|
1023
1030
|
- app/views/caboose/pages/admin_edit_general.html.erb
|
1024
1031
|
- app/views/caboose/pages/admin_edit_js.html.erb
|
1025
1032
|
- app/views/caboose/pages/admin_edit_layout.html.erb
|