zen 0.4.2 → 0.4.3
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.
- data/.gems +17 -15
- data/.gitignore +1 -1
- data/.travis.yml +1 -1
- data/MANIFEST +470 -0
- data/README.md +5 -3
- data/Rakefile +8 -6
- data/bin/zen +2 -7
- data/guide/asset_management.md +1 -0
- data/guide/autosaving_forms.md +1 -0
- data/guide/changelog.md +22 -0
- data/guide/faq.md +1 -0
- data/guide/getting_started.md +1 -0
- data/guide/hacking.md +1 -0
- data/guide/images/sections/revisions.png +0 -0
- data/guide/images/sections/revisions_diff.png +0 -0
- data/guide/images/sections/revisions_diff_multiple.png +0 -0
- data/guide/installation.md +4 -3
- data/guide/javascript.md +1 -0
- data/guide/javascript/zen_autosave.md +1 -0
- data/guide/javascript/zen_editor.md +1 -0
- data/guide/javascript/zen_form.md +1 -0
- data/guide/javascript/zen_hash.md +1 -0
- data/guide/javascript/zen_htmltable.md +1 -0
- data/guide/javascript/zen_tabs.md +1 -0
- data/guide/javascript/zen_window.md +1 -0
- data/guide/zen_compared.md +1 -0
- data/lib/zen.rb +10 -12
- data/lib/zen/event.rb +2 -2
- data/lib/zen/helper/controller.rb +13 -13
- data/lib/zen/helper/message.rb +3 -3
- data/lib/zen/helper/search.rb +4 -4
- data/lib/zen/helper/stacked_aspect.rb +9 -9
- data/lib/zen/html_diff.rb +151 -0
- data/lib/zen/language.rb +9 -7
- data/lib/zen/language/translation.rb +8 -8
- data/lib/zen/markup.rb +1 -1
- data/lib/zen/migrator.rb +2 -2
- data/lib/zen/model/helper.rb +4 -4
- data/lib/zen/model/plugin/events.rb +16 -16
- data/lib/zen/package.rb +2 -2
- data/lib/zen/package/all.rb +1 -1
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +4 -4
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +4 -4
- data/lib/zen/package/categories/lib/categories/helper/category.rb +3 -3
- data/lib/zen/package/categories/lib/categories/model/category.rb +9 -9
- data/lib/zen/package/categories/lib/categories/model/category_group.rb +9 -9
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +4 -4
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +2 -2
- data/lib/zen/package/comments/lib/comments/helper/comment.rb +1 -1
- data/lib/zen/package/comments/lib/comments/model/comment.rb +13 -13
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +1 -1
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +4 -4
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +6 -6
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +5 -5
- data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +3 -3
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +9 -9
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb +9 -9
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +9 -9
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +8 -3
- data/lib/zen/package/custom_fields/migrations/1336171490_revisions.rb +41 -0
- data/lib/zen/package/dashboard/lib/dashboard/controller/dashboard.rb +6 -6
- data/lib/zen/package/dashboard/lib/dashboard/model/widget.rb +3 -3
- data/lib/zen/package/dashboard/lib/dashboard/widget.rb +12 -12
- data/lib/zen/package/extensions/lib/extensions/controller/extensions.rb +3 -3
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +5 -5
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +4 -4
- data/lib/zen/package/menus/lib/menus/helper/menu.rb +4 -4
- data/lib/zen/package/menus/lib/menus/model/menu.rb +11 -11
- data/lib/zen/package/menus/lib/menus/model/menu_item.rb +10 -10
- data/lib/zen/package/menus/lib/menus/public/admin/menus/js/lib/nested_sortables.js +13 -13
- data/lib/zen/package/menus/lib/menus/public/admin/menus/js/menu_items.js +1 -1
- data/lib/zen/package/sections/lib/sections.rb +19 -0
- data/lib/zen/package/sections/lib/sections/controller/revisions.rb +184 -0
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +5 -5
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +9 -6
- data/lib/zen/package/sections/lib/sections/helper/revision.rb +124 -0
- data/lib/zen/package/sections/lib/sections/helper/section.rb +17 -15
- data/lib/zen/package/sections/lib/sections/helper/section_frontend.rb +104 -6
- data/lib/zen/package/sections/lib/sections/language/en/revisions.rb +34 -0
- data/lib/zen/package/sections/lib/sections/language/en/sections.rb +1 -0
- data/lib/zen/package/sections/lib/sections/language/nl/revisions.rb +35 -0
- data/lib/zen/package/sections/lib/sections/language/nl/sections.rb +1 -0
- data/lib/zen/package/sections/lib/sections/model/revision.rb +76 -0
- data/lib/zen/package/sections/lib/sections/model/section.rb +9 -9
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +47 -12
- data/lib/zen/package/sections/lib/sections/view/admin/revisions/index.xhtml +89 -0
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +1 -1
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +14 -0
- data/lib/zen/package/sections/migrations/1335711557_revisions.rb +40 -0
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +12 -4
- data/lib/zen/package/settings/lib/settings/setting.rb +6 -6
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +4 -4
- data/lib/zen/package/users/lib/users/controller/users.rb +12 -12
- data/lib/zen/package/users/lib/users/helper/access.rb +1 -1
- data/lib/zen/package/users/lib/users/helper/acl.rb +4 -4
- data/lib/zen/package/users/lib/users/helper/users.rb +2 -2
- data/lib/zen/package/users/lib/users/model/permission.rb +1 -1
- data/lib/zen/package/users/lib/users/model/user.rb +11 -11
- data/lib/zen/package/users/lib/users/model/user_group.rb +9 -9
- data/lib/zen/package/users/lib/users/model/user_status.rb +2 -2
- data/lib/zen/public/admin/zen/css/general.css +54 -0
- data/lib/zen/public/admin/zen/css/messages.css +6 -3
- data/lib/zen/public/admin/zen/css/tables.css +10 -0
- data/lib/zen/public/admin/zen/images/icons/undo.png +0 -0
- data/lib/zen/public/admin/zen/js/lib/autosave.js +8 -8
- data/lib/zen/public/admin/zen/js/lib/base.js +2 -2
- data/lib/zen/public/admin/zen/js/lib/events.js +2 -2
- data/lib/zen/public/admin/zen/js/lib/form.js +7 -7
- data/lib/zen/public/admin/zen/js/lib/hash.js +7 -7
- data/lib/zen/public/admin/zen/js/lib/tabs.js +3 -3
- data/lib/zen/public/admin/zen/js/lib/window.js +1 -1
- data/lib/zen/security.rb +2 -2
- data/lib/zen/spec/helper.rb +3 -9
- data/lib/zen/spec/helper/capybara.rb +4 -4
- data/lib/zen/spec/helper/general.rb +1 -1
- data/lib/zen/spec/simplecov.rb +1 -5
- data/lib/zen/task/build.rake +22 -16
- data/lib/zen/task/db.rake +3 -2
- data/lib/zen/task/spelling.rake +10 -10
- data/lib/zen/task/test.rake +27 -19
- data/lib/zen/theme.rb +6 -6
- data/lib/zen/version.rb +1 -1
- data/spec/zen/all.rb +4 -0
- data/spec/zen/package/sections/controller/revisions.rb +235 -0
- data/spec/zen/package/sections/model/revision.rb +76 -0
- data/zen.gemspec +23 -21
- metadata +88 -29
- data/lib/zen/model/methods.rb +0 -27
- data/lib/zen/task/clean.rake +0 -20
- data/lib/zen/task/setup.rake +0 -4
- data/pkg/.gitkeep +0 -0
data/lib/zen/package.rb
CHANGED
|
@@ -279,7 +279,7 @@ module Zen
|
|
|
279
279
|
##
|
|
280
280
|
# Creates a new instance of the package.
|
|
281
281
|
#
|
|
282
|
-
# @since
|
|
282
|
+
# @since 2012-02-12
|
|
283
283
|
#
|
|
284
284
|
def initialize
|
|
285
285
|
@env = OpenStruct.new
|
|
@@ -325,7 +325,7 @@ module Zen
|
|
|
325
325
|
# Returns the title as either an ``<a>`` tag or plain text depending on
|
|
326
326
|
# whether or not the package has a URL set.
|
|
327
327
|
#
|
|
328
|
-
# @since
|
|
328
|
+
# @since 2011-11-19
|
|
329
329
|
# @return [String]
|
|
330
330
|
#
|
|
331
331
|
def formatted_title
|
data/lib/zen/package/all.rb
CHANGED
|
@@ -5,8 +5,8 @@ require __DIR__('settings/lib/settings')
|
|
|
5
5
|
require __DIR__('users/lib/users')
|
|
6
6
|
require __DIR__('dashboard/lib/dashboard')
|
|
7
7
|
require __DIR__('sections/lib/sections')
|
|
8
|
+
require __DIR__('custom_fields/lib/custom_fields')
|
|
8
9
|
require __DIR__('comments/lib/comments')
|
|
9
10
|
require __DIR__('categories/lib/categories')
|
|
10
|
-
require __DIR__('custom_fields/lib/custom_fields')
|
|
11
11
|
require __DIR__('menus/lib/menus')
|
|
12
12
|
require __DIR__('extensions/lib/extensions')
|
|
@@ -71,10 +71,10 @@ module Categories
|
|
|
71
71
|
#
|
|
72
72
|
# This controller uses the following permissions:
|
|
73
73
|
#
|
|
74
|
-
# *
|
|
75
|
-
# *
|
|
76
|
-
# *
|
|
77
|
-
# *
|
|
74
|
+
# * show\_category
|
|
75
|
+
# * edit\_category
|
|
76
|
+
# * new\_category
|
|
77
|
+
# * delete\_category
|
|
78
78
|
#
|
|
79
79
|
# @since 0.1
|
|
80
80
|
# @map /admin/categories
|
|
@@ -82,10 +82,10 @@ module Categories
|
|
|
82
82
|
#
|
|
83
83
|
# ## Used Permissions
|
|
84
84
|
#
|
|
85
|
-
# *
|
|
86
|
-
# *
|
|
87
|
-
# *
|
|
88
|
-
# *
|
|
85
|
+
# * show\_category\_group
|
|
86
|
+
# * edit\_category\_group
|
|
87
|
+
# * new\_category\_group
|
|
88
|
+
# * delete\_category\_group
|
|
89
89
|
#
|
|
90
90
|
# @since 0.1
|
|
91
91
|
# @map /admin/category-groups
|
|
@@ -64,7 +64,7 @@ module Ramaze
|
|
|
64
64
|
# category group ID.
|
|
65
65
|
#
|
|
66
66
|
# @since 0.2.8
|
|
67
|
-
# @param [Fixnum
|
|
67
|
+
# @param [Fixnum] category_id The ID of the category, this one will be
|
|
68
68
|
# excluded from the hash.
|
|
69
69
|
# @param [Fixnum] category_group_id The ID of a category group for which
|
|
70
70
|
# to retrieve all the possible parent items.
|
|
@@ -87,7 +87,7 @@ module Ramaze
|
|
|
87
87
|
# Redirects the user to the category groups overview and shows a message
|
|
88
88
|
# about an invalid group being specified.
|
|
89
89
|
#
|
|
90
|
-
# @since
|
|
90
|
+
# @since 2012-04-03
|
|
91
91
|
#
|
|
92
92
|
def redirect_invalid_group
|
|
93
93
|
message(:error, lang('category_groups.errors.invalid_group'))
|
|
@@ -99,7 +99,7 @@ module Ramaze
|
|
|
99
99
|
# and shows a message informing the user that the specified category was
|
|
100
100
|
# invalid.
|
|
101
101
|
#
|
|
102
|
-
# @since
|
|
102
|
+
# @since 2012-04-03
|
|
103
103
|
# @param [Fixnum] category_group_id The ID of the category group that the
|
|
104
104
|
# category belongs to.
|
|
105
105
|
#
|
|
@@ -30,12 +30,12 @@ module Categories
|
|
|
30
30
|
# end
|
|
31
31
|
#
|
|
32
32
|
# @since 0.1
|
|
33
|
-
# @event
|
|
34
|
-
# @event
|
|
35
|
-
# @event
|
|
36
|
-
# @event
|
|
37
|
-
# @event
|
|
38
|
-
# @event
|
|
33
|
+
# @event before\_new\_category
|
|
34
|
+
# @event after\_new\_category
|
|
35
|
+
# @event before\_edit\_category
|
|
36
|
+
# @event after\_edit\_category
|
|
37
|
+
# @event before\_delete\_category
|
|
38
|
+
# @event after\_delete\_category
|
|
39
39
|
#
|
|
40
40
|
class Category < Sequel::Model
|
|
41
41
|
include Zen::Model::Helper
|
|
@@ -43,7 +43,7 @@ module Categories
|
|
|
43
43
|
##
|
|
44
44
|
# Array containing the column names that can be set by the user.
|
|
45
45
|
#
|
|
46
|
-
# @since
|
|
46
|
+
# @since 2012-02-17
|
|
47
47
|
#
|
|
48
48
|
COLUMNS = [:parent_id, :name, :description, :slug, :category_group_id]
|
|
49
49
|
|
|
@@ -63,7 +63,7 @@ module Categories
|
|
|
63
63
|
##
|
|
64
64
|
# Searches for a set of category groups using the specified search query.
|
|
65
65
|
#
|
|
66
|
-
# @since
|
|
66
|
+
# @since 2011-10-16
|
|
67
67
|
# @param [String] query The search query.
|
|
68
68
|
# @return [Mixed]
|
|
69
69
|
#
|
|
@@ -85,7 +85,7 @@ module Categories
|
|
|
85
85
|
##
|
|
86
86
|
# Hook that is executed before creating or saving an object.
|
|
87
87
|
#
|
|
88
|
-
# @since
|
|
88
|
+
# @since 2012-01-03
|
|
89
89
|
#
|
|
90
90
|
def before_save
|
|
91
91
|
sanitize_fields([:name, :slug, :description])
|
|
@@ -31,12 +31,12 @@ module Categories
|
|
|
31
31
|
# end
|
|
32
32
|
#
|
|
33
33
|
# @since 0.1
|
|
34
|
-
# @event
|
|
35
|
-
# @event
|
|
36
|
-
# @event
|
|
37
|
-
# @event
|
|
38
|
-
# @event
|
|
39
|
-
# @event
|
|
34
|
+
# @event before\_new\_category\_group
|
|
35
|
+
# @event after\_new\_category\_group
|
|
36
|
+
# @event before\_edit\_category\_group
|
|
37
|
+
# @event after\_edit\_category\_group
|
|
38
|
+
# @event before\_delete\_category\_group
|
|
39
|
+
# @event after\_delete\_category\_group
|
|
40
40
|
#
|
|
41
41
|
class CategoryGroup < Sequel::Model
|
|
42
42
|
include Zen::Model::Helper
|
|
@@ -44,7 +44,7 @@ module Categories
|
|
|
44
44
|
##
|
|
45
45
|
# Array containing the column names that can be set by the user.
|
|
46
46
|
#
|
|
47
|
-
# @since
|
|
47
|
+
# @since 2012-02-17
|
|
48
48
|
#
|
|
49
49
|
COLUMNS = [:name, :description]
|
|
50
50
|
|
|
@@ -64,7 +64,7 @@ module Categories
|
|
|
64
64
|
##
|
|
65
65
|
# Searches for a set of category groups using the specified search query.
|
|
66
66
|
#
|
|
67
|
-
# @since
|
|
67
|
+
# @since 2011-10-16
|
|
68
68
|
# @param [String] query The search query.
|
|
69
69
|
# @return [Mixed]
|
|
70
70
|
#
|
|
@@ -85,7 +85,7 @@ module Categories
|
|
|
85
85
|
##
|
|
86
86
|
# Hook that is run before creating or saving an object.
|
|
87
87
|
#
|
|
88
|
-
# @since
|
|
88
|
+
# @since 2012-01-03
|
|
89
89
|
#
|
|
90
90
|
def before_save
|
|
91
91
|
sanitize_fields([:name, :description])
|
|
@@ -117,10 +117,10 @@ module Comments
|
|
|
117
117
|
#
|
|
118
118
|
# This controller uses the following permissions:
|
|
119
119
|
#
|
|
120
|
-
# *
|
|
121
|
-
# *
|
|
122
|
-
# *
|
|
123
|
-
# *
|
|
120
|
+
# * show\_comment
|
|
121
|
+
# * edit\_comment
|
|
122
|
+
# * new\_comment
|
|
123
|
+
# * delete\_comment
|
|
124
124
|
#
|
|
125
125
|
# @since 0.1
|
|
126
126
|
# @map /admin/comments
|
|
@@ -86,8 +86,8 @@ module Comments
|
|
|
86
86
|
# two objects in the flash just like the backend controllers. These are the
|
|
87
87
|
# following two items:
|
|
88
88
|
#
|
|
89
|
-
# * **
|
|
90
|
-
# * **
|
|
89
|
+
# * **form\_data**: an instance of {Comments::Model::Comment}
|
|
90
|
+
# * **form\_errros**: a hash containing all errors, automatically used by
|
|
91
91
|
# ``Ramaze::Helper::BlueForm`` if the form was created using the
|
|
92
92
|
# ``form_for()`` method.
|
|
93
93
|
#
|
|
@@ -33,7 +33,7 @@ module Ramaze
|
|
|
33
33
|
# Redirects the user to the comments overview and shows a message
|
|
34
34
|
# informing the user that the comment he/she tried to access was invalid.
|
|
35
35
|
#
|
|
36
|
-
# @since
|
|
36
|
+
# @since 2012-04-05
|
|
37
37
|
#
|
|
38
38
|
def redirect_invalid_comment
|
|
39
39
|
message(:error, lang('comments.errors.invalid_comment'))
|
|
@@ -32,12 +32,12 @@ module Comments
|
|
|
32
32
|
# end
|
|
33
33
|
#
|
|
34
34
|
# @since 0.1
|
|
35
|
-
# @event
|
|
36
|
-
# @event
|
|
37
|
-
# @event
|
|
38
|
-
# @event
|
|
39
|
-
# @event
|
|
40
|
-
# @event
|
|
35
|
+
# @event before\_new\_comment
|
|
36
|
+
# @event after\_new\_comment
|
|
37
|
+
# @event before\_edit\_comment
|
|
38
|
+
# @event after\_edit\_comment
|
|
39
|
+
# @event beore\_delete\_comment
|
|
40
|
+
# @event after\_delete\_comment
|
|
41
41
|
#
|
|
42
42
|
class Comment < Sequel::Model
|
|
43
43
|
include Zen::Model::Helper
|
|
@@ -45,7 +45,7 @@ module Comments
|
|
|
45
45
|
##
|
|
46
46
|
# Array containing all the columns that can be set by the user.
|
|
47
47
|
#
|
|
48
|
-
# @since
|
|
48
|
+
# @since 2012-02-17
|
|
49
49
|
#
|
|
50
50
|
COLUMNS = [
|
|
51
51
|
:user_id, :name, :website, :email, :comment, :comment_status_id,
|
|
@@ -79,7 +79,7 @@ module Comments
|
|
|
79
79
|
# * users.email
|
|
80
80
|
# * users.name
|
|
81
81
|
#
|
|
82
|
-
# @since
|
|
82
|
+
# @since 2011-10-16
|
|
83
83
|
# @param [String] query The search query.
|
|
84
84
|
# @return [Array]
|
|
85
85
|
#
|
|
@@ -155,7 +155,7 @@ module Comments
|
|
|
155
155
|
# retrieved from the current comment row or from an associated user
|
|
156
156
|
# object.
|
|
157
157
|
#
|
|
158
|
-
# @since
|
|
158
|
+
# @since 2011-10-16
|
|
159
159
|
# @return [String]
|
|
160
160
|
#
|
|
161
161
|
def user_name
|
|
@@ -169,7 +169,7 @@ module Comments
|
|
|
169
169
|
##
|
|
170
170
|
# Gets the Email address of the author of the comment.
|
|
171
171
|
#
|
|
172
|
-
# @since
|
|
172
|
+
# @since 2011-10-16
|
|
173
173
|
# @return [String]
|
|
174
174
|
#
|
|
175
175
|
def user_email
|
|
@@ -184,7 +184,7 @@ module Comments
|
|
|
184
184
|
# Gets the website of the author of the comment and optionally creates an
|
|
185
185
|
# anchor tag for it.
|
|
186
186
|
#
|
|
187
|
-
# @since
|
|
187
|
+
# @since 2011-10-16
|
|
188
188
|
# @param [TrueClass|FalseClass] with_link When set to true the website
|
|
189
189
|
# will be returned as an ``<a>`` tag.
|
|
190
190
|
# @param [String] text The alternative text to use for the link tag.
|
|
@@ -213,7 +213,7 @@ module Comments
|
|
|
213
213
|
# Returns the first 15 characters of a comment, optionally wrapped in a
|
|
214
214
|
# link that points to the form to edit the comment.
|
|
215
215
|
#
|
|
216
|
-
# @since
|
|
216
|
+
# @since 2011-10-17
|
|
217
217
|
# @param [TrueClass|FalseClass] with_link When set to true the comment
|
|
218
218
|
# will be wrapped in an ``<a>`` tag.
|
|
219
219
|
# @return [String]
|
|
@@ -249,7 +249,7 @@ module Comments
|
|
|
249
249
|
##
|
|
250
250
|
# Returns the name of the comment status.
|
|
251
251
|
#
|
|
252
|
-
# @since
|
|
252
|
+
# @since 2011-10-17
|
|
253
253
|
# @return [String]
|
|
254
254
|
#
|
|
255
255
|
def status_name
|
|
@@ -273,7 +273,7 @@ module CustomFields
|
|
|
273
273
|
# ``flash[:form_data]`` it will be retrieved from this hash, otherwise the
|
|
274
274
|
# default value is used.
|
|
275
275
|
#
|
|
276
|
-
# @since
|
|
276
|
+
# @since 2012-02-26
|
|
277
277
|
# @param [String] name The name of the field.
|
|
278
278
|
# @param [Mixed] value The default value.
|
|
279
279
|
# @return [Mixed]
|
|
@@ -75,10 +75,10 @@ module CustomFields
|
|
|
75
75
|
#
|
|
76
76
|
# ## Used Permissions
|
|
77
77
|
#
|
|
78
|
-
# *
|
|
79
|
-
# *
|
|
80
|
-
# *
|
|
81
|
-
# *
|
|
78
|
+
# * show\_custom\_field\_group
|
|
79
|
+
# * new\_custom\_field\_group
|
|
80
|
+
# * edit\_custom\_field\_group
|
|
81
|
+
# * delete\_custom\_field\_group
|
|
82
82
|
#
|
|
83
83
|
# @since 0.1
|
|
84
84
|
# @map /admin/custom-field-groups
|
|
@@ -99,10 +99,10 @@ module CustomFields
|
|
|
99
99
|
#
|
|
100
100
|
# ## Used Permissions
|
|
101
101
|
#
|
|
102
|
-
# *
|
|
103
|
-
# *
|
|
104
|
-
# *
|
|
105
|
-
# *
|
|
102
|
+
# * show\_custom\_field\_type
|
|
103
|
+
# * edit\_custom\_field\_type
|
|
104
|
+
# * new\_custom\_field\_type
|
|
105
|
+
# * delete\_custom\_field\_type
|
|
106
106
|
#
|
|
107
107
|
# @since 0.2.8
|
|
108
108
|
# @map /admin/custom-field-types
|
|
@@ -165,7 +165,7 @@ module CustomFields
|
|
|
165
165
|
)
|
|
166
166
|
|
|
167
167
|
@custom_field_type = validate_custom_field_type(id)
|
|
168
|
-
@custom_field_methods = Model::CustomFieldMethod.
|
|
168
|
+
@custom_field_methods = Model::CustomFieldMethod.to_hash(:id, :name)
|
|
169
169
|
|
|
170
170
|
@custom_field_type.set(flash[:form_data]) if flash[:form_data]
|
|
171
171
|
|
|
@@ -186,7 +186,7 @@ module CustomFields
|
|
|
186
186
|
lang('custom_field_types.titles.new')
|
|
187
187
|
)
|
|
188
188
|
|
|
189
|
-
@custom_field_methods = Model::CustomFieldMethod.
|
|
189
|
+
@custom_field_methods = Model::CustomFieldMethod.to_hash(:id, :name)
|
|
190
190
|
@custom_field_type = Model::CustomFieldType.new
|
|
191
191
|
|
|
192
192
|
@custom_field_type.set(flash[:form_data]) if flash[:form_data]
|
|
@@ -133,10 +133,10 @@ module CustomFields
|
|
|
133
133
|
#
|
|
134
134
|
# ## Used Permissions
|
|
135
135
|
#
|
|
136
|
-
# *
|
|
137
|
-
# *
|
|
138
|
-
# *
|
|
139
|
-
# *
|
|
136
|
+
# * show\_custom\_field
|
|
137
|
+
# * new\_custom\_field
|
|
138
|
+
# * edit\_custom\_field
|
|
139
|
+
# * delete\_custom\_field
|
|
140
140
|
#
|
|
141
141
|
# @since 0.1
|
|
142
142
|
# @map /admin/custom-fields
|
|
@@ -197,7 +197,7 @@ module CustomFields
|
|
|
197
197
|
##
|
|
198
198
|
# Show a form that lets the user edit an existing custom field group.
|
|
199
199
|
#
|
|
200
|
-
# @param [Fixnum]
|
|
200
|
+
# @param [Fixnum] custom_field_group_id The ID of the custom field
|
|
201
201
|
# group to which all fields belong.
|
|
202
202
|
# @param [Fixnum] id The ID of the custom field to retrieve so that we
|
|
203
203
|
# can edit it.
|
|
@@ -74,7 +74,7 @@ module Ramaze
|
|
|
74
74
|
# Redirects the user back to the field groups overview and shows a message
|
|
75
75
|
# informing the user that the group he/she tried to access was invalid.
|
|
76
76
|
#
|
|
77
|
-
# @since
|
|
77
|
+
# @since 2012-04-05
|
|
78
78
|
#
|
|
79
79
|
def redirect_invalid_field_group
|
|
80
80
|
message(:error, lang('custom_field_groups.errors.invalid_group'))
|
|
@@ -85,7 +85,7 @@ module Ramaze
|
|
|
85
85
|
# Redirects the user to the custom field types overview and informs
|
|
86
86
|
# him/her that the type he/she tried to access was invalid.
|
|
87
87
|
#
|
|
88
|
-
# @since
|
|
88
|
+
# @since 2012-04-05
|
|
89
89
|
#
|
|
90
90
|
def redirect_invalid_field_type
|
|
91
91
|
message(:error, lang('custom_field_types.errors.invalid_type'))
|
|
@@ -96,7 +96,7 @@ module Ramaze
|
|
|
96
96
|
# Redirects the user to the overview of all custom fields of a given group
|
|
97
97
|
# and informs the user that the field he/she tried to access is invalid.
|
|
98
98
|
#
|
|
99
|
-
# @since
|
|
99
|
+
# @since 2012-04-05
|
|
100
100
|
# @param [Fixnum] custom_field_group_id The ID of the group to use for
|
|
101
101
|
# redirecting the user.
|
|
102
102
|
#
|
|
@@ -5,12 +5,12 @@ module CustomFields
|
|
|
5
5
|
# Model for managing retrieving custom fields.
|
|
6
6
|
#
|
|
7
7
|
# @since 0.1
|
|
8
|
-
# @event
|
|
9
|
-
# @event
|
|
10
|
-
# @event
|
|
11
|
-
# @event
|
|
12
|
-
# @event
|
|
13
|
-
# @event
|
|
8
|
+
# @event before\_new\_custom\_field
|
|
9
|
+
# @event after\_new\_custom\_field
|
|
10
|
+
# @event before\_edit\_custom\_field
|
|
11
|
+
# @event after\_edit\_custom\_field
|
|
12
|
+
# @event before\_delete\_custom\_field
|
|
13
|
+
# @event after\_delete\_custom\_field
|
|
14
14
|
#
|
|
15
15
|
class CustomField < Sequel::Model
|
|
16
16
|
include Zen::Model::Helper
|
|
@@ -18,7 +18,7 @@ module CustomFields
|
|
|
18
18
|
##
|
|
19
19
|
# Array containing all the columns the user can set.
|
|
20
20
|
#
|
|
21
|
-
# @since
|
|
21
|
+
# @since 2012-02-17
|
|
22
22
|
#
|
|
23
23
|
COLUMNS = [
|
|
24
24
|
:name,
|
|
@@ -57,7 +57,7 @@ module CustomFields
|
|
|
57
57
|
##
|
|
58
58
|
# Searches for a set of custom fields.
|
|
59
59
|
#
|
|
60
|
-
# @since
|
|
60
|
+
# @since 2011-10-16
|
|
61
61
|
# @param [String] query The search query.
|
|
62
62
|
# @return [Mixed]
|
|
63
63
|
#
|
|
@@ -96,7 +96,7 @@ module CustomFields
|
|
|
96
96
|
##
|
|
97
97
|
# Hook that is executed before creating or saving an object.
|
|
98
98
|
#
|
|
99
|
-
# @since
|
|
99
|
+
# @since 2012-01-03
|
|
100
100
|
#
|
|
101
101
|
def before_save
|
|
102
102
|
sanitize_fields([:name, :slug, :description, :format])
|