zen 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. data/.gitignore +15 -0
  2. data/.mailmap +2 -0
  3. data/.rvmrc +2 -0
  4. data/.travis.yml +8 -3
  5. data/AUTHORS +1 -2
  6. data/CHANGELOG.md +48 -17
  7. data/README.md +44 -39
  8. data/Rakefile +4 -0
  9. data/bin/zen +5 -30
  10. data/lib/zen.rb +13 -19
  11. data/lib/zen/asset.rb +99 -64
  12. data/lib/zen/bin/create.rb +94 -0
  13. data/lib/zen/bin/runner.rb +118 -0
  14. data/lib/zen/controller/admin_controller.rb +52 -36
  15. data/lib/zen/controller/base_controller.rb +5 -5
  16. data/lib/zen/controller/frontend_controller.rb +7 -7
  17. data/lib/zen/controller/main_controller.rb +12 -10
  18. data/lib/zen/controller/preview.rb +15 -11
  19. data/lib/zen/helper/acl.rb +73 -53
  20. data/lib/zen/helper/blue_form_vendor.rb +689 -0
  21. data/lib/zen/helper/breadcrumb.rb +23 -19
  22. data/lib/zen/helper/message.rb +3 -3
  23. data/lib/zen/helper/theme.rb +18 -13
  24. data/lib/zen/language.rb +62 -58
  25. data/lib/zen/language/en/zen_general.yml +2 -4
  26. data/lib/zen/language/nl/zen_general.yml +2 -4
  27. data/lib/zen/layout/admin.xhtml +3 -12
  28. data/lib/zen/layout/login.xhtml +1 -6
  29. data/lib/zen/model/methods.rb +6 -6
  30. data/lib/zen/model/settings.rb +5 -4
  31. data/lib/zen/package.rb +47 -38
  32. data/lib/zen/package/all.rb +3 -5
  33. data/lib/zen/package/base.rb +7 -7
  34. data/lib/zen/package/categories/lib/categories.rb +8 -3
  35. data/lib/zen/package/categories/lib/categories/controller/categories.rb +81 -55
  36. data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -44
  37. data/lib/zen/package/categories/lib/categories/helper/category.rb +88 -0
  38. data/lib/zen/package/categories/lib/categories/language/en/categories.yml +5 -4
  39. data/lib/zen/package/categories/lib/categories/language/en/category_groups.yml +5 -4
  40. data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +5 -4
  41. data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +5 -4
  42. data/lib/zen/package/categories/lib/categories/model/category.rb +15 -13
  43. data/lib/zen/package/categories/lib/categories/model/category_group.rb +3 -3
  44. data/lib/zen/package/categories/lib/categories/plugin/categories.rb +36 -25
  45. data/lib/zen/package/categories/lib/categories/view/admin/categories/form.xhtml +49 -56
  46. data/lib/zen/package/categories/lib/categories/view/admin/categories/index.xhtml +48 -35
  47. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/form.xhtml +36 -29
  48. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/index.xhtml +42 -37
  49. data/lib/zen/package/comments/lib/comments.rb +4 -1
  50. data/lib/zen/package/comments/lib/comments/controller/comments.rb +39 -32
  51. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +45 -26
  52. data/lib/zen/package/comments/lib/comments/helper/comment.rb +35 -0
  53. data/lib/zen/package/comments/lib/comments/language/en/comments.yml +9 -7
  54. data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +10 -8
  55. data/lib/zen/package/comments/lib/comments/model/comment.rb +31 -17
  56. data/lib/zen/package/comments/lib/comments/model/comment_status.rb +15 -0
  57. data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +27 -18
  58. data/lib/zen/package/comments/lib/comments/plugin/comments.rb +25 -20
  59. data/lib/zen/package/comments/lib/comments/view/admin/comments/form.xhtml +61 -54
  60. data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +38 -23
  61. data/lib/zen/package/comments/migrations/1308774099_comment_status.rb +60 -0
  62. data/lib/zen/package/custom_fields/lib/custom_fields.rb +33 -7
  63. data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +209 -0
  64. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +50 -47
  65. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +215 -0
  66. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +111 -73
  67. data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +79 -0
  68. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_groups.yml +20 -19
  69. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_field_types.yml +40 -0
  70. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +34 -32
  71. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +5 -4
  72. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_types.yml +40 -0
  73. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +18 -16
  74. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +31 -11
  75. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_method.rb +15 -0
  76. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +50 -0
  77. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +28 -7
  78. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/form.xhtml +33 -28
  79. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/index.xhtml +48 -46
  80. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/form.xhtml +61 -0
  81. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-types/index.xhtml +93 -0
  82. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/form.xhtml +105 -99
  83. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/index.xhtml +43 -39
  84. data/lib/zen/package/custom_fields/migrations/1295255665_create_schema.rb +47 -16
  85. data/lib/zen/package/custom_fields/migrations/1310659580_custom_field_types.rb +148 -0
  86. data/lib/zen/package/custom_fields/migrations/1311694920_rename_css_class.rb +11 -0
  87. data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +40 -35
  88. data/lib/zen/package/menus/lib/menus/controller/menus.rb +47 -43
  89. data/lib/zen/package/menus/lib/menus/helper/{menu_item.rb → menu.rb} +42 -15
  90. data/lib/zen/package/menus/lib/menus/language/en/menu_items.yml +5 -5
  91. data/lib/zen/package/menus/lib/menus/language/en/menus.yml +9 -8
  92. data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +8 -8
  93. data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +11 -10
  94. data/lib/zen/package/menus/lib/menus/model/menu.rb +5 -5
  95. data/lib/zen/package/menus/lib/menus/model/menu_item.rb +6 -5
  96. data/lib/zen/package/menus/lib/menus/plugin/menus.rb +41 -43
  97. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/form.xhtml +59 -63
  98. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/index.xhtml +35 -30
  99. data/lib/zen/package/menus/lib/menus/view/admin/menus/form.xhtml +46 -37
  100. data/lib/zen/package/menus/lib/menus/view/admin/menus/index.xhtml +37 -37
  101. data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +5 -5
  102. data/lib/zen/package/menus/migrations/1308671733_rename_order_column.rb +11 -0
  103. data/lib/zen/package/menus/migrations/1311695030_rename_css_class.rb +17 -0
  104. data/lib/zen/package/sections/lib/sections.rb +18 -11
  105. data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +115 -109
  106. data/lib/zen/package/sections/lib/sections/controller/sections.rb +72 -50
  107. data/lib/zen/package/sections/lib/sections/helper/section.rb +53 -0
  108. data/lib/zen/package/sections/lib/sections/language/en/section_entries.yml +5 -4
  109. data/lib/zen/package/sections/lib/sections/language/en/sections.yml +5 -4
  110. data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +5 -4
  111. data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +5 -4
  112. data/lib/zen/package/sections/lib/sections/model/section.rb +17 -9
  113. data/lib/zen/package/sections/lib/sections/model/section_entry.rb +192 -13
  114. data/lib/zen/package/sections/lib/sections/model/section_entry_status.rb +13 -0
  115. data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +60 -39
  116. data/lib/zen/package/sections/lib/sections/plugin/sections.rb +14 -11
  117. data/lib/zen/package/sections/lib/sections/view/admin/form.xhtml +100 -97
  118. data/lib/zen/package/sections/lib/sections/view/admin/index.xhtml +41 -39
  119. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +95 -215
  120. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +48 -40
  121. data/lib/zen/package/sections/migrations/1308672298_use_id_for_default_section.rb +40 -0
  122. data/lib/zen/package/sections/migrations/1308813320_section_entry_statuses.rb +58 -0
  123. data/lib/zen/package/settings/lib/settings/controller/settings.rb +5 -8
  124. data/lib/zen/package/settings/lib/settings/model/setting.rb +2 -37
  125. data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +18 -1
  126. data/lib/zen/package/settings/lib/settings/plugin/settings.rb +13 -7
  127. data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +2 -1
  128. data/lib/zen/package/users/lib/users.rb +3 -1
  129. data/lib/zen/package/users/lib/users/controller/access_rules.rb +77 -60
  130. data/lib/zen/package/users/lib/users/controller/user_groups.rb +41 -36
  131. data/lib/zen/package/users/lib/users/controller/users.rb +48 -42
  132. data/lib/zen/package/users/lib/users/helper/users.rb +72 -0
  133. data/lib/zen/package/users/lib/users/language/en/access_rules.yml +6 -5
  134. data/lib/zen/package/users/lib/users/language/en/user_groups.yml +5 -4
  135. data/lib/zen/package/users/lib/users/language/en/users.yml +1 -0
  136. data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +5 -4
  137. data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +5 -4
  138. data/lib/zen/package/users/lib/users/language/nl/users.yml +1 -0
  139. data/lib/zen/package/users/lib/users/model/access_rule.rb +5 -1
  140. data/lib/zen/package/users/lib/users/model/user.rb +17 -10
  141. data/lib/zen/package/users/lib/users/public/admin/js/users/access_rules.js +10 -37
  142. data/lib/zen/package/users/lib/users/public/admin/js/users/lib/access_rules.js +49 -0
  143. data/lib/zen/package/users/lib/users/view/admin/access-rules/form.xhtml +105 -96
  144. data/lib/zen/package/users/lib/users/view/admin/access-rules/index.xhtml +48 -41
  145. data/lib/zen/package/users/lib/users/view/admin/user-groups/form.xhtml +42 -32
  146. data/lib/zen/package/users/lib/users/view/admin/user-groups/index.xhtml +43 -38
  147. data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +76 -67
  148. data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +43 -41
  149. data/lib/zen/package/users/lib/users/view/admin/users/login.xhtml +12 -9
  150. data/lib/zen/package/users/migrations/1295281013_create_schema.rb +2 -2
  151. data/lib/zen/plugin.rb +56 -50
  152. data/lib/zen/plugin/markup/lib/markup/markup.rb +33 -21
  153. data/lib/zen/public/admin/css/zen/buttons.css +11 -7
  154. data/lib/zen/public/admin/css/zen/datepicker.css +6 -6
  155. data/lib/zen/public/admin/css/zen/forms.css +2 -1
  156. data/lib/zen/public/admin/css/zen/general.css +15 -10
  157. data/lib/zen/public/admin/css/zen/layout.css +51 -20
  158. data/lib/zen/public/admin/css/zen/tables.css +39 -11
  159. data/lib/zen/public/admin/css/zen/tabs.css +6 -4
  160. data/lib/zen/public/admin/css/zen/window.css +11 -11
  161. data/lib/zen/public/{favicon.ico → admin/favicon.ico} +0 -0
  162. data/lib/zen/public/admin/images/zen/icons/asc.png +0 -0
  163. data/lib/zen/public/admin/images/zen/icons/desc.png +0 -0
  164. data/lib/zen/public/admin/js/vendor/datepicker.js +0 -11
  165. data/lib/zen/public/admin/js/{mootools → vendor/mootools}/core.js +0 -1
  166. data/lib/zen/public/admin/js/{mootools → vendor/mootools}/more.js +100 -29
  167. data/lib/zen/public/admin/js/zen/index.js +48 -0
  168. data/lib/zen/public/admin/js/zen/lib/asset.js +111 -0
  169. data/lib/zen/public/admin/js/zen/{editor.js → lib/editor.js} +107 -127
  170. data/lib/zen/public/admin/js/zen/{editor → lib/editor}/markdown.js +7 -9
  171. data/lib/zen/public/admin/js/zen/{editor → lib/editor}/textile.js +7 -9
  172. data/lib/zen/public/admin/js/zen/lib/html_table.js +143 -0
  173. data/lib/zen/public/admin/js/zen/{tabs.js → lib/tabs.js} +40 -37
  174. data/lib/zen/public/admin/js/zen/{window.js → lib/window.js} +24 -20
  175. data/lib/zen/spec/bacon/color_output.rb +39 -0
  176. data/lib/zen/spec/helper.rb +152 -0
  177. data/lib/zen/spec/simplecov.rb +22 -0
  178. data/lib/zen/task/build.rake +20 -43
  179. data/lib/zen/task/clean.rake +2 -6
  180. data/lib/zen/task/db.rake +8 -12
  181. data/lib/zen/task/package.rake +4 -10
  182. data/lib/zen/task/plugin.rake +3 -9
  183. data/lib/zen/task/proto.rake +0 -62
  184. data/lib/zen/task/test.rake +6 -3
  185. data/lib/zen/task/theme.rake +4 -11
  186. data/lib/zen/theme.rb +22 -24
  187. data/lib/zen/validation.rb +34 -27
  188. data/lib/zen/version.rb +2 -8
  189. data/lib/zen/view/head.xhtml +7 -0
  190. data/lib/zen/view/main.xhtml +7 -22
  191. data/{proto/package/migrations → pkg}/.gitkeep +0 -0
  192. data/proto/app/app.rb +1 -0
  193. data/proto/app/config/config.rb +5 -4
  194. data/proto/app/config/database.rb +19 -41
  195. data/proto/app/config/middlewares.rb +32 -29
  196. data/proto/{package/lib/package/view/admin/package/index.xhtml → app/log/database/dev/.gitkeep} +0 -0
  197. data/proto/app/log/database/live/.gitkeep +0 -0
  198. data/spec/Rakefile +26 -0
  199. data/spec/fixtures/zen/asset.rb +18 -0
  200. data/spec/fixtures/zen/helper/acl.rb +39 -0
  201. data/spec/fixtures/zen/helper/message.rb +19 -0
  202. data/spec/fixtures/zen/language/en/spec.yml +10 -0
  203. data/spec/fixtures/zen/language/nl/spec.yml +7 -0
  204. data/spec/fixtures/zen/package.rb +17 -0
  205. data/spec/fixtures/zen/package/comments/controller/comments_form.rb +27 -0
  206. data/spec/fixtures/zen/package/settings/plugin/settings.rb +20 -0
  207. data/spec/fixtures/zen/plugin.rb +7 -0
  208. data/spec/fixtures/zen/theme/404.xhtml +1 -0
  209. data/spec/fixtures/zen/theme/default-section/index.xhtml +1 -0
  210. data/spec/fixtures/zen/theme/helper/404.xhtml +1 -0
  211. data/spec/fixtures/zen/theme/helper/partial.xhtml +1 -0
  212. data/spec/fixtures/zen/theme/helper/wrong_partial.xhtml +1 -0
  213. data/spec/fixtures/zen/theme/partials/partial.xhtml +1 -0
  214. data/spec/fixtures/zen/theme/theme.rb +11 -0
  215. data/spec/fixtures/zen/validation.rb +22 -0
  216. data/spec/helper.rb +41 -0
  217. data/spec/zen/all.rb +5 -0
  218. data/spec/zen/asset.rb +97 -0
  219. data/spec/zen/bin/create.rb +89 -0
  220. data/spec/zen/bin/runner.rb +47 -0
  221. data/spec/zen/controller/admin_controller.rb +26 -0
  222. data/spec/zen/controller/main_controller.rb +81 -0
  223. data/spec/zen/controller/preview.rb +33 -0
  224. data/spec/zen/helper/acl.rb +149 -0
  225. data/spec/zen/helper/breadcrumb.rb +38 -0
  226. data/spec/zen/helper/message.rb +31 -0
  227. data/spec/zen/helper/theme.rb +58 -0
  228. data/spec/zen/language.rb +55 -0
  229. data/spec/zen/package.rb +23 -0
  230. data/spec/zen/package/categories/controller/categories.rb +123 -0
  231. data/spec/zen/package/categories/controller/category_groups.rb +108 -0
  232. data/spec/zen/package/categories/helper/category.rb +75 -0
  233. data/spec/zen/package/categories/plugin/categories.rb +92 -0
  234. data/spec/zen/package/comments/controller/comments.rb +134 -0
  235. data/spec/zen/package/comments/controller/comments_form.rb +343 -0
  236. data/spec/zen/package/comments/helper/comment.rb +47 -0
  237. data/spec/zen/package/comments/plugin/anti_spam.rb +59 -0
  238. data/spec/zen/package/comments/plugin/comments.rb +107 -0
  239. data/spec/zen/package/custom_fields/blue_form_parameters.rb +183 -0
  240. data/spec/zen/package/custom_fields/controller/custom_field_groups.rb +120 -0
  241. data/spec/zen/package/custom_fields/controller/custom_field_types.rb +169 -0
  242. data/spec/zen/package/custom_fields/controller/custom_fields.rb +158 -0
  243. data/spec/zen/package/custom_fields/helper/custom_field.rb +86 -0
  244. data/spec/zen/package/menus/controller/menu_items.rb +110 -0
  245. data/spec/zen/package/menus/controller/menus.rb +110 -0
  246. data/spec/zen/package/menus/helper/menu.rb +75 -0
  247. data/spec/zen/package/menus/plugin/menus.rb +120 -0
  248. data/spec/zen/package/sections/controller/section_entries.rb +201 -0
  249. data/spec/zen/package/sections/controller/sections.rb +116 -0
  250. data/spec/zen/package/sections/helper/section.rb +74 -0
  251. data/spec/zen/package/sections/plugin/section_entries.rb +161 -0
  252. data/spec/zen/package/sections/plugin/sections.rb +75 -0
  253. data/spec/zen/package/settings/controller/settings.rb +36 -0
  254. data/spec/zen/package/settings/plugin/settings.rb +33 -0
  255. data/spec/zen/package/users/controller/access_rules.rb +90 -0
  256. data/spec/zen/package/users/controller/user_groups.rb +101 -0
  257. data/spec/zen/package/users/controller/users.rb +130 -0
  258. data/spec/zen/package/users/helper/users.rb +97 -0
  259. data/spec/zen/plugin.rb +64 -0
  260. data/spec/zen/plugin/helper.rb +11 -0
  261. data/spec/zen/plugin/markup.rb +44 -0
  262. data/spec/zen/theme.rb +41 -0
  263. data/spec/zen/validation.rb +63 -0
  264. data/zen.gemspec +36 -0
  265. metadata +159 -113
  266. data/MANIFEST +0 -266
  267. data/lib/zen/bin/app.rb +0 -40
  268. data/lib/zen/ext/string.rb +0 -185
  269. data/lib/zen/helper/common.rb +0 -106
  270. data/lib/zen/package/categories/lib/categories/view/admin/categories/edit.xhtml +0 -7
  271. data/lib/zen/package/categories/lib/categories/view/admin/categories/new.xhtml +0 -7
  272. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/edit.xhtml +0 -7
  273. data/lib/zen/package/categories/lib/categories/view/admin/category-groups/new.xhtml +0 -7
  274. data/lib/zen/package/comments/lib/comments/view/admin/comments/edit.xhtml +0 -7
  275. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/edit.xhtml +0 -7
  276. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-field-groups/new.xhtml +0 -7
  277. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/edit.xhtml +0 -7
  278. data/lib/zen/package/custom_fields/lib/custom_fields/view/admin/custom-fields/new.xhtml +0 -7
  279. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/edit.xhtml +0 -7
  280. data/lib/zen/package/menus/lib/menus/view/admin/menu-items/new.xhtml +0 -7
  281. data/lib/zen/package/menus/lib/menus/view/admin/menus/edit.xhtml +0 -7
  282. data/lib/zen/package/menus/lib/menus/view/admin/menus/new.xhtml +0 -7
  283. data/lib/zen/package/sections/lib/sections/view/admin/edit.xhtml +0 -7
  284. data/lib/zen/package/sections/lib/sections/view/admin/new.xhtml +0 -7
  285. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/edit.xhtml +0 -7
  286. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/new.xhtml +0 -7
  287. data/lib/zen/package/users/lib/users/view/admin/access-rules/edit.xhtml +0 -7
  288. data/lib/zen/package/users/lib/users/view/admin/access-rules/new.xhtml +0 -7
  289. data/lib/zen/package/users/lib/users/view/admin/user-groups/edit.xhtml +0 -7
  290. data/lib/zen/package/users/lib/users/view/admin/user-groups/new.xhtml +0 -7
  291. data/lib/zen/package/users/lib/users/view/admin/users/edit.xhtml +0 -7
  292. data/lib/zen/package/users/lib/users/view/admin/users/new.xhtml +0 -7
  293. data/lib/zen/plugin/controller.rb +0 -59
  294. data/lib/zen/public/admin/css/zen/notifications.css +0 -84
  295. data/lib/zen/public/admin/images/zen/icons/large/error.png +0 -0
  296. data/lib/zen/public/admin/images/zen/icons/large/notice.png +0 -0
  297. data/lib/zen/public/admin/images/zen/icons/large/success.png +0 -0
  298. data/lib/zen/public/admin/js/zen/core.js +0 -73
  299. data/lib/zen/public/admin/js/zen/init.js +0 -80
  300. data/proto/package/lib/package.rb +0 -21
  301. data/proto/package/lib/package/controller/controllers.rb +0 -50
  302. data/proto/package/lib/package/language/en/languages.yml +0 -4
  303. data/proto/package/lib/package/model/model.rb +0 -12
