caboose-cms 0.6.34 → 0.6.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDc5ZjY1NTljMGNjZTM5NGU2ODNlYmIyNmNkODM1OGRkNTEwZGVkYw==
4
+ YzkxODRhZjllNzhiN2FlYTNhN2MxMTJmZmMxYWI5NmM3MTY5ZjVlZA==
5
5
  data.tar.gz: !binary |-
6
- Yzk1YmZmOTdhYzQyMGUyYWI3ODcwYzdiMmU2OTMzNzUxNjE2OTA4NQ==
6
+ YjQ3ZTQzN2RhZGUzMWIyNjc4YTczNmIzMjAyM2I2MzMwZTk5M2UyOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmQzMjRiY2ExZmNjNzkyMmU0YjFkZjhhZGFiMjcwNzU3ODcyNGIyOTA3MjI5
10
- ODEwZmEwNTI5MGYyMmYzZTNkYTViY2Y3ZWU1Mzg0YWVmMGFmZGZkNzhiOGRk
11
- NDZiZTM1MWU3MDBhZDUyNzAxMTFlMmMyNmVhOWRlMWJlYTM0MDU=
9
+ M2ZlM2EyNWEwYTAyYTkyNzdiZjlhNjA2OTEwYWQ2ZjBhMDg5ODJkNDE1ODA4
10
+ ZGJjYjdhYzAyNWIyYTg1ZTliYmM2NzUzNWIwOWIzY2JlN2M1ZmUyOTE3ZmZh
11
+ N2M5ZDc3M2IxMGRjMTRhZGFlMTRkOTg3MDc0Yjk5NTRjODM1Y2E=
12
12
  data.tar.gz: !binary |-
