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
data/MANIFEST
DELETED
@@ -1,266 +0,0 @@
|
|
1
|
-
.travis.yml
|
2
|
-
AUTHORS
|
3
|
-
CHANGELOG.md
|
4
|
-
LICENSE
|
5
|
-
MANIFEST
|
6
|
-
README.md
|
7
|
-
Rakefile
|
8
|
-
bin/zen
|
9
|
-
lib/zen/asset.rb
|
10
|
-
lib/zen/bin/app.rb
|
11
|
-
lib/zen/controller/admin_controller.rb
|
12
|
-
lib/zen/controller/base_controller.rb
|
13
|
-
lib/zen/controller/frontend_controller.rb
|
14
|
-
lib/zen/controller/main_controller.rb
|
15
|
-
lib/zen/controller/preview.rb
|
16
|
-
lib/zen/error/language_error.rb
|
17
|
-
lib/zen/error/package_error.rb
|
18
|
-
lib/zen/error/plugin_error.rb
|
19
|
-
lib/zen/error/theme_error.rb
|
20
|
-
lib/zen/error/validation_error.rb
|
21
|
-
lib/zen/ext/string.rb
|
22
|
-
lib/zen/helper/acl.rb
|
23
|
-
lib/zen/helper/breadcrumb.rb
|
24
|
-
lib/zen/helper/common.rb
|
25
|
-
lib/zen/helper/message.rb
|
26
|
-
lib/zen/helper/theme.rb
|
27
|
-
lib/zen/language/en/zen_general.yml
|
28
|
-
lib/zen/language/en/zen_models.yml
|
29
|
-
lib/zen/language/nl/zen_general.yml
|
30
|
-
lib/zen/language/nl/zen_models.yml
|
31
|
-
lib/zen/language.rb
|
32
|
-
lib/zen/layout/admin.xhtml
|
33
|
-
lib/zen/layout/login.xhtml
|
34
|
-
lib/zen/model/methods.rb
|
35
|
-
lib/zen/model/settings.rb
|
36
|
-
lib/zen/package/all.rb
|
37
|
-
lib/zen/package/base.rb
|
38
|
-
lib/zen/package/categories/lib/categories/controller/categories.rb
|
39
|
-
lib/zen/package/categories/lib/categories/controller/category_groups.rb
|
40
|
-
lib/zen/package/categories/lib/categories/language/en/categories.yml
|
41
|
-
lib/zen/package/categories/lib/categories/language/en/category_groups.yml
|
42
|
-
lib/zen/package/categories/lib/categories/language/nl/categories.yml
|
43
|
-
lib/zen/package/categories/lib/categories/language/nl/category_groups.yml
|
44
|
-
lib/zen/package/categories/lib/categories/model/category.rb
|
45
|
-
lib/zen/package/categories/lib/categories/model/category_group.rb
|
46
|
-
lib/zen/package/categories/lib/categories/plugin/categories.rb
|
47
|
-
lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml
|
48
|
-
lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml
|
49
|
-
lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml
|
50
|
-
lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml
|
51
|
-
lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml
|
52
|
-
lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml
|
53
|
-
lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml
|
54
|
-
lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml
|
55
|
-
lib/zen/package/categories/lib/categories.rb
|
56
|
-
lib/zen/package/categories/migrations/.gitkeep
|
57
|
-
lib/zen/package/categories/migrations/1295282303_create_schema.rb
|
58
|
-
lib/zen/package/comments/lib/comments/controller/comments.rb
|
59
|
-
lib/zen/package/comments/lib/comments/controller/comments_form.rb
|
60
|
-
lib/zen/package/comments/lib/comments/language/en/comments.yml
|
61
|
-
lib/zen/package/comments/lib/comments/language/nl/comments.yml
|
62
|
-
lib/zen/package/comments/lib/comments/model/comment.rb
|
63
|
-
lib/zen/package/comments/lib/comments/plugin/anti_spam.rb
|
64
|
-
lib/zen/package/comments/lib/comments/plugin/comments.rb
|
65
|
-
lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml
|
66
|
-
lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml
|
67
|
-
lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml
|
68
|
-
lib/zen/package/comments/lib/comments.rb
|
69
|
-
lib/zen/package/comments/migrations/.gitkeep
|
70
|
-
lib/zen/package/comments/migrations/1295282202_create_schema.rb
|
71
|
-
lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb
|
72
|
-
lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb
|
73
|
-
lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml
|
74
|
-
lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml
|
75
|
-
lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml
|
76
|
-
lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml
|
77
|
-
lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb
|
78
|
-
lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb
|
79
|
-
lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb
|
80
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml
|
81
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml
|
82
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml
|
83
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml
|
84
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml
|
85
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml
|
86
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml
|
87
|
-
lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml
|
88
|
-
lib/zen/package/custom_fields/lib/custom_fields.rb
|
89
|
-
lib/zen/package/custom_fields/migrations/.gitkeep
|
90
|
-
lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb
|
91
|
-
lib/zen/package/menus/lib/menus/controller/menu_items.rb
|
92
|
-
lib/zen/package/menus/lib/menus/controller/menus.rb
|
93
|
-
lib/zen/package/menus/lib/menus/helper/menu_item.rb
|
94
|
-
lib/zen/package/menus/lib/menus/language/en/menu_items.yml
|
95
|
-
lib/zen/package/menus/lib/menus/language/en/menus.yml
|
96
|
-
lib/zen/package/menus/lib/menus/language/nl/menu_items.yml
|
97
|
-
lib/zen/package/menus/lib/menus/language/nl/menus.yml
|
98
|
-
lib/zen/package/menus/lib/menus/model/menu.rb
|
99
|
-
lib/zen/package/menus/lib/menus/model/menu_item.rb
|
100
|
-
lib/zen/package/menus/lib/menus/plugin/menus.rb
|
101
|
-
lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml
|
102
|
-
lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml
|
103
|
-
lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml
|
104
|
-
lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml
|
105
|
-
lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml
|
106
|
-
lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml
|
107
|
-
lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml
|
108
|
-
lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml
|
109
|
-
lib/zen/package/menus/lib/menus.rb
|
110
|
-
lib/zen/package/menus/migrations/.gitkeep
|
111
|
-
lib/zen/package/menus/migrations/1297184342_create_schema.rb
|
112
|
-
lib/zen/package/sections/lib/sections/controller/section_entries.rb
|
113
|
-
lib/zen/package/sections/lib/sections/controller/sections.rb
|
114
|
-
lib/zen/package/sections/lib/sections/language/en/section_entries.yml
|
115
|
-
lib/zen/package/sections/lib/sections/language/en/sections.yml
|
116
|
-
lib/zen/package/sections/lib/sections/language/nl/section_entries.yml
|
117
|
-
lib/zen/package/sections/lib/sections/language/nl/sections.yml
|
118
|
-
lib/zen/package/sections/lib/sections/model/section.rb
|
119
|
-
lib/zen/package/sections/lib/sections/model/section_entry.rb
|
120
|
-
lib/zen/package/sections/lib/sections/plugin/section_entries.rb
|
121
|
-
lib/zen/package/sections/lib/sections/plugin/sections.rb
|
122
|
-
lib/zen/package/sections/lib/sections/view/admin/edit.xhtml
|
123
|
-
lib/zen/package/sections/lib/sections/view/admin/form.xhtml
|
124
|
-
lib/zen/package/sections/lib/sections/view/admin/index.xhtml
|
125
|
-
lib/zen/package/sections/lib/sections/view/admin/new.xhtml
|
126
|
-
lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml
|
127
|
-
lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml
|
128
|
-
lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml
|
129
|
-
lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml
|
130
|
-
lib/zen/package/sections/lib/sections.rb
|
131
|
-
lib/zen/package/sections/migrations/.gitkeep
|
132
|
-
lib/zen/package/sections/migrations/1295251836_create_schema.rb
|
133
|
-
lib/zen/package/sections/migrations/1306772479_remove_unique_slug.rb
|
134
|
-
lib/zen/package/settings/lib/settings/controller/settings.rb
|
135
|
-
lib/zen/package/settings/lib/settings/language/en/settings.yml
|
136
|
-
lib/zen/package/settings/lib/settings/language/nl/settings.yml
|
137
|
-
lib/zen/package/settings/lib/settings/model/setting.rb
|
138
|
-
lib/zen/package/settings/lib/settings/plugin/group_base.rb
|
139
|
-
lib/zen/package/settings/lib/settings/plugin/setting_base.rb
|
140
|
-
lib/zen/package/settings/lib/settings/plugin/settings.rb
|
141
|
-
lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml
|
142
|
-
lib/zen/package/settings/lib/settings.rb
|
143
|
-
lib/zen/package/settings/migrations/.gitkeep
|
144
|
-
lib/zen/package/settings/migrations/1295597111_create_schema.rb
|
145
|
-
lib/zen/package/settings/migrations/1299538742_add_language_key.rb
|
146
|
-
lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
|
147
|
-
lib/zen/package/settings/migrations/1307796295_remove_website_enabled.rb
|
148
|
-
lib/zen/package/users/lib/users/controller/access_rules.rb
|
149
|
-
lib/zen/package/users/lib/users/controller/user_groups.rb
|
150
|
-
lib/zen/package/users/lib/users/controller/users.rb
|
151
|
-
lib/zen/package/users/lib/users/language/en/access_rules.yml
|
152
|
-
lib/zen/package/users/lib/users/language/en/user_groups.yml
|
153
|
-
lib/zen/package/users/lib/users/language/en/users.yml
|
154
|
-
lib/zen/package/users/lib/users/language/nl/access_rules.yml
|
155
|
-
lib/zen/package/users/lib/users/language/nl/user_groups.yml
|
156
|
-
lib/zen/package/users/lib/users/language/nl/users.yml
|
157
|
-
lib/zen/package/users/lib/users/model/access_rule.rb
|
158
|
-
lib/zen/package/users/lib/users/model/user.rb
|
159
|
-
lib/zen/package/users/lib/users/model/user_group.rb
|
160
|
-
lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js
|
161
|
-
lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml
|
162
|
-
lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml
|
163
|
-
lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml
|
164
|
-
lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml
|
165
|
-
lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml
|
166
|
-
lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml
|
167
|
-
lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml
|
168
|
-
lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml
|
169
|
-
lib/zen/package/users/lib/users/view/admin/users/edit.xhtml
|
170
|
-
lib/zen/package/users/lib/users/view/admin/users/form.xhtml
|
171
|
-
lib/zen/package/users/lib/users/view/admin/users/index.xhtml
|
172
|
-
lib/zen/package/users/lib/users/view/admin/users/login.xhtml
|
173
|
-
lib/zen/package/users/lib/users/view/admin/users/new.xhtml
|
174
|
-
lib/zen/package/users/lib/users.rb
|
175
|
-
lib/zen/package/users/migrations/.gitkeep
|
176
|
-
lib/zen/package/users/migrations/1295281013_create_schema.rb
|
177
|
-
lib/zen/package/users/migrations/1303510943_class_rules.rb
|
178
|
-
lib/zen/package/users/migrations/1304939855_user_settings.rb
|
179
|
-
lib/zen/package.rb
|
180
|
-
lib/zen/plugin/base.rb
|
181
|
-
lib/zen/plugin/controller.rb
|
182
|
-
lib/zen/plugin/helper.rb
|
183
|
-
lib/zen/plugin/markup/lib/markup/language/en/markup.yml
|
184
|
-
lib/zen/plugin/markup/lib/markup/markup.rb
|
185
|
-
lib/zen/plugin/markup/lib/markup.rb
|
186
|
-
lib/zen/plugin.rb
|
187
|
-
lib/zen/public/admin/css/zen/buttons.css
|
188
|
-
lib/zen/public/admin/css/zen/datepicker.css
|
189
|
-
lib/zen/public/admin/css/zen/editor.css
|
190
|
-
lib/zen/public/admin/css/zen/forms.css
|
191
|
-
lib/zen/public/admin/css/zen/general.css
|
192
|
-
lib/zen/public/admin/css/zen/grid.css
|
193
|
-
lib/zen/public/admin/css/zen/layout.css
|
194
|
-
lib/zen/public/admin/css/zen/messages.css
|
195
|
-
lib/zen/public/admin/css/zen/notifications.css
|
196
|
-
lib/zen/public/admin/css/zen/reset.css
|
197
|
-
lib/zen/public/admin/css/zen/tables.css
|
198
|
-
lib/zen/public/admin/css/zen/tabs.css
|
199
|
-
lib/zen/public/admin/css/zen/window.css
|
200
|
-
lib/zen/public/admin/images/zen/icons/accept.png
|
201
|
-
lib/zen/public/admin/images/zen/icons/add.png
|
202
|
-
lib/zen/public/admin/images/zen/icons/back.png
|
203
|
-
lib/zen/public/admin/images/zen/icons/bold.png
|
204
|
-
lib/zen/public/admin/images/zen/icons/close.png
|
205
|
-
lib/zen/public/admin/images/zen/icons/delete.png
|
206
|
-
lib/zen/public/admin/images/zen/icons/edit.png
|
207
|
-
lib/zen/public/admin/images/zen/icons/error.png
|
208
|
-
lib/zen/public/admin/images/zen/icons/help.png
|
209
|
-
lib/zen/public/admin/images/zen/icons/info.png
|
210
|
-
lib/zen/public/admin/images/zen/icons/italic.png
|
211
|
-
lib/zen/public/admin/images/zen/icons/large/error.png
|
212
|
-
lib/zen/public/admin/images/zen/icons/large/notice.png
|
213
|
-
lib/zen/public/admin/images/zen/icons/large/success.png
|
214
|
-
lib/zen/public/admin/images/zen/icons/link.png
|
215
|
-
lib/zen/public/admin/images/zen/icons/logout.png
|
216
|
-
lib/zen/public/admin/images/zen/icons/ol.png
|
217
|
-
lib/zen/public/admin/images/zen/icons/pdf.png
|
218
|
-
lib/zen/public/admin/images/zen/icons/preview.png
|
219
|
-
lib/zen/public/admin/images/zen/icons/ul.png
|
220
|
-
lib/zen/public/admin/images/zen/icons/user.png
|
221
|
-
lib/zen/public/admin/images/zen/icons/view.png
|
222
|
-
lib/zen/public/admin/js/mootools/core.js
|
223
|
-
lib/zen/public/admin/js/mootools/more.js
|
224
|
-
lib/zen/public/admin/js/vendor/datepicker.js
|
225
|
-
lib/zen/public/admin/js/zen/core.js
|
226
|
-
lib/zen/public/admin/js/zen/editor/markdown.js
|
227
|
-
lib/zen/public/admin/js/zen/editor/textile.js
|
228
|
-
lib/zen/public/admin/js/zen/editor.js
|
229
|
-
lib/zen/public/admin/js/zen/init.js
|
230
|
-
lib/zen/public/admin/js/zen/tabs.js
|
231
|
-
lib/zen/public/admin/js/zen/window.js
|
232
|
-
lib/zen/public/favicon.ico
|
233
|
-
lib/zen/task/build.rake
|
234
|
-
lib/zen/task/clean.rake
|
235
|
-
lib/zen/task/db.rake
|
236
|
-
lib/zen/task/package.rake
|
237
|
-
lib/zen/task/plugin.rake
|
238
|
-
lib/zen/task/proto.rake
|
239
|
-
lib/zen/task/test.rake
|
240
|
-
lib/zen/task/theme.rake
|
241
|
-
lib/zen/task.rb
|
242
|
-
lib/zen/theme/base.rb
|
243
|
-
lib/zen/theme.rb
|
244
|
-
lib/zen/validation.rb
|
245
|
-
lib/zen/version.rb
|
246
|
-
lib/zen/view/bottom.xhtml
|
247
|
-
lib/zen/view/main.xhtml
|
248
|
-
lib/zen.rb
|
249
|
-
proto/app/Rakefile
|
250
|
-
proto/app/app.rb
|
251
|
-
proto/app/config/config.rb
|
252
|
-
proto/app/config/database.rb
|
253
|
-
proto/app/config/middlewares.rb
|
254
|
-
proto/app/config.ru
|
255
|
-
proto/app/log/.gitkeep
|
256
|
-
proto/app/public/.gitkeep
|
257
|
-
proto/app/start.rb
|
258
|
-
proto/app/task/.gitkeep
|
259
|
-
proto/app/theme/.gitkeep
|
260
|
-
proto/migration.rb
|
261
|
-
proto/package/lib/package/controller/controllers.rb
|
262
|
-
proto/package/lib/package/language/en/languages.yml
|
263
|
-
proto/package/lib/package/model/model.rb
|
264
|
-
proto/package/lib/package/view/admin/package/index.xhtml
|
265
|
-
proto/package/lib/package.rb
|
266
|
-
proto/package/migrations/.gitkeep
|
data/lib/zen/bin/app.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
##
|
4
|
-
# Command that can be used to generate a new application.
|
5
|
-
#
|
6
|
-
# @author Yorick Peterse
|
7
|
-
# @since 0.2.5
|
8
|
-
#
|
9
|
-
command :app do |cmd|
|
10
|
-
# Set a few details of the command
|
11
|
-
cmd.syntax = '$ zen app [NAME]'
|
12
|
-
cmd.description = 'Creates a new application powered by Zen.'
|
13
|
-
|
14
|
-
cmd.option('-f', TrueClass, 'Overwrites any existing application.')
|
15
|
-
|
16
|
-
# The action to execute when the command is invoked
|
17
|
-
cmd.action do |args, opts|
|
18
|
-
if args.empty?
|
19
|
-
abort 'You need to specify a name for the application.'
|
20
|
-
end
|
21
|
-
|
22
|
-
name = args[0]
|
23
|
-
app = File.join('./', name)
|
24
|
-
proto = File.expand_path('../../../../proto/app', __FILE__)
|
25
|
-
|
26
|
-
if File.directory?(app) and !opts.f
|
27
|
-
abort "The application #{app} alread exists, use -f to overwrite it."
|
28
|
-
else
|
29
|
-
FileUtils.rm_rf(app)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Copy the prototype
|
33
|
-
begin
|
34
|
-
FileUtils.cp_r(proto, app)
|
35
|
-
puts "The application has been generated and saved in #{app}"
|
36
|
-
rescue => e
|
37
|
-
abort "Failed to generate the application: #{e.message}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/lib/zen/ext/string.rb
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Extension to the string class provided by Ruby that provides the following 2 methods:
|
3
|
-
#
|
4
|
-
# * String.pluralize
|
5
|
-
# * String.singularize
|
6
|
-
#
|
7
|
-
# Note that these methods only work for English words, other languages such as Japanese
|
8
|
-
# or French aren't supported at this time (January, 2011). This snippet also doesn't cover
|
9
|
-
# every single english word, patches are welcome!
|
10
|
-
#
|
11
|
-
# @author Yorick Peterse, Michael Fellinger
|
12
|
-
# @since 1.0
|
13
|
-
#
|
14
|
-
class String
|
15
|
-
##
|
16
|
-
# Constant containing all regular expressions for singular strings (that will be pluralized)
|
17
|
-
# and their replacements.
|
18
|
-
#
|
19
|
-
# @since 1.0
|
20
|
-
#
|
21
|
-
SingularToPlural = {
|
22
|
-
/ss$/ => 'sses',
|
23
|
-
/se$/ => 'ses',
|
24
|
-
/sh$/ => 'shes',
|
25
|
-
/ge$/ => 'ges',
|
26
|
-
/ch$/ => 'ches',
|
27
|
-
/ge$/ => 'ges',
|
28
|
-
/g$/ => 'gs',
|
29
|
-
|
30
|
-
# When the singular form ends in a voiceless consonant (other than a sibilant).
|
31
|
-
#
|
32
|
-
# lap => laps
|
33
|
-
# cat => cats
|
34
|
-
# clock => clocks
|
35
|
-
# cuff => cuffs
|
36
|
-
# death => deaths
|
37
|
-
/ap$/ => 'aps',
|
38
|
-
/at$/ => 'ats',
|
39
|
-
/ck$/ => 'cks',
|
40
|
-
/ff$/ => 'ffs',
|
41
|
-
/th$/ => 'ths',
|
42
|
-
|
43
|
-
# Most nouns ending in o preceded by a consonant also form their plurals by adding -es
|
44
|
-
#
|
45
|
-
# hero => heroes
|
46
|
-
# potato => potatoes
|
47
|
-
# volcano => volcanoes or volcanos
|
48
|
-
/o$/ => 'oes',
|
49
|
-
|
50
|
-
# nouns ending in a y preceded by a consonant usually drop the y and add -ies
|
51
|
-
#
|
52
|
-
# cherry => cherries
|
53
|
-
# lady => ladies
|
54
|
-
# ywzxvtsrqpnmlkjhgfdcb
|
55
|
-
#
|
56
|
-
/([bcdfghjklmnpqrstvxzwy]+)y$/ => "\\1ies",
|
57
|
-
|
58
|
-
# For all other words (i.e. words ending in vowels or voiced non-sibilants).
|
59
|
-
#
|
60
|
-
# boy => boys
|
61
|
-
# girl => girls
|
62
|
-
# chair => chairs
|
63
|
-
# quiz => quizes
|
64
|
-
/z$/ => 'zes',
|
65
|
-
/y$/ => 'ys',
|
66
|
-
/l$/ => 'ls',
|
67
|
-
/r$/ => 'rs'
|
68
|
-
}
|
69
|
-
|
70
|
-
##
|
71
|
-
# Constant containing all regular expressions used to convert plural words to
|
72
|
-
# singular words.
|
73
|
-
#
|
74
|
-
# @since 1.0
|
75
|
-
#
|
76
|
-
PluralToSingular = {
|
77
|
-
/sses$/ => 'ss',
|
78
|
-
/ses$/ => 'se',
|
79
|
-
/shes$/ => 'sh',
|
80
|
-
/ges$/ => 'ges',
|
81
|
-
/ches$/ => 'ches',
|
82
|
-
/ges$/ => 'ges',
|
83
|
-
/aps$/ => 'ap',
|
84
|
-
/ats$/ => 'at',
|
85
|
-
/cks$/ => 'ck',
|
86
|
-
/ffs$/ => 'ff',
|
87
|
-
/ths$/ => 'th',
|
88
|
-
/oes$/ => 'o',
|
89
|
-
/ies$/ => 'y',
|
90
|
-
/zes$/ => 'z',
|
91
|
-
/ys$/ => 'y',
|
92
|
-
/l$/ => 'ls',
|
93
|
-
/r$/ => 'rs',
|
94
|
-
/s$/ => ''
|
95
|
-
}
|
96
|
-
|
97
|
-
##
|
98
|
-
# Tries to convert a string to it's pluralized version. For example, "user" would
|
99
|
-
# result in "users" and "quiz" will result in "quizes". This method will return
|
100
|
-
# the pluralized string, use pluralize! to overwrite the current (singular) version
|
101
|
-
# of the string with the pluralized one.
|
102
|
-
#
|
103
|
-
# @example
|
104
|
-
#
|
105
|
-
# "user".pluralize # => users
|
106
|
-
# "baby".pluralize # => babies
|
107
|
-
#
|
108
|
-
# @author Yorick Peterse, Michael Fellinger
|
109
|
-
# @return [String] The pluralized version of the string.
|
110
|
-
# @since 1.0
|
111
|
-
#
|
112
|
-
def pluralize
|
113
|
-
string = self.dup
|
114
|
-
|
115
|
-
SingularToPlural.each do |regex, replace|
|
116
|
-
new_string = string.gsub(regex, replace)
|
117
|
-
|
118
|
-
if new_string != string
|
119
|
-
return new_string
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
return string
|
124
|
-
end
|
125
|
-
|
126
|
-
##
|
127
|
-
# Converts the current string into a pluralized form and
|
128
|
-
# overwrites the old value rather than returning it.
|
129
|
-
#
|
130
|
-
# @example
|
131
|
-
#
|
132
|
-
# word = "user"
|
133
|
-
# word.pluralize! # => nil
|
134
|
-
#
|
135
|
-
# puts word # => users
|
136
|
-
#
|
137
|
-
# @since 1.0
|
138
|
-
#
|
139
|
-
def pluralize!
|
140
|
-
self.replace(self.pluralize)
|
141
|
-
end
|
142
|
-
|
143
|
-
##
|
144
|
-
# Tries to convert the current string into a singular version.
|
145
|
-
#
|
146
|
-
# @example
|
147
|
-
#
|
148
|
-
# "users".singularize # => user
|
149
|
-
# "babies".singularize # => baby
|
150
|
-
#
|
151
|
-
# @author Yorick Peterse
|
152
|
-
# @return [String] a singular form of the string
|
153
|
-
# @since 1.0
|
154
|
-
#
|
155
|
-
def singularize
|
156
|
-
string = self.dup
|
157
|
-
|
158
|
-
PluralToSingular.each do |regex, replace|
|
159
|
-
new_string = string.gsub(regex, replace)
|
160
|
-
|
161
|
-
if new_string != string
|
162
|
-
return new_string
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
return string
|
167
|
-
end
|
168
|
-
|
169
|
-
##
|
170
|
-
# Converts a plural string to it's singular form and replaces
|
171
|
-
# the current value of the string with this singular version.
|
172
|
-
#
|
173
|
-
# @example
|
174
|
-
#
|
175
|
-
# word = "users"
|
176
|
-
# word.singularize! # => nil
|
177
|
-
#
|
178
|
-
# puts word # => user
|
179
|
-
#
|
180
|
-
# @since 1.0
|
181
|
-
#
|
182
|
-
def singularize!
|
183
|
-
self.replace(self.singularize)
|
184
|
-
end
|
185
|
-
end
|