@@ -1,22 +1,21 @@
1
- <article>
1
+ <article>
2
2
  <header>
3
3
  <h1>#{get_breadcrumbs}</h1>
4
4
  </header>
5
-
6
- <form method="post" action="#{@form_delete_url}">
5
+
6
+ <form method="post" action="#{Users::Controller::Users.r(:delete)}">
7
7
  <input type="hidden" name="csrf_token" value="#{get_csrf_token}" />
8
-
9
- <?r if @users and !@users.empty? ?>
10
-
11
- <table class="table">
8
+
9
+ <?r if !@users.empty? ?>
10
+ <table>
12
11
  <thead>
13
12
  <tr>
14
13
  <?r if user_authorized?([:delete]) ?>
15
- <th>
14
+ <th class="no_sort">
16
15
  <input type="checkbox" />
17
16
  </th>
18
17
  <?r end ?>
19
-
18
+
20
19
  <th>#{lang('users.labels.id')}</th>
21
20
  <th>#{lang('users.labels.email')}</th>
22
21
  <th>#{lang('users.labels.status')}</th>
@@ -30,25 +29,28 @@
30
29
  <tr>
31
30
  <?r if user_authorized?([:delete]) ?>
32
31
  <td>
33
- <input type="checkbox" name="user_ids[]" value="#{user.id}" />
32
+ <input type="checkbox" name="user_ids[]"
33
+ value="#{user.id}" />
34
34
  </td>
