zen 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -7,7 +7,7 @@ module Settings
|
|
7
7
|
#
|
8
8
|
# Similar to the custom fields module mentioned above adding methods to this
|
9
9
|
# module is relatively easy (though you usually don't need to add your own
|
10
|
-
# methods). This can be done by simply
|
10
|
+
# methods). This can be done by simply reopening the module and adding a
|
11
11
|
# class method to it:
|
12
12
|
#
|
13
13
|
# module Settings
|
@@ -27,7 +27,7 @@ module Settings
|
|
27
27
|
module BlueFormParameters
|
28
28
|
class << self
|
29
29
|
##
|
30
|
-
# Generates the required parameters for a
|
30
|
+
# Generates the required parameters for a text box (``input type="text"``).
|
31
31
|
#
|
32
32
|
# @since 0.3
|
33
33
|
# @param [Settings::Setting] setting The setting for which to generate the
|
@@ -20,7 +20,7 @@ module Settings
|
|
20
20
|
module Controller
|
21
21
|
##
|
22
22
|
# Controller for managing settings. Settings are used to store the name of
|
23
|
-
# the website, what anti
|
23
|
+
# the website, what anti spam system to use and so on. These settings can be
|
24
24
|
# managed via the admin interface rather than having to edit configuration
|
25
25
|
# files. Settings can be managed by going to ``/admin/settings``. This page
|
26
26
|
# shows an overview of all the available settings organized in a number of
|
@@ -33,20 +33,65 @@ module Settings
|
|
33
33
|
#
|
34
34
|
# Out of the box Zen ships with the following settings:
|
35
35
|
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
36
|
+
# <table class="table full">
|
37
|
+
# <thead>
|
38
|
+
# <tr>
|
39
|
+
# <th class="field_name">Field</th>
|
40
|
+
# <th>Description</th>
|
41
|
+
# </tr>
|
42
|
+
# </thead>
|
43
|
+
# <tbody>
|
44
|
+
# <tr>
|
45
|
+
# <td>Website name</td>
|
46
|
+
# <td>The name of the website.</td>
|
47
|
+
# </tr>
|
48
|
+
# <tr>
|
49
|
+
# <td>Website description</td>
|
50
|
+
# <td>A description of the website.</td>
|
51
|
+
# </tr>
|
52
|
+
# <tr>
|
53
|
+
# <td>Language</td>
|
54
|
+
# <td>The language to use for the backend.</td>
|
55
|
+
# </tr>
|
56
|
+
# <tr>
|
57
|
+
# <td>Frontend Language</td>
|
58
|
+
# <td>The language to use for the frontend of the website.</td>
|
59
|
+
# </tr>
|
60
|
+
# <tr>
|
61
|
+
# <td>Theme</td>
|
62
|
+
# <td>The theme to use for the website.</td>
|
63
|
+
# </tr>
|
64
|
+
# <tr>
|
65
|
+
# <td>Date format</td>
|
66
|
+
# <td>
|
67
|
+
# The date format to use for dates displayed in the backend.
|
68
|
+
# </td>
|
69
|
+
# </tr>
|
70
|
+
# <tr>
|
71
|
+
# <td>Enable anti-spam</td>
|
72
|
+
# <td>
|
73
|
+
# When set comments will be validated before they're saved.
|
74
|
+
# </td>
|
75
|
+
# </tr>
|
76
|
+
# <tr>
|
77
|
+
# <td>Anti-spam system</td>
|
78
|
+
# <td>
|
79
|
+
# The system to use for validating comments. Out of the box
|
80
|
+
# Zen only supports Defensio.
|
81
|
+
# </td>
|
82
|
+
# </tr>
|
83
|
+
# <tr>
|
84
|
+
# <td>Defensio key</td>
|
85
|
+
# <td>The API key to use for the Defensio API.</td>
|
86
|
+
# </tr>
|
87
|
+
# <tr>
|
88
|
+
# <td>Allow Registration</td>
|
89
|
+
# <td>
|
90
|
+
# When set users are allowed to register user accounts.
|
91
|
+
# </td>
|
92
|
+
# </tr>
|
93
|
+
# </tbody>
|
94
|
+
# </table>
|
50
95
|
#
|
51
96
|
# ## Used Permissions
|
52
97
|
#
|
@@ -23,7 +23,7 @@
|
|
23
23
|
f.input_hidden(:csrf_token, get_csrf_token)
|
24
24
|
|
25
25
|
@settings_ordered.each do |group, items|
|
26
|
-
f.g.div(:id => "group_#{group}") do
|
26
|
+
f.g.div(:id => "group_#{group}", :class => :tab_field) do
|
27
27
|
items.each do |s|
|
28
28
|
f.send(*get_setting(s.name).form_parameters)
|
29
29
|
end
|
@@ -22,13 +22,48 @@ module Users
|
|
22
22
|
#
|
23
23
|
# In this form you can fill in the following fields:
|
24
24
|
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
25
|
+
# <table class="table full">
|
26
|
+
# <thead>
|
27
|
+
# <tr>
|
28
|
+
# <th class="field_name">Field</th>
|
29
|
+
# <th>Required</th>
|
30
|
+
# <th>Maximum Length</th>
|
31
|
+
# <th>Description</th>
|
32
|
+
# </tr>
|
33
|
+
# </thead>
|
34
|
+
# <tbody>
|
35
|
+
# <tr>
|
36
|
+
# <td>Name</td>
|
37
|
+
# <td>Yes</td>
|
38
|
+
# <td>255</td>
|
39
|
+
# <td>The name of the user group.</td>
|
40
|
+
# </tr>
|
41
|
+
# <tr>
|
42
|
+
# <td>Slug</td>
|
43
|
+
# <td>No</td>
|
44
|
+
# <td>255</td>
|
45
|
+
# <td>
|
46
|
+
# A URL friendly version of the user group. If no value is
|
47
|
+
# specified one will be generated automatically based on the name
|
48
|
+
# of the user group.
|
49
|
+
# </td>
|
50
|
+
# </tr>
|
51
|
+
# <tr>
|
52
|
+
# <td>Super group</td>
|
53
|
+
# <td>Yes</td>
|
54
|
+
# <td></td>
|
55
|
+
# <td>
|
56
|
+
# When set users of this group have full access to the backend.
|
57
|
+
# </td>
|
58
|
+
# </tr>
|
59
|
+
# <tr>
|
60
|
+
# <td>Description</td>
|
61
|
+
# <td>No</td>
|
62
|
+
# <td>Unlimited</td>
|
63
|
+
# <td>A description of the user group.</td>
|
64
|
+
# </tr>
|
65
|
+
# </tbody>
|
66
|
+
# </table>
|
32
67
|
#
|
33
68
|
# Besides these fields you can also specify all the permissions o the user
|
34
69
|
# group similar to how they're managed for individual users. Note that user
|
@@ -48,22 +48,84 @@ module Users
|
|
48
48
|
#
|
49
49
|
# In this form the following fields can be filled:
|
50
50
|
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
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 full name of the user.</td>
|
66
|
+
# </tr>
|
67
|
+
# <tr>
|
68
|
+
# <td>Email</td>
|
69
|
+
# <td>Yes</td>
|
70
|
+
# <td>255</td>
|
71
|
+
# <td>The Email address of the user.</td>
|
72
|
+
# </tr>
|
73
|
+
# <tr>
|
74
|
+
# <td>Website</td>
|
75
|
+
# <td>No</td>
|
76
|
+
# <td>255</td>
|
77
|
+
# <td>The website of the user.</td>
|
78
|
+
# </tr>
|
79
|
+
# <tr>
|
80
|
+
# <td>Password</td>
|
81
|
+
# <td>No</td>
|
82
|
+
# <td>255</td>
|
83
|
+
# <td>The password for the user.</td>
|
84
|
+
# </tr>
|
85
|
+
# <tr>
|
86
|
+
# <td>Confirm Password</td>
|
87
|
+
# <td>
|
88
|
+
# Only when a password has been specified in the "Password"
|
89
|
+
# field.
|
90
|
+
# </td>
|
91
|
+
# <td>255</td>
|
92
|
+
# <td>
|
93
|
+
# Field used to confirm the password in case of setting a
|
94
|
+
# new one.
|
95
|
+
# </td>
|
96
|
+
# </tr>
|
97
|
+
# <tr>
|
98
|
+
# <td>Status</td>
|
99
|
+
# <td>No</td>
|
100
|
+
# <td></td>
|
101
|
+
# <td>The status of the user, set to closed by default.</td>
|
102
|
+
# </tr>
|
103
|
+
# <tr>
|
104
|
+
# <td>User groups</td>
|
105
|
+
# <td>No</td>
|
106
|
+
# <td></td>
|
107
|
+
# <td>A selection of groups to add the user to.</td>
|
108
|
+
# </tr>
|
109
|
+
# <tr>
|
110
|
+
# <td>Language</td>
|
111
|
+
# <td>No</td>
|
112
|
+
# <td></td>
|
113
|
+
# <td>The language to use for the backend of the website.</td>
|
114
|
+
# </tr>
|
115
|
+
# <tr>
|
116
|
+
# <td>Frontend Language</td>
|
117
|
+
# <td>No</td>
|
118
|
+
# <td></td>
|
119
|
+
# <td>The language to use for the frontend of the website.</td>
|
120
|
+
# </tr>
|
121
|
+
# <tr>
|
122
|
+
# <td>Date format</td>
|
123
|
+
# <td>No</td>
|
124
|
+
# <td></td>
|
125
|
+
# <td>The date format to use for the backend.</td>
|
126
|
+
# </tr>
|
127
|
+
# </tbody>
|
128
|
+
# </table>
|
67
129
|
#
|
68
130
|
# Besides these fields there's also the tab "Permissions". This tab contains
|
69
131
|
# a collection of all installed packages and their permissions. This makes
|
@@ -16,11 +16,12 @@ module Ramaze
|
|
16
16
|
# @return [Users::Model::UserGroup]
|
17
17
|
#
|
18
18
|
def validate_user_group(user_group_id)
|
19
|
+
redirect_invalid_user_group unless user_group_id =~ /\d+/
|
20
|
+
|
19
21
|
group = ::Users::Model::UserGroup[user_group_id]
|
20
22
|
|
21
23
|
if group.nil?
|
22
|
-
|
23
|
-
redirect(::Users::Controller::UserGroups.r(:index))
|
24
|
+
redirect_invalid_user_group
|
24
25
|
else
|
25
26
|
return group
|
26
27
|
end
|
@@ -34,11 +35,12 @@ module Ramaze
|
|
34
35
|
# @return [Users::Model::User]
|
35
36
|
#
|
36
37
|
def validate_user(user_id)
|
38
|
+
redirect_invalid_user unless user_id =~ /\d+/
|
39
|
+
|
37
40
|
user = ::Users::Model::User[user_id]
|
38
41
|
|
39
42
|
if user.nil?
|
40
|
-
|
41
|
-
redirect(::Users::Controller::Users.r(:index))
|
43
|
+
redirect_invalid_user
|
42
44
|
else
|
43
45
|
return user
|
44
46
|
end
|
@@ -84,6 +86,29 @@ module Ramaze
|
|
84
86
|
session[:super_group] = nil
|
85
87
|
session[:permissions] = nil
|
86
88
|
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# Redirects the user back to the users overview and shows a message
|
92
|
+
# informing the current user that the user he/she tried to access is
|
93
|
+
# invalid.
|
94
|
+
#
|
95
|
+
# @since 09-04-2012
|
96
|
+
#
|
97
|
+
def redirect_invalid_user
|
98
|
+
message(:error, lang('users.errors.invalid_user'))
|
99
|
+
redirect(::Users::Controller::Users.r(:index))
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Redirects the user back to the user groups overview and informs the user
|
104
|
+
# that the group he/she tried to access is invalid.
|
105
|
+
#
|
106
|
+
# @since 09-04-2012
|
107
|
+
#
|
108
|
+
def redirect_invalid_user_group
|
109
|
+
message(:error, lang('user_groups.errors.invalid_group'))
|
110
|
+
redirect(::Users::Controller::UserGroups.r(:index))
|
111
|
+
end
|
87
112
|
end # Users
|
88
113
|
end # Helper
|
89
114
|
end # Ramaze
|
@@ -36,7 +36,7 @@
|
|
36
36
|
f.input_hidden(:id, @user_group.id)
|
37
37
|
f.input_hidden(:csrf_token, get_csrf_token)
|
38
38
|
|
39
|
-
f.g.div(:id => 'user_group_tab') do
|
39
|
+
f.g.div(:id => 'user_group_tab', :class => :tab_field) do
|
40
40
|
f.input_text(
|
41
41
|
lang('user_groups.labels.name'),
|
42
42
|
:name,
|
@@ -66,7 +66,7 @@
|
|
66
66
|
end
|
67
67
|
|
68
68
|
if user_authorized?(:show_permission) and @user_group.exists?
|
69
|
-
f.g.div(:id => 'permissions') do
|
69
|
+
f.g.div(:id => 'permissions', :class => :tab_field) do
|
70
70
|
render_file(__DIR__('../users/permissions.xhtml'))
|
71
71
|
end
|
72
72
|
end
|
@@ -36,7 +36,7 @@
|
|
36
36
|
f.input_hidden(:csrf_token, get_csrf_token)
|
37
37
|
f.input_hidden(:id, @user.id)
|
38
38
|
|
39
|
-
f.g.div(:id => 'user_tab') do
|
39
|
+
f.g.div(:id => 'user_tab', :class => :tab_field) do
|
40
40
|
f.input_text(
|
41
41
|
lang('users.labels.name'),
|
42
42
|
:name,
|
@@ -113,7 +113,7 @@
|
|
113
113
|
end
|
114
114
|
|
115
115
|
if user_authorized?(:show_permission) and @user.exists?
|
116
|
-
f.g.div(:id => 'permissions') do
|
116
|
+
f.g.div(:id => 'permissions', :class => :tab_field) do
|
117
117
|
render_view(:permissions)
|
118
118
|
end
|
119
119
|
end
|
@@ -55,3 +55,36 @@ table
|
|
55
55
|
{
|
56
56
|
background: #fff;
|
57
57
|
}
|
58
|
+
|
59
|
+
/* Styles for the pager. */
|
60
|
+
.pager
|
61
|
+
{
|
62
|
+
float: right;
|
63
|
+
margin-bottom: 20px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.pager .grey
|
67
|
+
{
|
68
|
+
display: none;
|
69
|
+
}
|
70
|
+
|
71
|
+
.pager span, .pager a
|
72
|
+
{
|
73
|
+
border: 1px solid #ccc;
|
74
|
+
color: #000;
|
75
|
+
display: inline-block;
|
76
|
+
min-width: 20px;
|
77
|
+
margin-right: 8px;
|
78
|
+
padding: 5px;
|
79
|
+
text-align: center;
|
80
|
+
|
81
|
+
border-radius: 3px;
|
82
|
+
-webkit-border-radius: 3px;
|
83
|
+
-moz-border-radius: 3px;
|
84
|
+
}
|
85
|
+
|
86
|
+
.pager a:hover, .pager .current
|
87
|
+
{
|
88
|
+
background: #eee;
|
89
|
+
text-decoration: none;
|
90
|
+
}
|