zen 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -0
- data/.mailmap +2 -0
- data/.rvmrc +2 -0
- data/.travis.yml +8 -3
- data/AUTHORS +1 -2
- data/CHANGELOG.md +48 -17
- data/README.md +44 -39
- data/Rakefile +4 -0
- data/bin/zen +5 -30
- data/lib/zen.rb +13 -19
- data/lib/zen/asset.rb +99 -64
- data/lib/zen/bin/create.rb +94 -0
- data/lib/zen/bin/runner.rb +118 -0
- data/lib/zen/controller/admin_controller.rb +52 -36
- data/lib/zen/controller/base_controller.rb +5 -5
- data/lib/zen/controller/frontend_controller.rb +7 -7
- data/lib/zen/controller/main_controller.rb +12 -10
- data/lib/zen/controller/preview.rb +15 -11
- data/lib/zen/helper/acl.rb +73 -53
- data/lib/zen/helper/blue_form_vendor.rb +689 -0
- data/lib/zen/helper/breadcrumb.rb +23 -19
- data/lib/zen/helper/message.rb +3 -3
- data/lib/zen/helper/theme.rb +18 -13
- data/lib/zen/language.rb +62 -58
- data/lib/zen/language/en/zen_general.yml +2 -4
- data/lib/zen/language/nl/zen_general.yml +2 -4
- data/lib/zen/layout/admin.xhtml +3 -12
- data/lib/zen/layout/login.xhtml +1 -6
- data/lib/zen/model/methods.rb +6 -6
- data/lib/zen/model/settings.rb +5 -4
- data/lib/zen/package.rb +47 -38
- data/lib/zen/package/all.rb +3 -5
- data/lib/zen/package/base.rb +7 -7
- data/lib/zen/package/categories/lib/categories.rb +8 -3
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +81 -55
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -44
- data/lib/zen/package/categories/lib/categories/helper/category.rb +88 -0
- data/lib/zen/package/categories/lib/categories/language/en/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/en/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +5 -4
- data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +5 -4
- data/lib/zen/package/categories/lib/categories/model/category.rb +15 -13
- data/lib/zen/package/categories/lib/categories/model/category_group.rb +3 -3
- data/lib/zen/package/categories/lib/categories/plugin/categories.rb +36 -25
- data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +49 -56
- data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +48 -35
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +36 -29
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +42 -37
- data/lib/zen/package/comments/lib/comments.rb +4 -1
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +39 -32
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +45 -26
- data/lib/zen/package/comments/lib/comments/helper/comment.rb +35 -0
- data/lib/zen/package/comments/lib/comments/language/en/comments.yml +9 -7
- data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +10 -8
- data/lib/zen/package/comments/lib/comments/model/comment.rb +31 -17
- data/lib/zen/package/comments/lib/comments/model/comment_status.rb +15 -0
- data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +27 -18
- data/lib/zen/package/comments/lib/comments/plugin/comments.rb +25 -20
- data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +61 -54
- data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +38 -23
- data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +60 -0
- data/lib/zen/package/custom_fields/lib/custom_fields.rb +33 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +209 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +50 -47
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +215 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +111 -73
- data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +79 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml +20 -19
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +34 -32
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +5 -4
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_types.yml +40 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +18 -16
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +31 -11
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +15 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +50 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +28 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +33 -28
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +48 -46
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +61 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +93 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +105 -99
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +43 -39
- data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +47 -16
- data/lib/zen/package/custom_fields/migrations/1310659580_custom_field_types.rb +148 -0
- data/lib/zen/package/custom_fields/migrations/1311694920_rename_css_class.rb +11 -0
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +40 -35
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +47 -43
- data/lib/zen/package/menus/lib/menus/helper/{menu_item.rb → menu.rb} +42 -15
- data/lib/zen/package/menus/lib/menus/language/en/menu_items.yml +5 -5
- data/lib/zen/package/menus/lib/menus/language/en/menus.yml +9 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +8 -8
- data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +11 -10
- data/lib/zen/package/menus/lib/menus/model/menu.rb +5 -5
- data/lib/zen/package/menus/lib/menus/model/menu_item.rb +6 -5
- data/lib/zen/package/menus/lib/menus/plugin/menus.rb +41 -43
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +59 -63
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +35 -30
- data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +46 -37
- data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +37 -37
- data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +5 -5
- data/lib/zen/package/menus/migrations/1308671733_rename_order_column.rb +11 -0
- data/lib/zen/package/menus/migrations/1311695030_rename_css_class.rb +17 -0
- data/lib/zen/package/sections/lib/sections.rb +18 -11
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +115 -109
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +72 -50
- data/lib/zen/package/sections/lib/sections/helper/section.rb +53 -0
- data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/en/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +5 -4
- data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +5 -4
- data/lib/zen/package/sections/lib/sections/model/section.rb +17 -9
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +192 -13
- data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +13 -0
- data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +60 -39
- data/lib/zen/package/sections/lib/sections/plugin/sections.rb +14 -11
- data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +100 -97
- data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +41 -39
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +95 -215
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +48 -40
- data/lib/zen/package/sections/migrations/1308672298_use_id_for_default_section.rb +40 -0
- data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +58 -0
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +5 -8
- data/lib/zen/package/settings/lib/settings/model/setting.rb +2 -37
- data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +18 -1
- data/lib/zen/package/settings/lib/settings/plugin/settings.rb +13 -7
- data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +2 -1
- data/lib/zen/package/users/lib/users.rb +3 -1
- data/lib/zen/package/users/lib/users/controller/access_rules.rb +77 -60
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +41 -36
- data/lib/zen/package/users/lib/users/controller/users.rb +48 -42
- data/lib/zen/package/users/lib/users/helper/users.rb +72 -0
- data/lib/zen/package/users/lib/users/language/en/access_rules.yml +6 -5
- data/lib/zen/package/users/lib/users/language/en/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/en/users.yml +1 -0
- data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +5 -4
- data/lib/zen/package/users/lib/users/language/nl/users.yml +1 -0
- data/lib/zen/package/users/lib/users/model/access_rule.rb +5 -1
- data/lib/zen/package/users/lib/users/model/user.rb +17 -10
- data/lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js +10 -37
- data/lib/zen/package/users/lib/users/public/admin/js/users/lib/access_rules.js +49 -0
- data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +105 -96
- data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +48 -41
- data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +42 -32
- data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +43 -38
- data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +76 -67
- data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +43 -41
- data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +12 -9
- data/lib/zen/package/users/migrations/1295281013_create_schema.rb +2 -2
- data/lib/zen/plugin.rb +56 -50
- data/lib/zen/plugin/markup/lib/markup/markup.rb +33 -21
- data/lib/zen/public/admin/css/zen/buttons.css +11 -7
- data/lib/zen/public/admin/css/zen/datepicker.css +6 -6
- data/lib/zen/public/admin/css/zen/forms.css +2 -1
- data/lib/zen/public/admin/css/zen/general.css +15 -10
- data/lib/zen/public/admin/css/zen/layout.css +51 -20
- data/lib/zen/public/admin/css/zen/tables.css +39 -11
- data/lib/zen/public/admin/css/zen/tabs.css +6 -4
- data/lib/zen/public/admin/css/zen/window.css +11 -11
- data/lib/zen/public/{favicon.ico → admin/favicon.ico} +0 -0
- data/lib/zen/public/admin/images/zen/icons/asc.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/desc.png +0 -0
- data/lib/zen/public/admin/js/vendor/datepicker.js +0 -11
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/core.js +0 -1
- data/lib/zen/public/admin/js/{mootools → vendor/mootools}/more.js +100 -29
- data/lib/zen/public/admin/js/zen/index.js +48 -0
- data/lib/zen/public/admin/js/zen/lib/asset.js +111 -0
- data/lib/zen/public/admin/js/zen/{editor.js → lib/editor.js} +107 -127
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/markdown.js +7 -9
- data/lib/zen/public/admin/js/zen/{editor → lib/editor}/textile.js +7 -9
- data/lib/zen/public/admin/js/zen/lib/html_table.js +143 -0
- data/lib/zen/public/admin/js/zen/{tabs.js → lib/tabs.js} +40 -37
- data/lib/zen/public/admin/js/zen/{window.js → lib/window.js} +24 -20
- data/lib/zen/spec/bacon/color_output.rb +39 -0
- data/lib/zen/spec/helper.rb +152 -0
- data/lib/zen/spec/simplecov.rb +22 -0
- data/lib/zen/task/build.rake +20 -43
- data/lib/zen/task/clean.rake +2 -6
- data/lib/zen/task/db.rake +8 -12
- data/lib/zen/task/package.rake +4 -10
- data/lib/zen/task/plugin.rake +3 -9
- data/lib/zen/task/proto.rake +0 -62
- data/lib/zen/task/test.rake +6 -3
- data/lib/zen/task/theme.rake +4 -11
- data/lib/zen/theme.rb +22 -24
- data/lib/zen/validation.rb +34 -27
- data/lib/zen/version.rb +2 -8
- data/lib/zen/view/head.xhtml +7 -0
- data/lib/zen/view/main.xhtml +7 -22
- data/{proto/package/migrations → pkg}/.gitkeep +0 -0
- data/proto/app/app.rb +1 -0
- data/proto/app/config/config.rb +5 -4
- data/proto/app/config/database.rb +19 -41
- data/proto/app/config/middlewares.rb +32 -29
- data/proto/{package/lib/package/view/admin/package/index.xhtml → app/log/database/dev/.gitkeep} +0 -0
- data/proto/app/log/database/live/.gitkeep +0 -0
- data/spec/Rakefile +26 -0
- data/spec/fixtures/zen/asset.rb +18 -0
- data/spec/fixtures/zen/helper/acl.rb +39 -0
- data/spec/fixtures/zen/helper/message.rb +19 -0
- data/spec/fixtures/zen/language/en/spec.yml +10 -0
- data/spec/fixtures/zen/language/nl/spec.yml +7 -0
- data/spec/fixtures/zen/package.rb +17 -0
- data/spec/fixtures/zen/package/comments/controller/comments_form.rb +27 -0
- data/spec/fixtures/zen/package/settings/plugin/settings.rb +20 -0
- data/spec/fixtures/zen/plugin.rb +7 -0
- data/spec/fixtures/zen/theme/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/default-section/index.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/404.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/helper/wrong_partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/partials/partial.xhtml +1 -0
- data/spec/fixtures/zen/theme/theme.rb +11 -0
- data/spec/fixtures/zen/validation.rb +22 -0
- data/spec/helper.rb +41 -0
- data/spec/zen/all.rb +5 -0
- data/spec/zen/asset.rb +97 -0
- data/spec/zen/bin/create.rb +89 -0
- data/spec/zen/bin/runner.rb +47 -0
- data/spec/zen/controller/admin_controller.rb +26 -0
- data/spec/zen/controller/main_controller.rb +81 -0
- data/spec/zen/controller/preview.rb +33 -0
- data/spec/zen/helper/acl.rb +149 -0
- data/spec/zen/helper/breadcrumb.rb +38 -0
- data/spec/zen/helper/message.rb +31 -0
- data/spec/zen/helper/theme.rb +58 -0
- data/spec/zen/language.rb +55 -0
- data/spec/zen/package.rb +23 -0
- data/spec/zen/package/categories/controller/categories.rb +123 -0
- data/spec/zen/package/categories/controller/category_groups.rb +108 -0
- data/spec/zen/package/categories/helper/category.rb +75 -0
- data/spec/zen/package/categories/plugin/categories.rb +92 -0
- data/spec/zen/package/comments/controller/comments.rb +134 -0
- data/spec/zen/package/comments/controller/comments_form.rb +343 -0
- data/spec/zen/package/comments/helper/comment.rb +47 -0
- data/spec/zen/package/comments/plugin/anti_spam.rb +59 -0
- data/spec/zen/package/comments/plugin/comments.rb +107 -0
- data/spec/zen/package/custom_fields/blue_form_parameters.rb +183 -0
- data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +120 -0
- data/spec/zen/package/custom_fields/controller/custom_field_types.rb +169 -0
- data/spec/zen/package/custom_fields/controller/custom_fields.rb +158 -0
- data/spec/zen/package/custom_fields/helper/custom_field.rb +86 -0
- data/spec/zen/package/menus/controller/menu_items.rb +110 -0
- data/spec/zen/package/menus/controller/menus.rb +110 -0
- data/spec/zen/package/menus/helper/menu.rb +75 -0
- data/spec/zen/package/menus/plugin/menus.rb +120 -0
- data/spec/zen/package/sections/controller/section_entries.rb +201 -0
- data/spec/zen/package/sections/controller/sections.rb +116 -0
- data/spec/zen/package/sections/helper/section.rb +74 -0
- data/spec/zen/package/sections/plugin/section_entries.rb +161 -0
- data/spec/zen/package/sections/plugin/sections.rb +75 -0
- data/spec/zen/package/settings/controller/settings.rb +36 -0
- data/spec/zen/package/settings/plugin/settings.rb +33 -0
- data/spec/zen/package/users/controller/access_rules.rb +90 -0
- data/spec/zen/package/users/controller/user_groups.rb +101 -0
- data/spec/zen/package/users/controller/users.rb +130 -0
- data/spec/zen/package/users/helper/users.rb +97 -0
- data/spec/zen/plugin.rb +64 -0
- data/spec/zen/plugin/helper.rb +11 -0
- data/spec/zen/plugin/markup.rb +44 -0
- data/spec/zen/theme.rb +41 -0
- data/spec/zen/validation.rb +63 -0
- data/zen.gemspec +36 -0
- metadata +159 -113
- data/MANIFEST +0 -266
- data/lib/zen/bin/app.rb +0 -40
- data/lib/zen/ext/string.rb +0 -185
- data/lib/zen/helper/common.rb +0 -106
- data/lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml +0 -7
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml +0 -7
- data/lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml +0 -7
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml +0 -7
- data/lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/new.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml +0 -7
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/edit.xhtml +0 -7
- data/lib/zen/package/users/lib/users/view/admin/users/new.xhtml +0 -7
- data/lib/zen/plugin/controller.rb +0 -59
- data/lib/zen/public/admin/css/zen/notifications.css +0 -84
- data/lib/zen/public/admin/images/zen/icons/large/error.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/notice.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/large/success.png +0 -0
- data/lib/zen/public/admin/js/zen/core.js +0 -73
- data/lib/zen/public/admin/js/zen/init.js +0 -80
- data/proto/package/lib/package.rb +0 -21
- data/proto/package/lib/package/controller/controllers.rb +0 -50
- data/proto/package/lib/package/language/en/languages.yml +0 -4
- data/proto/package/lib/package/model/model.rb +0 -12
@@ -1,59 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
f.input_hidden(:category_group_id, @category_group_id)
|
7
|
-
f.input_hidden(:id , @category.id)
|
8
|
-
f.input_hidden(:csrf_token , get_csrf_token)
|
9
|
-
|
10
|
-
f.g.div(:id => 'general') do
|
11
|
-
f.input_text(
|
12
|
-
lang('categories.labels.name'),
|
13
|
-
:name,
|
14
|
-
:placeholder => lang('categories.placeholders.name'),
|
15
|
-
:required => :required,
|
16
|
-
:maxlength => 255
|
17
|
-
)
|
18
|
-
|
19
|
-
f.input_text(
|
20
|
-
lang('categories.labels.slug'),
|
21
|
-
:slug,
|
22
|
-
:placeholder => lang('categories.placeholders.slug')
|
23
|
-
)
|
1
|
+
<article>
|
2
|
+
<header>
|
3
|
+
<h1>#{get_breadcrumbs}</h1>
|
4
|
+
</header>
|
24
5
|
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
6
|
+
#{
|
7
|
+
form_for(
|
8
|
+
@category,
|
9
|
+
:method => :post,
|
10
|
+
:action => Categories::Controller::Categories.r(:save),
|
11
|
+
:id => :category_form
|
12
|
+
) do |f|
|
13
|
+
f.input_hidden(:category_group_id, @category_group_id)
|
14
|
+
f.input_hidden(:id , @category.id)
|
15
|
+
f.input_hidden(:csrf_token , get_csrf_token)
|
16
|
+
|
17
|
+
f.g.div(:id => 'general') do
|
18
|
+
f.input_text(
|
19
|
+
lang('categories.labels.name'),
|
20
|
+
:name,
|
21
|
+
:placeholder => lang('categories.placeholders.name'),
|
22
|
+
:required => :required,
|
23
|
+
:maxlength => 255
|
24
|
+
)
|
32
25
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
f.g.
|
26
|
+
f.input_text(
|
27
|
+
lang('categories.labels.slug'),
|
28
|
+
:slug,
|
29
|
+
:placeholder => lang('categories.placeholders.slug')
|
30
|
+
)
|
31
|
+
|
32
|
+
f.select(
|
33
|
+
lang('categories.labels.parent'),
|
34
|
+
:parent_id,
|
35
|
+
:values => parent_categories(@category.id, @category_group_id),
|
36
|
+
:size => 1,
|
37
|
+
:selected => @category.parent_id
|
38
|
+
)
|
39
|
+
|
40
|
+
f.textarea(
|
41
|
+
lang('categories.labels.description'),
|
42
|
+
:description,
|
43
|
+
:rows => 8
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
f.g.div(:class => 'button') do
|
48
|
+
f.g.input(:type => 'submit', :value => lang('categories.buttons.save'))
|
49
|
+
end
|
55
50
|
end
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
}
|
51
|
+
}
|
52
|
+
</article>
|
@@ -2,22 +2,24 @@
|
|
2
2
|
<header>
|
3
3
|
<h1>#{get_breadcrumbs}</h1>
|
4
4
|
</header>
|
5
|
-
|
6
|
-
<form method="post"
|
5
|
+
|
6
|
+
<form method="post"
|
7
|
+
action="#{Categories::Controller::Categories.r(:delete)}">
|
7
8
|
<input type="hidden" name="csrf_token" value="#{get_csrf_token}" />
|
8
|
-
<input type="hidden" name="category_group_id"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
<input type="hidden" name="category_group_id"
|
10
|
+
value="#{@category_group_id}" />
|
11
|
+
|
12
|
+
<?r if !@categories.empty? ?>
|
13
|
+
|
14
|
+
<table>
|
13
15
|
<thead>
|
14
16
|
<tr>
|
15
17
|
<?r if user_authorized?([:delete]) ?>
|
16
|
-
<th>
|
18
|
+
<th class="no_sort">
|
17
19
|
<input type="checkbox" />
|
18
20
|
</th>
|
19
21
|
<?r end ?>
|
20
|
-
|
22
|
+
|
21
23
|
<th>#{lang('categories.labels.id')}</th>
|
22
24
|
<th>#{lang('categories.labels.name')}</th>
|
23
25
|
<th>#{lang('categories.labels.slug')}</th>
|
@@ -29,50 +31,61 @@
|
|
29
31
|
<tr>
|
30
32
|
<?r if user_authorized?([:delete]) ?>
|
31
33
|
<td>
|
32
|
-
<input type="checkbox" name="category_ids[]"
|
34
|
+
<input type="checkbox" name="category_ids[]"
|
35
|
+
value="#{category.id}" />
|
33
36
|
</td>
|
34
37
|
<?r end ?>
|
35
|
-
|
38
|
+
|
36
39
|
<td>#{category.id}</td>
|
37
|
-
|
40
|
+
|
38
41
|
<?r if user_authorized?([:update]) ?>
|
39
42
|
<td>
|
40
|
-
#{
|
41
|
-
category.name,
|
42
|
-
|
43
|
+
#{Categories::Controller::Categories.a(
|
44
|
+
category.name,
|
45
|
+
:edit,
|
46
|
+
@category_group_id,
|
47
|
+
category.id
|
43
48
|
)}
|
44
49
|
</td>
|
45
50
|
<?r else ?>
|
46
51
|
<td>#{category.name}</td>
|
47
52
|
<?r end ?>
|
48
|
-
|
53
|
+
|
49
54
|
<td>#{category.slug}</td>
|
50
|
-
<td
|
55
|
+
<td>
|
56
|
+
#{category.parent.name \
|
57
|
+
if category.parent.respond_to?(:name)}
|
58
|
+
</td>
|
51
59
|
</tr>
|
52
60
|
<?r end ?>
|
53
61
|
</tbody>
|
54
62
|
</table>
|
55
|
-
|
63
|
+
|
64
|
+
#{
|
65
|
+
if @categories.respond_to?(:navigation) and @categories.page_count > 1
|
66
|
+
@categories.navigation
|
67
|
+
end
|
68
|
+
}
|
69
|
+
|
56
70
|
<?r else ?>
|
57
71
|
<p>#{lang('categories.messages.no_categories')}</p>
|
58
72
|
<?r end ?>
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
</div>
|
68
|
-
<?r end ?>
|
69
|
-
|
70
|
-
<?r if user_authorized?([:delete]) and @categories and !@categories.empty? ?>
|
71
|
-
<div class="button">
|
72
|
-
<input type="submit" value="#{lang('categories.buttons.delete')}" />
|
73
|
-
</div>
|
74
|
-
<?r end ?>
|
75
|
-
|
73
|
+
|
74
|
+
<?r if user_authorized?([:create]) ?>
|
75
|
+
<div class="button">
|
76
|
+
#{Categories::Controller::Categories.a(
|
77
|
+
lang('categories.buttons.new'),
|
78
|
+
:new,
|
79
|
+
@category_group_id
|
80
|
+
)}
|
76
81
|
</div>
|
82
|
+
<?r end ?>
|
83
|
+
|
84
|
+
<?r if user_authorized?([:delete]) and !@categories.empty? ?>
|
85
|
+
<div class="button">
|
86
|
+
<input type="submit"
|
87
|
+
value="#{lang('categories.buttons.delete')}" />
|
88
|
+
</div>
|
89
|
+
<?r end ?>
|
77
90
|
</form>
|
78
91
|
</article>
|
@@ -1,31 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<article>
|
2
|
+
<header>
|
3
|
+
<h1>#{get_breadcrumbs}</h1>
|
4
|
+
</header>
|
5
|
+
|
6
|
+
#{
|
7
|
+
form_for(
|
8
|
+
@category_group,
|
9
|
+
:method => :post,
|
10
|
+
:action => Categories::Controller::CategoryGroups.r(:save),
|
11
|
+
:id => :category_group_form
|
12
|
+
) do |f|
|
13
|
+
f.input_hidden(:id , @category_group.id)
|
14
|
+
f.input_hidden(:csrf_token, get_csrf_token)
|
15
|
+
|
16
|
+
f.input_text(
|
17
|
+
lang('category_groups.labels.name'),
|
18
|
+
:name,
|
19
|
+
:placeholder => lang('category_groups.placeholders.name'),
|
20
|
+
:required => :required,
|
21
|
+
:maxlength => 255
|
22
|
+
)
|
6
23
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
lang('category_groups.labels.description'),
|
20
|
-
:description,
|
21
|
-
:rows => 8
|
22
|
-
)
|
23
|
-
|
24
|
-
f.g.div(:class => "clearfix") do
|
25
|
-
f.g.div(:class => "button") do
|
26
|
-
f.g.input(:type => 'submit', :value => lang('category_groups.buttons.save'))
|
24
|
+
f.textarea(
|
25
|
+
lang('category_groups.labels.description'),
|
26
|
+
:description,
|
27
|
+
:rows => 8
|
28
|
+
)
|
29
|
+
|
30
|
+
f.g.div(:class => 'button') do
|
31
|
+
f.g.input(
|
32
|
+
:type => 'submit',
|
33
|
+
:value => lang('category_groups.buttons.save')
|
34
|
+
)
|
35
|
+
end
|
27
36
|
end
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
}
|
37
|
+
}
|
38
|
+
</article>
|
@@ -2,24 +2,24 @@
|
|
2
2
|
<header>
|
3
3
|
<h1>#{get_breadcrumbs}</h1>
|
4
4
|
</header>
|
5
|
-
|
6
|
-
<form method="post"
|
5
|
+
|
6
|
+
<form method="post"
|
7
|
+
action="#{Categories::Controller::CategoryGroups.r(:delete)}">
|
7
8
|
<input type="hidden" name="csrf_token" value="#{get_csrf_token}" />
|
8
|
-
|
9
|
-
<?r if
|
10
|
-
|
11
|
-
<table class="table">
|
9
|
+
|
10
|
+
<?r if !@category_groups.empty? ?>
|
11
|
+
<table>
|
12
12
|
<thead>
|
13
13
|
<tr>
|
14
14
|
<?r if user_authorized?([:delete]) ?>
|
15
|
-
<th>
|
15
|
+
<th class="no_sort">
|
16
16
|
<input type="checkbox" />
|
17
17
|
</th>
|
18
18
|
<?r end ?>
|
19
|
-
|
19
|
+
|
20
20
|
<th>#{lang('category_groups.labels.id')}</th>
|
21
21
|
<th>#{lang('category_groups.labels.name')}</th>
|
22
|
-
|
22
|
+
|
23
23
|
<?r if user_authorized?(
|
24
24
|
[:read], true, 'Categories::Controller::Categories'
|
25
25
|
) ?>
|
@@ -32,59 +32,64 @@
|
|
32
32
|
<tr>
|
33
33
|
<?r if user_authorized?([:delete]) ?>
|
34
34
|
<td>
|
35
|
-
<input type="checkbox" name="category_group_ids[]"
|
35
|
+
<input type="checkbox" name="category_group_ids[]"
|
36
36
|
value="#{group.id}" />
|
37
37
|
</td>
|
38
38
|
<?r end ?>
|
39
|
-
|
39
|
+
|
40
40
|
<td>#{group.id}</td>
|
41
|
-
|
41
|
+
|
42
42
|
<?r if user_authorized?([:update]) ?>
|
43
43
|
<td>
|
44
|
-
#{
|
45
|
-
group.name,
|
46
|
-
Categories::Controller::CategoryGroups.r(:edit, group.id)
|
44
|
+
#{Categories::Controller::CategoryGroups.a(
|
45
|
+
group.name, :edit, group.id
|
47
46
|
)}
|
48
47
|
</td>
|
49
48
|
<?r else ?>
|
50
49
|
<td>#{group.name}</td>
|
51
50
|
<?r end ?>
|
52
|
-
|
51
|
+
|
53
52
|
<?r if user_authorized?(
|
54
53
|
[:read], true, 'Categories::Controller::Categories'
|
55
54
|
) ?>
|
56
55
|
<td>
|
57
|
-
#{
|
58
|
-
lang('category_groups.labels.manage'),
|
59
|
-
|
56
|
+
#{Categories::Controller::Categories.a(
|
57
|
+
lang('category_groups.labels.manage'),
|
58
|
+
:index,
|
59
|
+
group.id
|
60
60
|
)}
|
61
61
|
</td>
|
62
62
|
<?r end ?>
|
63
|
-
|
63
|
+
|
64
64
|
</tr>
|
65
65
|
<?r end ?>
|
66
66
|
</tbody>
|
67
67
|
</table>
|
68
|
-
|
68
|
+
|
69
|
+
#{
|
70
|
+
if @category_groups.respond_to?(:navigation) \
|
71
|
+
and @category_groups.page_count > 1
|
72
|
+
@category_groups.navigation
|
73
|
+
end
|
74
|
+
}
|
75
|
+
|
69
76
|
<?r else ?>
|
70
77
|
<p>#{lang('category_groups.messages.no_groups')}</p>
|
71
78
|
<?r end ?>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
Categories::Controller::CategoryGroups.r(:new)
|
79
|
-
)}
|
80
|
-
</div>
|
81
|
-
<?r end ?>
|
82
|
-
|
83
|
-
<?r if user_authorized?([:delete]) and @category_groups and !@category_groups.empty? ?>
|
84
|
-
<div class="button">
|
85
|
-
<input type="submit" value="#{lang('category_groups.buttons.delete')}" />
|
86
|
-
</div>
|
87
|
-
<?r end ?>
|
79
|
+
|
80
|
+
<?r if user_authorized?([:create]) ?>
|
81
|
+
<div class="button">
|
82
|
+
#{Categories::Controller::CategoryGroups.a(
|
83
|
+
lang('category_groups.buttons.new'), :new
|
84
|
+
)}
|
88
85
|
</div>
|
86
|
+
<?r end ?>
|
87
|
+
|
88
|
+
<?r if user_authorized?([:delete]) and !@category_groups.empty? ?>
|
89
|
+
<div class="button">
|
90
|
+
<input type="submit"
|
91
|
+
value="#{lang('category_groups.buttons.delete')}" />
|
92
|
+
</div>
|
93
|
+
<?r end ?>
|
89
94
|
</form>
|
90
95
|
</article>
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
Ramaze::HelpersHelper.options.paths.push(__DIR__('comments'))
|
2
|
+
|
3
|
+
require __DIR__('comments/model/comment_status')
|
4
|
+
require __DIR__('comments/model/comment')
|
2
5
|
require __DIR__('comments/controller/comments')
|
3
6
|
require __DIR__('comments/controller/comments_form')
|
4
7
|
require __DIR__('comments/plugin/comments')
|
@@ -6,9 +6,9 @@ module Comments
|
|
6
6
|
# Controller used for managing comments. Administrations can't actually
|
7
7
|
# add new comments using the backend controller but can edit or delete them.
|
8
8
|
# Comments can be submitted to any section entry as long as the section
|
9
|
-
# allows it. When submitting a comment the user data such as the name and
|
10
|
-
# will be retrieved from either the users table (if the user is logged
|
11
|
-
# from the form that was submitted.
|
9
|
+
# allows it. When submitting a comment the user data such as the name and
|
10
|
+
# email will be retrieved from either the users table (if the user is logged
|
11
|
+
# in) or from the form that was submitted.
|
12
12
|
#
|
13
13
|
# @author Yorick Peterse
|
14
14
|
# @since 0.1
|
@@ -16,7 +16,8 @@ module Comments
|
|
16
16
|
class Comments < Zen::Controller::AdminController
|
17
17
|
include ::Comments::Model
|
18
18
|
|
19
|
-
map
|
19
|
+
map '/admin/comments'
|
20
|
+
helper :comment
|
20
21
|
|
21
22
|
before_all do
|
22
23
|
csrf_protection(:save, :delete) do
|
@@ -36,9 +37,6 @@ module Comments
|
|
36
37
|
def initialize
|
37
38
|
super
|
38
39
|
|
39
|
-
@form_save_url = Comments.r(:save)
|
40
|
-
@form_delete_url = Comments.r(:delete)
|
41
|
-
|
42
40
|
Zen::Language.load('comments')
|
43
41
|
|
44
42
|
# Set the page title
|
@@ -60,13 +58,11 @@ module Comments
|
|
60
58
|
# @since 0.1
|
61
59
|
#
|
62
60
|
def index
|
63
|
-
|
64
|
-
respond(lang('zen_general.errors.not_authorized'), 403)
|
65
|
-
end
|
61
|
+
require_permissions(:read)
|
66
62
|
|
67
63
|
set_breadcrumbs(lang('comments.titles.index'))
|
68
64
|
|
69
|
-
@comments = Comment.
|
65
|
+
@comments = paginate(Comment.eager(:comment_status))
|
70
66
|
end
|
71
67
|
|
72
68
|
##
|
@@ -78,28 +74,31 @@ module Comments
|
|
78
74
|
# * update
|
79
75
|
#
|
80
76
|
# @author Yorick Peterse
|
81
|
-
# @param [Integer] id The ID of the comment to retrieve so that we can
|
77
|
+
# @param [Integer] id The ID of the comment to retrieve so that we can
|
78
|
+
# edit it.
|
82
79
|
# @since 0.1
|
83
80
|
#
|
84
81
|
def edit(id)
|
85
|
-
|
86
|
-
respond(lang('zen_general.errors.not_authorized'), 403)
|
87
|
-
end
|
82
|
+
require_permissions(:read, :update)
|
88
83
|
|
89
84
|
set_breadcrumbs(
|
90
|
-
|
85
|
+
Comments.a(lang('comments.titles.index'), :index),
|
86
|
+
@page_title
|
91
87
|
)
|
92
88
|
|
93
89
|
if flash[:form_data]
|
94
90
|
@comment = flash[:form_data]
|
95
91
|
else
|
96
|
-
@comment =
|
92
|
+
@comment = validate_comment(id)
|
97
93
|
end
|
94
|
+
|
95
|
+
render_view(:form)
|
98
96
|
end
|
99
97
|
|
100
98
|
##
|
101
99
|
# Saves a comment based on the current POST data. Note that this
|
102
|
-
# method won't create a new comment as this can't be done using the
|
100
|
+
# method won't create a new comment as this can't be done using the
|
101
|
+
# backend.
|
103
102
|
#
|
104
103
|
# This method requires the following permissions:
|
105
104
|
#
|
@@ -109,33 +108,40 @@ module Comments
|
|
109
108
|
# @since 0.1
|
110
109
|
#
|
111
110
|
def save
|
112
|
-
|
113
|
-
respond(lang('zen_general.errors.not_authorized'), 403)
|
114
|
-
end
|
111
|
+
require_permissions(:update)
|
115
112
|
|
116
113
|
# Copy the POST data so we can work with it without messing things up
|
117
114
|
post = request.subset(
|
118
|
-
:
|
115
|
+
:id,
|
116
|
+
:user_id,
|
117
|
+
:name,
|
118
|
+
:website,
|
119
|
+
:email,
|
120
|
+
:comment,
|
121
|
+
:comment_status_id,
|
122
|
+
:section_entry_id
|
119
123
|
)
|
120
124
|
|
121
|
-
|
125
|
+
comment = validate_comment(post['id'])
|
122
126
|
|
123
127
|
post.delete('id')
|
124
128
|
|
125
129
|
begin
|
126
|
-
|
130
|
+
comment.update(post)
|
127
131
|
message(:success, lang('comments.success.save'))
|
128
132
|
rescue => e
|
129
133
|
Ramaze::Log.error(e.inspect)
|
130
134
|
message(:error, lang('comments.errors.save'))
|
131
135
|
|
132
|
-
flash[:form_errors] =
|
133
|
-
flash[:form_data] =
|
136
|
+
flash[:form_errors] = comment.errors
|
137
|
+
flash[:form_data] = comment
|
138
|
+
|
139
|
+
redirect_referrer
|
134
140
|
end
|
135
141
|
|
136
142
|
# Redirect the user to the proper page.
|
137
|
-
if
|
138
|
-
redirect(Comments.r(:edit,
|
143
|
+
if comment.id
|
144
|
+
redirect(Comments.r(:edit, comment.id))
|
139
145
|
else
|
140
146
|
redirect_referrer
|
141
147
|
end
|
@@ -153,12 +159,11 @@ module Comments
|
|
153
159
|
# @since 0.1
|
154
160
|
#
|
155
161
|
def delete
|
156
|
-
|
157
|
-
respond(lang('zen_general.errors.not_authorized'), 403)
|
158
|
-
end
|
162
|
+
require_permissions(:delete)
|
159
163
|
|
160
164
|
# Obviously we'll require some IDs
|
161
|
-
if !request.params['comment_ids']
|
165
|
+
if !request.params['comment_ids'] \
|
166
|
+
or request.params['comment_ids'].empty?
|
162
167
|
message(:error, lang('comments.errors.no_delete'))
|
163
168
|
redirect_referrer
|
164
169
|
end
|
@@ -171,6 +176,8 @@ module Comments
|
|
171
176
|
rescue => e
|
172
177
|
Ramaze::Log.error(e.inspect)
|
173
178
|
message(:error, lang('comments.errors.delete') % id)
|
179
|
+
|
180
|
+
redirect_referrer
|
174
181
|
end
|
175
182
|
end
|
176
183
|
|