35
35
  <?r end ?>
36
-
36
+
37
37
  <td>#{user.id}</td>
38
-
39
- <?r if user_authorized?([:update]) ?>
38
+
40
39
  <td>
41
- #{anchor_to(
42
- user.email,
43
- Users::Controller::Users.r(:edit, user.id)
44
- )}
40
+ #{
41
+ if user_authorized?([:update])
42
+ Users::Controller::Users.a(user.email, :edit, user.id)
43
+ else
44
+ user.email
45
+ end
46
+ }
47
+ </td>
48
+ <td>
49
+ #{lang("users.special.status_hash.#{user.status}")}
50
+ </td>
51
+ <td>
52
+ #{user.created_at.strftime(session[:user].date_format)}
45
53
  </td>
46
- <?r else ?>
47
- <td>#{user.email}</td>
48
- <?r end ?>
49
-
50
- <td>#{lang("users.special.status_hash.#{user.status}")}</td>
51
- <td>#{user.created_at.strftime(session[:user].date_format)}</td>
52
54
  <td>
53
55
  #{
54
56
  if user.updated_at
@@ -67,27 +69,27 @@
67
69
  <?r end ?>
68
70
  </tbody>
69
71
  </table>
70
-
72
+
73
+ #{
74
+ if @users.respond_to?(:navigation) and @users.page_count > 1
75
+ @users.navigation
76
+ end
77
+ }
78
+
71
79
  <?r else ?>