13
- Njg5YmI2MGQyOGE2ODk1ZmQ3NTUxZTUxYmFiMTg5ZTY1NTQyYTFhMTE4NzYx
14
- NDk1YjA4ZjZhMzI3MDUzYmMzOTYyNTFkZDNjNDJhZTRmOWM3YzQ2YTBjOWY4
15
- YmNlYTNhNTI3MDNkMWE0NGYwYzNjNmNjNWZjMjAyOWRlMTJhOWI=
13
+ YjUxNjk3ODVhZjdkNzE5MzllNDZmNDBmZmIyOWJhODQ2ZjgyZjA2MjNlY2M4
14
+ NzljMDgzMzg2MDNkMzMxMDdjMTlhYmVjYjIxMzY5YjBjYjM3YWYyZDkzZTg2
15
+ ZGFjOGM5NjEyODg0N2Q3Yzk3ODU0YThjOGJhMjEzMGMzZDM2MDU=
@@ -0,0 +1,2 @@
1
+
2
+ post.custom_field_value('photographer_name')
@@ -0,0 +1,22 @@
1
+ module Caboose
2
+ class PostCustomFieldValuesController < ApplicationController
3
+
4
+ # PUT /admin/post-custom-field-values/:id
5
+ def admin_update
6
+ return if !user_is_allowed('postcustomfieldvalues', 'edit')
7
+
8
+ resp = Caboose::StdClass.new
9
+ fv = PostCustomFieldValue.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 PostCustomFieldsController < ApplicationController
3
+
4
+ helper :application
5
+
6
+ # GET /admin/post-custom-fields
7
+ def admin_index
8
+ return if !user_is_allowed_to 'view', 'postcustomfields'
9
+ render :layout => 'caboose/admin'
10
+ end
11
+
12
+ # GET /admin/post-custom-fields/json
13
+ def admin_json
14
+ return if !user_is_allowed_to 'view', 'postcustomfields'
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::PostCustomField',
29
+ 'sort' => 'key',
30
+ 'desc' => 'false',
31
+ 'items_per_page' => 100,
32
+ 'base_url' => '/admin/post-custom-fields'
33
+ })
34
+ end
35
+
36
+ # GET /admin/post-custom-fields/:id/json
37
+ def admin_json_single
38
+ return if !user_is_allowed_to 'view', 'postcustomfields'
39
+ f = PostCustomField.find(params[:id])
40
+ render :json => f
41
+ end
42
+
43
+ # GET /admin/post-custom-fields/:id
44
+ def admin_edit
45
+ return if !user_is_allowed('postcustomfields', 'edit')
46
+ @post_custom_field = PostCustomField.find(params[:id])
47
+ render :layout => 'caboose/admin'
48
+ end
49
+
50
+ # PUT /admin/post-custom-fields/:id
51
+ def admin_update
52
+ return if !user_is_allowed('postcustomfields', 'edit')
53
+
54
+ resp = Caboose::StdClass.new
55
+ f = PostCustomField.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/post-custom-fields
72
+ def admin_add
73
+ return if !user_is_allowed('postcustomfields', 'add')
74
+
75
+ resp = Caboose::StdClass.new
76
+
77
+ f = PostCustomField.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 = PostCustomField::FIELD_TYPE_TEXT
86
+ f.save
87
+ resp.redirect = "/admin/post-custom-fields/#{f.id}"
88
+ end
89
+
90
+ render :json => resp
91
+ end
92
+
93
+ # DELETE /admin/post-custom-fields/:id
94
+ def admin_delete
95
+ return if !user_is_allowed('postcustomfields', 'edit')
96
+
97
+ if params[:id] == 'bulk'
98
+ params[:model_ids].each do |fid|
99
+ PostCustomFieldValue.where(:post_custom_field_id => fid).destroy_all
100
+ PostCustomField.where(:id => fid).destroy_all
101
+ end
102
+ else
103
+ fid = params[:id]
104
+ PostCustomFieldValue.where(:post_custom_field_id => fid).destroy_all
105
+ PostCustomField.where(:id => fid).destroy_all
106
+ end
107
+
108
+ render :json => { 'redirect' => '/admin/post-custom-fields' }
109
+ end
110
+
111
+ # GET /admin/post-custom-fields/:field-options
112
+ def admin_options
113
+ return if !user_is_allowed_to 'view', 'postcustomfields'
114
+ options = []
115
+ case params[:field]
116
+ when nil
117
+ arr = PostCustomField.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' => PostCustomField::FIELD_TYPE_TEXT , 'text' => 'Text' },
122
+ { 'value' => PostCustomField::FIELD_TYPE_SELECT , 'text' => 'Select' },
123
+ { 'value' => PostCustomField::FIELD_TYPE_CHECKBOX , 'text' => 'Checkbox' },
124
+ { 'value' => PostCustomField::FIELD_TYPE_DATE , 'text' => 'Date' },
125
+ { 'value' => PostCustomField::FIELD_TYPE_DATETIME , 'text' => 'Datetime' }
126
+ ]
127
+ end
128
+ render :json => options
129
+ end
130
+
131
+ end
132
+ end
@@ -69,13 +69,14 @@ module Caboose
69
69
  def admin_edit_general
70
70
  return if !user_is_allowed('posts', 'edit')
71
71
  @post = Post.find(params[:id])
72
+ @post.verify_custom_field_values_exist
72
73
  render :layout => 'caboose/admin'
73
74
  end
74
75
 
75
76
  # GET /admin/posts/:id/preview
76
77
  def admin_edit_preview
77
78
  return if !user_is_allowed('posts', 'edit')
78
- @post = Post.find(params[:id])
79
+ @post = Post.find(params[:id])
79
80
  render :layout => 'caboose/admin'
80
81
  end
81
82
 
@@ -7,19 +7,20 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
7
7
  nav << { 'id' => 'my-account' , 'text' => 'My Account' , 'href' => '/my-account' , 'modal' => true }
8
8
 
9
9
  item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] }
