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,213 @@
|
|
1
|
+
/**
|
2
|
+
* The Notification class can be used to display Growl like notifications to the user.
|
3
|
+
* These notifications can be used to inform the user that an entry has been saved, a new comment
|
4
|
+
* has been posted, etc. Note that this class only inserts/animates the HTML, you'll have to
|
5
|
+
* style the notifications yourself (more on that later on).
|
6
|
+
*
|
7
|
+
* h2. Basic Usage
|
8
|
+
*
|
9
|
+
* Creating a new notification is fairly easy. The most basic notification only requires some content
|
10
|
+
* and a title.
|
11
|
+
*
|
12
|
+
* bc. notification = new Zen.Notification(
|
13
|
+
* {
|
14
|
+
* title: 'My title',
|
15
|
+
* content: 'Hello, world!'
|
16
|
+
* });
|
17
|
+
*
|
18
|
+
* This will show a new notification without a title and an image, just the text "Hello, world!".
|
19
|
+
* You're not limited to plain text so feel free to use Comic Sans MS, pink colors and other funky
|
20
|
+
* elements.
|
21
|
+
*
|
22
|
+
* h2. Configuring Notifications
|
23
|
+
*
|
24
|
+
* Obviously just a message isn't enough and you might want to add an image or a title. When creating
|
25
|
+
* a new notification you can use the following configuration options:
|
26
|
+
*
|
27
|
+
* * title: the title for the notification
|
28
|
+
* * content: the text or HTML to display in the message
|
29
|
+
* * image: a custom image to show in the notification
|
30
|
+
* * sticky: boolean that indicates that the message can't be hidden by clicking on it
|
31
|
+
* * duration: the time (in miliseconds) after which the notification should be removed
|
32
|
+
*
|
33
|
+
* h2. Styling Notifications
|
34
|
+
*
|
35
|
+
* The HTML generated by the Notification class is fairly straightforward. There
|
36
|
+
* are 2 important elements. The notification container and the notification itself.
|
37
|
+
* The container will, how unexpected it may sound, contain all notifications. It's
|
38
|
+
* HTML looks like the following:
|
39
|
+
*
|
40
|
+
* bc. <div id="notification_container">
|
41
|
+
*
|
42
|
+
* </div>
|
43
|
+
*
|
44
|
+
* The HTML for a notification is slightly more complicated and looks like the following:
|
45
|
+
*
|
46
|
+
* bc. <div class="notification">
|
47
|
+
* <div class="close"></div>
|
48
|
+
* <div class="image">
|
49
|
+
* <img src="..." />
|
50
|
+
* </div>
|
51
|
+
* <div class="title">
|
52
|
+
* Notification Title
|
53
|
+
* </div>
|
54
|
+
* <div class="content">
|
55
|
+
* Content goes here
|
56
|
+
* </div>
|
57
|
+
* </div>
|
58
|
+
*
|
59
|
+
* As you can see it uses quite a few div elements but it's nothing ground breaking.
|
60
|
+
* The image and title div elements will only be displayed if a title and/or image has been
|
61
|
+
* specified. The close and content div will always be displayed.
|
62
|
+
*
|
63
|
+
* @author Yorick Peterse
|
64
|
+
* @link http://yorickpeterse.com/
|
65
|
+
* @license MIT License
|
66
|
+
* @package Zen
|
67
|
+
* @since 0.1
|
68
|
+
*
|
69
|
+
* Copyright (c) 2011, Yorick Peterse
|
70
|
+
*
|
71
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
72
|
+
* of this software and associated documentation files (the "Software"), to deal
|
73
|
+
* in the Software without restriction, including without limitation the rights
|
74
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
75
|
+
* copies of the Software, and to permit persons to whom the Software is
|
76
|
+
* furnished to do so, subject to the following conditions:
|
77
|
+
*
|
78
|
+
* The above copyright notice and this permission notice shall be included in
|
79
|
+
* all copies or substantial portions of the Software.
|
80
|
+
*
|
81
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
82
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
83
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
84
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
85
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
86
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
87
|
+
* THE SOFTWARE.
|
88
|
+
*/
|
89
|
+
Zen.Notification = new Class(
|
90
|
+
{
|
91
|
+
Implements: Options,
|
92
|
+
|
93
|
+
/**
|
94
|
+
* JSON object containing all default and user defined options.
|
95
|
+
* The following options are available:
|
96
|
+
*
|
97
|
+
* * title: the title for the notification
|
98
|
+
* * content: the text or HTML to display in the message
|
99
|
+
* * image: a custom image to show in the notification
|
100
|
+
* * sticky: boolean that indicates that the message can't be hidden by clicking on it
|
101
|
+
* * duration: the time (in miliseconds) after which the notification should be removed
|
102
|
+
*
|
103
|
+
* @var [Object]
|
104
|
+
*/
|
105
|
+
options:
|
106
|
+
{
|
107
|
+
title: '',
|
108
|
+
content: '',
|
109
|
+
image: '',
|
110
|
+
sticky: false,
|
111
|
+
duration: 3000
|
112
|
+
},
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Creates a new instance of the notification class
|
116
|
+
* and shows the notification based on the specified options.
|
117
|
+
*
|
118
|
+
* @author Yorick Peterse
|
119
|
+
* @param [Object] options JSON objects containing all custom configuration parameters.
|
120
|
+
* @return [Object]
|
121
|
+
*/
|
122
|
+
initialize: function(options)
|
123
|
+
{
|
124
|
+
this.setOptions(options);
|
125
|
+
this.generateContainer();
|
126
|
+
this.generateNotification();
|
127
|
+
},
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Generates a new notification container in case it doesn't already exist.
|
131
|
+
*
|
132
|
+
* @author Yorick Peterse
|
133
|
+
* @return [Void]
|
134
|
+
*/
|
135
|
+
generateContainer: function()
|
136
|
+
{
|
137
|
+
// The container only has to be created once
|
138
|
+
if ( $('notification_container') != null )
|
139
|
+
{
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
container = new Element('div', {id: 'notification_container'});
|
144
|
+
container.inject(document.body);
|
145
|
+
},
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Generates a new notification and inserts it into the notification
|
149
|
+
* container.
|
150
|
+
*
|
151
|
+
* @author Yorick Peterse
|
152
|
+
* @return [Void]
|
153
|
+
*/
|
154
|
+
generateNotification: function()
|
155
|
+
{
|
156
|
+
var self = this;
|
157
|
+
var notification = new Element('div', {
|
158
|
+
class: 'notification',
|
159
|
+
styles: {visibility: 'hidden'}
|
160
|
+
});
|
161
|
+
|
162
|
+
notification.adopt(new Element('div', {class: 'close'}));
|
163
|
+
|
164
|
+
// We'll only add the title and the image if they've been set
|
165
|
+
if ( this.options.image != '' )
|
166
|
+
{
|
167
|
+
var image_div = new Element('div', {class: 'image'});
|
168
|
+
var image_tag = new Element('img', {src: this.options.image});
|
169
|
+
|
170
|
+
notification.adopt(image_div.adopt(image_tag));
|
171
|
+
}
|
172
|
+
|
173
|
+
var title_div = new Element('div', {class: 'title' , html: this.options.title });
|
174
|
+
var content_div = new Element('div', {class: 'content', html: this.options.content});
|
175
|
+
|
176
|
+
notification.adopt(title_div, content_div).inject($('notification_container'));
|
177
|
+
|
178
|
+
// Add a new event listener so we can close our event
|
179
|
+
notification.addEvent('click', function()
|
180
|
+
{
|
181
|
+
self.removeNotification(notification);
|
182
|
+
});
|
183
|
+
|
184
|
+
notification.tween('opacity', 0, 1);
|
185
|
+
|
186
|
+
// Automatically remove the notification after 3 seconds if "sticky" is set to false
|
187
|
+
if ( this.options.sticky != true )
|
188
|
+
{
|
189
|
+
this.removeNotification.delay(this.options.duration, this, [notification]);
|
190
|
+
}
|
191
|
+
},
|
192
|
+
|
193
|
+
/**
|
194
|
+
* Removes the specified notification by fading it out and them removing the DOM element.
|
195
|
+
*
|
196
|
+
* @author Yorick peterse
|
197
|
+
* @param [Object] notification The notification to remove.
|
198
|
+
* @return [Void]
|
199
|
+
*/
|
200
|
+
removeNotification: function(notification)
|
201
|
+
{
|
202
|
+
// Fade the notification along with a callback so we can remove the element
|
203
|
+
// once the animation is finished
|
204
|
+
effect = new Fx.Tween(notification);
|
205
|
+
|
206
|
+
effect.addEvent('complete', function()
|
207
|
+
{
|
208
|
+
notification.destroy();
|
209
|
+
});
|
210
|
+
|
211
|
+
effect.start('opacity', 1, 0);
|
212
|
+
}
|
213
|
+
});
|
@@ -0,0 +1,263 @@
|
|
1
|
+
/**
|
2
|
+
* Widget that allows developers to create a tab based navigation menu.
|
3
|
+
* The Tabs class supports both normal tabs (fields hidden based on their IDs) as well
|
4
|
+
* as tabs loaded using Ajax.
|
5
|
+
*
|
6
|
+
* In order to use the Tab class you only need some very basic markup. You'll need a
|
7
|
+
* list element (either ordered or unordered) that will contain all links and a few divs
|
8
|
+
* in case you're using regular tabs that don't load their content using Ajax. The most
|
9
|
+
* basic example looks like the following:
|
10
|
+
*
|
11
|
+
* bc. <ul class="tabs">
|
12
|
+
* <li>
|
13
|
+
* <a href="#tab1">Tab #1</a>
|
14
|
+
* </li>
|
15
|
+
* </ul>
|
16
|
+
*
|
17
|
+
* bc. <div id="tab1">
|
18
|
+
* <p>This is the content of tab #1.</p>
|
19
|
+
* </div>
|
20
|
+
*
|
21
|
+
* When using regular tabs it doesn't matter where you put the divs for the tabs. However, when
|
22
|
+
* using the Ajax tabs it's important to remember that the content will be inserted just after
|
23
|
+
* the closing tags of the unordered/ordered list in a div with a class of "tab_content". Example:
|
24
|
+
*
|
25
|
+
* bc. <ul class="tabs">
|
26
|
+
* <li>
|
27
|
+
* <a href="#tab1">Tab #1</a>
|
28
|
+
* </li>
|
29
|
+
* </ul>
|
30
|
+
*
|
31
|
+
* bc. <div class="tab_content">
|
32
|
+
* <p>This is the content of tab #1 loaded using Ajax.</p>
|
33
|
+
* </div>
|
34
|
+
*
|
35
|
+
* h2. Creating and Configuration
|
36
|
+
*
|
37
|
+
* Now that we know how the markup works, let's create some tabs. Doing this is fairly easy and
|
38
|
+
* at a basic level only requires the following code:
|
39
|
+
*
|
40
|
+
* bc. Zen.Objects.MyTabs = new Zen.Tabs('css_selector_for_element');
|
41
|
+
*
|
42
|
+
* In this case we're creating a new instance of the Tabs class for an element named "css_selector_for_element".
|
43
|
+
* The first argument is a simple CSS selector that defines what element to choose. This means that you can either
|
44
|
+
* use a class or ID name but also a more complicated selector like "div > ul ul:first-child".
|
45
|
+
*
|
46
|
+
* Let's create another Tab instance but use some custom configuration options this time.
|
47
|
+
*
|
48
|
+
* bc. Zen.Objects.MyTabs = new Zen.Tabs('ul.some_class_name',
|
49
|
+
* {
|
50
|
+
* default: 'li:last-child',
|
51
|
+
* ajax: false
|
52
|
+
* });
|
53
|
+
*
|
54
|
+
* As you can see there are configuration items available.
|
55
|
+
*
|
56
|
+
* * default: The default tab/tab field to show. Again this is just a CSS selector so you
|
57
|
+
* can easily customize it.
|
58
|
+
* * ajax: Boolean that indicates that the tabs should be loaded from an external page using
|
59
|
+
* Ajax.
|
60
|
+
*
|
61
|
+
* Special thanks to the guys from #mootools for helping me out :)
|
62
|
+
*
|
63
|
+
* @author Yorick Peterse
|
64
|
+
* @link http://yorickpeterse.com/
|
65
|
+
* @license MIT License
|
66
|
+
* @package Zen
|
67
|
+
* @since 0.1
|
68
|
+
*
|
69
|
+
* Copyright (c) 2011, Yorick Peterse
|
70
|
+
*
|
71
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
72
|
+
* of this software and associated documentation files (the "Software"), to deal
|
73
|
+
* in the Software without restriction, including without limitation the rights
|
74
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
75
|
+
* copies of the Software, and to permit persons to whom the Software is
|
76
|
+
* furnished to do so, subject to the following conditions:
|
77
|
+
*
|
78
|
+
* The above copyright notice and this permission notice shall be included in
|
79
|
+
* all copies or substantial portions of the Software.
|
80
|
+
*
|
81
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
82
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
83
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
84
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
85
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
86
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
87
|
+
* THE SOFTWARE.
|
88
|
+
*/
|
89
|
+
Zen.Tabs = new Class(
|
90
|
+
{
|
91
|
+
Implements: Options,
|
92
|
+
|
93
|
+
// Define our default options
|
94
|
+
options:
|
95
|
+
{
|
96
|
+
// The default tab/field to display
|
97
|
+
default: 'li:first-child',
|
98
|
+
|
99
|
+
// Specifies if the content of each tab should be loaded using Ajax.
|
100
|
+
ajax: false
|
101
|
+
},
|
102
|
+
|
103
|
+
/**
|
104
|
+
* String that contains the CSS selector that specifies which element
|
105
|
+
* should be used for creating the tabs.
|
106
|
+
*
|
107
|
+
* @var [Object]
|
108
|
+
*/
|
109
|
+
element: null,
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Array that will contain a list of objects for each tab/field for the
|
113
|
+
* current element. This array will be used when binding events to each
|
114
|
+
* tab so that we don't have to search for these tabs/fields over and over again.
|
115
|
+
*
|
116
|
+
* @var [Array]
|
117
|
+
*/
|
118
|
+
fields: [],
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Constructor method called upon initialization. Options can be
|
122
|
+
* set as a JSON object in the first argument.
|
123
|
+
*
|
124
|
+
* @author Yorick Peterse
|
125
|
+
* @param [String] element The element to use for creating the tabs.
|
126
|
+
* @param [Object] options Custom options used when creating the tabs
|
127
|
+
* @return [Object]
|
128
|
+
*/
|
129
|
+
initialize: function(element, options)
|
130
|
+
{
|
131
|
+
this.setOptions(options);
|
132
|
+
|
133
|
+
// Ignore the tab system if the element couldn't be found
|
134
|
+
if ( $$(element).length <= 0 )
|
135
|
+
{
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
|
139
|
+
this.element = $$(element)[0];
|
140
|
+
|
141
|
+
// We're good to go
|
142
|
+
if ( this.options.ajax == false )
|
143
|
+
{
|
144
|
+
this.generalTabs();
|
145
|
+
}
|
146
|
+
else
|
147
|
+
{
|
148
|
+
this.ajaxTabs();
|
149
|
+
}
|
150
|
+
},
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Generate a set of normal tabs that will load content that's already on the page.
|
154
|
+
* In order for these tabs to work your URLs will need to point to an element with
|
155
|
+
* an ID. These elements will be hidden and shown upon clicking the corresponding tab.
|
156
|
+
*
|
157
|
+
* @author Yorick Peterse
|
158
|
+
* @return [Void]
|
159
|
+
*/
|
160
|
+
generalTabs: function()
|
161
|
+
{
|
162
|
+
// Create a reference to the current instance so we can
|
163
|
+
// use data in this instance in our events and loops.
|
164
|
+
var self = this;
|
165
|
+
|
166
|
+
// Select our default tab element
|
167
|
+
var default_field = this.element.getElement(self.options.default).getElement('a');
|
168
|
+
var links = this.element.getElements('li a');
|
169
|
+
|
170
|
+
this.element.getElement(self.options.default).addClass('active');
|
171
|
+
|
172
|
+
links.each(function(link)
|
173
|
+
{
|
174
|
+
// Hide the corresponding element
|
175
|
+
var url = link.get('href');
|
176
|
+
var field = $(url.replace('#', ''));
|
177
|
+
|
178
|
+
// Check if the field actually exists and hide it if it's a non
|
179
|
+
// default field.
|
180
|
+
if ( field != null && default_field != link )
|
181
|
+
{
|
182
|
+
field.setStyle('display', 'none');
|
183
|
+
}
|
184
|
+
|
185
|
+
self.fields.push({url: url, field: field});
|
186
|
+
|
187
|
+
// Add an event that will show the corresponding field for each link
|
188
|
+
link.addEvent('click', function(event)
|
189
|
+
{
|
190
|
+
// Prevent normal behavior
|
191
|
+
event.stop();
|
192
|
+
|
193
|
+
self.element.getElement('li.active').removeClass('active');
|
194
|
+
|
195
|
+
// Now we can add the class to the current tab
|
196
|
+
this.getParent('li').addClass('active');
|
197
|
+
|
198
|
+
// Toggle the state of each tab and ignore any non-existing fields.
|
199
|
+
self.fields.each(function(item)
|
200
|
+
{
|
201
|
+
if ( item == null || item.field == null )
|
202
|
+
{
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
|
206
|
+
if ( item.url == link.get('href') )
|
207
|
+
{
|
208
|
+
item.field.setStyle('display', 'block');
|
209
|
+
}
|
210
|
+
else
|
211
|
+
{
|
212
|
+
item.field.setStyle('display', 'none');
|
213
|
+
}
|
214
|
+
});
|
215
|
+
});
|
216
|
+
});
|
217
|
+
},
|
218
|
+
|
219
|
+
/**
|
220
|
+
* Generate a set of tabs of which the content for each tab will be loaded
|
221
|
+
* using an Ajax request. By default the content of these tabs will be inserted
|
222
|
+
* after the element that contains the tabs. This content will be inserted into
|
223
|
+
* a div of which the class is "tab_content".
|
224
|
+
*
|
225
|
+
* @author Yorick Peterse
|
226
|
+
* @return [Void]
|
227
|
+
*/
|
228
|
+
ajaxTabs: function()
|
229
|
+
{
|
230
|
+
// Create a reference to the current instance so we can
|
231
|
+
// use data in this instance in our events and loops.
|
232
|
+
var self = this;
|
233
|
+
|
234
|
+
// Select our default tab element
|
235
|
+
var default_link = this.element.getElement(self.options.default).getElement('a');
|
236
|
+
var links = this.element.getElements('li a');
|
237
|
+
|
238
|
+
// Create the element that will contain our Ajax response data
|
239
|
+
tab_content = new Element('div', {class: 'tab_content'});
|
240
|
+
tab_content.inject(this.element, 'after');
|
241
|
+
|
242
|
+
// Load our default tab content
|
243
|
+
this.element.getElement(self.options.default).addClass('active');
|
244
|
+
this.element.getNext('.tab_content').load(default_link.get('href'));
|
245
|
+
|
246
|
+
links.each(function(link)
|
247
|
+
{
|
248
|
+
// Add an event that will show the corresponding field for each link
|
249
|
+
link.addEvent('click', function(event)
|
250
|
+
{
|
251
|
+
// Prevent normal behavior
|
252
|
+
event.stop();
|
253
|
+
|
254
|
+
self.element.getElement('li.active').removeClass('active');
|
255
|
+
|
256
|
+
// Now we can add the class to the current tab
|
257
|
+
this.getParent('li').addClass('active');
|
258
|
+
|
259
|
+
self.element.getNext('.tab_content').load(this.get('href'));
|
260
|
+
});
|
261
|
+
});
|
262
|
+
}
|
263
|
+
});
|