zen 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gems +3 -2
- data/.rvmrc +1 -1
- data/.travis.yml +5 -0
- data/.yardopts +2 -1
- data/LICENSE +1 -1
- data/README.md +28 -24
- data/Rakefile +5 -2
- data/guide/asset_management.md +6 -6
- data/guide/autosaving_forms.md +42 -0
- data/guide/changelog.md +41 -0
- data/guide/faq.md +49 -0
- data/guide/getting_started.md +24 -13
- data/guide/hacking.md +40 -9
- data/guide/images/categories/categories.png +0 -0
- data/guide/images/categories/category_groups.png +0 -0
- data/guide/images/categories/new_category.png +0 -0
- data/guide/images/categories/new_category_group.png +0 -0
- data/guide/images/comments/comments.png +0 -0
- data/guide/images/comments/edit_comment.png +0 -0
- data/guide/images/custom_fields/custom_field_groups.png +0 -0
- data/guide/images/custom_fields/custom_field_types.png +0 -0
- data/guide/images/custom_fields/custom_fields.png +0 -0
- data/guide/images/custom_fields/edit_custom_field_general.png +0 -0
- data/guide/images/custom_fields/edit_custom_field_group.png +0 -0
- data/guide/images/custom_fields/edit_custom_field_settings.png +0 -0
- data/guide/images/custom_fields/edit_custom_field_type.png +0 -0
- data/guide/images/dashboard/added.png +0 -0
- data/guide/images/dashboard/columns.png +0 -0
- data/guide/images/dashboard/dashboard.png +0 -0
- data/guide/images/dashboard/options.png +0 -0
- data/guide/images/menus/edit_menu.png +0 -0
- data/guide/images/menus/edit_menu_item.png +0 -0
- data/guide/images/menus/menu_item_hierarchy.png +0 -0
- data/guide/images/menus/menu_items.png +0 -0
- data/guide/images/menus/menus.png +0 -0
- data/guide/images/sections/edit_entry.png +0 -0
- data/guide/images/sections/edit_entry_categories.png +0 -0
- data/guide/images/sections/edit_entry_general.png +0 -0
- data/guide/images/sections/edit_entry_meta.png +0 -0
- data/guide/images/sections/edit_section_comments.png +0 -0
- data/guide/images/sections/edit_section_general.png +0 -0
- data/guide/images/sections/edit_section_groups.png +0 -0
- data/guide/images/sections/entries.png +0 -0
- data/guide/images/sections/sections.png +0 -0
- data/guide/images/settings/overview_general.png +0 -0
- data/guide/images/settings/overview_security.png +0 -0
- data/guide/images/settings/overview_user.png +0 -0
- data/guide/images/users/edit_user.png +0 -0
- data/guide/images/users/edit_user_group.png +0 -0
- data/guide/images/users/edit_user_group_permissions.png +0 -0
- data/guide/images/users/edit_user_permissions.png +0 -0
- data/guide/images/users/overview.png +0 -0
- data/guide/images/users/user_groups_overview.png +0 -0
- data/guide/installation.md +7 -1
- data/guide/javascript.md +36 -273
- data/guide/javascript/zen_autosave.md +26 -0
- data/guide/javascript/zen_editor.md +83 -0
- data/guide/javascript/zen_hash.md +34 -0
- data/guide/javascript/zen_htmltable.md +78 -0
- data/guide/javascript/zen_tabs.md +44 -0
- data/guide/javascript/zen_window.md +49 -0
- data/guide/zen_compared.md +201 -0
- data/lib/vendor/sequel_sluggable.rb +1 -1
- data/lib/zen.rb +64 -44
- data/lib/zen/asset_groups.rb +10 -10
- data/lib/zen/bin/create.rb +8 -1
- data/lib/zen/helper/breadcrumb.rb +4 -12
- data/lib/zen/helper/controller.rb +209 -6
- data/lib/zen/helper/locale.rb +19 -0
- data/lib/zen/helper/search.rb +1 -1
- data/lib/zen/helper/stacked_aspect.rb +7 -43
- data/lib/zen/helper/theme.rb +3 -3
- data/lib/zen/language.rb +5 -10
- data/lib/zen/language/translation.rb +1 -1
- data/lib/zen/layout/admin.xhtml +41 -25
- data/lib/zen/layout/login.xhtml +8 -3
- data/lib/zen/migrator.rb +54 -0
- data/lib/zen/model/helper.rb +20 -1
- data/lib/zen/model/init.rb +2 -0
- data/lib/zen/model/plugin/events.rb +158 -0
- data/lib/zen/package.rb +32 -6
- data/lib/zen/package/all.rb +1 -0
- data/lib/zen/package/categories/lib/categories.rb +6 -6
- data/lib/zen/package/categories/lib/categories/controller/categories.rb +20 -83
- data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +23 -74
- data/lib/zen/package/categories/lib/categories/model/category.rb +58 -1
- data/lib/zen/package/categories/lib/categories/model/category_group.rb +62 -2
- data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +46 -40
- data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +74 -75
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +27 -24
- data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +83 -86
- data/lib/zen/package/comments/lib/comments.rb +5 -5
- data/lib/zen/package/comments/lib/comments/controller/comments.rb +12 -64
- data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +4 -22
- data/lib/zen/package/comments/lib/comments/model/comment.rb +65 -16
- data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +52 -49
- data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +52 -60
- data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +1 -1
- data/lib/zen/package/custom_fields/lib/custom_fields.rb +11 -13
- data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +29 -13
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +21 -50
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +27 -71
- data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +25 -78
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +48 -1
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb +35 -1
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +3 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +40 -1
- data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +1 -0
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +29 -26
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +96 -100
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +56 -53
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +82 -82
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +88 -85
- data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +83 -80
- data/lib/zen/package/dashboard/lib/dashboard.rb +28 -0
- data/lib/zen/package/dashboard/lib/dashboard/controller/dashboard.rb +154 -0
- data/lib/zen/package/dashboard/lib/dashboard/language/en/dashboard.rb +35 -0
- data/lib/zen/package/dashboard/lib/dashboard/language/nl/dashboard.rb +36 -0
- data/lib/zen/package/dashboard/lib/dashboard/model/widget.rb +45 -0
- data/lib/zen/package/dashboard/lib/dashboard/public/admin/dashboard/css/dashboard.css +74 -0
- data/lib/zen/package/dashboard/lib/dashboard/public/admin/dashboard/js/dashboard.js +102 -0
- data/lib/zen/package/dashboard/lib/dashboard/view/admin/index.xhtml +29 -0
- data/lib/zen/package/dashboard/lib/dashboard/view/admin/widget/welcome.xhtml +28 -0
- data/lib/zen/package/dashboard/lib/dashboard/widget.rb +292 -0
- data/lib/zen/package/dashboard/lib/dashboard/widget/welcome.rb +9 -0
- data/lib/zen/package/dashboard/migrations/1326411254_create_schema.rb +28 -0
- data/lib/zen/package/extensions/lib/extensions.rb +5 -5
- data/lib/zen/package/extensions/lib/extensions/view/admin/extensions/index.xhtml +72 -67
- data/lib/zen/package/menu.rb +6 -1
- data/lib/zen/package/menus/lib/menus.rb +6 -4
- data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +69 -104
- data/lib/zen/package/menus/lib/menus/controller/menus.rb +19 -76
- data/lib/zen/package/menus/lib/menus/helper/menu.rb +54 -38
- data/lib/zen/package/menus/lib/menus/helper/menu_frontend.rb +7 -13
- data/lib/zen/package/menus/lib/menus/model/menu.rb +158 -2
- data/lib/zen/package/menus/lib/menus/model/menu_item.rb +73 -10
- data/lib/zen/package/menus/lib/menus/public/admin/menus/css/menus.css +47 -0
- data/lib/zen/package/menus/lib/menus/public/admin/menus/js/lib/nested_sortables.js +549 -0
- data/lib/zen/package/menus/lib/menus/public/admin/menus/js/menu_items.js +38 -0
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +51 -61
- data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +18 -81
- data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +49 -44
- data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +81 -83
- data/lib/zen/package/sections/lib/sections.rb +9 -4
- data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +80 -132
- data/lib/zen/package/sections/lib/sections/controller/sections.rb +27 -73
- data/lib/zen/package/sections/lib/sections/helper/section.rb +44 -1
- data/lib/zen/package/sections/lib/sections/language/en/section_entries.rb +2 -0
- data/lib/zen/package/sections/lib/sections/language/nl/section_entries.rb +2 -0
- data/lib/zen/package/sections/lib/sections/model/section.rb +48 -1
- data/lib/zen/package/sections/lib/sections/model/section_entry.rb +55 -5
- data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +2 -0
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +76 -67
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +74 -79
- data/lib/zen/package/sections/lib/sections/view/admin/section-entries/recent_entries.xhtml +45 -0
- data/lib/zen/package/sections/lib/sections/view/admin/sections/form.xhtml +119 -0
- data/lib/zen/package/sections/lib/sections/view/admin/sections/index.xhtml +96 -0
- data/lib/zen/package/sections/lib/sections/widget/recent_entries.rb +14 -0
- data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +1 -1
- data/lib/zen/package/settings/lib/settings.rb +14 -5
- data/lib/zen/package/settings/lib/settings/controller/settings.rb +4 -4
- data/lib/zen/package/settings/lib/settings/language/nl/settings.rb +1 -1
- data/lib/zen/package/settings/lib/settings/setting.rb +1 -1
- data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +21 -17
- data/lib/zen/package/users/lib/users.rb +18 -19
- data/lib/zen/package/users/lib/users/controller/user_groups.rb +23 -50
- data/lib/zen/package/users/lib/users/controller/users.rb +57 -89
- data/lib/zen/package/users/lib/users/helper/acl.rb +1 -0
- data/lib/zen/package/users/lib/users/language/en/user_groups.rb +1 -0
- data/lib/zen/package/users/lib/users/language/en/users.rb +2 -1
- data/lib/zen/package/users/lib/users/language/nl/user_groups.rb +1 -0
- data/lib/zen/package/users/lib/users/language/nl/users.rb +2 -1
- data/lib/zen/package/users/lib/users/model/permission.rb +13 -0
- data/lib/zen/package/users/lib/users/model/user.rb +57 -4
- data/lib/zen/package/users/lib/users/model/user_group.rb +37 -3
- data/lib/zen/package/users/lib/users/model/user_status.rb +4 -0
- data/lib/zen/package/users/lib/users/public/admin/{css/users/permissions.css → users/css/users.css} +0 -0
- data/lib/zen/package/users/lib/users/public/admin/{js/users/permissions.js → users/js/users.js} +4 -2
- data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +51 -47
- data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +62 -69
- data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +92 -82
- data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +68 -66
- data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +36 -28
- data/lib/zen/package/users/lib/users/view/admin/users/permissions.xhtml +5 -7
- data/lib/zen/package/users/lib/users/view/admin/users/register.xhtml +47 -41
- data/lib/zen/package/users/migrations/1320272365_status_ids.rb +1 -1
- data/lib/zen/public/admin/{js/vendor/mootools → mootools/js}/core.js +113 -108
- data/lib/zen/public/admin/{js/vendor/mootools → mootools/js}/more.js +99 -6
- data/lib/zen/public/admin/zen/css/buttons.css +106 -0
- data/lib/zen/public/admin/{css/zen → zen/css}/datepicker.css +45 -30
- data/lib/zen/public/admin/zen/css/editor.css +69 -0
- data/lib/zen/public/admin/{css/zen → zen/css}/forms.css +28 -30
- data/lib/zen/public/admin/zen/css/general.css +183 -0
- data/lib/zen/public/admin/zen/css/layout.css +224 -0
- data/lib/zen/public/admin/zen/css/messages.css +34 -0
- data/lib/zen/public/admin/{css/zen → zen/css}/reset.css +4 -9
- data/lib/zen/public/admin/zen/css/tables.css +57 -0
- data/lib/zen/public/admin/zen/css/tabs.css +84 -0
- data/lib/zen/public/admin/zen/css/window.css +74 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/asc.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/bold.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/box.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/categories.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/close.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/comment.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/desc.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/edit.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/error.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/external.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/globe.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/italic.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/link.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/lock.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/ol.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/pages.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/preview.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/relation.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/settings.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/template.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/ul.png +0 -0
- data/lib/zen/public/admin/{images/zen → zen/images}/icons/user.png +0 -0
- data/lib/zen/public/admin/zen/images/icons/user_group.png +0 -0
- data/lib/zen/public/admin/{js/zen → zen/js}/index.js +21 -9
- data/lib/zen/public/admin/zen/js/lib/autosave.js +185 -0
- data/lib/zen/public/admin/zen/js/lib/base.js +60 -0
- data/lib/zen/public/admin/{js/vendor → zen/js/lib}/datepicker.js +52 -28
- data/lib/zen/public/admin/{js/zen → zen/js}/lib/editor.js +23 -34
- data/lib/zen/public/admin/{js/zen → zen/js}/lib/editor/markdown.js +5 -1
- data/lib/zen/public/admin/{js/zen → zen/js}/lib/editor/textile.js +4 -0
- data/lib/zen/public/admin/zen/js/lib/hash.js +218 -0
- data/lib/zen/public/admin/{js/zen → zen/js}/lib/html_table.js +5 -0
- data/lib/zen/public/admin/zen/js/lib/tabs.js +194 -0
- data/lib/zen/public/admin/{js/zen → zen/js}/lib/window.js +54 -29
- data/lib/zen/security.rb +50 -0
- data/lib/zen/spec/helper.rb +5 -120
- data/lib/zen/spec/helper/capybara.rb +75 -0
- data/lib/zen/spec/helper/general.rb +75 -0
- data/lib/zen/spec/simplecov.rb +1 -0
- data/lib/zen/task/build.rake +2 -21
- data/lib/zen/task/clean.rake +1 -10
- data/lib/zen/task/db.rake +4 -10
- data/lib/zen/task/package.rake +2 -5
- data/lib/zen/task/setup.rake +1 -1
- data/lib/zen/task/test.rake +6 -6
- data/lib/zen/task/theme.rake +2 -5
- data/lib/zen/theme.rb +26 -22
- data/lib/zen/version.rb +1 -1
- data/lib/zen/view/bottom.xhtml +2 -3
- data/lib/zen/view/search.xhtml +3 -5
- data/proto/app/config/config.rb.erb +1 -1
- data/proto/app/theme/default/index.xhtml +116 -20
- data/proto/app/theme/partials/head.xhtml +9 -0
- data/proto/app/theme/partials/sidebar.xhtml +40 -0
- data/proto/app/theme/theme.rb +3 -0
- data/spec/Rakefile +1 -2
- data/spec/fixtures/zen/helper/stacked_aspect.rb +54 -0
- data/spec/fixtures/zen/package/dashboard/controller/widget.rb +15 -0
- data/spec/fixtures/zen/package/dashboard/widget.rb +5 -0
- data/spec/fixtures/zen/theme/theme.rb +2 -2
- data/spec/helper.rb +19 -10
- data/spec/zen/controller/admin_controller.rb +3 -3
- data/spec/zen/controller/main_controller.rb +7 -7
- data/spec/zen/controller/preview.rb +3 -3
- data/spec/zen/event.rb +4 -4
- data/spec/zen/helper/breadcrumb.rb +4 -8
- data/spec/zen/helper/controller.rb +47 -4
- data/spec/zen/helper/locale.rb +3 -3
- data/spec/zen/helper/message.rb +4 -4
- data/spec/zen/helper/stacked_aspect.rb +40 -0
- data/spec/zen/helper/theme.rb +9 -9
- data/spec/zen/language.rb +8 -8
- data/spec/zen/markup.rb +6 -6
- data/spec/zen/package.rb +11 -9
- data/spec/zen/package/categories/controller/categories.rb +56 -24
- data/spec/zen/package/categories/controller/category_groups.rb +55 -23
- data/spec/zen/package/categories/helper/category.rb +5 -5
- data/spec/zen/package/categories/helper/category_frontend.rb +5 -5
- data/spec/zen/package/comments/anti_spam.rb +4 -4
- data/spec/zen/package/comments/controller/comments.rb +95 -24
- data/spec/zen/package/comments/controller/comments_form.rb +31 -26
- data/spec/zen/package/comments/helper/comment.rb +3 -3
- data/spec/zen/package/comments/helper/comment_frontend.rb +6 -6
- data/spec/zen/package/custom_fields/blue_form_parameters.rb +8 -8
- data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +58 -27
- data/spec/zen/package/custom_fields/controller/custom_field_types.rb +57 -27
- data/spec/zen/package/custom_fields/controller/custom_fields.rb +58 -27
- data/spec/zen/package/custom_fields/helper/custom_field.rb +7 -7
- data/spec/zen/package/dashboard/controller/dashboard.rb +147 -0
- data/spec/zen/package/dashboard/widget.rb +56 -0
- data/spec/zen/package/extensions/controller/extensions.rb +4 -4
- data/spec/zen/package/menus/controller/menu_items.rb +48 -39
- data/spec/zen/package/menus/controller/menus.rb +55 -24
- data/spec/zen/package/menus/helper/menu.rb +6 -14
- data/spec/zen/package/menus/helper/menu_frontend.rb +7 -7
- data/spec/zen/package/menus/model/menu.rb +121 -0
- data/spec/zen/package/menus/model/menu_item.rb +34 -0
- data/spec/zen/package/sections/controller/section_entries.rb +104 -39
- data/spec/zen/package/sections/controller/sections.rb +60 -27
- data/spec/zen/package/sections/helper/section.rb +5 -5
- data/spec/zen/package/sections/helper/section_frontend.rb +9 -9
- data/spec/zen/package/sections/widget.rb +44 -0
- data/spec/zen/package/settings/controller/settings.rb +18 -16
- data/spec/zen/package/settings/settings.rb +12 -12
- data/spec/zen/package/users/controller/user_groups.rb +61 -29
- data/spec/zen/package/users/controller/users.rb +118 -39
- data/spec/zen/package/users/helper/access.rb +3 -3
- data/spec/zen/package/users/helper/acl.rb +4 -4
- data/spec/zen/package/users/helper/users.rb +5 -5
- data/spec/zen/security.rb +25 -0
- data/spec/zen/theme.rb +20 -18
- data/spec/zen/validation.rb +5 -5
- data/spec/zen/vendor/sequel_sluggable.rb +12 -0
- data/zen.gemspec +27 -4
- metadata +182 -124
- data/AUTHORS +0 -4
- data/guide/_static/categories/categories.png +0 -0
- data/guide/_static/categories/category_groups.png +0 -0
- data/guide/_static/categories/new_category.png +0 -0
- data/guide/_static/categories/new_category_group.png +0 -0
- data/guide/_static/comments/comments.png +0 -0
- data/guide/_static/comments/edit_comment.png +0 -0
- data/guide/_static/custom_fields/custom_field_groups.png +0 -0
- data/guide/_static/custom_fields/custom_field_types.png +0 -0
- data/guide/_static/custom_fields/custom_fields.png +0 -0
- data/guide/_static/custom_fields/edit_custom_field_general.png +0 -0
- data/guide/_static/custom_fields/edit_custom_field_group.png +0 -0
- data/guide/_static/custom_fields/edit_custom_field_settings.png +0 -0
- data/guide/_static/custom_fields/edit_custom_field_type.png +0 -0
- data/guide/_static/menus/edit_menu.png +0 -0
- data/guide/_static/menus/edit_menu_item.png +0 -0
- data/guide/_static/menus/menu_items.png +0 -0
- data/guide/_static/menus/menus.png +0 -0
- data/guide/_static/sections/edit_entry.png +0 -0
- data/guide/_static/sections/edit_entry_categories.png +0 -0
- data/guide/_static/sections/edit_entry_general.png +0 -0
- data/guide/_static/sections/edit_entry_meta.png +0 -0
- data/guide/_static/sections/edit_section_comments.png +0 -0
- data/guide/_static/sections/edit_section_general.png +0 -0
- data/guide/_static/sections/edit_section_groups.png +0 -0
- data/guide/_static/sections/entries.png +0 -0
- data/guide/_static/sections/sections.png +0 -0
- data/guide/_static/settings/overview_general.png +0 -0
- data/guide/_static/settings/overview_security.png +0 -0
- data/guide/_static/settings/overview_user.png +0 -0
- data/guide/_static/users/edit_user.png +0 -0
- data/guide/_static/users/edit_user_group.png +0 -0
- data/guide/_static/users/edit_user_group_permissions.png +0 -0
- data/guide/_static/users/edit_user_permissions.png +0 -0
- data/guide/_static/users/overview.png +0 -0
- data/guide/_static/users/user_groups_overview.png +0 -0
- data/lib/zen/controller/translations.rb +0 -49
- data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +0 -113
- data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +0 -97
- data/lib/zen/public/admin/css/zen/buttons.css +0 -46
- data/lib/zen/public/admin/css/zen/editor.css +0 -88
- data/lib/zen/public/admin/css/zen/general.css +0 -109
- data/lib/zen/public/admin/css/zen/grid.css +0 -100
- data/lib/zen/public/admin/css/zen/layout.css +0 -184
- data/lib/zen/public/admin/css/zen/messages.css +0 -54
- data/lib/zen/public/admin/css/zen/tables.css +0 -97
- data/lib/zen/public/admin/css/zen/tabs.css +0 -47
- data/lib/zen/public/admin/css/zen/window.css +0 -73
- data/lib/zen/public/admin/images/zen/icons/accept.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/add.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/back.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/delete.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/help.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/info.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/logout.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/pdf.png +0 -0
- data/lib/zen/public/admin/images/zen/icons/view.png +0 -0
- data/lib/zen/public/admin/js/zen/lib/tabs.js +0 -207
- data/lib/zen/view/main.xhtml +0 -19
data/lib/zen/package.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'ramaze/gestalt'
|
2
|
+
require 'ostruct'
|
2
3
|
require __DIR__('package/menu')
|
3
4
|
|
4
5
|
module Zen
|
@@ -28,6 +29,7 @@ module Zen
|
|
28
29
|
# * root: the root directory of the package, this path should point to the
|
29
30
|
# directory containing your ``helper/`` and ``language/`` directories as
|
30
31
|
# well as any ``public/`` directories.
|
32
|
+
# * An innstance of OpenStruct that can be used for storing custom data.
|
31
33
|
#
|
32
34
|
# Setting these (and other) attributes is very easy:
|
33
35
|
#
|
@@ -135,6 +137,9 @@ module Zen
|
|
135
137
|
# The directory to all migrations.
|
136
138
|
attr_accessor :migrations
|
137
139
|
|
140
|
+
# Instance of OpenStruct that can be used for storing custom data.
|
141
|
+
attr_reader :env
|
142
|
+
|
138
143
|
class << self
|
139
144
|
##
|
140
145
|
# Adds a new package along with all it's details such as the name, author,
|
@@ -192,15 +197,20 @@ module Zen
|
|
192
197
|
# @return [String]
|
193
198
|
#
|
194
199
|
def build_menu(html_class = 'navigation', permissions = [])
|
195
|
-
g
|
200
|
+
g = Ramaze::Gestalt.new
|
201
|
+
attrs = {:class => html_class}
|
202
|
+
|
203
|
+
if html_class.nil? or html_class.empty?
|
204
|
+
attrs.delete(:class)
|
205
|
+
end
|
196
206
|
|
197
|
-
g.ul(
|
207
|
+
g.ul(attrs) do
|
198
208
|
# Sort the hash
|
199
209
|
keys = REGISTERED.keys.sort
|
200
210
|
|
201
211
|
keys.each do |key|
|
202
212
|
unless REGISTERED[key].menu.nil?
|
203
|
-
g.out <<
|
213
|
+
REGISTERED[key].menu.each { |m| g.out << m.html(permissions) }
|
204
214
|
end
|
205
215
|
end
|
206
216
|
end
|
@@ -209,6 +219,15 @@ module Zen
|
|
209
219
|
end
|
210
220
|
end # class << self
|
211
221
|
|
222
|
+
##
|
223
|
+
# Creates a new instance of the package.
|
224
|
+
#
|
225
|
+
# @since 12-02-2012
|
226
|
+
#
|
227
|
+
def initialize
|
228
|
+
@env = OpenStruct.new
|
229
|
+
end
|
230
|
+
|
212
231
|
##
|
213
232
|
# Sets the name of the package. The name of a package should be a short and
|
214
233
|
# unique name. A human readable version can be set using title=().
|
@@ -254,7 +273,11 @@ module Zen
|
|
254
273
|
#
|
255
274
|
def formatted_title
|
256
275
|
if url
|
257
|
-
return '<a href="%s" title="%s">%s</a>' % [
|
276
|
+
return '<a href="%s" title="%s" class="icon external">%s</a>' % [
|
277
|
+
url,
|
278
|
+
title,
|
279
|
+
title
|
280
|
+
]
|
258
281
|
else
|
259
282
|
return title
|
260
283
|
end
|
@@ -326,10 +349,11 @@ module Zen
|
|
326
349
|
#
|
327
350
|
def menu(title = nil, url = nil, options = {}, &block)
|
328
351
|
if title.nil? and url.nil? and !block_given?
|
329
|
-
return @
|
352
|
+
return @menus || []
|
330
353
|
end
|
331
354
|
|
332
|
-
@
|
355
|
+
@menus ||= []
|
356
|
+
@menus << Zen::Package::Menu.new(title, url, options, &block)
|
333
357
|
end
|
334
358
|
|
335
359
|
##
|
@@ -361,6 +385,8 @@ module Zen
|
|
361
385
|
def permissions
|
362
386
|
perms = {}
|
363
387
|
|
388
|
+
return perms if @permissions.nil?
|
389
|
+
|
364
390
|
@permissions.each do |perm, title|
|
365
391
|
begin
|
366
392
|
perms[perm] = lang(title)
|
data/lib/zen/package/all.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# foreign keys might not work.
|
4
4
|
require __DIR__('settings/lib/settings')
|
5
5
|
require __DIR__('users/lib/users')
|
6
|
+
require __DIR__('dashboard/lib/dashboard')
|
6
7
|
require __DIR__('sections/lib/sections')
|
7
8
|
require __DIR__('comments/lib/comments')
|
8
9
|
require __DIR__('categories/lib/categories')
|
@@ -7,11 +7,9 @@ Zen::Package.add do |p|
|
|
7
7
|
p.root = __DIR__('categories')
|
8
8
|
p.migrations = __DIR__('../migrations')
|
9
9
|
|
10
|
-
p.menu
|
11
|
-
'categories.titles.index',
|
10
|
+
p.menu 'categories.titles.index',
|
12
11
|
'/admin/category-groups',
|
13
12
|
:permission => :show_category_group
|
14
|
-
)
|
15
13
|
|
16
14
|
p.permission :show_category_group , 'category_groups.permissions.show'
|
17
15
|
p.permission :edit_category_group , 'category_groups.permissions.edit'
|
@@ -24,12 +22,14 @@ Zen::Package.add do |p|
|
|
24
22
|
p.permission :delete_category, 'categories.permissions.delete'
|
25
23
|
end
|
26
24
|
|
27
|
-
Zen::Language.load('categories')
|
28
|
-
Zen::Language.load('category_groups')
|
29
|
-
|
30
25
|
require __DIR__('categories/model/category_group')
|
31
26
|
require __DIR__('categories/model/category')
|
32
27
|
require __DIR__('categories/controller/category_groups')
|
33
28
|
require __DIR__('categories/controller/categories')
|
34
29
|
|
35
30
|
Zen::Controller::FrontendController.helper(:category_frontend)
|
31
|
+
|
32
|
+
Zen::Event.listen :post_start do
|
33
|
+
Zen::Language.load('categories')
|
34
|
+
Zen::Language.load('category_groups')
|
35
|
+
end
|
@@ -15,7 +15,7 @@ module Categories
|
|
15
15
|
# you've reached the categories overview you'll be presented with an
|
16
16
|
# overview that looks like the following image:
|
17
17
|
#
|
18
|
-
# ![Categories Overview](../../
|
18
|
+
# ![Categories Overview](../../images/categories/categories.png)
|
19
19
|
#
|
20
20
|
# ## Adding/Editing Categories
|
21
21
|
#
|
@@ -23,7 +23,7 @@ module Categories
|
|
23
23
|
# If you want to create a new category instead you should click the button
|
24
24
|
# "Add category". In both cases you'll end up with the following form:
|
25
25
|
#
|
26
|
-
# ![New Category](../../
|
26
|
+
# ![New Category](../../images/categories/new_category.png)
|
27
27
|
#
|
28
28
|
# In this form you can specify the following fields:
|
29
29
|
#
|
@@ -49,48 +49,18 @@ module Categories
|
|
49
49
|
# * new_category
|
50
50
|
# * delete_category
|
51
51
|
#
|
52
|
-
# ## Events
|
53
|
-
#
|
54
|
-
# All available events will receive an instance of
|
55
|
-
# {Categories::Model::Category}. Do note that the event
|
56
|
-
# ``after_delete_category`` will receive an instance of this model *after*
|
57
|
-
# ``#destroy()`` has been invoked on the instance. This means that you can
|
58
|
-
# not save any changes made to the object as the database no longer
|
59
|
-
# exists.
|
60
|
-
#
|
61
|
-
# Say you want to notify a user whenever a category is removed you could do
|
62
|
-
# the following:
|
63
|
-
#
|
64
|
-
# # "mail" can be installed by running gem install mail.
|
65
|
-
# require 'mail'
|
66
|
-
#
|
67
|
-
# Zen::Event.listen(:delete_category) do |category|
|
68
|
-
# user = Users::Model::User[:name => 'admin']
|
69
|
-
# Mail.deliver do
|
70
|
-
# from 'example@domain.com'
|
71
|
-
# to user.email
|
72
|
-
# subject "Category \"#{category.name}\" has been removed"
|
73
|
-
# "has been removed from the database."
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
#
|
77
52
|
# @since 0.1
|
78
53
|
# @map /admin/categories
|
79
|
-
# @event before_new_category
|
80
|
-
# @event after_new_category
|
81
|
-
# @event before_edit_category
|
82
|
-
# @event after_edit_category
|
83
|
-
# @event before_delete_category
|
84
|
-
# @event after_delete_category
|
85
54
|
#
|
86
55
|
class Categories < Zen::Controller::AdminController
|
87
56
|
map '/admin/categories'
|
88
57
|
helper :category
|
89
58
|
title 'categories.titles.%s'
|
90
59
|
|
91
|
-
# Protect Categories#save() and Categories#delete() against CSRF attacks.
|
92
60
|
csrf_protection :save, :delete
|
93
61
|
|
62
|
+
autosave Model::Category, Model::Category::COLUMNS, :edit_category
|
63
|
+
|
94
64
|
##
|
95
65
|
# Show an overview of all existing categories and allow the user
|
96
66
|
# manage these categories.
|
@@ -153,11 +123,8 @@ module Categories
|
|
153
123
|
|
154
124
|
@category_group_id = category_group_id
|
155
125
|
|
156
|
-
|
157
|
-
|
158
|
-
else
|
159
|
-
@category = ::Categories::Model::Category.new
|
160
|
-
end
|
126
|
+
@category = Model::Category.new
|
127
|
+
@category.set(flash[:form_data]) if flash[:form_data]
|
161
128
|
|
162
129
|
render_view(:form)
|
163
130
|
end
|
@@ -189,12 +156,9 @@ module Categories
|
|
189
156
|
validate_category_group(category_group_id)
|
190
157
|
|
191
158
|
@category_group_id = category_group_id
|
159
|
+
@category = validate_category(id, category_group_id)
|
192
160
|
|
193
|
-
if flash[:form_data]
|
194
|
-
@category = flash[:form_data]
|
195
|
-
else
|
196
|
-
@category = validate_category(id, category_group_id)
|
197
|
-
end
|
161
|
+
@category.set(flash[:form_data]) if flash[:form_data]
|
198
162
|
|
199
163
|
render_view(:form)
|
200
164
|
end
|
@@ -206,64 +170,43 @@ module Categories
|
|
206
170
|
# @since 0.1
|
207
171
|
# @permission edit_category (when editing a category)
|
208
172
|
# @permission new_category (when creating a category)
|
209
|
-
# @event before_edit_category
|
210
|
-
# @event after_edit_category
|
211
|
-
# @event before_new_category
|
212
|
-
# @event after_new_category
|
213
173
|
#
|
214
174
|
def save
|
215
|
-
|
216
|
-
|
217
|
-
:parent_id,
|
218
|
-
:name,
|
219
|
-
:description,
|
220
|
-
:slug,
|
221
|
-
:category_group_id
|
222
|
-
)
|
175
|
+
id = request.params['id']
|
176
|
+
post = post_fields(*Model::Category::COLUMNS)
|
223
177
|
|
224
178
|
validate_category_group(post['category_group_id'])
|
225
179
|
|
226
180
|
# Retrieve the category and set the notifications based on if the ID has
|
227
181
|
# been specified or not.
|
228
|
-
if
|
182
|
+
if id and !id.empty?
|
229
183
|
authorize_user!(:edit_category)
|
230
184
|
|
231
|
-
category
|
232
|
-
save_action
|
233
|
-
before_event = :before_edit_category
|
234
|
-
after_event = :after_edit_category
|
185
|
+
category = validate_category(id, post['category_group_id'])
|
186
|
+
save_action = :save
|
235
187
|
else
|
236
188
|
authorize_user!(:new_category)
|
237
189
|
|
238
|
-
category
|
239
|
-
save_action
|
240
|
-
before_event = :before_new_category
|
241
|
-
after_event = :after_new_category
|
190
|
+
category = ::Categories::Model::Category.new
|
191
|
+
save_action = :new
|
242
192
|
end
|
243
193
|
|
244
|
-
post.delete('id')
|
245
|
-
|
246
194
|
success = lang("categories.success.#{save_action}")
|
247
195
|
error = lang("categories.errors.#{save_action}")
|
248
196
|
|
249
|
-
# Try to update the category
|
250
197
|
begin
|
251
|
-
|
252
|
-
Zen::Event.call(before_event, category)
|
253
|
-
|
198
|
+
category.set(post)
|
254
199
|
category.save
|
255
200
|
rescue => e
|
256
|
-
Ramaze::Log.error(e
|
201
|
+
Ramaze::Log.error(e)
|
257
202
|
message(:error, error)
|
258
203
|
|
259
204
|
flash[:form_errors] = category.errors
|
260
|
-
flash[:form_data] =
|
205
|
+
flash[:form_data] = post
|
261
206
|
|
262
207
|
redirect_referrer
|
263
208
|
end
|
264
209
|
|
265
|
-
Zen::Event.call(after_event, category)
|
266
|
-
|
267
210
|
message(:success, success)
|
268
211
|
redirect(Categories.r(:edit, category.category_group_id, category.id))
|
269
212
|
end
|
@@ -276,13 +219,11 @@ module Categories
|
|
276
219
|
#
|
277
220
|
# @since 0.1
|
278
221
|
# @permission delete_category
|
279
|
-
# @event before_delete_category
|
280
|
-
# @event after_delete_category
|
281
222
|
#
|
282
223
|
def delete
|
283
224
|
authorize_user!(:delete_category)
|
284
225
|
|
285
|
-
post =
|
226
|
+
post = post_fields(:category_ids)
|
286
227
|
|
287
228
|
# Obviously we'll require some IDs
|
288
229
|
if post['category_ids'].nil? or post['category_ids'].empty?
|
@@ -296,18 +237,14 @@ module Categories
|
|
296
237
|
|
297
238
|
next if category.nil?
|
298
239
|
|
299
|
-
Zen::Event.call(:before_delete_category, category)
|
300
|
-
|
301
240
|
begin
|
302
241
|
category.destroy
|
303
242
|
rescue => e
|
304
|
-
Ramaze::Log.error(e
|
243
|
+
Ramaze::Log.error(e)
|
305
244
|
message(:error, lang('categories.errors.delete') % id)
|
306
245
|
|
307
246
|
redirect_referrer
|
308
247
|
end
|
309
|
-
|
310
|
-
Zen::Event.call(:after_delete_category, category)
|
311
248
|
end
|
312
249
|
|
313
250
|
message(:success, lang('categories.success.delete'))
|
@@ -32,7 +32,7 @@ module Categories
|
|
32
32
|
# ``/admin/category-groups``. This overview looks like the image displayed
|
33
33
|
# below.
|
34
34
|
#
|
35
|
-
# ![Category Group Overview](../../
|
35
|
+
# ![Category Group Overview](../../images/categories/category_groups.png)
|
36
36
|
#
|
37
37
|
# Editing an existing group can be done by clicking on the name of a group
|
38
38
|
# while managing the categories of a group is done by clicking the link
|
@@ -49,7 +49,7 @@ module Categories
|
|
49
49
|
# existing group or create a new one. The form used to manage such a group
|
50
50
|
# looks like the one in the image below.
|
51
51
|
#
|
52
|
-
# ![New Category Group](../../
|
52
|
+
# ![New Category Group](../../images/categories/new_category_group.png)
|
53
53
|
#
|
54
54
|
# In this form you can set the following fields:
|
55
55
|
#
|
@@ -66,50 +66,20 @@ module Categories
|
|
66
66
|
# * new_category_group
|
67
67
|
# * delete_category_group
|
68
68
|
#
|
69
|
-
# ## Events
|
70
|
-
#
|
71
|
-
# All available events receive an instance of
|
72
|
-
# {Categories::Model::CategoyGroup}. However, the
|
73
|
-
# ``after_delete_category_group`` event will receive an instance that has
|
74
|
-
# already been removed from the database. This means that you can not make
|
75
|
-
# changes to the object and call ``#save()``.
|
76
|
-
#
|
77
|
-
# Example of logging when a new category group is created:
|
78
|
-
#
|
79
|
-
# Zen::Event.listen(:after_new_category_group) do |group|
|
80
|
-
# Ramaze::Log.info("New category: \"#{group.name}\"")
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# Maybe you want to automatically add a category group to a section:
|
84
|
-
#
|
85
|
-
# Zen::Event.listen(:after_new_category_group) do |group|
|
86
|
-
# section = Sections::Model::Section[5]
|
87
|
-
#
|
88
|
-
# begin
|
89
|
-
# section.add_category_group(group)
|
90
|
-
# rescue => e
|
91
|
-
# Ramaze::Log.error(e.inspect)
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
#
|
95
69
|
# @since 0.1
|
96
70
|
# @map /admin/category-groups
|
97
|
-
# @event before_new_category_group
|
98
|
-
# @event after_new_category_group
|
99
|
-
# @event before_edit_category_group
|
100
|
-
# @event after_edit_category_group
|
101
|
-
# @event before_delete_category_group
|
102
|
-
# @event after_delete_category_group
|
103
71
|
#
|
104
72
|
class CategoryGroups < Zen::Controller::AdminController
|
105
73
|
helper :category
|
106
74
|
map '/admin/category-groups'
|
107
75
|
title 'category_groups.titles.%s'
|
108
76
|
|
109
|
-
# Protects CategoryGroups#save() and CategoryGroups#delete() against CSRF
|
110
|
-
# attacks.
|
111
77
|
csrf_protection :save, :delete
|
112
78
|
|
79
|
+
autosave Model::CategoryGroup,
|
80
|
+
Model::CategoryGroup::COLUMNS,
|
81
|
+
:edit_category_group
|
82
|
+
|
113
83
|
##
|
114
84
|
# Show an overview of all existing category groups and allow the user
|
115
85
|
# to create new category groups or manage individual categories.
|
@@ -123,10 +93,10 @@ module Categories
|
|
123
93
|
set_breadcrumbs(lang('category_groups.titles.index'))
|
124
94
|
|
125
95
|
@category_groups = search do |query|
|
126
|
-
|
96
|
+
Model::CategoryGroup.search(query).order(:id.asc)
|
127
97
|
end
|
128
98
|
|
129
|
-
@category_groups ||=
|
99
|
+
@category_groups ||= Model::CategoryGroup.order(:id.asc)
|
130
100
|
@category_groups = paginate(@category_groups)
|
131
101
|
end
|
132
102
|
|
@@ -145,7 +115,8 @@ module Categories
|
|
145
115
|
lang('category_groups.titles.edit')
|
146
116
|
)
|
147
117
|
|
148
|
-
@category_group =
|
118
|
+
@category_group = validate_category_group(id)
|
119
|
+
@category_group.set(flash[:form_data]) if flash[:form_data]
|
149
120
|
|
150
121
|
render_view(:form)
|
151
122
|
end
|
@@ -164,11 +135,8 @@ module Categories
|
|
164
135
|
lang('category_groups.titles.new')
|
165
136
|
)
|
166
137
|
|
167
|
-
|
168
|
-
|
169
|
-
else
|
170
|
-
@category_group = ::Categories::Model::CategoryGroup.new
|
171
|
-
end
|
138
|
+
@category_group = Model::CategoryGroup.new
|
139
|
+
@category_group.set(flash[:form_data]) if flash[:form_data]
|
172
140
|
|
173
141
|
render_view(:form)
|
174
142
|
end
|
@@ -181,54 +149,41 @@ module Categories
|
|
181
149
|
# @since 0.1
|
182
150
|
# @permission edit_category_group (when editing a group)
|
183
151
|
# @permission new_category_group (when creating a group)
|
184
|
-
# @event before_new_category_group
|
185
|
-
# @event after_new_category_group
|
186
|
-
# @event before_edit_category_group
|
187
|
-
# @event after_edit_category_group
|
188
152
|
#
|
189
153
|
def save
|
190
|
-
post =
|
154
|
+
post = post_fields(*Model::CategoryGroup::COLUMNS)
|
155
|
+
id = request.params['id']
|
191
156
|
|
192
157
|
# Get/create the group and set the event names.
|
193
|
-
if
|
158
|
+
if id and !id.empty?
|
194
159
|
authorize_user!(:edit_category_group)
|
195
160
|
|
196
|
-
category_group = validate_category_group(
|
161
|
+
category_group = validate_category_group(id)
|
197
162
|
save_action = :save
|
198
|
-
before_event = :before_edit_category_group
|
199
|
-
after_event = :after_edit_category_group
|
200
163
|
else
|
201
164
|
authorize_user!(:new_category_group)
|
202
165
|
|
203
|
-
category_group =
|
166
|
+
category_group = Model::CategoryGroup.new
|
204
167
|
save_action = :new
|
205
|
-
before_event = :before_new_category_group
|
206
|
-
after_event = :after_new_category_group
|
207
168
|
end
|
208
169
|
|
209
170
|
success = lang("category_groups.success.#{save_action}")
|
210
171
|
error = lang("category_groups.errors.#{save_action}")
|
211
172
|
|
212
|
-
post.delete('id')
|
213
|
-
|
214
173
|
# Set the values, call the events and try to save the category group.
|
215
174
|
begin
|
216
|
-
|
217
|
-
Zen::Event.call(before_event, category_group)
|
218
|
-
|
175
|
+
category_group.set(post)
|
219
176
|
category_group.save
|
220
177
|
rescue => e
|
221
178
|
message(:error, error)
|
222
|
-
Ramaze::Log.error(e
|
179
|
+
Ramaze::Log.error(e)
|
223
180
|
|
224
|
-
flash[:form_data] =
|
181
|
+
flash[:form_data] = post
|
225
182
|
flash[:form_errors] = category_group.errors
|
226
183
|
|
227
184
|
redirect_referrer
|
228
185
|
end
|
229
186
|
|
230
|
-
Zen::Event.call(after_event, category_group)
|
231
|
-
|
232
187
|
message(:success, success)
|
233
188
|
redirect(CategoryGroups.r(:edit, category_group.id))
|
234
189
|
end
|
@@ -239,13 +194,11 @@ module Categories
|
|
239
194
|
#
|
240
195
|
# @since 0.1
|
241
196
|
# @permission delete_category_group
|
242
|
-
# @event before_delete_category_group
|
243
|
-
# @event after_delete_category_group
|
244
197
|
#
|
245
198
|
def delete
|
246
199
|
authorize_user!(:delete_category_group)
|
247
200
|
|
248
|
-
post =
|
201
|
+
post = post_fields(:category_group_ids)
|
249
202
|
|
250
203
|
if post['category_group_ids'].nil? or post['category_group_ids'].empty?
|
251
204
|
message(:error, lang('category_groups.errors.no_delete'))
|
@@ -253,22 +206,18 @@ module Categories
|
|
253
206
|
end
|
254
207
|
|
255
208
|
post['category_group_ids'].each do |id|
|
256
|
-
group =
|
209
|
+
group = Model::CategoryGroup[id]
|
257
210
|
|
258
211
|
next if group.nil?
|
259
212
|
|
260
|
-
Zen::Event.call(:before_delete_category_group, group)
|
261
|
-
|
262
213
|
begin
|
263
214
|
group.destroy
|
264
215
|
rescue => e
|
265
|
-
Ramaze::Log.error(e
|
216
|
+
Ramaze::Log.error(e)
|
266
217
|
message(:error, lang('category_groups.errors.delete') % id)
|
267
218
|
|
268
219
|
redirect_referrer
|
269
220
|
end
|
270
|
-
|
271
|
-
Zen::Event.call(:after_delete_category_group, group)
|
272
221
|
end
|
273
222
|
|
274
223
|
message(:success, lang('category_groups.success.delete'))
|