10
- item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
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
- item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') if site.use_fonts == true
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')
15
- item['children'] << { 'id' => 'post_categories' , 'text' => 'Post Categories' , 'href' => '/admin/post-categories' , 'modal' => false } if user.is_allowed('post_categories', 'view')
16
- item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view')
17
- item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') if site.is_master == true
18
- item['children'] << { 'id' => 'smtp' , 'text' => 'SMTP (Mail)' , 'href' => '/admin/smtp' , 'modal' => false } if user.is_allowed('smtp' , 'view')
19
- item['children'] << { 'id' => 'social' , 'text' => 'Social Media' , 'href' => '/admin/social' , 'modal' => false } if user.is_allowed('social' , 'view')
20
- item['children'] << { 'id' => 'store' , 'text' => 'Store' , 'href' => '/admin/store' , 'modal' => false } if user.is_allowed('store' , 'view') if site.use_store == true
21
- item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view')
22
- item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
10
+ item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
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
+ item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') if site.use_fonts == true
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')
15
+ item['children'] << { 'id' => 'post_categories' , 'text' => 'Post Categories' , 'href' => '/admin/post-categories' , 'modal' => false } if user.is_allowed('post_categories' , 'view')
16
+ item['children'] << { 'id' => 'postcustomfields' , 'text' => 'Post Custom Fields' , 'href' => '/admin/post-custom-fields' , 'modal' => false } if user.is_allowed('postcustomfields' , 'view')
17
+ item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view')
18
+ item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') if site.is_master == true
19
+ item['children'] << { 'id' => 'smtp' , 'text' => 'SMTP (Mail)' , 'href' => '/admin/smtp' , 'modal' => false } if user.is_allowed('smtp' , 'view')
20
+ item['children'] << { 'id' => 'social' , 'text' => 'Social Media' , 'href' => '/admin/social' , 'modal' => false } if user.is_allowed('social' , 'view')
21
+ item['children'] << { 'id' => 'store' , 'text' => 'Store' , 'href' => '/admin/store' , 'modal' => false } if user.is_allowed('store' , 'view') if site.use_store == true
22
+ item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view')
23
+ item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
23
24
  nav << item if item['children'].count > 0
24
25
 
25
26
  item = { 'id' => 'content', 'text' => 'Content', 'children' => [] }
@@ -2,15 +2,16 @@
2
2
  class Caboose::Post < ActiveRecord::Base
3
3
  self.table_name = "posts"
4
4
 
5
+ has_many :post_custom_field_values
5
6
  has_many :post_category_memberships
6
- has_many :post_categories, :through => :post_category_memberships
7
+ has_many :post_categories, :through => :post_category_memberships
7
8
  belongs_to :site
8
9
 
9
10
  attr_accessible :id,
10
11
  :site_id ,
11
12
  :title ,
12
13
  :subtitle ,
13
- :author ,
14
+ :author ,
14
15
  :body ,
15
16
  :preview ,
16
17
  :hide ,
@@ -68,5 +69,22 @@ class Caboose::Post < ActiveRecord::Base
68
69
  self.uri = new_uri
69
70
  self.save
70
71
  end
72
+
73
+ def custom_field_value(key)
74
+ fv = Caboose::PostCustomFieldValue.where(:post_id => self.id, :key => key).first
75
+ if fv.nil?
76
+ f = Caboose::PostCustomField.where(:site_id => self.site_id, :key => key).first
77
+ return nil if f.nil?
78
+ fv = Caboose::PostCustomFieldValue.create(:post_id => self.id, :key => key, :value => f.default_value, :sort_order => f.sort_order)
79
+ end
80
+ return fv.value
81
+ end
82
+
83
+ def verify_custom_field_values_exist
84
+ Caboose::PostCustomField.where(:site_id => self.site_id).all.each do |f|
85
+ fv = Caboose::PostCustomFieldValue.where(:post_id => self.id, :post_custom_field_id => f.id).first
86
+ Caboose::PostCustomFieldValue.create(:post_id => self.id, :post_custom_field_id => f.id, :key => f.key, :value => f.default_value, :sort_order => f.sort_order) if fv.nil?
87
+ end
88
+ end
71
89
 
72
90
  end