72
80
  <p>#{lang('users.messages.no_users')}</p>
73
81
  <?r end ?>
74
-
75
- <div class="clearfix">
76
-
77
- <?r if user_authorized?([:create]) ?>
78
- <div class="button">
79
- #{anchor_to(
80
- lang('users.buttons.new'),
81
- Users::Controller::Users.r(:new)
82
- )}
83
- </div>
84
- <?r end ?>
85
-
86
- <?r if user_authorized?([:delete]) and @users and !@users.empty? ?>
87
- <div class="button">
88
- <input type="submit" value="#{lang('users.buttons.delete')}" />
89
- </div>
90
- <?r end ?>
82
+
83
+ <?r if user_authorized?([:create]) ?>
84
+ <div class="button">
85
+ #{Users::Controller::Users.a(lang('users.buttons.new'), :new)}
91
86
  </div>
87
+ <?r end ?>
88
+
89
+ <?r if user_authorized?([:delete]) and !@users.empty? ?>
90
+ <div class="button">
91
+ <input type="submit" value="#{lang('users.buttons.delete')}" />
92
+ </div>
93
+ <?r end ?>
92
94
  </form>
93
95
  </article>
@@ -4,23 +4,26 @@
4
4
  </header>
5
5
 
6
6
  #{
7
- form_for(nil, :method => :post, :action => @form_login_url, :id => 'login_form') do |f|
7
+ form_for(
8
+ nil,
9
+ :method => :post,
10
+ :action => Users::Controller::Users.r(:login),
11
+ :id => 'login_form'
12
+ ) do |f|
8
13
  f.input_text(
9
- lang('users.labels.email'),
10
- :email,
14
+ lang('users.labels.email'),
15
+ :email,
11
16
  :tabindex => 1
12
17
  )
