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
@@ -10,15 +10,15 @@ labels:
|
|
10
10
|
name : 'Name'
|
11
11
|
url : 'URL'
|
12
12
|
order : 'Order'
|
13
|
-
|
14
|
-
|
13
|
+
html_class : 'HTML class'
|
14
|
+
html_id : 'HTML ID'
|
15
15
|
|
16
16
|
placeholders:
|
17
17
|
name : 'The text that will be displayed in the link.'
|
18
18
|
url : 'The location to which the link will point.'
|
19
19
|
order : 'A number that indicates the sort order.'
|
20
|
-
|
21
|
-
|
20
|
+
html_class : 'Specify a class name (or multiple names) to apply to this item.'
|
21
|
+
html_id : 'Specify an ID to apply to this item.'
|
22
22
|
|
23
23
|
messages:
|
24
24
|
no_items : 'No menu items have been added yet.'
|
@@ -38,4 +38,4 @@ errors:
|
|
38
38
|
save : 'The menu item could not be modified.'
|
39
39
|
delete : 'The menu item with ID #%s could not be deleted.'
|
40
40
|
no_delete : 'You need to specify at least one item to delete.'
|
41
|
-
|
41
|
+
invalid_item : 'The specified menu item is invalid.'
|
@@ -9,15 +9,15 @@ labels:
|
|
9
9
|
name : 'Name'
|
10
10
|
slug : 'Slug'
|
11
11
|
description : 'Description'
|
12
|
-
|
13
|
-
|
12
|
+
html_class : 'CSS class'
|
13
|
+
html_id : 'CSS ID'
|
14
14
|
manage_items : 'Manage menu items'
|
15
15
|
|
16
16
|
placeholders:
|
17
17
|
name : 'Specify the name of the menu.'
|
18
18
|
slug : 'Specify the URL friendly name of the menu.'
|
19
|
-
|
20
|
-
|
19
|
+
html_class : 'A number of classes to apply to the menu.'
|
20
|
+
html_id : 'An ID to apply to the menu.'
|
21
21
|
|
22
22
|
messages:
|
23
23
|
no_menus: 'No menus have been added yet.'
|
@@ -33,7 +33,8 @@ success:
|
|
33
33
|
delete : 'The selected menus have been deleted.'
|
34
34
|
|
35
35
|
errors:
|
36
|
-
new
|
37
|
-
save
|
38
|
-
delete
|
39
|
-
no_delete
|
36
|
+
new : 'The menu could not be created.'
|
37
|
+
save : 'The menu could not be modified.'
|
38
|
+
delete : 'The menu with ID #%s could not be deleted.'
|
39
|
+
no_delete : 'You need to specify at least one menu to delete.'
|
40
|
+
invalid_menu: 'The specified menu is invalid.'
|
@@ -10,15 +10,15 @@ labels:
|
|
10
10
|
name : 'Naam'
|
11
11
|
url : 'URL'
|
12
12
|
order : 'Volgorde'
|
13
|
-
|
14
|
-
|
13
|
+
html_class: 'CSS klasse'
|
14
|
+
html_id : 'CSS ID'
|
15
15
|
|
16
16
|
placeholders:
|
17
|
-
name
|
18
|
-
url
|
19
|
-
order
|
20
|
-
|
21
|
-
|
17
|
+
name : 'De naam/label van het menu item.'
|
18
|
+
url : 'De URL van het menu item.'
|
19
|
+
order : 'De sorteer volgorde.'
|
20
|
+
html_class: 'Een of meerdere klasses voor dit item.'
|
21
|
+
html_id : 'Een ID voor dit item.'
|
22
22
|
|
23
23
|
messages:
|
24
24
|
no_items: 'Er zijn nog geen menu items aangemaakt.'
|
@@ -38,4 +38,4 @@ errors:
|
|
38
38
|
save : 'Het menu item kon niet worden aangepast.'
|
39
39
|
delete : 'Het menu item met ID #%s kon niet worden verwijderd.'
|
40
40
|
no_delete : 'U moet ten minste 1 item specificeren om te verwijderen.'
|
41
|
-
|
41
|
+
invalid_item: 'Het opgegeven menu item is ongeldig.'
|
@@ -9,15 +9,15 @@ labels:
|
|
9
9
|
name : 'Naam'
|
10
10
|
slug : 'Slug'
|
11
11
|
description : 'Beschrijving'
|
12
|
-
|
13
|
-
|
12
|
+
html_class : 'CSS klasse'
|
13
|
+
html_id : 'CSS ID'
|
14
14
|
manage_items: 'Menu items beheren'
|
15
15
|
|
16
16
|
placeholders:
|
17
|
-
name
|
18
|
-
slug
|
19
|
-
|
20
|
-
|
17
|
+
name : 'De naam van het menu.'
|
18
|
+
slug : 'Een URL vriendelijke versie van de menu naam.'
|
19
|
+
html_class: 'Een of meerdere klasses voor dit menu.'
|
20
|
+
html_id : 'Een ID voor dit menu.'
|
21
21
|
|
22
22
|
messages:
|
23
23
|
no_menus: "Er zijn nog geen menu's aangemaakt."
|
@@ -33,7 +33,8 @@ success:
|
|
33
33
|
delete: "De geselecteerde menu's zijn verwijderd."
|
34
34
|
|
35
35
|
errors:
|
36
|
-
new
|
37
|
-
save
|
38
|
-
delete
|
39
|
-
no_delete: 'U moet ten minste 1 menu specificeren om te verwijderen.'
|
36
|
+
new : 'Het menu kon niet worden aangemaakt.'
|
37
|
+
save : 'Het menu kon niet worden aangepast.'
|
38
|
+
delete : 'Het menu met ID #%s kon niet worden verwijderd.'
|
39
|
+
no_delete : 'U moet ten minste 1 menu specificeren om te verwijderen.'
|
40
|
+
invalid_menu: 'Het opgegeven menu is ongeldig.'
|
@@ -3,8 +3,8 @@ module Menus
|
|
3
3
|
#:nodoc:
|
4
4
|
module Model
|
5
5
|
##
|
6
|
-
# Model used for managing groups of menu items. This model uses the
|
7
|
-
# Sequel plugins:
|
6
|
+
# Model used for managing groups of menu items. This model uses the
|
7
|
+
# following Sequel plugins:
|
8
8
|
#
|
9
9
|
# * sluggable
|
10
10
|
#
|
@@ -19,8 +19,8 @@ module Menus
|
|
19
19
|
|
20
20
|
##
|
21
21
|
# Specifies all validates rules used when creating or updating a menu.
|
22
|
-
# A slug will be generated when a menu is first created but after that
|
23
|
-
# required to ensure that they don't collide with existing slugs.
|
22
|
+
# A slug will be generated when a menu is first created but after that
|
23
|
+
# they are required to ensure that they don't collide with existing slugs.
|
24
24
|
#
|
25
25
|
# @author Yorick Peterse
|
26
26
|
# @since 0.2a
|
@@ -31,7 +31,7 @@ module Menus
|
|
31
31
|
validates_unique :slug
|
32
32
|
|
33
33
|
# Prevent people from entering random crap for class and ID names
|
34
|
-
validates_format(/^[a-zA-Z\-_0-9]*/, [:
|
34
|
+
validates_format(/^[a-zA-Z\-_0-9]*/, [:html_class, :html_id])
|
35
35
|
end
|
36
36
|
end # Menu
|
37
37
|
end # Model
|
@@ -12,24 +12,25 @@ module Menus
|
|
12
12
|
# @since 0.2a
|
13
13
|
#
|
14
14
|
class MenuItem < Sequel::Model
|
15
|
-
plugin :tree, :order => :
|
15
|
+
plugin :tree, :order => :sort_order
|
16
16
|
|
17
17
|
many_to_one :menu , :class => 'Menus::Model::Menu'
|
18
18
|
many_to_one :parent, :class => self
|
19
19
|
|
20
20
|
##
|
21
|
-
# Specifies all validation rules that will be used when creating or
|
22
|
-
# menu item.
|
21
|
+
# Specifies all validation rules that will be used when creating or
|
22
|
+
# updating a menu item.
|
23
23
|
#
|
24
24
|
# @author Yorick Peterse
|
25
25
|
# @since 0.2a
|
26
26
|
#
|
27
27
|
def validate
|
28
28
|
validates_presence :name
|
29
|
-
|
29
|
+
validates_presence :url
|
30
|
+
validates_integer [:sort_order, :parent_id]
|
30
31
|
|
31
32
|
# Prevent people from entering random crap for class and ID names
|
32
|
-
validates_format(/^[a-zA-Z\-_0-9]*/, [:
|
33
|
+
validates_format(/^[a-zA-Z\-_0-9]*/, [:html_class, :html_id])
|
33
34
|
end
|
34
35
|
end # MenuItem
|
35
36
|
end # Model
|
@@ -5,19 +5,19 @@ module Menus
|
|
5
5
|
#:nodoc:
|
6
6
|
module Plugin
|
7
7
|
##
|
8
|
-
# Plugin for displaying navigation menus. This plugin will take care of
|
9
|
-
# displaying all sub items and various other tasks, you merely
|
10
|
-
# options and then you can sit back and enjoy.
|
8
|
+
# Plugin for displaying navigation menus. This plugin will take care of
|
9
|
+
# recursively displaying all sub items and various other tasks, you merely
|
10
|
+
# have to set a few options and then you can sit back and enjoy.
|
11
11
|
#
|
12
12
|
# ## Usage
|
13
13
|
#
|
14
14
|
# menu = plugin(:menus, :menu => 'userguide', :sub => true)
|
15
15
|
#
|
16
|
-
# Calling this plugin will result in a string with HTML being returned. If
|
17
|
-
# to use this plugin in an Etanni template you'd have to wrap the
|
18
|
-
# to actually display the menu.
|
16
|
+
# Calling this plugin will result in a string with HTML being returned. If
|
17
|
+
# you were to use this plugin in an Etanni template you'd have to wrap the
|
18
|
+
# call in #{} in order to actually display the menu.
|
19
19
|
#
|
20
|
-
# For more information about all the available options see
|
20
|
+
# For more information about all the available options see
|
21
21
|
# Menus::Plugin::Menus#initialize().
|
22
22
|
#
|
23
23
|
# @author Yorick Peterse
|
@@ -36,20 +36,21 @@ module Menus
|
|
36
36
|
# @author Yorick Peterse
|
37
37
|
# @since 0.2.5
|
38
38
|
# @param [Hash] options Hash with configuration options.
|
39
|
-
# @option options [Integer/Fixnum] :limit The maximum amount of root items
|
40
|
-
# retrieve.
|
41
|
-
# @option options [Integer/Fixnum] :offset The row offset for all root
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# option
|
46
|
-
#
|
39
|
+
# @option options [Integer/Fixnum] :limit The maximum amount of root items
|
40
|
+
# to retrieve.
|
41
|
+
# @option options [Integer/Fixnum] :offset The row offset for all root
|
42
|
+
# elements.
|
43
|
+
# @option options [Fixnum/Integer/String] :menu The ID or slug of the menu
|
44
|
+
# for which to retrieve all menu items.
|
45
|
+
# @option options [Boolean] :sub When set to false sub items will be
|
46
|
+
# ignored. This option is set to true by default.
|
47
|
+
#
|
47
48
|
def initialize(options = {})
|
48
49
|
@options = {
|
49
50
|
:limit => 20,
|
50
51
|
:offset => 0,
|
51
52
|
:menu => nil,
|
52
|
-
:sub =>
|
53
|
+
:sub => false,
|
53
54
|
:order => :asc
|
54
55
|
}.merge(options)
|
55
56
|
|
@@ -67,7 +68,7 @@ module Menus
|
|
67
68
|
# @return [String] The HTML for the navigation menu.
|
68
69
|
#
|
69
70
|
def call
|
70
|
-
# Retrieve the menu
|
71
|
+
# Retrieve the menu
|
71
72
|
if @options[:menu].class == String
|
72
73
|
menu = Menu[:slug => @options[:menu]]
|
73
74
|
else
|
@@ -79,20 +80,20 @@ module Menus
|
|
79
80
|
# Get all menu items
|
80
81
|
menu_items = MenuItem.filter(:menu_id => menu.id, :parent_id => nil) \
|
81
82
|
.limit(@options[:limit], @options[:offset]) \
|
82
|
-
.order(:
|
83
|
+
.order(:sort_order.send(@options[:order])) \
|
83
84
|
.all
|
84
|
-
|
85
|
+
|
85
86
|
@g = Ramaze::Gestalt.new
|
86
87
|
attributes = {}
|
87
88
|
items_tree = {}
|
88
89
|
|
89
90
|
# Set the attributes for the main <ul> elements
|
90
|
-
if !menu.
|
91
|
-
attributes[:class] = menu.
|
91
|
+
if !menu.html_class.nil?
|
92
|
+
attributes[:class] = menu.html_class if !menu.html_class.empty?
|
92
93
|
end
|
93
94
|
|
94
|
-
if !menu.
|
95
|
-
attributes[:id] = menu.
|
95
|
+
if !menu.html_id.nil?
|
96
|
+
attributes[:id] = menu.html_id if !menu.html_id.empty?
|
96
97
|
end
|
97
98
|
|
98
99
|
# Time to build the HTML
|
@@ -113,39 +114,36 @@ module Menus
|
|
113
114
|
# Generates the HTML for a single <li> element and all sub elements.
|
114
115
|
#
|
115
116
|
# @author Yorick Peterse
|
116
|
-
# @since 0.2.5
|
117
|
-
# @param [Object] item An instance of the MenuItem model as returned by
|
117
|
+
# @since 0.2.5
|
118
|
+
# @param [Object] item An instance of the MenuItem model as returned by
|
119
|
+
# Sequel.
|
118
120
|
#
|
119
121
|
def generate_item(item)
|
120
122
|
attributes = {}
|
121
123
|
|
122
|
-
if !item.
|
123
|
-
attributes[:class] = item.
|
124
|
+
if !item.html_class.nil?
|
125
|
+
attributes[:class] = item.html_class if !item.html_class.empty?
|
124
126
|
end
|
125
127
|
|
126
|
-
if !item.
|
127
|
-
attributes[:id] = item.
|
128
|
+
if !item.html_id.nil?
|
129
|
+
attributes[:id] = item.html_id if !item.html_id.empty?
|
128
130
|
end
|
129
131
|
|
130
|
-
# Get all child elements
|
131
|
-
children = item.children
|
132
|
-
|
133
132
|
# Render the <li> tag
|
134
133
|
@g.li(attributes) do
|
135
|
-
|
136
|
-
if !item.url.nil? and !item.url.empty?
|
137
|
-
@g.a(:href => item.url, :title => item.name) { item.name }
|
138
|
-
else
|
139
|
-
@g.span { item.name }
|
140
|
-
end
|
134
|
+
@g.a(:href => item.url, :title => item.name) { item.name }
|
141
135
|
|
142
136
|
# Generate all the sub elements
|
143
|
-
if
|
144
|
-
|
145
|
-
|
146
|
-
|
137
|
+
if @options[:sub] === true
|
138
|
+
children = item.children
|
139
|
+
|
140
|
+
if !children.empty?
|
141
|
+
@g.ul(:class => :children) do
|
142
|
+
children.each do |child|
|
143
|
+
generate_item(child)
|
144
|
+
end
|
147
145
|
end
|
148
|
-
end
|
146
|
+
end # if !children.empty?
|
149
147
|
end
|
150
148
|
end
|
151
149
|
end
|
@@ -1,64 +1,60 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
f.g.div(:class => :clearfix) do
|
59
|
-
f.g.div(:class => :button) do
|
60
|
-
f.g.input(:type => :submit, :value => lang('menu_items.buttons.save'))
|
1
|
+
<article>
|
2
|
+
<header>
|
3
|
+
<h1>#{get_breadcrumbs}</h1>
|
4
|
+
</header>
|
5
|
+
|
6
|
+
#{
|
7
|
+
form_for(
|
8
|
+
@menu_item,
|
9
|
+
:method => :post,
|
10
|
+
:action => Menus::Controller::MenuItems.r(:save),
|
11
|
+
:id => :menu_item_form
|
12
|
+
) do |f|
|
13
|
+
f.input_hidden(:csrf_token, get_csrf_token)
|
14
|
+
f.input_hidden(:id , @menu_item.id)
|
15
|
+
f.input_hidden(:menu_id , @menu_id)
|
16
|
+
|
17
|
+
f.input_text(
|
18
|
+
lang('menu_items.labels.name'),
|
19
|
+
:name,
|
20
|
+
:placeholder => lang('menu_items.placeholders.name')
|
21
|
+
)
|
22
|
+
|
23
|
+
f.input_text(
|
24
|
+
lang('menu_items.labels.url'),
|
25
|
+
:url,
|
26
|
+
:placeholder => lang('menu_items.placeholders.url')
|
27
|
+
)
|
28
|
+
|
29
|
+
f.input_text(
|
30
|
+
lang('menu_items.labels.order'),
|
31
|
+
:sort_order,
|
32
|
+
:placeholder => lang('menu_items.placeholders.order')
|
33
|
+
)
|
34
|
+
|
35
|
+
f.select(
|
36
|
+
lang('menu_items.labels.parent_id'),
|
37
|
+
:parent_id,
|
38
|
+
:values => menu_item_tree(@menu_id),
|
39
|
+
:selected => @menu_item.parent_id,
|
40
|
+
:size => 1
|
41
|
+
)
|
42
|
+
|
43
|
+
f.input_text(
|
44
|
+
lang('menu_items.labels.html_class'),
|
45
|
+
:html_class,
|
46
|
+
:placeholder => lang('menu_items.placeholders.html_class')
|
47
|
+
)
|
48
|
+
|
49
|
+
f.input_text(
|
50
|
+
lang('menu_items.labels.html_id'),
|
51
|
+
:html_id,
|
52
|
+
:placeholder => lang('menu_items.placeholders.html_id')
|
53
|
+
)
|
54
|
+
|
55
|
+
f.g.div(:class => :button) do
|
56
|
+
f.g.input(:type => :submit, :value => lang('menu_items.buttons.save'))
|
57
|
+
end
|
61
58
|
end
|
62
|
-
|
63
|
-
|
64
|
-
}
|
59
|
+
}
|
60
|
+
</article>
|