zen 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. data/.gems +34 -0
  2. data/.travis.yml +7 -0
  3. data/AUTHORS +5 -0
  4. data/CHANGELOG +14 -0
  5. data/{license.txt → LICENSE} +0 -0
  6. data/MANIFEST +67 -51
  7. data/README.md +18 -25
  8. data/Rakefile +2 -3
  9. data/bin/zen +2 -2
  10. data/lib/zen.rb +93 -57
  11. data/lib/zen/asset.rb +7 -8
  12. data/lib/zen/bin/app.rb +0 -2
  13. data/lib/zen/controller/admin_controller.rb +4 -9
  14. data/lib/zen/controller/base_controller.rb +0 -25
  15. data/lib/zen/controller/main_controller.rb +5 -5
  16. data/lib/zen/controller/preview.rb +50 -0
  17. data/lib/zen/helper/common.rb +4 -68
  18. data/lib/zen/helper/message.rb +82 -0
  19. data/lib/zen/helper/theme.rb +2 -2
  20. data/lib/zen/language.rb +68 -38
  21. data/lib/zen/language/en/zen_general.yml +1 -4
  22. data/lib/zen/language/nl/zen_general.yml +28 -0
  23. data/lib/zen/language/nl/zen_models.yml +13 -0
  24. data/lib/zen/layout/admin.xhtml +1 -1
  25. data/lib/zen/layout/login.xhtml +1 -1
  26. data/lib/zen/model/settings.rb +2 -0
  27. data/lib/zen/package.rb +29 -25
  28. data/lib/zen/package/all.rb +1 -1
  29. data/lib/zen/package/categories/lib/categories/controller/categories.rb +51 -63
  30. data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -52
  31. data/lib/zen/package/categories/lib/categories/language/en/categories.yml +2 -2
  32. data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +39 -0
  33. data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +33 -0
  34. data/lib/zen/package/categories/lib/categories/plugin/categories.rb +2 -2
  35. data/lib/zen/package/comments/lib/comments.rb +31 -2
  36. data/lib/zen/package/comments/lib/comments/controller/comments.rb +42 -57
  37. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +36 -51
  38. data/lib/zen/package/comments/lib/comments/language/en/comments.yml +7 -3
  39. data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +48 -0
  40. data/lib/zen/package/comments/lib/comments/model/comment.rb +45 -4
  41. data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +152 -0
  42. data/lib/zen/package/comments/lib/comments/plugin/comments.rb +5 -6
  43. data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +2 -2
  44. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +43 -52
  45. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +68 -67
  46. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +1 -1
  47. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +32 -0
  48. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +52 -0
  49. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +3 -3
  50. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb +4 -7
  51. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +3 -3
  52. data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +37 -44
  53. data/lib/zen/package/menus/lib/menus/controller/menus.rb +33 -43
  54. data/lib/zen/package/menus/lib/menus/helper/menu_item.rb +5 -10
  55. data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +41 -0
  56. data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +39 -0
  57. data/lib/zen/package/menus/lib/menus/model/menu.rb +3 -3
  58. data/lib/zen/package/menus/lib/menus/model/menu_item.rb +3 -3
  59. data/lib/zen/package/menus/lib/menus/plugin/menus.rb +5 -6
  60. data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +1 -1
  61. data/lib/zen/package/sections/lib/sections.rb +20 -0
  62. data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +85 -79
  63. data/lib/zen/package/sections/lib/sections/controller/sections.rb +58 -66
  64. data/lib/zen/package/sections/lib/sections/language/en/sections.yml +0 -1
  65. data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +43 -0
  66. data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +47 -0
  67. data/lib/zen/package/sections/lib/sections/model/section.rb +11 -15
  68. data/lib/zen/package/sections/lib/sections/model/section_entry.rb +9 -5
  69. data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +7 -8
  70. data/lib/zen/package/sections/lib/sections/plugin/sections.rb +3 -4
  71. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +0 -4
  72. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +8 -2
  73. data/lib/zen/package/sections/migrations/1306772479_remove_unique_slug.rb +28 -0
  74. data/lib/zen/package/settings/lib/settings.rb +21 -34
  75. data/lib/zen/package/settings/lib/settings/controller/settings.rb +29 -22
  76. data/lib/zen/package/settings/lib/settings/language/en/settings.yml +7 -5
  77. data/lib/zen/package/settings/lib/settings/language/nl/settings.yml +39 -0
  78. data/lib/zen/package/settings/lib/settings/model/setting.rb +3 -5
  79. data/lib/zen/package/settings/lib/settings/plugin/group_base.rb +3 -4
  80. data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +3 -5
  81. data/lib/zen/package/settings/lib/settings/plugin/settings.rb +11 -4
  82. data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +5 -5
  83. data/lib/zen/package/settings/migrations/1299538742_add_language_key.rb +8 -8
  84. data/lib/zen/package/settings/migrations/1303196915_settings_plugin.rb +2 -5
  85. data/lib/zen/package/users/lib/users/controller/access_rules.rb +54 -61
  86. data/lib/zen/package/users/lib/users/controller/user_groups.rb +49 -57
  87. data/lib/zen/package/users/lib/users/controller/users.rb +58 -73
  88. data/lib/zen/package/users/lib/users/language/en/users.yml +6 -0
  89. data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +37 -0
  90. data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +31 -0
  91. data/lib/zen/package/users/lib/users/language/nl/users.yml +56 -0
  92. data/lib/zen/package/users/lib/users/model/user.rb +16 -1
  93. data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +27 -2
  94. data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +15 -3
  95. data/lib/zen/package/users/migrations/1304939855_user_settings.rb +15 -0
  96. data/lib/zen/plugin.rb +7 -9
  97. data/lib/zen/public/admin/css/{buttons.css → zen/buttons.css} +11 -7
  98. data/lib/zen/public/admin/css/{datepicker.css → zen/datepicker.css} +0 -0
  99. data/lib/zen/public/admin/css/{editor.css → zen/editor.css} +10 -5
  100. data/lib/zen/public/admin/css/{forms.css → zen/forms.css} +1 -1
  101. data/lib/zen/public/admin/css/{general.css → zen/general.css} +7 -7
  102. data/lib/zen/public/admin/css/{grid.css → zen/grid.css} +0 -0
  103. data/lib/zen/public/admin/css/{layout.css → zen/layout.css} +4 -5
  104. data/lib/zen/public/admin/css/zen/messages.css +61 -0
  105. data/lib/zen/public/admin/css/{notifications.css → zen/notifications.css} +4 -4
  106. data/lib/zen/public/admin/css/{reset.css → zen/reset.css} +0 -0
  107. data/lib/zen/public/admin/css/{tables.css → zen/tables.css} +3 -3
  108. data/lib/zen/public/admin/css/{tabs.css → zen/tabs.css} +5 -5
  109. data/lib/zen/public/admin/css/zen/window.css +79 -0
  110. data/lib/zen/public/admin/images/{icons → zen/icons}/accept.png +0 -0
  111. data/lib/zen/public/admin/images/{icons → zen/icons}/add.png +0 -0
  112. data/lib/zen/public/admin/images/{icons → zen/icons}/back.png +0 -0
  113. data/lib/zen/public/admin/images/{icons → zen/icons}/bold.png +0 -0
  114. data/lib/zen/public/admin/images/zen/icons/close.png +0 -0
  115. data/lib/zen/public/admin/images/{icons → zen/icons}/delete.png +0 -0
  116. data/lib/zen/public/admin/images/{icons → zen/icons}/edit.png +0 -0
  117. data/lib/zen/public/admin/images/{icons → zen/icons}/error.png +0 -0
  118. data/lib/zen/public/admin/images/{icons → zen/icons}/help.png +0 -0
  119. data/lib/zen/public/admin/images/{icons → zen/icons}/info.png +0 -0
  120. data/lib/zen/public/admin/images/{icons → zen/icons}/italic.png +0 -0
  121. data/lib/zen/public/admin/images/{icons → zen/icons}/large/error.png +0 -0
  122. data/lib/zen/public/admin/images/{icons → zen/icons}/large/notice.png +0 -0
  123. data/lib/zen/public/admin/images/{icons → zen/icons}/large/success.png +0 -0
  124. data/lib/zen/public/admin/images/{icons → zen/icons}/link.png +0 -0
  125. data/lib/zen/public/admin/images/{icons → zen/icons}/logout.png +0 -0
  126. data/lib/zen/public/admin/images/{icons → zen/icons}/ol.png +0 -0
  127. data/lib/zen/public/admin/images/{icons → zen/icons}/pdf.png +0 -0
  128. data/lib/zen/public/admin/images/zen/icons/preview.png +0 -0
  129. data/lib/zen/public/admin/images/{icons → zen/icons}/ul.png +0 -0
  130. data/lib/zen/public/admin/images/{icons → zen/icons}/user.png +0 -0
  131. data/lib/zen/public/admin/images/{icons → zen/icons}/view.png +0 -0
  132. data/lib/zen/public/admin/js/zen/core.js +73 -0
  133. data/lib/zen/public/admin/js/zen/editor.js +527 -0
  134. data/lib/zen/public/admin/js/zen/editor/markdown.js +84 -0
  135. data/lib/zen/public/admin/js/zen/editor/textile.js +84 -0
  136. data/lib/zen/public/admin/js/zen/init.js +12 -66
  137. data/lib/zen/public/admin/js/zen/tabs.js +5 -0
  138. data/lib/zen/public/admin/js/zen/window.js +206 -0
  139. data/lib/zen/task/build.rake +23 -6
  140. data/lib/zen/task/clean.rake +6 -7
  141. data/lib/zen/task/db.rake +7 -9
  142. data/lib/zen/task/package.rake +6 -6
  143. data/lib/zen/task/test.rake +6 -0
  144. data/lib/zen/task/theme.rake +3 -3
  145. data/lib/zen/theme.rb +3 -4
  146. data/lib/zen/validation.rb +7 -9
  147. data/lib/zen/version.rb +3 -4
  148. data/lib/zen/view/bottom.xhtml +0 -5
  149. data/lib/zen/view/main.xhtml +2 -0
  150. data/proto/app/app.rb +6 -4
  151. data/proto/app/config/config.rb +1 -7
  152. data/proto/app/config/database.rb +47 -43
  153. data/proto/app/config/middlewares.rb +0 -40
  154. data/proto/app/start.rb +1 -6
  155. data/proto/app/{vendor → theme}/.gitkeep +0 -0
  156. data/proto/migration.rb +3 -3
  157. data/proto/package/lib/package.rb +0 -1
  158. data/proto/package/lib/package/controller/controllers.rb +7 -40
  159. data/proto/package/lib/package/model/model.rb +3 -3
  160. metadata +106 -79
  161. data/CHANGELOG.md +0 -27
  162. data/ROADMAP.md +0 -53
  163. data/lib/zen/database.rb +0 -112
  164. data/lib/zen/logger.rb +0 -56
  165. data/lib/zen/public/admin/css/modals.css +0 -63
  166. data/lib/zen/public/admin/images/icons/close.png +0 -0
  167. data/lib/zen/public/admin/js/vendor/yepnope.js +0 -1
  168. data/lib/zen/public/admin/js/zen/editor/base.js +0 -262
  169. data/lib/zen/public/admin/js/zen/editor/drivers/html.js +0 -89
  170. data/lib/zen/public/admin/js/zen/editor/drivers/markdown.js +0 -87
  171. data/lib/zen/public/admin/js/zen/editor/drivers/textile.js +0 -87
  172. data/lib/zen/public/admin/js/zen/modal.js +0 -146
  173. data/lib/zen/public/admin/js/zen/notification.js +0 -211
  174. data/proto/app/config/requires.rb +0 -10
  175. data/proto/app/vendor/theme/.gitkeep +0 -0
  176. data/proto/package/lib/package/view/admin/package/edit.xhtml +0 -0
  177. data/proto/package/lib/package/view/admin/package/form.xhtml +0 -0
  178. data/proto/package/lib/package/view/admin/package/new.xhtml +0 -0
