zen 0.1a
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/MANIFEST +337 -0
- data/README.textile +42 -0
- data/Rakefile +6 -0
- data/bin/zen +9 -0
- data/doc/Categories.html +93 -0
- data/doc/Categories/Controllers.html +93 -0
- data/doc/Categories/Controllers/Categories.html +995 -0
- data/doc/Categories/Controllers/CategoryGroups.html +878 -0
- data/doc/Categories/Models.html +97 -0
- data/doc/Categories/Models/Category.html +269 -0
- data/doc/Categories/Models/CategoryGroup.html +231 -0
- data/doc/Comments.html +93 -0
- data/doc/Comments/Controllers.html +93 -0
- data/doc/Comments/Controllers/Comments.html +797 -0
- data/doc/Comments/Controllers/CommentsForm.html +487 -0
- data/doc/Comments/Liquid.html +93 -0
- data/doc/Comments/Liquid/CommentForm.html +522 -0
- data/doc/Comments/Liquid/Comments.html +543 -0
- data/doc/Comments/Models.html +95 -0
- data/doc/Comments/Models/Comment.html +260 -0
- data/doc/CustomFields.html +93 -0
- data/doc/CustomFields/Controllers.html +93 -0
- data/doc/CustomFields/Controllers/CustomFieldGroups.html +902 -0
- data/doc/CustomFields/Controllers/CustomFields.html +974 -0
- data/doc/CustomFields/Models.html +97 -0
- data/doc/CustomFields/Models/CustomField.html +272 -0
- data/doc/CustomFields/Models/CustomFieldGroup.html +259 -0
- data/doc/CustomFields/Models/CustomFieldValue.html +154 -0
- data/doc/Ramaze.html +93 -0
- data/doc/Ramaze/Helper.html +93 -0
- data/doc/Ramaze/Helper/ACL.html +531 -0
- data/doc/Ramaze/Helper/Asset.html +617 -0
- data/doc/Ramaze/Helper/Breadcrumb.html +411 -0
- data/doc/Ramaze/Helper/Common.html +738 -0
- data/doc/Sections.html +93 -0
- data/doc/Sections/Controllers.html +93 -0
- data/doc/Sections/Controllers/SectionEntries.html +1100 -0
- data/doc/Sections/Controllers/Sections.html +953 -0
- data/doc/Sections/Liquid.html +93 -0
- data/doc/Sections/Liquid/SectionEntries.html +674 -0
- data/doc/Sections/Liquid/Sections.html +494 -0
- data/doc/Sections/Models.html +97 -0
- data/doc/Sections/Models/Section.html +272 -0
- data/doc/Sections/Models/SectionEntry.html +264 -0
- data/doc/Sequel.html +91 -0
- data/doc/Sequel/Model.html +243 -0
- data/doc/Settings.html +93 -0
- data/doc/Settings/Controllers.html +91 -0
- data/doc/Settings/Controllers/Settings.html +565 -0
- data/doc/Settings/Liquid.html +91 -0
- data/doc/Settings/Liquid/Setting.html +426 -0
- data/doc/Settings/Models.html +95 -0
- data/doc/Settings/Models/Setting.html +293 -0
- data/doc/Users.html +93 -0
- data/doc/Users/Controllers.html +93 -0
- data/doc/Users/Controllers/AccessRules.html +904 -0
- data/doc/Users/Controllers/UserGroups.html +879 -0
- data/doc/Users/Controllers/Users.html +1124 -0
- data/doc/Users/Liquid.html +93 -0
- data/doc/Users/Liquid/User.html +480 -0
- data/doc/Users/Liquid/Users.html +495 -0
- data/doc/Users/Models.html +97 -0
- data/doc/Users/Models/AccessRule.html +257 -0
- data/doc/Users/Models/User.html +649 -0
- data/doc/Users/Models/UserGroup.html +267 -0
- data/doc/Zen.html +391 -0
- data/doc/Zen/Bin.html +113 -0
- data/doc/Zen/Bin/Base.html +727 -0
- data/doc/Zen/Controllers.html +115 -0
- data/doc/Zen/Controllers/AdminController.html +298 -0
- data/doc/Zen/Controllers/BaseController.html +272 -0
- data/doc/Zen/Controllers/FrontendController.html +164 -0
- data/doc/Zen/Controllers/MainController.html +421 -0
- data/doc/Zen/Database.html +498 -0
- data/doc/Zen/Language.html +660 -0
- data/doc/Zen/Liquid.html +117 -0
- data/doc/Zen/Liquid/ControllerBehavior.html +448 -0
- data/doc/Zen/Liquid/General.html +444 -0
- data/doc/Zen/Liquid/Redirect.html +435 -0
- data/doc/Zen/Liquid/Strip.html +447 -0
- data/doc/Zen/Logger.html +393 -0
- data/doc/Zen/Package.html +909 -0
- data/doc/_index.html +724 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +310 -0
- data/doc/file.README.html +86 -0
- data/doc/file_list.html +38 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +86 -0
- data/doc/js/app.js +203 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +154 -0
- data/doc/method_list.html +1139 -0
- data/doc/top-level-namespace.html +88 -0
- data/lib/zen.rb +77 -0
- data/lib/zen/base/database.rb +105 -0
- data/lib/zen/base/language.rb +132 -0
- data/lib/zen/base/logger.rb +54 -0
- data/lib/zen/base/package.rb +233 -0
- data/lib/zen/base/version.rb +11 -0
- data/lib/zen/bin/zen_binary.rb +173 -0
- data/lib/zen/controller/admin_controller.rb +60 -0
- data/lib/zen/controller/base_controller.rb +39 -0
- data/lib/zen/controller/frontend_controller.rb +16 -0
- data/lib/zen/controller/main_controller.rb +93 -0
- data/lib/zen/helper/acl.rb +124 -0
- data/lib/zen/helper/asset.rb +104 -0
- data/lib/zen/helper/breadcrumb.rb +71 -0
- data/lib/zen/helper/common.rb +157 -0
- data/lib/zen/language/en/zen_general.rb +21 -0
- data/lib/zen/language/en/zen_models.rb +39 -0
- data/lib/zen/layout/admin.xhtml +72 -0
- data/lib/zen/layout/login.xhtml +44 -0
- data/lib/zen/liquid/controller_behavior.rb +55 -0
- data/lib/zen/liquid/general.rb +69 -0
- data/lib/zen/liquid/redirect.rb +47 -0
- data/lib/zen/liquid/strip.rb +58 -0
- data/lib/zen/model/methods.rb +26 -0
- data/lib/zen/model/settings.rb +27 -0
- data/lib/zen/packages/categories/LICENSE +19 -0
- data/lib/zen/packages/categories/README.textile +0 -0
- data/lib/zen/packages/categories/lib/categories.rb +24 -0
- data/lib/zen/packages/categories/lib/categories/controller/categories.rb +202 -0
- data/lib/zen/packages/categories/lib/categories/controller/category_groups.rb +173 -0
- data/lib/zen/packages/categories/lib/categories/language/en/categories.rb +38 -0
- data/lib/zen/packages/categories/lib/categories/language/en/category_groups.rb +37 -0
- data/lib/zen/packages/categories/lib/categories/model/category.rb +42 -0
- data/lib/zen/packages/categories/lib/categories/model/category_group.rb +29 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/edit.xhtml +7 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/form.xhtml +36 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/index.xhtml +70 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/new.xhtml +7 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/edit.xhtml +7 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/form.xhtml +18 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/index.xhtml +72 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/new.xhtml +7 -0
- data/lib/zen/packages/categories/migrations/.gitkeep +0 -0
- data/lib/zen/packages/categories/migrations/1295282303_create_schema.rb +40 -0
- data/lib/zen/packages/comments/LICENSE +19 -0
- data/lib/zen/packages/comments/README.textile +0 -0
- data/lib/zen/packages/comments/lib/comments.rb +26 -0
- data/lib/zen/packages/comments/lib/comments/controller/comments.rb +157 -0
- data/lib/zen/packages/comments/lib/comments/controller/comments_form.rb +135 -0
- data/lib/zen/packages/comments/lib/comments/language/en/comments.rb +52 -0
- data/lib/zen/packages/comments/lib/comments/liquid/comment_form.rb +97 -0
- data/lib/zen/packages/comments/lib/comments/liquid/comments.rb +115 -0
- data/lib/zen/packages/comments/lib/comments/model/comment.rb +34 -0
- data/lib/zen/packages/comments/lib/comments/view/admin/comments/edit.xhtml +7 -0
- data/lib/zen/packages/comments/lib/comments/view/admin/comments/form.xhtml +31 -0
- data/lib/zen/packages/comments/lib/comments/view/admin/comments/index.xhtml +74 -0
- data/lib/zen/packages/comments/migrations/.gitkeep +0 -0
- data/lib/zen/packages/comments/migrations/1295282202_create_schema.rb +24 -0
- data/lib/zen/packages/comments/migrations/1296949631_add_defensio_signature.rb +11 -0
- data/lib/zen/packages/custom_fields/LICENSE +19 -0
- data/lib/zen/packages/custom_fields/README.textile +0 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields.rb +24 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +179 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/controller/custom_fields.rb +194 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/language/en/custom_field_groups.rb +45 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/language/en/custom_fields.rb +64 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/model/custom_field.rb +41 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/model/custom_field_group.rb +32 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/model/custom_field_value.rb +20 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/edit.xhtml +7 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/form.xhtml +18 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/index.xhtml +88 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/new.xhtml +7 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/edit.xhtml +7 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/form.xhtml +50 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/index.xhtml +75 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/new.xhtml +7 -0
- data/lib/zen/packages/custom_fields/migrations/.gitkeep +0 -0
- data/lib/zen/packages/custom_fields/migrations/1295255665_create_schema.rb +53 -0
- data/lib/zen/packages/sections/LICENSE +19 -0
- data/lib/zen/packages/sections/README.textile +43 -0
- data/lib/zen/packages/sections/lib/sections.rb +33 -0
- data/lib/zen/packages/sections/lib/sections/controller/section_entries.rb +251 -0
- data/lib/zen/packages/sections/lib/sections/controller/sections.rb +205 -0
- data/lib/zen/packages/sections/lib/sections/language/en/section_entries.rb +58 -0
- data/lib/zen/packages/sections/lib/sections/language/en/sections.rb +63 -0
- data/lib/zen/packages/sections/lib/sections/liquid/section_entries.rb +209 -0
- data/lib/zen/packages/sections/lib/sections/liquid/sections.rb +76 -0
- data/lib/zen/packages/sections/lib/sections/model/section.rb +43 -0
- data/lib/zen/packages/sections/lib/sections/model/section_entry.rb +43 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/edit.xhtml +7 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/form.xhtml +54 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/index.xhtml +77 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/new.xhtml +7 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/edit.xhtml +7 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/form.xhtml +147 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/index.xhtml +74 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/new.xhtml +7 -0
- data/lib/zen/packages/sections/migrations/.gitkeep +0 -0
- data/lib/zen/packages/sections/migrations/1295251836_create_schema.rb +35 -0
- data/lib/zen/packages/sections/migrations/1296335671_userdata_section_entries.rb +18 -0
- data/lib/zen/packages/sections/migrations/1296936110_drop_comment_antispam.rb +11 -0
- data/lib/zen/packages/settings/LICENSE +0 -0
- data/lib/zen/packages/settings/README.textile +0 -0
- data/lib/zen/packages/settings/lib/settings.rb +22 -0
- data/lib/zen/packages/settings/lib/settings/controller/settings.rb +113 -0
- data/lib/zen/packages/settings/lib/settings/language/en/settings.rb +56 -0
- data/lib/zen/packages/settings/lib/settings/liquid/setting.rb +56 -0
- data/lib/zen/packages/settings/lib/settings/model/setting.rb +38 -0
- data/lib/zen/packages/settings/lib/settings/view/admin/settings/index.xhtml +79 -0
- data/lib/zen/packages/settings/migrations/.gitkeep +0 -0
- data/lib/zen/packages/settings/migrations/1295597111_create_schema.rb +31 -0
- data/lib/zen/packages/users/LICENSE +19 -0
- data/lib/zen/packages/users/README.textile +0 -0
- data/lib/zen/packages/users/lib/users.rb +35 -0
- data/lib/zen/packages/users/lib/users/controller/access_rules.rb +186 -0
- data/lib/zen/packages/users/lib/users/controller/user_groups.rb +171 -0
- data/lib/zen/packages/users/lib/users/controller/users.rb +240 -0
- data/lib/zen/packages/users/lib/users/language/en/access_rules.rb +49 -0
- data/lib/zen/packages/users/lib/users/language/en/user_groups.rb +42 -0
- data/lib/zen/packages/users/lib/users/language/en/users.rb +63 -0
- data/lib/zen/packages/users/lib/users/liquid/user.rb +75 -0
- data/lib/zen/packages/users/lib/users/liquid/users.rb +80 -0
- data/lib/zen/packages/users/lib/users/model/access_rule.rb +29 -0
- data/lib/zen/packages/users/lib/users/model/user.rb +96 -0
- data/lib/zen/packages/users/lib/users/model/user_group.rb +38 -0
- data/lib/zen/packages/users/lib/users/public/admin/js/users/access_rules.js +43 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/edit.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/form.xhtml +68 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/index.xhtml +85 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/new.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/edit.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/form.xhtml +19 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/index.xhtml +69 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/new.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/edit.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/form.xhtml +25 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/index.xhtml +73 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/login.xhtml +22 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/new.xhtml +7 -0
- data/lib/zen/packages/users/migrations/.gitkeep +0 -0
- data/lib/zen/packages/users/migrations/1295281013_create_schema.rb +54 -0
- data/lib/zen/public/admin/css/boilerplate.css +174 -0
- data/lib/zen/public/admin/css/general.css +485 -0
- data/lib/zen/public/admin/css/grid.css +119 -0
- data/lib/zen/public/admin/css/layout.css +111 -0
- data/lib/zen/public/admin/images/general/noise.jpg +0 -0
- data/lib/zen/public/admin/images/icons/accept.png +0 -0
- data/lib/zen/public/admin/images/icons/add.png +0 -0
- data/lib/zen/public/admin/images/icons/back.png +0 -0
- data/lib/zen/public/admin/images/icons/bold.png +0 -0
- data/lib/zen/public/admin/images/icons/close.png +0 -0
- data/lib/zen/public/admin/images/icons/delete.png +0 -0
- data/lib/zen/public/admin/images/icons/edit.png +0 -0
- data/lib/zen/public/admin/images/icons/error.png +0 -0
- data/lib/zen/public/admin/images/icons/help.png +0 -0
- data/lib/zen/public/admin/images/icons/info.png +0 -0
- data/lib/zen/public/admin/images/icons/italic.png +0 -0
- data/lib/zen/public/admin/images/icons/large/error.png +0 -0
- data/lib/zen/public/admin/images/icons/large/notice.png +0 -0
- data/lib/zen/public/admin/images/icons/large/success.png +0 -0
- data/lib/zen/public/admin/images/icons/link.png +0 -0
- data/lib/zen/public/admin/images/icons/logout.png +0 -0
- data/lib/zen/public/admin/images/icons/ol.png +0 -0
- data/lib/zen/public/admin/images/icons/pdf.png +0 -0
- data/lib/zen/public/admin/images/icons/ul.png +0 -0
- data/lib/zen/public/admin/images/icons/user.png +0 -0
- data/lib/zen/public/admin/images/icons/view.png +0 -0
- data/lib/zen/public/admin/js/mootools/core.js +436 -0
- data/lib/zen/public/admin/js/mootools/more.js +288 -0
- data/lib/zen/public/admin/js/zen/editor/base.js +265 -0
- data/lib/zen/public/admin/js/zen/editor/drivers/html.js +104 -0
- data/lib/zen/public/admin/js/zen/editor/drivers/markdown.js +102 -0
- data/lib/zen/public/admin/js/zen/editor/drivers/textile.js +102 -0
- data/lib/zen/public/admin/js/zen/init.js +57 -0
- data/lib/zen/public/admin/js/zen/modal.js +159 -0
- data/lib/zen/public/admin/js/zen/notification.js +213 -0
- data/lib/zen/public/admin/js/zen/tabs.js +263 -0
- data/lib/zen/tasks.rb +6 -0
- data/pkg/.gitkeep +0 -0
- data/proto/app/Rakefile +2 -0
- data/proto/app/app.rb +20 -0
- data/proto/app/config.ru +18 -0
- data/proto/app/config/config.rb +17 -0
- data/proto/app/config/database.rb +18 -0
- data/proto/app/config/middlewares.rb +23 -0
- data/proto/app/config/requires.rb +8 -0
- data/proto/app/logs/.gitkeep +0 -0
- data/proto/app/public/.gitkeep +0 -0
- data/proto/app/start.rb +22 -0
- data/proto/app/vendor/.gitkeep +0 -0
- data/proto/app/vendor/themes/.gitkeep +0 -0
- data/proto/migration.rb +11 -0
- data/proto/module/LICENSE +0 -0
- data/proto/module/README.textile +0 -0
- data/proto/module/lib/module.rb +15 -0
- data/proto/module/lib/module/controller/controllers.rb +86 -0
- data/proto/module/lib/module/language/en/languages.rb +3 -0
- data/proto/module/lib/module/model/model.rb +12 -0
- data/proto/module/lib/module/view/admin/edit.xhtml +0 -0
- data/proto/module/lib/module/view/admin/form.xhtml +0 -0
- data/proto/module/lib/module/view/admin/index.xhtml +0 -0
- data/proto/module/lib/module/view/admin/new.xhtml +0 -0
- data/proto/module/migrations/.gitkeep +0 -0
- data/spec/javascript/css/base.css +177 -0
- data/spec/javascript/css/style.css +204 -0
- data/spec/javascript/css/typography.css +70 -0
- data/spec/javascript/editor/index.html +65 -0
- data/spec/javascript/images/close.png +0 -0
- data/spec/javascript/images/info.png +0 -0
- data/spec/javascript/js/editor.js +16 -0
- data/spec/javascript/js/modal.js +12 -0
- data/spec/javascript/js/namespace.js +2 -0
- data/spec/javascript/js/notification.js +43 -0
- data/spec/javascript/js/tabs.js +8 -0
- data/spec/javascript/modal/index.html +45 -0
- data/spec/javascript/notification/index.html +48 -0
- data/spec/javascript/tabs/index.html +73 -0
- data/spec/javascript/tabs/tab_1.html +1 -0
- data/spec/javascript/tabs/tab_2.html +1 -0
- data/spec/zen/base/language.rb +31 -0
- data/spec/zen/base/logger.rb +34 -0
- data/spec/zen/base/package.rb +47 -0
- data/spec/zen/config/database.rb +8 -0
- data/spec/zen/helper/asset.rb +26 -0
- data/spec/zen/helper/breadcrumb.rb +24 -0
- data/spec/zen/language/en/general.rb +4 -0
- data/spec/zen/language/nl/general.rb +4 -0
- data/spec/zen/liquid/general.rb +42 -0
- data/spec/zen/logs/.gitkeep +0 -0
- data/spec/zen/spec.rb +9 -0
- data/spec/zen/spec_database.db +0 -0
- data/tasks/bacon.rake +99 -0
- data/tasks/build.rake +72 -0
- data/tasks/clean.rake +18 -0
- data/tasks/db.rake +81 -0
- data/tasks/doc.rake +5 -0
- data/tasks/extension.rake +65 -0
- data/tasks/proto.rake +37 -0
- data/tasks/theme.rake +63 -0
- metadata +512 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
module Sections
|
2
|
+
module Liquid
|
3
|
+
##
|
4
|
+
# Tag that can be used to retrieve a number of sections. By default
|
5
|
+
# all sections will be retrieved but you can specify a specific section
|
6
|
+
# by setting the "section" key.
|
7
|
+
#
|
8
|
+
# @example Basic usage
|
9
|
+
# {% sections section="pages" %}
|
10
|
+
# {{description}}
|
11
|
+
# {% endsections %}
|
12
|
+
#
|
13
|
+
# The following arguments can be specified:
|
14
|
+
#
|
15
|
+
# * section
|
16
|
+
# * limit
|
17
|
+
# * offset
|
18
|
+
#
|
19
|
+
# @author Yorick Peterse
|
20
|
+
# @since 0.1
|
21
|
+
#
|
22
|
+
class Sections < ::Liquid::Block
|
23
|
+
include ::Zen::Liquid::General
|
24
|
+
|
25
|
+
##
|
26
|
+
# Creates a new instance of the block and passes the tag name,
|
27
|
+
# all additional arguments and the HTML to the constructor method.
|
28
|
+
#
|
29
|
+
# @author Yorick Peterse
|
30
|
+
# @param [String] tag_name The name of the tag that was called.
|
31
|
+
# @param [String] arguments All additional arguments passed as a string.
|
32
|
+
# @param [String] html The HTML inside the block.
|
33
|
+
# @since 0.1
|
34
|
+
#
|
35
|
+
def initialize tag_name, arguments, html
|
36
|
+
super
|
37
|
+
|
38
|
+
@arguments = {
|
39
|
+
'limit' => nil,
|
40
|
+
'offset' => nil
|
41
|
+
}
|
42
|
+
|
43
|
+
@arguments = @arguments.merge(parse_key_values(arguments))
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Renders the tag
|
48
|
+
#
|
49
|
+
# @author Yorick Peterse
|
50
|
+
# @param [Object] context The Liquid context for the current tag.
|
51
|
+
# @return [Array]
|
52
|
+
#
|
53
|
+
def render context
|
54
|
+
result = []
|
55
|
+
|
56
|
+
if !@arguments.key?('section')
|
57
|
+
sections = ::Sections::Models::Section.limit(@arguments['limit'], @arguments['offset'])
|
58
|
+
else
|
59
|
+
sections = ::Sections::Models::Section.filter(:slug => @arguments['section'])
|
60
|
+
.limit(@arguments['limit'], @arguments['offset'])
|
61
|
+
end
|
62
|
+
|
63
|
+
sections.each do |s|
|
64
|
+
s.values.each do |k, v|
|
65
|
+
context[k.to_s] =v
|
66
|
+
end
|
67
|
+
|
68
|
+
result << render_all(@nodelist, context)
|
69
|
+
end
|
70
|
+
|
71
|
+
result << render_all(@nodelist, context) if result.empty?
|
72
|
+
return result
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Sections
|
2
|
+
module Models
|
3
|
+
##
|
4
|
+
# Model that represents a single section. This model has the following
|
5
|
+
# relations:
|
6
|
+
#
|
7
|
+
# * section entries (one to many), eager loads the custom field values
|
8
|
+
# * custom field group (many to many)
|
9
|
+
# * category groups (many to many)
|
10
|
+
#
|
11
|
+
# The following plugins are loaded by this model:
|
12
|
+
#
|
13
|
+
# * sluggable (source: "name")
|
14
|
+
#
|
15
|
+
# @author Yorick Peterse
|
16
|
+
# @since 0.1
|
17
|
+
#
|
18
|
+
class Section < Sequel::Model
|
19
|
+
one_to_many :section_entries, :class => "Sections::Models::SectionEntry", :eager => [:custom_field_values]
|
20
|
+
|
21
|
+
many_to_many :custom_field_groups, :class => "CustomFields::Models::CustomFieldGroup"
|
22
|
+
many_to_many :category_groups, :class => "Categories::Models::CategoryGroup"
|
23
|
+
|
24
|
+
plugin :sluggable, :source => :name, :freeze => false
|
25
|
+
|
26
|
+
##
|
27
|
+
# Specifies all validation rules for each section.
|
28
|
+
#
|
29
|
+
# @author Yorick Peterse
|
30
|
+
# @since 0.1
|
31
|
+
#
|
32
|
+
def validate
|
33
|
+
validates_presence [:name, :comment_allow, :comment_require_account, :comment_moderate, :comment_antispam, :comment_format]
|
34
|
+
validates_presence :slug unless new?
|
35
|
+
validates_max_length 255, [:name, :slug]
|
36
|
+
|
37
|
+
validates_type TrueClass, [:comment_allow, :comment_require_account, :comment_moderate, :comment_antispam]
|
38
|
+
|
39
|
+
validates_unique :slug
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Sections
|
2
|
+
module Models
|
3
|
+
##
|
4
|
+
# Model that represents a singe section entry. This model has the following
|
5
|
+
# relations:
|
6
|
+
#
|
7
|
+
# * comments (one to many)
|
8
|
+
# * custom field values (one to many), eager loads all custom fields
|
9
|
+
# * categories (many to many)
|
10
|
+
# * sections (many to one)
|
11
|
+
#
|
12
|
+
# The following plugins are loaded by this model
|
13
|
+
#
|
14
|
+
# * sluggable (source "title")
|
15
|
+
# * timestamps
|
16
|
+
#
|
17
|
+
# @author Yorick Peterse
|
18
|
+
# @since 0.1
|
19
|
+
#
|
20
|
+
class SectionEntry < Sequel::Model
|
21
|
+
one_to_many :comments , :class => "Comments::Models::Comment"
|
22
|
+
one_to_many :custom_field_values, :class => "CustomFields::Models::CustomFieldValue", :eager => [:custom_field]
|
23
|
+
|
24
|
+
many_to_one :user , :class => "Users::Models::User"
|
25
|
+
many_to_many :categories, :class => "Categories::Models::Category"
|
26
|
+
many_to_one :section , :class => "Sections::Models::Section"
|
27
|
+
|
28
|
+
plugin :sluggable , :source => :title , :freeze => false
|
29
|
+
plugin :timestamps, :create => :created_at, :update => false
|
30
|
+
|
31
|
+
##
|
32
|
+
# Specify our validation rules.
|
33
|
+
#
|
34
|
+
# @author Yorick Peterse
|
35
|
+
# @since 0.1
|
36
|
+
#
|
37
|
+
def validate
|
38
|
+
validates_presence [:title, :status, :user_id]
|
39
|
+
validates_presence :slug unless new?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<a href="#general" title="#{@sections_lang.tabs[:general]}">#{@sections_lang.tabs[:general]}</a>
|
5
|
+
</li>
|
6
|
+
<li>
|
7
|
+
<a href="#comments" title="#{@sections_lang.tabs[:comment_settings]}">#{@sections_lang.tabs[:comment_settings]}</a>
|
8
|
+
</li>
|
9
|
+
<li>
|
10
|
+
<a href="#groups" title="#{@sections_lang.tabs[:group_assignments]}">#{@sections_lang.tabs[:group_assignments]}</a>
|
11
|
+
</li>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
#{
|
16
|
+
form_for(@section, :method => 'post', :action => @form_save_url) do |f|
|
17
|
+
f.input_hidden :id, @section.id
|
18
|
+
f.input_hidden :csrf_token, get_csrf_token
|
19
|
+
|
20
|
+
f.g.div :id => 'general' do
|
21
|
+
f.input_text @sections_lang.labels[:name], :name
|
22
|
+
f.input_text @sections_lang.labels[:slug], :slug
|
23
|
+
f.textarea @sections_lang.labels[:description], :description, :rows => 8
|
24
|
+
end
|
25
|
+
|
26
|
+
f.g.div :id => 'comments' do
|
27
|
+
f.input_radio @sections_lang.labels[:comment_allow], :comment_allow, @section.comment_allow,
|
28
|
+
:values => @sections_lang.special[:boolean_hash]
|
29
|
+
|
30
|
+
f.input_radio @sections_lang.labels[:comment_require_account], :comment_require_account, @section.comment_require_account,
|
31
|
+
:values => @sections_lang.special[:boolean_hash]
|
32
|
+
|
33
|
+
f.input_radio @sections_lang.labels[:comment_moderate], :comment_moderate, @section.comment_moderate,
|
34
|
+
:values => @sections_lang.special[:boolean_hash]
|
35
|
+
|
36
|
+
f.select @sections_lang.labels[:comment_format], :comment_format,
|
37
|
+
:values => @sections_lang.special[:format_hash], :selected => @section.comment_format, :size => 1
|
38
|
+
end
|
39
|
+
|
40
|
+
f.g.div :id => 'groups' do
|
41
|
+
f.select @sections_lang.labels[:custom_field_groups], :custom_field_group_pks, :values => @custom_field_group_pk_hash,
|
42
|
+
:multiple => :multiple, :selected => @section.custom_field_group_pks
|
43
|
+
|
44
|
+
f.select @sections_lang.labels[:category_groups], :category_group_pks, :values => @category_group_pk_hash,
|
45
|
+
:multiple => :multiple, :selected => @section.category_group_pks
|
46
|
+
end
|
47
|
+
|
48
|
+
f.g.div :class => 'clearfix' do
|
49
|
+
f.g.div :class => 'button' do
|
50
|
+
f.g.input :type => 'submit', :value => @sections_lang.buttons[:save_section]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<article>
|
2
|
+
<header>
|
3
|
+
<h1>#{get_breadcrumbs}</h1>
|
4
|
+
</header>
|
5
|
+
|
6
|
+
<form method="post" action="#{@form_delete_url}">
|
7
|
+
<input type="hidden" name="csrf_token" value="#{get_csrf_token}" />
|
8
|
+
|
9
|
+
<?r if @sections and !@sections.empty? ?>
|
10
|
+
|
11
|
+
<table class="table">
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<?r if user_authorized?([:delete]) ?>
|
15
|
+
<th>
|
16
|
+
<input type="checkbox" />
|
17
|
+
</th>
|
18
|
+
<?r end ?>
|
19
|
+
|
20
|
+
<th>#{@sections_lang.labels[:id]}</th>
|
21
|
+
<th>#{@sections_lang.labels[:name]}</th>
|
22
|
+
<th>#{@sections_lang.labels[:slug]}</th>
|
23
|
+
<th>#{@sections_lang.labels[:comment_allow]}</th>
|
24
|
+
|
25
|
+
<?r if user_authorized?([:create]) ?>
|
26
|
+
<th></th>
|
27
|
+
<?r end ?>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<?r @sections.each do |section| ?>
|
32
|
+
<tr>
|
33
|
+
<?r if user_authorized?([:delete]) ?>
|
34
|
+
<td>
|
35
|
+
<input type="checkbox" name="section_ids[]" value="#{section.id}" />
|
36
|
+
</td>
|
37
|
+
<?r end ?>
|
38
|
+
|
39
|
+
<td>#{section.id}</td>
|
40
|
+
|
41
|
+
<?r if user_authorized?([:update]) ?>
|
42
|
+
<td>#{anchor_to(section.name, "admin/edit/#{section.id}", :title => section.name)}</td>
|
43
|
+
<?r else ?>
|
44
|
+
<td>#{section.name}</td>
|
45
|
+
<?r end ?>
|
46
|
+
|
47
|
+
<td>#{section.slug}</td>
|
48
|
+
<td>#{@sections_lang.special[:boolean_hash].invert[section.comment_allow]}</td>
|
49
|
+
|
50
|
+
<?r if user_authorized?([:create]) ?>
|
51
|
+
<td>#{anchor_to(@sections_lang.labels[:manage_entries], "admin/section_entries/index/#{section.id}")}</td>
|
52
|
+
<?r end ?>
|
53
|
+
</tr>
|
54
|
+
<?r end ?>
|
55
|
+
</tbody>
|
56
|
+
</table>
|
57
|
+
|
58
|
+
<?r else ?>
|
59
|
+
<p>#{@sections_lang.messages[:no_sections]}</p>
|
60
|
+
<?r end ?>
|
61
|
+
|
62
|
+
<div class="clearfix">
|
63
|
+
<?r if user_authorized?([:create]) ?>
|
64
|
+
<div class="button">
|
65
|
+
#{anchor_to(@sections_lang.buttons[:new_section], "admin/new")}
|
66
|
+
</div>
|
67
|
+
<?r end ?>
|
68
|
+
|
69
|
+
<?r if user_authorized?([:delete]) and @sections and !@sections.empty? ?>
|
70
|
+
<div class="button">
|
71
|
+
<input type="submit" value="#{@sections_lang.buttons[:delete_sections]}" />
|
72
|
+
</div>
|
73
|
+
<?r end ?>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
</form>
|
77
|
+
</article>
|
@@ -0,0 +1,147 @@
|
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<a href="#basic">#{@entries_lang.tabs[:basic]}</a>
|
5
|
+
</li>
|
6
|
+
<li>
|
7
|
+
<a href="#categories">#{@entries_lang.tabs[:categories]}</a>
|
8
|
+
</li>
|
9
|
+
|
10
|
+
<?r if @entry.section.custom_field_groups and !@entry.section.custom_field_groups.empty? ?>
|
11
|
+
<?r @entry.section.custom_field_groups.each do |group| ?>
|
12
|
+
<li>
|
13
|
+
<a href="#group_#{group.id}">#{group.name}</a>
|
14
|
+
</li>
|
15
|
+
<?r end ?>
|
16
|
+
<?r end ?>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
#{
|
21
|
+
form_for(@entry, :method => :post, :action => @form_save_url) do |f|
|
22
|
+
f.input_hidden :csrf_token, get_csrf_token
|
23
|
+
f.input_hidden :section_id, @section_id
|
24
|
+
f.input_hidden :id, @entry.id
|
25
|
+
|
26
|
+
f.g.div :id => :basic do
|
27
|
+
f.input_text @entries_lang.labels[:title], :title
|
28
|
+
f.input_text @entries_lang.labels[:slug], :slug
|
29
|
+
f.select @entries_lang.labels[:author], :user_id, :values => @users_hash
|
30
|
+
|
31
|
+
f.select @entries_lang.labels[:status], :status, :values => @entries_lang.special[:status_hash],
|
32
|
+
:selected => @entry.status, :size => 1
|
33
|
+
end
|
34
|
+
|
35
|
+
f.g.div :id => :categories do
|
36
|
+
if @entry.section.category_groups
|
37
|
+
@entry.section.category_groups.each do |group|
|
38
|
+
categories = {}
|
39
|
+
group.categories.each do |category|
|
40
|
+
categories[category.id] = category.name
|
41
|
+
end
|
42
|
+
|
43
|
+
f.select group.name, :category_pks, :values => categories, :multiple => :multiple,
|
44
|
+
:selected => @entry.category_pks
|
45
|
+
end
|
46
|
+
else
|
47
|
+
f.g.p @entries_lang.messages[:no_categories]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Organize all field values by field ID
|
52
|
+
field_values_by_id = {}
|
53
|
+
@entry.custom_field_values.each do |value|
|
54
|
+
field_values_by_id[value.custom_field_id] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# Loop through all the custom field groups
|
58
|
+
if @entry.section.custom_field_groups and !@entry.section.custom_field_groups.empty?
|
59
|
+
@entry.section.custom_field_groups.each do |group|
|
60
|
+
|
61
|
+
f.g.div :id => "group_#{group.id}" do
|
62
|
+
# Show each custom field
|
63
|
+
if group.custom_fields and !group.custom_fields.empty?
|
64
|
+
group.custom_fields.each do |field|
|
65
|
+
|
66
|
+
# Generate some global variables for all fields
|
67
|
+
field_name = "custom_field_values[#{field.id}]"
|
68
|
+
possible_values = {}
|
69
|
+
field.possible_values = '' if field.possible_values.nil?
|
70
|
+
|
71
|
+
field.possible_values.split("\n").each do |row|
|
72
|
+
if row.include? '|'
|
73
|
+
row = row.split('|')
|
74
|
+
key = row[0]
|
75
|
+
value = row[1]
|
76
|
+
else
|
77
|
+
key = value = row
|
78
|
+
end
|
79
|
+
|
80
|
+
possible_values[key] = value
|
81
|
+
end
|
82
|
+
|
83
|
+
if field.text_limit == 0
|
84
|
+
text_limit = nil
|
85
|
+
else
|
86
|
+
text_limit = field.text_limit
|
87
|
+
end
|
88
|
+
|
89
|
+
# Get the current field's value
|
90
|
+
field_value = field_values_by_id[field.id].value rescue nil
|
91
|
+
|
92
|
+
case field.type
|
93
|
+
when "textbox" then
|
94
|
+
f.input_text field.name, field_name, :maxlength => text_limit,
|
95
|
+
:value => field_value, :placeholder => field.description, :'data-format' => field.format
|
96
|
+
|
97
|
+
when "textarea" then
|
98
|
+
if field.visual_editor == true
|
99
|
+
textarea_class = 'visual_editor'
|
100
|
+
else
|
101
|
+
textarea_class = nil
|
102
|
+
end
|
103
|
+
|
104
|
+
f.textarea field.name, field_name, :rows => field.textarea_rows, :maxlength => text_limit,
|
105
|
+
:value => field_value, :class => textarea_class, :placeholder => field.description,
|
106
|
+
:'data-format' => field.format
|
107
|
+
|
108
|
+
when "radio" then
|
109
|
+
f.input_radio field.name, field_name, field_value, :values => possible_values,
|
110
|
+
:placeholder => field.description, :'data-format' => field.format
|
111
|
+
|
112
|
+
when "checkbox" then
|
113
|
+
f.input_checkbox field.name, field_name, field_value, :values => possible_values,
|
114
|
+
:placeholder => field.description, :'data-format' => field.format
|
115
|
+
|
116
|
+
when "file" then
|
117
|
+
f.file field.name, field_name, :placeholder => field.description, :'data-format' => field.format
|
118
|
+
|
119
|
+
when "date" then
|
120
|
+
f.input_text field.name, field_name, :value => field_value, :class => 'date',
|
121
|
+
:placeholder => field.description, :'data-format' => field.format
|
122
|
+
|
123
|
+
when "select" then
|
124
|
+
possible_values = possible_values.invert
|
125
|
+
f.select field.name, field_name, :values => possible_values, :selected => field_value,
|
126
|
+
:size => 1, :placeholder => field.description, :'data-format' => field.format
|
127
|
+
|
128
|
+
when "select_multiple" then
|
129
|
+
possible_values = possible_values.invert
|
130
|
+
f.select field.name, field_name, :values => possible_values, :selected => field_value,
|
131
|
+
:multiple => :multiple, :placeholder => field.description, :'data-format' => field.format
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
f.g.div :class => 'clearfix' do
|
142
|
+
f.g.div :class => 'button' do
|
143
|
+
f.g.input :type => 'submit', :value => @entries_lang.buttons[:save_entry]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
}
|