13
18
 
14
19
  f.input_password(
15
- lang('users.labels.password'),
16
- :password,
20
+ lang('users.labels.password'),
21
+ :password,
17
22
  :tabindex => 2
18
23
  )
19
24
 
20
- f.g.div(:class => 'clearfix') do
21
- f.g.div(:class => 'button') do
22
- f.g.input(:type => :submit, :value => lang('users.buttons.login'))
23
- end
25
+ f.g.div(:class => 'button') do
26
+ f.g.input(:type => :submit, :value => lang('users.buttons.login'))
24
27
  end
25
28
  end
26
29
  }
@@ -4,10 +4,10 @@ Sequel.migration do
4
4
  create_table :users do
5
5
  primary_key :id
6
6
 
7
- String :email, :null => false, :unique => true
7
+ String :email, :null => false, :unique => true
8
8
  String :name
9
9
  String :website
10
- String :password, :null => false
10
+ String :password, :null => false
11
11
  String :status, :default => 'closed'
12
12
  Time :created_at
13
13
  Time :updated_at
data/lib/zen/plugin.rb CHANGED
@@ -4,18 +4,19 @@ require __DIR__('plugin/base')
4
4
  #:nodoc:
5
5
  module Zen
6
6
  ##
7
- # Plugins in Zen are quite similar to packages except for a few differences. The biggest
8
- # difference is that plugins won't update any Ramaze root directories or language
9
- # directories. This means that they can't have controllers, models and so on.
10
- # Plugins are useful for supporting multiple markup formats (Markdown, Textile, etc)
11
- # and other small tasks such as replacing Email addresses and so on.
7
+ # Plugins in Zen are quite similar to packages except for a few differences.
8
+ # The biggest difference is that plugins won't update any Ramaze root
9
+ # directories or language directories. This means that they can't have
10
+ # controllers, models and so on. Plugins are useful for supporting multiple
11
+ # markup formats (Markdown, Textile, etc) and other small tasks such as
12
+ # replacing Email addresses and so on.
12
13
  #