@@ -0,0 +1,21 @@
1
+
2
+ class Caboose::PostCustomField < ActiveRecord::Base
3
+ self.table_name = "post_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::PostCustomFieldValue < ActiveRecord::Base
3
+ self.table_name = "post_custom_field_values"
4
+
5
+ belongs_to :post
6
+ belongs_to :post_custom_field
7
+ attr_accessible :id ,
8
+ :post_id ,
9
+ :post_custom_field_id ,
10
+ :key ,
11
+ :value ,
12
+ :sort_order
13
+
14
+ end
@@ -507,6 +507,22 @@ class Caboose::Schema < Caboose::Utilities::Schema
507
507
  [ :post_id , :integer ],
508
508
  [ :post_category_id , :integer ]
509
509
  ],
510
+ Caboose::PostCustomField => [
511
+ [ :site_id , :integer ],
512
+ [ :key , :string ],
513
+ [ :name , :string ],
514
+ [ :field_type , :string ],
515
+ [ :default_value , :text ],
516
+ [ :options , :text ],
517
+ [ :sort_order , :integer , { :default => 0 }]
518
+ ],
519
+ Caboose::PostCustomFieldValue => [
520
+ [ :post_id , :integer ],
521
+ [ :post_custom_field_id , :integer ],
522
+ [ :key , :string ],
523
+ [ :value , :text ],
524
+ [ :sort_order , :integer , { :default => 0 }]
525
+ ],
510
526
  Caboose::Product => [
511
527
  [ :site_id , :integer ],
512
528
  [ :alternate_id , :string ],
@@ -0,0 +1,40 @@
1
+ <%
2
+ f = @post_custom_field
3
+ %>
4
+
5
+ <h1>Edit Post Custom Field</h1>
6
+
7
+ <p><div id='postcustomfield_<%= f.id %>_key' ></div></p>
8
+ <p><div id='postcustomfield_<%= f.id %>_name' ></div></p>
9
+ <p><div id='postcustomfield_<%= f.id %>_field_type' ></div></p>
10
+ <p><div id='postcustomfield_<%= f.id %>_default_value' ></div></p>
11
+ <p><div id='postcustomfield_<%= f.id %>_options' ></div></p>
12
+
13
+ <div id='message'></div>
14
+
15
+ <p>
16
+ <input type='button' value='< Back' onclick="window.location='/admin/post-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: 'PostCustomField',
26
+ id: <%= f.id %>,
27
+ update_url: '/admin/post-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/post-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>Post Custom Fields</h1>
3
+
4
+ <div id='postcustomfields'></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: 'postcustomfields',
15
+ base_url: '/admin/post-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/post-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 %>
@@ -6,6 +6,9 @@
6
6
  <p><div id='post_<%= @post.id %>_title' ></div></p>
7
7
  <p><div id='post_<%= @post.id %>_subtitle' ></div></p>
8
8
  <p><div id='post_<%= @post.id %>_author' ></div></p>
9
+ <% @post.post_custom_field_values.each do |fv| %>
10
+ <p><div id='postcustomfieldvalue_<%= fv.id %>_value'></div></p>
11
+ <% end %>
9
12
  <p><div id='post_<%= @post.id %>_created_at'></div></p>
10
13
  <p><div id='post_<%= @post.id %>_published' ></div></p>
11
14
  <p><div id='post_<%= @post.id %>_image' ></div></p>
@@ -32,6 +35,25 @@ $(document).ready(function() {
32
35
  { name: 'image' , nice_name: 'Image' , type: 'image' , value: <%= raw Caboose.json(@post.image.url(:thumb)) %>, width: 600, update_url: '/admin/posts/<%= @post.id %>/image' }
33
36
  ]
34
37
  });
38
+ <% @post.post_custom_field_values.each do |fv| %>
39
+ <% f = fv.post_custom_field %>
40
+ new ModelBinder({
41
+ name: 'PostCustomFieldValue',
42
+ id: <%= fv.id %>,
43
+ update_url: '/admin/post-custom-field-values/<%= fv.id %>',
44
+ authenticity_token: '<%= form_authenticity_token %>',
45
+ attributes: [
46
+ {
47
+ name: 'value',
48
+ nice_name: <%= raw Caboose.json(f.name) %>,
49
+ type: <%= raw Caboose.json(f.field_type) %>,
50
+ value: <%= raw Caboose.json(fv.value) %>,
51
+ width: 600
52
+ <% if f.field_type == 'select' %>, options_url: '/admin/post-custom-fields/<%= f.id %>/options'<% end %>
53
+ }
54
+ ]
55
+ });
56
+ <% end %>
35
57
  });