@@ -1,27 +0,0 @@
1
- # Changelog
2
-
3
- ## 0.2.4 - March 27th, 2011
4
-
5
- * Fix an issue that would prevent migrations from being executed in the correct order.
6
- * Fixed a small translation bug in the section entries translation file.
7
- * Restyled the footer in the admin panel.
8
- * Removed the requirement of having to specify the type of package/extension.
9
- * Navigation items will now be hidden according to the user's permissions.
10
- * Split packages into packages, themes and plugins. This makes it much easier to extend
11
- small features such as the markup generator and the comment validation system
12
-
13
- ## 0.2 - March 20th, 2011
14
-
15
- * Added a package for managing navigation items.
16
- * Introduced a new language system using YAML files instead of Ruby files.
17
- * Added a datepicker for date fields.
18
- * Improved several existing Liquid tags.
19
- * Form data is no longer lost in case of an error.
20
- * Converted all markup from Textile to Markdown.
21
- * Replaced Bacon by RSpec 2 and Webrat.
22
- * Replaced Rake by Thor.
23
- * Cleaned up a lot of code.
24
-
25
- ## 0.1a - February, 5th 2011
26
-
27
- First public alpha release. Many things are still missing at this point.
data/ROADMAP.md DELETED
@@ -1,53 +0,0 @@
1
- # Roadmap
2
-
3
- Please note that the release dates in this roadmap may and most likely will change from
4
- time to time. List items that contain a "(!)" are considered to be important and should
5
- be solved/added before any of the other items. Items containing "(?)" are considered
6
- to be unverified/undecided and might not be added/completed at all.
7
-
8
- ## Planned Releases
9
-
10
- ### 0.3 - June 2011
11
-
12
- * Website completely up and running. (!)
13
- * Translation system for the Javascript used in the backend.
14
- * Documentation online.
15
-
16
- ### 0.2.6 - May 2011
17
-
18
- * Implement something like Sprockets that can combine CSS/Javascript files and ditch the
19
- rather crappy helper Ramaze::Helper::Asset.
20
- * Add some sort of UI framework making it easier to create modal windows, tables, etc.
21
- * Improve/overhaul the text editor used in the backend, it's rather basic at the moment.
22
- * Improve the comment system so that people can save their data in some way (perhaps
23
- allow people to register).
24
-
25
- ### 0.2.5 - April 2011
26
-
27
- * Replaced Liquid by a combination of Etanni and a set of plugins.
28
- * Allow developers to register and load Javascript and CSS files globally.
29
- * Replace all CSS files by Less CSS if this turns out to have an advantage over regular
30
- css files. (?)
31
- * Remove the methods from Settings::Model::Setting that are used to generate the possible
32
- values for system settings. These should go in a plugin or something similar.
33
-
34
- ### 0.2.4 - March 2011
35
-
36
- * Liquid tags work when caching is enabled.
37
- * Compatibility with 1.9 and 1.9.1. (?)
38
- * A working (although probably rough) plugin system to extend the inner parts of Zen.
39
- An example of a plugin would be something that allows the use of Akismet for comments
40
- rather than Defensio.
41
-
42
- ### 0.2 - March 2011
43
-
44
- * General code improvements.
45
- * Navigation module for the frontend.
46
- * Improved Liquid tags.
47
- * A working datepicker
48
- * Refilling forms in case of errors (!)
49
-
50
- ### 0.1a - February 2011
51
-
52
- The first public alpha released, mainly meant to give people and idea of what Zen is
53
- all about.
@@ -1,112 +0,0 @@
1
- #:nodoc:
2
- module Zen
3
- ##
4
- # The database module is one of the most important classes in Zen (which is quite obvious).
5
- # Without this module the application wouldn't exist. The database module is
6
- # basically a small wrapper around the Sequel.connect method and allows developers
7
- # to specify database settings for various environments (live, test, production, etc)
8
- # using a simple block.
9
- #
10
- # ## Database Configuration
11
- #
12
- # Connecting to a database is fairly easy and only requires a single configuration file.
13
- # In this file, called "database.rb" you'll define all your database environments
14
- # (live, dev, test, etc).
15
- #
16
- # Zen::Database.mode :dev do |db|
17
- # db.adapter = 'mysql'
18
- # db.host = 'localhost'
19
- #
20
- # db.username = 'root'
21
- # db.password = 'root'
22
- # db.database = 'database'
23
- # end
24
- #
25
- # In this example we're connecting to "localhost" using the mysql adapter and
26
- # selecting the database called "database". When placing multiple environments in the
27
- # same file you don't have to worry about them overriding eachother, Zen will only
28
- # load the environment settings of the block that matches
29
- # the current environment set in Ramaze.options.mode.
30
- #
31
- # ## Database Interaction
32
- #
33
- # Once your database configuration file has been loaded you can communicate with the
34
- # database using models. Each model should extend the base model provided by Sequel:
35
- #
36
- # class Comment < Sequel::Model
37
- #
38
- # end
39
- #
40
- # Models can be called like any other class and don't need to be initialized. For
41
- # more information on how to use models using Sequel you should read Sequel's
42
- # documentation: http://sequel.rubyforge.com/
43
- #
44
- # @author Yorick Peterse
45
- # @since 0.1
46
- # @attr_reader [Object] handle The Sequel database handle to use for all models.
47
- #
48
- module Database
49
- include Innate::Optioned
50
-
51
- class << self
52
- attr_reader :handle
53
- end
54
-
55
- # Database related configuration options
56
- options.dsl do
57
- o 'The database adapter to use.', :adapter, ''
58
- o 'The address of the SQL server.', :host, ''
59
- o 'The database username', :username, ''
60
- o 'The database password', :password, ''
61
- o 'The database name', :database, ''
62
- end
63
-
64
- ##
65
- # Initializes a new database connection based on the configuration options specified in
66
- # Zen::Database.options. Sequel will trigger an error in case any of these settings
67
- # are incorrect. For logging a custom logger will be used, this logger can be found in
68
- # Zen::Logger().
69
- #
70
- # An extra notice for MySQL users, Zen uses InnoDB in order to use true foreign keys.
71
- # Make sure that your MySQL installation comes with the InnoDB plugin.
72
- #
73
- # @author Yorick Peterse
74
- # @since 0.1
75
- #
76
- def self.init
77
- @handle = Sequel.connect(
78
- :adapter => self.options.adapter,
79
- :host => self.options.host,
80
- :database => self.options.database,
81
- :username => self.options.username,
82
- :password => self.options.password,
83
- :logger => Zen::Logger.new("#{Zen.options.root}/log/database"),
84
- :test => true,
85
- :encoding => Zen.options.encoding)
86
-
87
- # We'll need to use InnoDB for MySQL tables in order to provide proper foreign key support
88
- if self.options.adapter === 'mysql' or self.options.adapter === 'mysql2'
89
- Sequel::MySQL.default_engine = 'InnoDB'
90
- end
91
- end
92
-
93
- ##
94
- # Method that's used to provide the ability to use different database configurations
95
- # for each mode. This method basically just sets the Zen.options.db parameters based
96
- # on the provided variables in the block. If you don't want to use different database
97
- # configurations you can just set the variables directly using Zen.options.db.
98
- #
99
- # @author Yorick Peterse
100
- # @since 0.1
101
- # @param [Symbol] mode The development mode for which the database settings should be used.
102
- # @yield [config] Object containing all the options to set for the current mode.
103
- #
104
- def self.mode(mode)
105
- mode = mode.to_sym
106
-
107
- if mode == Ramaze.options.mode
108
- yield self.options
109
- end
110
- end
111
- end
112
- end
@@ -1,56 +0,0 @@
1
- require 'ramaze/log/rotatinginformer'
2
-
3
- #:nodoc:
4
- module Zen
5
- ##
6
- # The Logger class acts as a small wrapper around the RotatingInformer class provided
7
- # by Ramaze. Before returning a new instance this logger will make sure the specified
8
- # directory actually exists and create it if this isn't the case.
9
- #
10
- # @author Yorick Peterse
11
- # @since 0.1
12
- #
13
- class Logger < Ramaze::Logger::RotatingInformer
14
-
15
- trait :timestamp => Zen.options.date_format
16
- trait :format => "[%time] %prefix %text"
17
-
18
- ##
19
- # Create a new instance of the logging class. The first parameter is the directory
20
- # in which the log files should be stored. Based on this paramater and the current
21
- # mode (specified in Ramaze.options.mode) the required directories will be created.
22
- # When specifying a directory you should NOT add trailing slash.
23
- #
24
- # @example
25
- # # When running in :dev mode this will result in the log files being stored in
26
- # # logs/database/dev
27
- # Zen::Logger.new 'logs/database'
28
- #
29
- # @author Yorick Peterse
30
- # @since 0.1
31
- # @param [String] log_dir The relative path to the log directory.
32
- # @return [Object]
33
- #
34
- def initialize log_dir
35
- # Create the log directory if it doesn't exist
36
- Dir.mkdir log_dir unless Dir.exist? log_dir
37
-
38
- log_dir += "/#{Ramaze.options.mode}"
39
- Dir.mkdir log_dir unless Dir.exist? log_dir
40
-
41
- # Initialize the RotatingInformer class
42
- super(log_dir, "#{Zen.options.date_format}.log")
43
- end
44
-
45
- ##
46
- # The write method is called whenever a log message has to be written to a file.
47
- #
48
- # @author Yorick Peterse
49
- # @since 0.1
50
- # @param [String] message The data that has to be logged.
51
- #
52
- def write message
53
- self.log(:info, message)
54
- end
55
- end
56
- end
@@ -1,63 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- /**
4
- * Modal windows.
5
- *
6
- * @author Yorick Peterse
7
- * @since 0.1
8
- */
9
- #modal_background, #modal_container
10
- {
11
- height: 100%;
12
- left: 0px;
13
- position: fixed;
14
- top: 0px;
15
- width: 100%;
16
- }
17
-
18
- #modal_container
19
- {
20
- position: absolute!important;
21
- }
22
-
23
- #modal_container:after
24
- {
25
- clear: both;
26
- content: '.';
27
- display: block;
28
- height: 0;
29
- visibility: hidden;
30
- }
31
-
32
- #modal_background
33
- {
34
- background: #444;
35
- opacity: 0.8;
36
- }
37
-
38
- #modal_container #modal_window
39
- {
40
- background: #fff;
41
- border: 1px solid #000;
42
- margin: 5% auto 20px auto;
43
- min-height: 50px;
44
- padding: 20px 10px 10px 10px;
45
- width: 50%;
46
- }
47
-
48
- #modal_container #modal_window.fullscreen
49
- {
50
- height: 90%;
51
- margin-top: 2%;
52
- width: 95%;
53
- }
54
-
55
- #modal_container #modal_window #modal_close
56
- {
57
- background: url("../images/icons/close.png");
58
- cursor: pointer;
59
- display: block;
60
- height: 30px;
61
- margin: -50px 0px 0px -20px;
62
- width: 30px;
63
- }
@@ -1 +0,0 @@
1
- /*yepnope1.0.1|WTFPL*/(function(a,b,c){function H(){var a=z;a.loader={load:G,i:0};return a}function G(a,b,c){var e=b=="c"?r:q;i=0,b=b||"j",u(a)?F(e,a,b,this.i++,d,c):(h.splice(this.i++,0,a),h.length==1&&E());return this}function F(a,c,d,g,j,l){function q(){!o&&A(n.readyState)&&(p.r=o=1,!i&&B(),n.onload=n.onreadystatechange=null,e(function(){m.removeChild(n)},0))}var n=b.createElement(a),o=0,p={t:d,s:c,e:l};n.src=n.data=c,!k&&(n.style.display="none"),n.width=n.height="0",a!="object"&&(n.type=d),n.onload=n.onreadystatechange=q,a=="img"?n.onerror=q:a=="script"&&(n.onerror=function(){p.e=p.r=1,E()}),h.splice(g,0,p),m.insertBefore(n,k?null:f),e(function(){o||(m.removeChild(n),p.r=p.e=o=1,B())},z.errorTimeout)}function E(){var a=h.shift();i=1,a?a.t?e(function(){a.t=="c"?D(a):C(a)},0):(a(),B()):i=0}function D(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css",!a.e&&(o||j)?function g(a){e(function(){if(!d)try{a.sheet.cssRules.length?(d=1,B()):g(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,e(function(){B()},0)):g(a)}},0)}(c):(c.onload=function(){d||(d=1,e(function(){B()},0))},a.e&&c.onload()),e(function(){d||(d=1,B())},z.errorTimeout),!a.e&&f.parentNode.insertBefore(c,f)}function C(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&A(c.readyState)&&(d=1,B(),c.onload=c.onreadystatechange=null)},e(function(){d||(d=1,B())},z.errorTimeout),a.e?c.onload():f.parentNode.insertBefore(c,f)}function B(){var a=1,b=-1;while(h.length- ++b)if(h[b].s&&!(a=h[b].r))break;a&&E()}function A(a){return!a||a=="loaded"||a=="complete"}var d=b.documentElement,e=a.setTimeout,f=b.getElementsByTagName("script")[0],g=({}).toString,h=[],i=0,j="MozAppearance"in d.style,k=j&&!!b.createRange().compareNode,l=j&&!k,m=k?d:f.parentNode,n=a.opera&&g.call(a.opera)=="[object Opera]",o="webkitAppearance"in d.style,p=o&&"async"in b.createElement("script"),q=j?"object":n||p?"img":"script",r=o?"img":q,s=Array.isArray||function(a){return g.call(a)=="[object Array]"},t=function(a){return typeof a=="object"},u=function(a){return typeof a=="string"},v=function(a){return g.call(a)=="[object Function]"},w=[],x={},y,z;z=function(a){function h(a,b){function i(a){if(u(a))g(a,f,b,0,c);else if(t(a))for(h in a)a.hasOwnProperty(h)&&g(a[h],f,b,h,c)}var c=!!a.test,d=c?a.yep:a.nope,e=a.load||a.both,f=a.callback,h;i(d),i(e),a.complete&&b.load(a.complete)}function g(a,b,d,e,g){var h=f(a),i=h.autoCallback;if(!h.bypass){b&&(b=v(b)?b:b[a]||b[e]||b[a.split("/").pop().split("?")[0]]);if(h.instead)return h.instead(a,b,d,e,g);d.load(h.url,h.forceCSS||!h.forceJS&&/css$/.test(h.url)?"c":c,h.noexec),(v(b)||v(i))&&d.load(function(){H(),b&&b(h.origUrl,g,e),i&&i(h.origUrl,g,e)})}}function f(a){var b=a.split("!"),c=w.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=x[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=w[h](f);return f}var b,d,e=this.yepnope.loader;if(u(a))g(a,0,e,0);else if(s(a))for(b=0;b<a.length;b++)d=a[b],u(d)?g(d,0,e,0):s(d)?z(d):t(d)&&h(d,e);else t(a)&&h(a,e)},z.addPrefix=function(a,b){x[a]=b},z.addFilter=function(a){w.push(a)},z.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",y=function(){b.removeEventListener("DOMContentLoaded",y,0),b.readyState="complete"},0)),a.yepnope=H()})(this,this.document)
@@ -1,262 +0,0 @@
1
- Zen.Editor = {};
2
-
3
- /**
4
- * The Editor class can be used to create simple text editors that support HTML,
5
- * Textile and Markdown (more might be supported in the future). The generated
6
- * output is very simple and very easy to style (the class doesn't inject any CSS).
7
- *
8
- * ## Usage
9
- *
10
- * Adding an editor requires 2 steps. First you'll need to create a new instance
11
- * of the editor:
12
- *
13
- * editor = new Zen.Editor.Base('css selector');
14
- *
15
- * Once the instance is created you can call the display() method to show the editor:
16
- *
17
- * editor.display();
18
- *
19
- * This will render the editor using the default format, HTML.
20
- *
21
- * ## Customizing
22
- *
23
- * By default the editor will generate HTML tags but this can be changed by passing
24
- * an object as the second argument of the constructor method:
25
- *
26
- * editor = new Zen.Editor.Base('css selector', {format: '...'});
27
- *
28
- * The second argument accepts the following 2 options:
29
- *
30
- * format: the formatting engine to use. You can choose from "html" (default),
31
- * "textile" and "markdown". You can also create your own driver as long as you make
32
- * sure the class is loaded and defined under Zen.Editor.DriverName, where DriverName
33
- * is the PascalCased version of the driver name.
34
- *
35
- * buttons: an array of default buttons. Note that in most cased you'd want to use the
36
- * addButtons() method as specifying an array of buttons in the constructor will prevent
37
- * the default buttons from being added.
38
- *
39
- * ## Adding Buttons
40
- *
41
- * The recommended way of adding buttons is using the addButtons method. This method takes
42
- * a single argument which is an array of JSON objects. Each JSON object should contain the
43
- * following keys:
44
- *
45
- * * name: the name of the button, used to generate the CSS class
46
- * * html: the content of the button (text, html, etc)
47
- * * callback: the function/method called whenever the button is clicked.
48
- *
49
- * Example:
50
- *
51
- * editor.addButtons(
52
- * [
53
- * {name: 'hello', html: 'Hello', callback: function() { alert('Hello!'); }}
54
- * ]);
55
- *
56
- * When the callback is invoked the instance of the editor to which the button belongs will
57
- * be sent to the callback.
58
- *
59
- * ## Drivers
60
- *
61
- * The Base class relies on so called "drivers": small classes that handle actions
62
- * whenever a button is clicked. By default there are 3 drivers, HTML, Textile and Markdown.
63
- * In order to use your own driver while still supporting the default buttons (bold, italic, etc)
64
- * your class has to implement the following methods:
65
- *
66
- * * bold
67
- * * italic
68
- * * link
69
- * * ol
70
- * * ul
71
- *
72
- * When creating a method for a driver they should accept a single parameter, the instance
73
- * of the editor to which the button belongs. Say your button wraps the currently selected
74
- * text in an element you'd do something like the following:
75
- *
76
- * my_method: function(editor)
77
- * {
78
- * editor.insertAroundCursor({before: '<', after: '>'})
79
- * }
80
- *
81
- * Also keep in mind that you don't have to create an entire class, you can also specify
82
- * a closure in the "callback" key when adding a button.
83
- *
84
- * ## Markup
85
- *
86
- * The Editor class generates the following markup:
87
- *
88
- * <div class="editor_container">
89
- * <div class="editor_toolbar">
90
- * <ul>
91
- * <li class="button name">button HTML</li>
92
- * </ul>
93
- * </div>
94
- *
95
- * <textarea></textarea>
96
- * </div>
97
- *
98
- * As you can see the markup is very simple and no CSS rules are injected. This does however
99
- * mean you generally spend a bit more time styling the editor but it also gives
100
- * you much more flexibility and less trouble.
101
- *
102
- * @author Yorick Peterse
103
- * @link http://yorickpeterse.com/ Yorick Peterse's Website
104
- * @link http://zen-cms.com/ Zen Website
105
- * @license http://code.yorickpeterse.com/license.txt The MIT license
106
- * @since 0.1
107
- */
108
- Zen.Editor.Base = new Class(
109
- {
110
- Implements: Options,
111
-
112
- /**
113
- * Object with all default options. The following options are available:
114
- *
115
- * * format: the text format (textile, markdown, etc)
116
- * * buttons: Array of all buttons and their callbacks.
117
- * Note that by default this object is empty, all buttons will be
118
- * added by the initialize() method as the callbacks won't be available
119
- * until the drivers have been loaded.
120
- *
121
- * @author Yorick Peterse
122
- * @since 0.1
123
- * @type {object}
124
- */
125
- options:
126
- {
127
- format: 'html',
128
- buttons: []
129
- },
130
-
131
- /**
132
- * Collection of objects for the CSS selector specified
133
- * when initializing this class.
134
- *
135
- * @author Yorick Peterse
136
- * @since 0.1
137
- * @type {array}
138
- */
139
- elements: [],
140
-
141
- /**
142
- * New instance of the driver for the current editor.
143
- *
144
- * @author Yorick Peterse
145
- * @since 0.1
146
- * @type {object}
147
- */
148
- driver: {},
149
-
150
- /**
151
- * Initializes a new instance of the visual editor. The first
152
- * argument is the CSS selector and the second a JSON object
153
- * with additional options.
154
- *
155
- * @author Yorick Peterse
156
- * @param {string} css_selector The CSS selector for the editor.
157
- * @param {object} options JSON object with additional options.
158
- * @return {object}
159
- * @since 0.1
160
- */
161
- initialize: function(css_selector, options)
162
- {
163
- this.setOptions(options);
164
-
165
- if ( typeof css_selector === 'string' )
166
- {
167
- this.elements = $$(css_selector);
168
- }
169
- else
170
- {
171
- this.elements = [css_selector];
172
- }
173
-
174
- // Load our driver
175
- var driver = this.options.format.capitalize().camelCase();
176
- this.driver = new Zen.Editor[driver]();
177
-
178
- // Add our buttons
179
- if ( this.options.buttons.length <= 0 )
180
- {
181
- this.options.buttons = [
182
- {name: 'bold' , html: 'Bold' , callback: this.driver.bold},
183
- {name: 'italic' , html: 'Italic' , callback: this.driver.italic},
184
- {name: 'link' , html: 'Link' , callback: this.driver.link},
185
- {name: 'ol' , html: 'Ordered list' , callback: this.driver.ol},
186
- {name: 'ul' , html: 'Unordered list', callback: this.driver.ul}
187
- ];
188
- }
189
- },
190
-
191
- /**
192
- * Generates the required markup for the editor along
193
- * with binding all events for all the available buttons.
194
- *
195
- * @author Yorick Peterse
196
- * @since 0.1
197
- * @return {void}
198
- */
199
- display: function()
200
- {
201
- // Ignore the entire process if no elements have been found
202
- if ( this.elements.length === 0 ) { return; }
203
-
204
- // Generate our markup
205
- var toolbar = new Element('div', {'class': 'editor_toolbar'});
206
- var ul = new Element('ul');
207
-
208
- // Generate all the buttons
209
- this.options.buttons.each(function(btn)
210
- {
211
- var li = new Element('li', {'class': btn.name});
212
-
213
- // Add the html?
214
- if ( btn.html )
215
- {
216
- li.set('html', btn.html);
217
- }
218
-
219
- li.addEvent('click', function()
220
- {
221
- // Get the editor closest to this button
222
- var current_editor = this.getParent('.editor_container');
223
- current_editor = current_editor.getElement('textarea');
224
-
225
- btn.callback(current_editor);
226
- });
227
-
228
- li.inject(ul);
229
- });
230
-
231
- this.elements.each(function(element)
232
- {
233
- var container = new Element('div', {'class': 'editor_container'});
234
-
235
- // Replace the text area with all our elements
236
- ul.inject(toolbar);
237
- toolbar.inject(container);
238
- container.inject(element, 'before');
239
- element.inject(container);
240
- });
241
- },
242
-
243
- /**
244
- * Adds the specified buttons to this.options.buttons.
245
- * Buttons can also be added by directly setting them in the construct
246
- * but that will prevent the default buttons from getting added.
247
- *
248
- * @author Yorick Peterse
249
- * @since 0.1
250
- * @param {array} buttons An array of the buttons to add
251
- * @return {void}
252
- */
253
- addButtons: function(buttons)
254
- {
255
- var self = this;
256
-
257
- buttons.each(function(button)
258
- {
259
- self.options.buttons.push(button);
260
- });
261
- }
262
- });