13
14
  # ## Creating Plugins
14
15
  #
15
- # Creating a plugin happens in two steps. First you'll create your class and then you'll
16
- # register it so that it can be used by the system. A plugin has a very simple layout,
17
- # it's just a class with two methods: initialize and call. The most basic skeleton of a
18
- # plugin looks like the following:
16
+ # Creating a plugin happens in two steps. First you'll create your class and
17
+ # then you'll register it so that it can be used by the system. A plugin has
18
+ # a very simple layout, it's just a class with two methods: initialize and
19
+ # call. The most basic skeleton of a plugin looks like the following:
19
20
  #
20
21
  # class MyPlugin
21
22
  # def initialize
@@ -27,9 +28,9 @@ module Zen
27
28
  # end
28
29
  # end
29
30
  #
30
- # When a plugin is called all specified arguments are sent to the construct method so if
31
- # your plugin requires a number of arguments be sure to store them. An example of this
32
- # looks like the following:
31
+ # When a plugin is called all specified arguments are sent to the construct
32
+ # method so if your plugin requires a number of arguments be sure to store
33
+ # them. An example of this looks like the following:
33
34
  #
34
35
  # class MyPlugin
35
36
  # def initialize(name)
@@ -41,8 +42,8 @@ module Zen
41
42
  # end
42
43
  # end
43
44
  #
44
- # The call method is supposed to return some data. Say we want to capitalize a given
45
- # name we'd modify the skeleton so that it looks like the following:
45
+ # The call method is supposed to return some data. Say we want to capitalize
46
+ # a given name we'd modify the skeleton so that it looks like the following:
46
47
  #
47
48
  # class MyPlugin
48
49
  # def initialize(name)
@@ -56,9 +57,10 @@ module Zen
56
57
  #
57
58
  # ## Registering Plugins
58
59
  #
59
- # Now that the plugin is created it's time to tell Zen it actually is a plugin and not
60
- # some random class that doesn't belong somewhere. This can be done by calling
61
- # Zen::Plugin.add and specifying a block with the details of the plugin. Example:
60
+ # Now that the plugin is created it's time to tell Zen it actually is a plugin
61
+ # and not some random class that doesn't belong somewhere. This can be done
62
+ # by calling Zen::Plugin.add and specifying a block with the details of the
63
+ # plugin. Example:
62
64
  #
63
65
  # Zen::Plugin.add do |plugin|
64
66
  # plugin.name = :my_plugin
@@ -67,31 +69,32 @@ module Zen
67
69
  # plugin.plugin = MyPlugin
68
70
  # end
69
71
  #