36
58
 
37
59
  function refresh_uri()
@@ -416,6 +416,20 @@ Caboose::Engine.routes.draw do
416
416
  post "/admin/post-categories" => "post-categories#admin_add"
417
417
  delete "/admin/post-categories/:id" => "post-categories#admin_delete"
418
418
 
419
+ #=============================================================================
420
+ # Post Custom Fields and Values
421
+ #=============================================================================
422
+
423
+ put "/admin/post-custom-field-values/:id" => "post_custom_field_values#admin_update"
424
+ get "/admin/post-custom-fields/json" => "post_custom_fields#admin_json"
425
+ get "/admin/post-custom-fields/:field-options" => "post_custom_fields#admin_options"
426
+ get "/admin/post-custom-fields/:id/json" => "post_custom_fields#admin_json_single"
427
+ get "/admin/post-custom-fields/:id" => "post_custom_fields#admin_edit"
428
+ put "/admin/post-custom-fields/:id" => "post_custom_fields#admin_update"
429
+ get "/admin/post-custom-fields" => "post_custom_fields#admin_index"
430
+ post "/admin/post-custom-fields" => "post_custom_fields#admin_add"
431
+ delete "/admin/post-custom-fields/:id" => "post_custom_fields#admin_delete"
432
+
419
433
  #=============================================================================
420
434
  # Google Spreadsheets
421
435
  #=============================================================================
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.6.34'
2
+ VERSION = '0.6.35'
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.6.34
4
+ version: 0.6.35
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-05 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -601,6 +601,7 @@ files:
601
601
  - app/assets/templates/caboose/product/images.jst.ejs
602
602
  - app/assets/templates/caboose/product/images_old.jst.ejs
603
603
  - app/assets/templates/caboose/product/options.jst.ejs
604
+ - app/controllers/caboose/#Untitled-1#
604
605
  - app/controllers/caboose/ab_options_controller.rb
605
606
  - app/controllers/caboose/ab_variants_controller.rb
606
607
  - app/controllers/caboose/admin_controller.rb
@@ -641,6 +642,8 @@ files:
641
642
  - app/controllers/caboose/pages_controller.rb
642
643
  - app/controllers/caboose/permissions_controller.rb
643
644
  - app/controllers/caboose/post_categories_controller.rb
645
+ - app/controllers/caboose/post_custom_field_values_controller.rb
646
+ - app/controllers/caboose/post_custom_fields_controller.rb
644
647
  - app/controllers/caboose/posts_controller.rb
645
648
  - app/controllers/caboose/product_images_controller.rb
646
649
  - app/controllers/caboose/products_controller.rb
@@ -740,6 +743,8 @@ files:
740
743
  - app/models/caboose/post.rb
741
744
  - app/models/caboose/post_category.rb
742
745
  - app/models/caboose/post_category_membership.rb
746
+ - app/models/caboose/post_custom_field.rb
747
+ - app/models/caboose/post_custom_field_value.rb
743
748
  - app/models/caboose/product.rb
744
749
  - app/models/caboose/product_category_sort.rb
745
750
  - app/models/caboose/product_image.rb
@@ -950,6 +955,8 @@ files:
950
955
  - app/views/caboose/post_categories/admin_edit.html.erb
951
956
  - app/views/caboose/post_categories/admin_index.html.erb
952
957
  - app/views/caboose/post_categories/admin_new.html.erb
958
+ - app/views/caboose/post_custom_fields/admin_edit.html.erb
959
+ - app/views/caboose/post_custom_fields/admin_index.html.erb
953
960
  - app/views/caboose/posts/_admin_footer.html.erb
954
961
  - app/views/caboose/posts/_admin_header.html.erb
955
962
  - app/views/caboose/posts/admin_delete_form.html.erb