zen 0.4 → 0.4.1
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/.aspell.en.pws +31 -0
- data/.gems +1 -1
- data/.mailmap +1 -0
- data/.travis.yml +13 -7
- data/.yardopts +1 -1
- data/Rakefile +2 -2
- data/guide/changelog.md +23 -5
- data/guide/css/common.css +48 -0
- data/guide/javascript.md +1 -0
- data/guide/javascript/zen_form.md +46 -0
- data/guide/zen_compared.md +104 -0
- data/lib/zen.rb +21 -12
- data/lib/zen/helper/breadcrumb.rb +1 -1
- data/lib/zen/helper/message.rb +4 -5
- data/lib/zen/language.rb +75 -10
- data/lib/zen/markup.rb +20 -8
- data/lib/zen/model/init.rb +14 -9
- data/lib/zen/model/plugin/events.rb +1 -1
- data/lib/zen/package.rb +71 -14
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +39 -12
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +26 -5
- data/lib/zen/package/categories/lib/categories/helper/category.rb +37 -6
- data/lib/zen/package/categories/lib/categories/helper/category_frontend.rb +2 -2
- data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +26 -29
- data/lib/zen/package/comments/lib/comments.rb +9 -1
- data/lib/zen/package/comments/lib/comments/anti_spam.rb +1 -1
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +59 -14
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +49 -11
- data/lib/zen/package/comments/lib/comments/helper/comment.rb +14 -2
- data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +3 -3
- data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +1 -1
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +12 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +24 -6
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +68 -20
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +106 -26
- data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +50 -11
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +2 -2
- data/lib/zen/package/dashboard/lib/dashboard/controller/dashboard.rb +1 -1
- data/lib/zen/package/menu.rb +6 -1
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +44 -9
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +53 -13
- data/lib/zen/package/menus/lib/menus/helper/menu.rb +30 -4
- data/lib/zen/package/menus/lib/menus/model/menu.rb +4 -2
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +48 -9
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +77 -21
- data/lib/zen/package/sections/lib/sections/helper/section.rb +32 -4
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +1 -1
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +5 -4
- data/lib/zen/package/sections/lib/sections/view/admin/sections/form.xhtml +3 -3
- data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +1 -1
- data/lib/zen/package/settings/lib/settings/blue_form_parameters.rb +2 -2
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +60 -15
- data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +1 -1
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +42 -7
- data/lib/zen/package/users/lib/users/controller/users.rb +78 -16
- data/lib/zen/package/users/lib/users/helper/users.rb +29 -4
- data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +2 -2
- data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +2 -2
- data/lib/zen/public/admin/zen/css/general.css +5 -0
- data/lib/zen/public/admin/zen/css/messages.css +1 -0
- data/lib/zen/public/admin/zen/css/tables.css +33 -0
- data/lib/zen/public/admin/zen/css/tabs.css +8 -0
- data/lib/zen/public/admin/zen/js/index.js +21 -2
- data/lib/zen/public/admin/zen/js/lib/events.js +45 -0
- data/lib/zen/public/admin/zen/js/lib/form.js +229 -0
- data/lib/zen/public/admin/zen/js/lib/hash.js +0 -27
- data/lib/zen/task/spelling.rake +97 -0
- data/lib/zen/task/test.rake +21 -0
- data/lib/zen/theme.rb +80 -24
- data/lib/zen/validation.rb +1 -1
- data/lib/zen/version.rb +1 -1
- data/proto/app/config/config.rb.erb +9 -4
- data/proto/app/config/middlewares.rb +1 -2
- data/spec/README.md +56 -0
- data/spec/zen/controller/admin_controller.rb +0 -1
- data/spec/zen/controller/preview.rb +0 -1
- data/spec/zen/package.rb +32 -0
- data/spec/zen/package/categories/controller/categories.rb +7 -0
- data/spec/zen/package/categories/controller/category_groups.rb +7 -0
- data/spec/zen/package/comments/controller/comments.rb +7 -0
- data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +7 -0
- data/spec/zen/package/custom_fields/controller/custom_field_types.rb +7 -0
- data/spec/zen/package/custom_fields/controller/custom_fields.rb +7 -0
- data/spec/zen/package/menus/controller/menu_items.rb +7 -0
- data/spec/zen/package/menus/controller/menus.rb +7 -0
- data/spec/zen/package/menus/helper/menu_frontend.rb +1 -1
- data/spec/zen/package/sections/controller/section_entries.rb +39 -0
- data/spec/zen/package/sections/controller/sections.rb +14 -0
- data/spec/zen/package/users/controller/user_groups.rb +7 -0
- data/spec/zen/package/users/controller/users.rb +7 -0
- data/zen.gemspec +6 -5
- metadata +142 -40
|
@@ -48,12 +48,30 @@ module CustomFields
|
|
|
48
48
|
# When creating a new group or editing an existing group you can fill in the
|
|
49
49
|
# following two fields:
|
|
50
50
|
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
51
|
+
# <table class="table full">
|
|
52
|
+
# <thead>
|
|
53
|
+
# <tr>
|
|
54
|
+
# <th class="field_name">Field</th>
|
|
55
|
+
# <th>Required</th>
|
|
56
|
+
# <th>Maximum Length</th>
|
|
57
|
+
# <th>Description</th>
|
|
58
|
+
# </tr>
|
|
59
|
+
# </thead>
|
|
60
|
+
# <tbody>
|
|
61
|
+
# <tr>
|
|
62
|
+
# <td>Name</td>
|
|
63
|
+
# <td>Yes</td>
|
|
64
|
+
# <td>255</td>
|
|
65
|
+
# <td>The name of the custom field group.</td>
|
|
66
|
+
# </tr>
|
|
67
|
+
# <tr>
|
|
68
|
+
# <td>Description</td>
|
|
69
|
+
# <td>No</td>
|
|
70
|
+
# <td>Unlimited</td>
|
|
71
|
+
# <td>A description of the custom field group.</td>
|
|
72
|
+
# </tr>
|
|
73
|
+
# </tbody>
|
|
74
|
+
# </table>
|
|
57
75
|
#
|
|
58
76
|
# ## Used Permissions
|
|
59
77
|
#
|
|
@@ -28,26 +28,74 @@ module CustomFields
|
|
|
28
28
|
#
|
|
29
29
|
# In this form you can specify the following fields:
|
|
30
30
|
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
31
|
+
# <table class="table full">
|
|
32
|
+
# <thead>
|
|
33
|
+
# <tr>
|
|
34
|
+
# <th class="field_name">Field</th>
|
|
35
|
+
# <th>Required</th>
|
|
36
|
+
# <th>Maximum Length</th>
|
|
37
|
+
# <th>Description</th>
|
|
38
|
+
# </tr>
|
|
39
|
+
# </thead>
|
|
40
|
+
# <tbody>
|
|
41
|
+
# <tr>
|
|
42
|
+
# <td>Name</td>
|
|
43
|
+
# <td>Yes</td>
|
|
44
|
+
# <td>255</td>
|
|
45
|
+
# <td>The name of the custom field type.</td>
|
|
46
|
+
# </tr>
|
|
47
|
+
# <tr>
|
|
48
|
+
# <td>Language string</td>
|
|
49
|
+
# <td>Yes</td>
|
|
50
|
+
# <td>255</td>
|
|
51
|
+
# <td>
|
|
52
|
+
# The language string to use when displaying the custom
|
|
53
|
+
# field type.
|
|
54
|
+
# </td>
|
|
55
|
+
# </tr>
|
|
56
|
+
# <tr>
|
|
57
|
+
# <td>HTML class</td>
|
|
58
|
+
# <td>No</td>
|
|
59
|
+
# <td>255</td>
|
|
60
|
+
# <td>
|
|
61
|
+
# A space separated list of HTML classes to apply to custom
|
|
62
|
+
# fields of this type. The value of this field should match
|
|
63
|
+
# the pattern <code>/^[a-zA-Z\-_0-9\s]*$/</code>
|
|
64
|
+
# </td>
|
|
65
|
+
# </tr>
|
|
66
|
+
# <tr>
|
|
67
|
+
# <td>Serialize</td>
|
|
68
|
+
# <td>No</td>
|
|
69
|
+
# <td></td>
|
|
70
|
+
# <td>
|
|
71
|
+
# When set the values of custom fields of this type will be
|
|
72
|
+
# serialized using Ruby's Marshal module. This setting is
|
|
73
|
+
# useful for fields that can have multiple values such as
|
|
74
|
+
# checkboxes.
|
|
75
|
+
# </td>
|
|
76
|
+
# </tr>
|
|
77
|
+
# <tr>
|
|
78
|
+
# <td>Allow markup</td>
|
|
79
|
+
# <td>No</td>
|
|
80
|
+
# <td></td>
|
|
81
|
+
# <td>
|
|
82
|
+
# When set custom fields of this type can contain markup
|
|
83
|
+
# other than plain text.
|
|
84
|
+
# </td>
|
|
85
|
+
# </tr>
|
|
86
|
+
# <tr>
|
|
87
|
+
# <td>Custom field method</td>
|
|
88
|
+
# <td>Yes</td>
|
|
89
|
+
# <td></td>
|
|
90
|
+
# <td>
|
|
91
|
+
# The name of the method in the module
|
|
92
|
+
# {CustomFields::BlueFormParameters}. This method will be
|
|
93
|
+
# used for generating the required markup for each field of
|
|
94
|
+
# this type.
|
|
95
|
+
# </td>
|
|
96
|
+
# </tr>
|
|
97
|
+
# </tbody>
|
|
98
|
+
# </table>
|
|
51
99
|
#
|
|
52
100
|
# ## Used Permissions
|
|
53
101
|
#
|
|
@@ -24,32 +24,112 @@ module CustomFields
|
|
|
24
24
|
#
|
|
25
25
|
# In this form you can specify the following fields:
|
|
26
26
|
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
27
|
+
# <table class="table full">
|
|
28
|
+
# <thead>
|
|
29
|
+
# <tr>
|
|
30
|
+
# <th class="field_name">Field</th>
|
|
31
|
+
# <th>Required</th>
|
|
32
|
+
# <th>Maximum Length</th>
|
|
33
|
+
# <th>Description</th>
|
|
34
|
+
# </tr>
|
|
35
|
+
# </thead>
|
|
36
|
+
# <tbody>
|
|
37
|
+
# <tr>
|
|
38
|
+
# <td>Name</td>
|
|
39
|
+
# <td>Yes</td>
|
|
40
|
+
# <td>255</td>
|
|
41
|
+
# <td>The name of the custom field.</td>
|
|
42
|
+
# </tr>
|
|
43
|
+
# <tr>
|
|
44
|
+
# <td>Slug</td>
|
|
45
|
+
# <td>No</td>
|
|
46
|
+
# <td>255</td>
|
|
47
|
+
# <td>
|
|
48
|
+
# A URL friendly version of the name. If no value is
|
|
49
|
+
# specified the slug will be generated based on the custom
|
|
50
|
+
# field's name.
|
|
51
|
+
# </td>
|
|
52
|
+
# </tr>
|
|
53
|
+
# <tr>
|
|
54
|
+
# <td>Field type</td>
|
|
55
|
+
# <td>Yes</td>
|
|
56
|
+
# <td></td>
|
|
57
|
+
# <td>The custom field type to use.</td>
|
|
58
|
+
# </tr>
|
|
59
|
+
# <tr>
|
|
60
|
+
# <td>Format</td>
|
|
61
|
+
# <td>Yes</td>
|
|
62
|
+
# <td></td>
|
|
63
|
+
# <td>The markup format for values of this custom field.</td>
|
|
64
|
+
# </tr>
|
|
65
|
+
# <tr>
|
|
66
|
+
# <td>Description</td>
|
|
67
|
+
# <td>No</td>
|
|
68
|
+
# <td>Unlimited</td>
|
|
69
|
+
# <td>
|
|
70
|
+
# A description of the custom field, displayed when the user
|
|
71
|
+
# hovers over a custom field's form element.
|
|
72
|
+
# </td>
|
|
73
|
+
# </tr>
|
|
74
|
+
# <tr>
|
|
75
|
+
# <td>Possible values</td>
|
|
76
|
+
# <td>No</td>
|
|
77
|
+
# <td>Unlimited</td>
|
|
78
|
+
# <td>
|
|
79
|
+
# A newline separated list of values that can be specified
|
|
80
|
+
# for custom fields that allow multiple values to be
|
|
81
|
+
# selected (e.g. checkboxes). These values can be specified
|
|
82
|
+
# by writing "key|value" (where "key" and "value" are the
|
|
83
|
+
# name and value of an item) on each line.
|
|
84
|
+
# </td>
|
|
85
|
+
# </tr>
|
|
86
|
+
# <tr>
|
|
87
|
+
# <td>Requires a value</td>
|
|
88
|
+
# <td>No</td>
|
|
89
|
+
# <td></td>
|
|
90
|
+
# <td>
|
|
91
|
+
# When set to "Yes" users are required to enter a value for
|
|
92
|
+
# the custom field.
|
|
93
|
+
# </td>
|
|
94
|
+
# </tr>
|
|
95
|
+
# <tr>
|
|
96
|
+
# <td>Enable a text editor</td>
|
|
97
|
+
# <td>No</td>
|
|
98
|
+
# <td></td>
|
|
99
|
+
# <td>
|
|
100
|
+
# When set to "Yes" the values of the custom field can be
|
|
101
|
+
# set using a markup editor.
|
|
102
|
+
# </td>
|
|
103
|
+
# </tr>
|
|
104
|
+
# <tr>
|
|
105
|
+
# <td>Textarea rows</td>
|
|
106
|
+
# <td>No</td>
|
|
107
|
+
# <td></td>
|
|
108
|
+
# <td>
|
|
109
|
+
# The amount of rows for a textarea field. This value only
|
|
110
|
+
# affects custom fields using the "Textarea" type.
|
|
111
|
+
# </td>
|
|
112
|
+
# </tr>
|
|
113
|
+
# <tr>
|
|
114
|
+
# <td>Character limit</td>
|
|
115
|
+
# <td>No</td>
|
|
116
|
+
# <td></td>
|
|
117
|
+
# <td>
|
|
118
|
+
# The maximum amount of characters that a user can enter in
|
|
119
|
+
# a field.
|
|
120
|
+
# </td>
|
|
121
|
+
# </tr>
|
|
122
|
+
# <tr>
|
|
123
|
+
# <td>Sort order</td>
|
|
124
|
+
# <td>No</td>
|
|
125
|
+
# <td></td>
|
|
126
|
+
# <td>
|
|
127
|
+
# The order in which to display the field when managing a
|
|
128
|
+
# section entry.
|
|
129
|
+
# </td>
|
|
130
|
+
# </tr>
|
|
131
|
+
# </tbody>
|
|
132
|
+
# </table>
|
|
53
133
|
#
|
|
54
134
|
# ## Used Permissions
|
|
55
135
|
#
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
module Ramaze
|
|
2
|
-
#:nodocL
|
|
3
2
|
module Helper
|
|
4
3
|
##
|
|
5
4
|
# Helper for the custom fields package.
|
|
@@ -16,11 +15,12 @@ module Ramaze
|
|
|
16
15
|
# @return [CustomFields::Model::CustomFieldGroup]
|
|
17
16
|
#
|
|
18
17
|
def validate_custom_field_group(custom_field_group_id)
|
|
18
|
+
redirect_invalid_field_group unless custom_field_group_id =~ /\d+/
|
|
19
|
+
|
|
19
20
|
group = ::CustomFields::Model::CustomFieldGroup[custom_field_group_id]
|
|
20
21
|
|
|
21
22
|
if group.nil?
|
|
22
|
-
|
|
23
|
-
redirect(::CustomFields::Controller::CustomFieldGroups.r(:index))
|
|
23
|
+
redirect_invalid_field_group
|
|
24
24
|
else
|
|
25
25
|
return group
|
|
26
26
|
end
|
|
@@ -37,15 +37,14 @@ module Ramaze
|
|
|
37
37
|
# @return [CustomFields::Model::CustomField]
|
|
38
38
|
#
|
|
39
39
|
def validate_custom_field(custom_field_id, custom_field_group_id)
|
|
40
|
+
unless custom_field_id =~ /\d+/
|
|
41
|
+
redirect_invalid_field(custom_field_group_id)
|
|
42
|
+
end
|
|
43
|
+
|
|
40
44
|
field = ::CustomFields::Model::CustomField[custom_field_id]
|
|
41
45
|
|
|
42
46
|
if field.nil?
|
|
43
|
-
|
|
44
|
-
redirect(
|
|
45
|
-
::CustomFields::Controller::CustomFields.r(
|
|
46
|
-
:index, custom_field_group_id
|
|
47
|
-
)
|
|
48
|
-
)
|
|
47
|
+
redirect_invalid_field(custom_field_group_id)
|
|
49
48
|
else
|
|
50
49
|
return field
|
|
51
50
|
end
|
|
@@ -60,15 +59,55 @@ module Ramaze
|
|
|
60
59
|
# @return [CustomFields::Model::CustomFieldType]
|
|
61
60
|
#
|
|
62
61
|
def validate_custom_field_type(custom_field_type_id)
|
|
62
|
+
redirect_invalid_field_type unless custom_field_type_id =~ /\d+/
|
|
63
|
+
|
|
63
64
|
type = ::CustomFields::Model::CustomFieldType[custom_field_type_id]
|
|
64
65
|
|
|
65
66
|
if type.nil?
|
|
66
|
-
|
|
67
|
-
redirect(::CustomFields::Controller::CustomFieldTypes.r(:index))
|
|
67
|
+
redirect_invalid_field_type
|
|
68
68
|
else
|
|
69
69
|
return type
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
|
+
|
|
73
|
+
##
|
|
74
|
+
# Redirects the user back to the field groups overview and shows a message
|
|
75
|
+
# informing the user that the group he/she tried to access was invalid.
|
|
76
|
+
#
|
|
77
|
+
# @since 05-04-2012
|
|
78
|
+
#
|
|
79
|
+
def redirect_invalid_field_group
|
|
80
|
+
message(:error, lang('custom_field_groups.errors.invalid_group'))
|
|
81
|
+
redirect(::CustomFields::Controller::CustomFieldGroups.r(:index))
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
##
|
|
85
|
+
# Redirects the user to the custom field types overview and informs
|
|
86
|
+
# him/her that the type he/she tried to access was invalid.
|
|
87
|
+
#
|
|
88
|
+
# @since 05-04-2012
|
|
89
|
+
#
|
|
90
|
+
def redirect_invalid_field_type
|
|
91
|
+
message(:error, lang('custom_field_types.errors.invalid_type'))
|
|
92
|
+
redirect(::CustomFields::Controller::CustomFieldTypes.r(:index))
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
##
|
|
96
|
+
# Redirects the user to the overview of all custom fields of a given group
|
|
97
|
+
# and informs the user that the field he/she tried to access is invalid.
|
|
98
|
+
#
|
|
99
|
+
# @since 05-04-2012
|
|
100
|
+
# @param [Fixnum] custom_field_group_id The ID of the group to use for
|
|
101
|
+
# redirecting the user.
|
|
102
|
+
#
|
|
103
|
+
def redirect_invalid_field(custom_field_group_id)
|
|
104
|
+
message(:error, lang('custom_fields.errors.invalid_field'))
|
|
105
|
+
redirect(
|
|
106
|
+
::CustomFields::Controller::CustomFields.r(
|
|
107
|
+
:index, custom_field_group_id
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
end
|
|
72
111
|
end # CustomField
|
|
73
112
|
end # Helper
|
|
74
113
|
end # Ramaze
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
f.input_hidden(:custom_field_group_id, @custom_field_group_id)
|
|
34
34
|
f.input_hidden(:csrf_token , get_csrf_token)
|
|
35
35
|
|
|
36
|
-
f.g.div(:id => 'general') do
|
|
36
|
+
f.g.div(:id => 'general', :class => :tab_field) do
|
|
37
37
|
f.input_text(
|
|
38
38
|
lang('custom_fields.labels.name'),
|
|
39
39
|
:name,
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
f.g.div(:id => 'settings') do
|
|
80
|
+
f.g.div(:id => 'settings', :class => :tab_field) do
|
|
81
81
|
f.input_radio(
|
|
82
82
|
lang('custom_fields.labels.required'),
|
|
83
83
|
:required,
|
|
@@ -20,7 +20,7 @@ module Dashboard
|
|
|
20
20
|
module Controller
|
|
21
21
|
##
|
|
22
22
|
# Shows the dashboard for the currently logged in user. The dashboard shows
|
|
23
|
-
# a list of user specific widgets. These widgets can be
|
|
23
|
+
# a list of user specific widgets. These widgets can be rearranged,
|
|
24
24
|
# disabled/enabled and the columns for these widgets can also be customized.
|
|
25
25
|
#
|
|
26
26
|
# When you open up the dashboard for the first time only one widget will be
|
data/lib/zen/package/menu.rb
CHANGED
|
@@ -19,6 +19,9 @@ module Zen
|
|
|
19
19
|
# All the child elements of the current navigation element.
|
|
20
20
|
attr_reader :children
|
|
21
21
|
|
|
22
|
+
# Hash containing extra configuration options for the menu.
|
|
23
|
+
attr_reader :options
|
|
24
|
+
|
|
22
25
|
##
|
|
23
26
|
# Creates a new instance of the class and optionally processes all sub
|
|
24
27
|
# navigation items.
|
|
@@ -77,7 +80,9 @@ module Zen
|
|
|
77
80
|
def html(permissions = [])
|
|
78
81
|
# Skip the navigation menu and all it's child elements if the user isn't
|
|
79
82
|
# allowed to view it.
|
|
80
|
-
|
|
83
|
+
if @options[:permission] and !user_authorized?(@options[:permissions])
|
|
84
|
+
return
|
|
85
|
+
end
|
|
81
86
|
|
|
82
87
|
g = Ramaze::Gestalt.new
|
|
83
88
|
children = []
|
|
@@ -30,14 +30,49 @@ module Menus
|
|
|
30
30
|
#
|
|
31
31
|
# In this form you can specify the following fields:
|
|
32
32
|
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
33
|
+
# <table class="table full">
|
|
34
|
+
# <thead>
|
|
35
|
+
# <tr>
|
|
36
|
+
# <th class="field_name">Field</th>
|
|
37
|
+
# <th>Required</th>
|
|
38
|
+
# <th>Maximum Length</th>
|
|
39
|
+
# <th>Description</th>
|
|
40
|
+
# </tr>
|
|
41
|
+
# </thead>
|
|
42
|
+
# <tbody>
|
|
43
|
+
# <tr>
|
|
44
|
+
# <td>Name</td>
|
|
45
|
+
# <td>Yes</td>
|
|
46
|
+
# <td>255</td>
|
|
47
|
+
# <td>The name of the menu item.</td>
|
|
48
|
+
# </tr>
|
|
49
|
+
# <tr>
|
|
50
|
+
# <td>URL</td>
|
|
51
|
+
# <td>Yes</td>
|
|
52
|
+
# <td>255</td>
|
|
53
|
+
# <td>The URL the menu item should point to.</td>
|
|
54
|
+
# </tr>
|
|
55
|
+
# <tr>
|
|
56
|
+
# <td>HTML class</td>
|
|
57
|
+
# <td>No</td>
|
|
58
|
+
# <td>255</td>
|
|
59
|
+
# <td>
|
|
60
|
+
# A space separated string containing the class(es) to apply
|
|
61
|
+
# to the menu. This value should match the pattern
|
|
62
|
+
# <code>^[a-zA-Z\-_0-9\s]*$</code>.
|
|
63
|
+
# </td>
|
|
64
|
+
# </tr>
|
|
65
|
+
# <tr>
|
|
66
|
+
# <td>HTML ID</td>
|
|
67
|
+
# <td>No</td>
|
|
68
|
+
# <td>255</td>
|
|
69
|
+
# <td>
|
|
70
|
+
# A single ID to apply to the menu. This value should match
|
|
71
|
+
# the pattern <code>^[a-zA-Z\-_0-9]*$</code>.
|
|
72
|
+
# </td>
|
|
73
|
+
# </tr>
|
|
74
|
+
# </tbody>
|
|
75
|
+
# </table>
|
|
41
76
|
#
|
|
42
77
|
# ## Used Permissions
|
|
43
78
|
#
|
|
@@ -142,7 +177,7 @@ module Menus
|
|
|
142
177
|
end
|
|
143
178
|
|
|
144
179
|
##
|
|
145
|
-
# Saves an existing menu
|
|
180
|
+
# Saves an existing menu item or creates a new one using the supplied
|
|
146
181
|
# POST data.
|
|
147
182
|
#
|
|
148
183
|
# @since 0.2a
|