70
- # The name and plugin setter are the most important. Names should always match the
71
- # regular expression /[a-z0-9_\-]+/. This is done to ensure names are consistent and
72
- # easy to remember. It's also used for calling plugins and making sure there are no
73
- # duplicates.
72
+ # The name and plugin setter are the most important. Names should always match
73
+ # the regular expression /[a-z0-9_\-]+/. This is done to ensure names are
74
+ # consistent and easy to remember. It's also used for calling plugins and
75
+ # making sure there are no duplicates.
74
76
  #
75
- # The second important part is the plugin setting. This setter takes the class constant
76
- # of the plugin that was created earlier on. There's no need to call new(), this will
77
- # be done by Zen whenever the plugin is actually used.
77
+ # The second important part is the plugin setting. This setter takes the class
78
+ # constant of the plugin that was created earlier on. There's no need to call
79
+ # new(), this will be done by Zen whenever the plugin is actually used.
78
80
  #
79
81
  # ## Executing Plugins
80
82
  #
81
- # Executing plugins is very easy and can be done by using the global method plugin():
83
+ # Executing plugins is very easy and can be done by using the global method
84
+ # plugin():
82
85
  #
83
86
  # plugin(:my_plugin, 'yorick') # => "YORICK"
84
87
  #
85
- # The first argument is the name of the plugin to call, all following arguments will be
86
- # sent to the plugin's construct method.
88
+ # The first argument is the name of the plugin to call, all following
89
+ # arguments will be sent to the plugin's construct method.
87
90
  #
88
91
  # @author Yorick Peterse
89
92
  # @since 0.2.4
90
93
  #
91
94
  module Plugin
92
95
  ##
93
- # Hash containing all registered plugins. The keys are the names of the plugins and
94
- # the values are instances of Zen::Plugin::Base.
96
+ # Hash containing all registered plugins. The keys are the names of the
97
+ # plugins and the values are instances of Zen::Plugin::Base.
95
98
  #
96
99
  # @author Yorick Peterse
97
100
  # @since 0.2.5
@@ -103,8 +106,8 @@ module Zen
103
106
  #
104
107
  # @author Yorick Peterse
105
108
  # @since 0.2.4
106
- # @raise [Zen::PluginError] Error raised whenever the plugin already exists or is
107
- # missing a certain setter.
109
+ # @raise [Zen::PluginError] Error raised whenever the plugin already exists
110
+ # or is missing a certain setter.
108
111
  #
109
112
  def self.add
110
113
  plugin = Zen::Plugin::Base.new
@@ -127,18 +130,12 @@ module Zen
127
130
  # @author Yorick Peterse
128
131
  # @since 0.2.4
129
132
  # @param [String] name The name of the plugin to retrieve.
130
- # @raise Zen::PluginError Error that's raised when no plugins have been added yet or
131
- # the specified plugin doesn't exist.
133
+ # @raise Zen::PluginError Error that's raised when no plugins have been
134
+ # added yet or the specified plugin doesn't exist.
132
135
  # @return [Struct] Instance of the plugin.
133
136
  #
134
137
  def self.[](name)
135
- if name.class != Symbol
136
- name = name.to_sym
137
- end
138
-
139
- if Registered.nil?
140
- raise(Zen::PluginError, "No plugins have been added.")
141
- end
138
+ name = name.to_sym if name.class != Symbol
142
139
 
143
140
  if !Registered[name]
144
141
  raise(Zen::PluginError, "The plugin #{name} doesn't exist.")
@@ -147,11 +144,24 @@ module Zen
147
144
  return Registered[name]
148
145
  end
149
146
 
147
+ ##
148
+ # @author Yorick Peterse
149
+ # @since 0.2.8
150
+ # @see Zen::Plugin::SingletonMethods#plugin
151
+ #
152
+ def self.plugin(name, *data, &block)
153
+ if name.class != Symbol
154
+ name = name.to_sym
155
+ end
156
+
157
+ return ::Zen::Plugin[name].plugin.new(*data, &block).call
158
+ end
159
+
150
160
  #:nodoc:
151
161
  module SingletonMethods
152
162
  ##
153
- # Retrieves the given plugin and executes it. All specified parameters will be sent
154
- # to the plugin as well.
163
+ # Retrieves the given plugin and executes it. All specified parameters
164
+ # will be sent to the plugin as well.
155
165
  #
156
166
  # @example
157
167
  # plugin(:settings, :get, :language)
@@ -160,17 +170,13 @@ module Zen
160
170
  # @since 0.2.5
161
171
  # @param [String/Symbol] name The name of the plugin to call.
162
172
  # @param [Array] data Any data to pass to the plugin's action (a lambda).
163
- # @param [Proc] block A block that should be passed to the plugin instead of this
164
- # method.
173
+ # @param [Proc] block A block that should be passed to the plugin instead
174
+ # of this method.
165
175
  # @return [Mixed]
166
176
  #
167
177
  def plugin(name, *data, &block)
168
- if name.class != Symbol
169
- name = name.to_sym
170
- end
171
-
172
- return ::Zen::Plugin[name].plugin.new(*data, &block).call
178
+ ::Zen::Plugin.plugin(name, *data, &block)
173
179
  end
174
- end
180
+ end # SingletonMethods
175
181
  end # Plugin
176
182
  end # Zen
@@ -3,16 +3,16 @@ module Zen
3
3
  #:nodoc
4
4
  module Plugin
5
5
  ##
6
- # The Markup plugin is used to convert the given markup using the specified engine.
7
- # Out of the box this plugin is capable of doing the following:
6
+ # The Markup plugin is used to convert the given markup using the specified
7
+ # engine. Out of the box this plugin is capable of doing the following:
8
8
  #
9
9
  # * Markdown -> HTML
10
10
  # * Textile -> HTML
11
11
  # * HTML -> Plain text (escapes HTML)
12
12
  # * Regular HTML
13
13
  #
14
- # When using Markdown you'll have to make sure RDiscount is loaded, for Textile this
15
- # should be RedCloth.
14
+ # When using Markdown you'll have to make sure RDiscount is loaded, for
15
+ # Textile this should be RedCloth.
16
16
  #
17
17
  # ## Usage
18
18
  #
@@ -22,14 +22,15 @@ module Zen
22
22
  #
23
23
  # ## Adding Engines
24
24
  #
25
- # In order to add a custom markdown engine (e.g. RDoc) you'll have to update
26
- # Zen::Plugin::Markup::Engines so that it includes the name and human readable name
27
- # of the engine you wish to use. This can be done as following:
25
+ # In order to add a custom markdown engine (e.g. RDoc) you'll have to update
26
+ # Zen::Plugin::Markup::Engines so that it includes the name and human
27
+ # readable name of the engine you wish to use. This can be done as
28
+ # following:
28
29
  #
29
30
  # Zen::Plugin::Markup::Engines[:rdoc] => 'RDoc'
30
31
  #
31
- # Once this is done you'll need to define a method that matches the key you've just
32
- # added. In this case it will be named "rdoc":
32
+ # Once this is done you'll need to define a method that matches the key
33
+ # you've just added. In this case it will be named "rdoc":
33
34
  #
34
35
  # module Zen
35
36
  # module Plugin
@@ -41,22 +42,25 @@ module Zen
41
42
  # end
42
43
  # end
43
44
  #
44
- # Once this has been done you're able to convert RDoc markup to HTML using this plugin.
45
+ # Once this has been done you're able to convert RDoc markup to HTML using
46
+ # this plugin.
45
47
  #
46
48
  # @author Yorick Peterse
47
49
  # @since 0.2.5
48
50
  #
49
51
  class Markup
50
52
  include Ramaze::Helper::CGI
51
-
52
- # Load the language pack in the class method scope rather than the instance's scope
53
+
54
+ # Load the language pack in the class method scope rather than the
55
+ # instance's scope
53
56
  class << self
54
57
  include Zen::Language
55
58
  end
56
59
 
57
60
  ##
58
- # Hash containing the keys of the engines to use and their human friendly names
59
- # (used in the backend). Note that the keys of this hash should be strings.
61
+ # Hash containing the keys of the engines to use and their human friendly
62
+ # names (used in the backend). Note that the keys of this hash should be
63
+ # strings.
60
64
  #
61
65
  # @author Yorick Peterse
62
66
  # @since 0.2.5
@@ -66,10 +70,11 @@ module Zen
66
70
  'textile' => lang('markup.engines.textile'),
67
71
  'plain' => lang('markup.engines.plain'),
68
72
  'html' => lang('markup.engines.html')
69
- }
70
-
73
+ }
74
+
71
75
  ##
72
- # Creates a new instance of the markup plugin and validates all the given parameters.
76
+ # Creates a new instance of the markup plugin and validates all the given
77
+ # parameters.
73
78
  #
74
79
  # @author Yorick Peterse
75
80
  # @since 0.2.5
@@ -81,17 +86,23 @@ module Zen
81
86
 
82
87
  # Validate the given engine
83
88
  if !Engines.keys.include?(@engine)
84
- raise(ArgumentError, "The markup engine \"#{@engine}\" is invalid.")
89
+ raise(
90
+ ArgumentError,
91
+ "The markup engine \"#{@engine}\" is invalid."
92
+ )
85
93
  end
86
94
 
87
95
  # Does the engine have a matching method?
88
96
  if !respond_to?(@engine)
89
- raise(NoMethodError, "The engine \"#{@engine}\" has no matching method.")
97
+ raise(
98
+ NoMethodError,
99
+ "The engine \"#{@engine}\" has no matching method."
100
+ )
90
101
  end
91
102
  end
92
103
 
93
104
  ##
94
- # Converts the markup into HTML or plain text.
105
+ # Converts the markup into HTML or plain text.
95
106
  #
96
107
  # @author Yorick Peterse
97
108
  # @since 0.2.5
@@ -130,7 +141,8 @@ module Zen
130
141
  #
131
142
  # @author Yorick Peterse
132
143
  # @since 0.2.5
133
- # @param [String] markup The markup in which all HTML tags should be escaped.
144
+ # @param [String] markup The markup in which all HTML tags should be
145
+ # escaped.
134
146
  # @return [String] String containing the escaped HTML.
135
147
  #
136
148
  def plain(markup)