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
@@ -10,15 +10,15 @@ labels:
10
10
  name : 'Name'
11
11
  url : 'URL'
12
12
  order : 'Order'
13
- css_class : 'CSS class'
14
- css_id : 'CSS ID'
13
+ html_class : 'HTML class'
14
+ html_id : 'HTML ID'
15
15
 
16
16
  placeholders:
17
17
  name : 'The text that will be displayed in the link.'
18
18
  url : 'The location to which the link will point.'
19
19
  order : 'A number that indicates the sort order.'
20
- css_class : 'Specify a class name to use for stylesheets.'
21
- css_id : 'Specify an ID to use for stylesheets.'
20
+ html_class : 'Specify a class name (or multiple names) to apply to this item.'
21
+ html_id : 'Specify an ID to apply to this item.'
22
22
 
23
23
  messages:
24
24
  no_items : 'No menu items have been added yet.'
@@ -38,4 +38,4 @@ errors:
38
38
  save : 'The menu item could not be modified.'
39
39
  delete : 'The menu item with ID #%s could not be deleted.'
40
40
  no_delete : 'You need to specify at least one item to delete.'
41
- invalid_menu : 'The specified menu was invalid or no longer exists.'
41
+ invalid_item : 'The specified menu item is invalid.'
@@ -9,15 +9,15 @@ labels:
9
9
  name : 'Name'
10
10
  slug : 'Slug'
11
11
  description : 'Description'
12
- css_class : 'CSS class'
13
- css_id : 'CSS ID'
12
+ html_class : 'CSS class'
13
+ html_id : 'CSS ID'
14
14
  manage_items : 'Manage menu items'
15
15
 
16
16
  placeholders:
17
17
  name : 'Specify the name of the menu.'
18
18
  slug : 'Specify the URL friendly name of the menu.'
19
- css_class : 'Specify a class to use in stylesheets.'
20
- css_id : 'Specify an ID to use in stylesheets.'
19
+ html_class : 'A number of classes to apply to the menu.'
20
+ html_id : 'An ID to apply to the menu.'
21
21
 
22
22
  messages:
23
23
  no_menus: 'No menus have been added yet.'
@@ -33,7 +33,8 @@ success:
33
33
  delete : 'The selected menus have been deleted.'
34
34
 
35
35
  errors:
36
- new : 'The menu could not be created.'
37
- save : 'The menu could not be modified.'
38
- delete : 'The menu with ID #%s could not be deleted.'
39
- no_delete : 'You need to specify at least one menu to delete.'
36
+ new : 'The menu could not be created.'
37
+ save : 'The menu could not be modified.'
38
+ delete : 'The menu with ID #%s could not be deleted.'
39
+ no_delete : 'You need to specify at least one menu to delete.'
40
+ invalid_menu: 'The specified menu is invalid.'
@@ -10,15 +10,15 @@ labels:
10
10
  name : 'Naam'
11
11
  url : 'URL'
12
12
  order : 'Volgorde'
13
- css_class: 'CSS klasse'
14
- css_id : 'CSS ID'
13
+ html_class: 'CSS klasse'
14
+ html_id : 'CSS ID'
15
15
 
16
16
  placeholders:
17
- name : 'De naam/label van het menu item.'
18
- url : 'De URL van het menu item.'
19
- order : 'De sorteer volgorde.'
20
- css_class: 'Een klasse die gebruikt kan worden in CSS bestanden.'
21
- css_id : 'Een ID die gebruikt kan worden in CSS bestanden.'
17
+ name : 'De naam/label van het menu item.'
18
+ url : 'De URL van het menu item.'
19
+ order : 'De sorteer volgorde.'
20
+ html_class: 'Een of meerdere klasses voor dit item.'
21
+ html_id : 'Een ID voor dit item.'
22
22
 
23
23
  messages:
24
24
  no_items: 'Er zijn nog geen menu items aangemaakt.'
@@ -38,4 +38,4 @@ errors:
38
38
  save : 'Het menu item kon niet worden aangepast.'
39
39
  delete : 'Het menu item met ID #%s kon niet worden verwijderd.'
40
40
  no_delete : 'U moet ten minste 1 item specificeren om te verwijderen.'
41
- invalid_menu: 'Het opgegeven menu is ongeldig of bestaat niet meer.'
41
+ invalid_item: 'Het opgegeven menu item is ongeldig.'
@@ -9,15 +9,15 @@ labels:
9
9
  name : 'Naam'
10
10
  slug : 'Slug'
11
11
  description : 'Beschrijving'
12
- css_class : 'CSS klasse'
13
- css_id : 'CSS ID'
12
+ html_class : 'CSS klasse'
13
+ html_id : 'CSS ID'
14
14
  manage_items: 'Menu items beheren'
15
15
 
16
16
  placeholders:
17
- name : 'De naam van het menu.'
18
- slug : 'Een URL vriendelijke versie van de menu naam.'
19
- css_class: 'Een klasse die gebruikt kan worden in CSS bestanden.'
20
- css_id : 'Een ID die gebruikt kan worden in CSS bestanden.'
17
+ name : 'De naam van het menu.'
18
+ slug : 'Een URL vriendelijke versie van de menu naam.'
19
+ html_class: 'Een of meerdere klasses voor dit menu.'
20
+ html_id : 'Een ID voor dit menu.'
21
21
 
22
22
  messages:
23
23
  no_menus: "Er zijn nog geen menu's aangemaakt."
@@ -33,7 +33,8 @@ success:
33
33
  delete: "De geselecteerde menu's zijn verwijderd."
34
34
 
35
35
  errors:
36
- new : 'Het menu kon niet worden aangemaakt.'
37
- save : 'Het menu kon niet worden aangepast.'
38
- delete : 'Het menu met ID #%s kon niet worden verwijderd.'
39
- no_delete: 'U moet ten minste 1 menu specificeren om te verwijderen.'
36
+ new : 'Het menu kon niet worden aangemaakt.'
37
+ save : 'Het menu kon niet worden aangepast.'
38
+ delete : 'Het menu met ID #%s kon niet worden verwijderd.'
39
+ no_delete : 'U moet ten minste 1 menu specificeren om te verwijderen.'
40
+ invalid_menu: 'Het opgegeven menu is ongeldig.'
@@ -3,8 +3,8 @@ module Menus
3
3
  #:nodoc:
4
4
  module Model
5
5
  ##
6
- # Model used for managing groups of menu items. This model uses the following
7
- # Sequel plugins:
6
+ # Model used for managing groups of menu items. This model uses the
7
+ # following Sequel plugins:
8
8
  #
9
9
  # * sluggable
10
10
  #
@@ -19,8 +19,8 @@ module Menus
19
19
 
20
20
  ##
21
21
  # Specifies all validates rules used when creating or updating a menu.
22
- # A slug will be generated when a menu is first created but after that they are
23
- # required to ensure that they don't collide with existing slugs.
22
+ # A slug will be generated when a menu is first created but after that
23
+ # they are required to ensure that they don't collide with existing slugs.
24
24
  #
25
25
  # @author Yorick Peterse
26
26
  # @since 0.2a
@@ -31,7 +31,7 @@ module Menus
31
31
  validates_unique :slug
32
32
 
33
33
  # Prevent people from entering random crap for class and ID names
34
- validates_format(/^[a-zA-Z\-_0-9]*/, [:css_class, :css_id])
34
+ validates_format(/^[a-zA-Z\-_0-9]*/, [:html_class, :html_id])
35
35
  end
36
36
  end # Menu
37
37
  end # Model
@@ -12,24 +12,25 @@ module Menus
12
12
  # @since 0.2a
13
13
  #
14
14
  class MenuItem < Sequel::Model
15
- plugin :tree, :order => :order
15
+ plugin :tree, :order => :sort_order
16
16
 
17
17
  many_to_one :menu , :class => 'Menus::Model::Menu'
18
18
  many_to_one :parent, :class => self
19
19
 
20
20
  ##
21
- # Specifies all validation rules that will be used when creating or updating a
22
- # menu item.
21
+ # Specifies all validation rules that will be used when creating or
22
+ # updating a menu item.
23
23
  #
24
24
  # @author Yorick Peterse
25
25
  # @since 0.2a
26
26
  #
27
27
  def validate
28
28
  validates_presence :name
29
- validates_integer [:order, :parent_id]
29
+ validates_presence :url
30
+ validates_integer [:sort_order, :parent_id]
30
31
 
31
32
  # Prevent people from entering random crap for class and ID names
32
- validates_format(/^[a-zA-Z\-_0-9]*/, [:css_class, :css_id])
33
+ validates_format(/^[a-zA-Z\-_0-9]*/, [:html_class, :html_id])
33
34
  end
34
35
  end # MenuItem
35
36
  end # Model
@@ -5,19 +5,19 @@ module Menus
5
5
  #:nodoc:
6
6
  module Plugin
7
7
  ##
8
- # Plugin for displaying navigation menus. This plugin will take care of recursively
9
- # displaying all sub items and various other tasks, you merely have to set a few
10
- # options and then you can sit back and enjoy.
8
+ # Plugin for displaying navigation menus. This plugin will take care of
9
+ # recursively displaying all sub items and various other tasks, you merely
10
+ # have to set a few options and then you can sit back and enjoy.
11
11
  #
12
12
  # ## Usage
13
13
  #
14
14
  # menu = plugin(:menus, :menu => 'userguide', :sub => true)
15
15
  #
16
- # Calling this plugin will result in a string with HTML being returned. If you were
17
- # to use this plugin in an Etanni template you'd have to wrap the call in #{} in order
18
- # to actually display the menu.
16
+ # Calling this plugin will result in a string with HTML being returned. If
17
+ # you were to use this plugin in an Etanni template you'd have to wrap the
18
+ # call in #{} in order to actually display the menu.
19
19
  #
20
- # For more information about all the available options see
20
+ # For more information about all the available options see
21
21
  # Menus::Plugin::Menus#initialize().
22
22
  #
23
23
  # @author Yorick Peterse
@@ -36,20 +36,21 @@ module Menus
36
36
  # @author Yorick Peterse
37
37
  # @since 0.2.5
38
38
  # @param [Hash] options Hash with configuration options.
39
- # @option options [Integer/Fixnum] :limit The maximum amount of root items to
40
- # retrieve.
41
- # @option options [Integer/Fixnum] :offset The row offset for all root elements.
42
- # @option options [Fixnum/Integer/String] :menu The ID or slug of the menu for which
43
- # to retrieve all menu items.
44
- # @option options [Boolean] :sub When set to false sub items will be ignored. This
45
- # option is set to true by default.
46
- #
39
+ # @option options [Integer/Fixnum] :limit The maximum amount of root items
40
+ # to retrieve.
41
+ # @option options [Integer/Fixnum] :offset The row offset for all root
42
+ # elements.
43
+ # @option options [Fixnum/Integer/String] :menu The ID or slug of the menu
44
+ # for which to retrieve all menu items.
45
+ # @option options [Boolean] :sub When set to false sub items will be
46
+ # ignored. This option is set to true by default.
47
+ #
47
48
  def initialize(options = {})
48
49
  @options = {
49
50
  :limit => 20,
50
51
  :offset => 0,
51
52
  :menu => nil,
52
- :sub => true,
53
+ :sub => false,
53
54
  :order => :asc
54
55
  }.merge(options)
55
56
 
@@ -67,7 +68,7 @@ module Menus
67
68
  # @return [String] The HTML for the navigation menu.
68
69
  #
69
70
  def call
70
- # Retrieve the menu
71
+ # Retrieve the menu
71
72
  if @options[:menu].class == String
72
73
  menu = Menu[:slug => @options[:menu]]
73
74
  else
@@ -79,20 +80,20 @@ module Menus
79
80
  # Get all menu items
80
81
  menu_items = MenuItem.filter(:menu_id => menu.id, :parent_id => nil) \
81
82
  .limit(@options[:limit], @options[:offset]) \
82
- .order(:order.send(@options[:order])) \
83
+ .order(:sort_order.send(@options[:order])) \
83
84
  .all
84
-
85
+
85
86
  @g = Ramaze::Gestalt.new
86
87
  attributes = {}
87
88
  items_tree = {}
88
89
 
89
90
  # Set the attributes for the main <ul> elements
90
- if !menu.css_class.nil?
91
- attributes[:class] = menu.css_class if !menu.css_class.empty?
91
+ if !menu.html_class.nil?
92
+ attributes[:class] = menu.html_class if !menu.html_class.empty?
92
93
  end
93
94
 
94
- if !menu.css_id.nil?
95
- attributes[:id] = menu.css_id if !menu.css_id.empty?
95
+ if !menu.html_id.nil?
96
+ attributes[:id] = menu.html_id if !menu.html_id.empty?
96
97
  end
97
98
 
98
99
  # Time to build the HTML
@@ -113,39 +114,36 @@ module Menus
113
114
  # Generates the HTML for a single <li> element and all sub elements.
114
115
  #
115
116
  # @author Yorick Peterse
116
- # @since 0.2.5
117
- # @param [Object] item An instance of the MenuItem model as returned by Sequel.
117
+ # @since 0.2.5
118
+ # @param [Object] item An instance of the MenuItem model as returned by
119
+ # Sequel.
118
120
  #
119
121
  def generate_item(item)
120
122
  attributes = {}
121
123
 
122
- if !item.css_class.nil?
123
- attributes[:class] = item.css_class if !item.css_class.empty?
124
+ if !item.html_class.nil?
125
+ attributes[:class] = item.html_class if !item.html_class.empty?
124
126
  end
125
127
 
126
- if !item.css_id.nil?
127
- attributes[:id] = item.css_id if !item.css_id.empty?
128
+ if !item.html_id.nil?
129
+ attributes[:id] = item.html_id if !item.html_id.empty?
128
130
  end
129
131
 
130
- # Get all child elements
131
- children = item.children
132
-
133
132
  # Render the <li> tag
134
133
  @g.li(attributes) do
135
- # Do we have a URL?
136
- if !item.url.nil? and !item.url.empty?
137
- @g.a(:href => item.url, :title => item.name) { item.name }
138
- else
139
- @g.span { item.name }
140
- end
134
+ @g.a(:href => item.url, :title => item.name) { item.name }
141
135
 
142
136
  # Generate all the sub elements
143
- if !children.empty? and @options[:sub] === true
144
- @g.ul(:class => :children) do
145
- children.each do |child|
146
- generate_item(child)
137
+ if @options[:sub] === true
138
+ children = item.children
139
+
140
+ if !children.empty?
141
+ @g.ul(:class => :children) do
142
+ children.each do |child|
143
+ generate_item(child)
144
+ end
147
145
  end
148
- end
146
+ end # if !children.empty?
149
147
  end
150
148
  end
151
149
  end
@@ -1,64 +1,60 @@
1
- #{
2
- form_for(
3
- @menu_item, :method => :post, :action => @form_save_url, :id => :menu_item_form
4
- ) do |f|
5
-
6
- f.input_hidden(:csrf_token, get_csrf_token)
7
- f.input_hidden(:id , @menu_item.id)
8
- f.input_hidden(:menu_id , @menu_id)
9
-
10
- f.input_text(
11
- lang('menu_items.labels.name'),
12
- :name,
13
- :placeholder => lang('menu_items.placeholders.name')
14
- )
15
-
16
- f.input_text(
17
- lang('menu_items.labels.url'),
18
- :url,
19
- :placeholder => lang('menu_items.placeholders.url')
20
- )
21
-
22
- f.input_text(
23
- lang('menu_items.labels.order'),
24
- :order,
25
- :placeholder => lang('menu_items.placeholders.order')
26
- )
27
-
28
- # Generate the dropdown that contains all possible parent menu items
29
- parent_items = {}
30
- Menus::Model::Menu[@menu_id.to_i].menu_items.each do |i|
31
- if i.id != @menu_item.id
32
- parent_items[i.id] = i.name
33
- end
34
- end
35
-
36
- parent_items = menu_item_tree(@menu_id.to_i)
37
-
38
- f.select(
39
- lang('menu_items.labels.parent_id'),
40
- :parent_id,
41
- :values => parent_items,
42
- :selected => @menu_item.parent_id,
43
- :size => 1
44
- )
45
-
46
- f.input_text(
47
- lang('menu_items.labels.css_class'),
48
- :css_class,
49
- :placeholder => lang('menu_items.placeholders.css_class')
50
- )
51
-
52
- f.input_text(
53
- lang('menu_items.labels.css_id'),
54
- :css_id,
55
- :placeholder => lang('menu_items.placeholders.css_id')
56
- )
57
-
58
- f.g.div(:class => :clearfix) do
59
- f.g.div(:class => :button) do
60
- f.g.input(:type => :submit, :value => lang('menu_items.buttons.save'))
1
+ <article>
2
+ <header>
3
+ <h1>#{get_breadcrumbs}</h1>
4
+ </header>
5
+
6
+ #{
7
+ form_for(
8
+ @menu_item,
9
+ :method => :post,
10
+ :action => Menus::Controller::MenuItems.r(:save),
11
+ :id => :menu_item_form
12
+ ) do |f|
13
+ f.input_hidden(:csrf_token, get_csrf_token)
14
+ f.input_hidden(:id , @menu_item.id)
15
+ f.input_hidden(:menu_id , @menu_id)
16
+
17
+ f.input_text(
18
+ lang('menu_items.labels.name'),
19
+ :name,
20
+ :placeholder => lang('menu_items.placeholders.name')
21
+ )
22
+
23
+ f.input_text(
24
+ lang('menu_items.labels.url'),
25
+ :url,
26
+ :placeholder => lang('menu_items.placeholders.url')
27
+ )
28
+
29
+ f.input_text(
30
+ lang('menu_items.labels.order'),
31
+ :sort_order,
32
+ :placeholder => lang('menu_items.placeholders.order')
33
+ )
34
+
35
+ f.select(
36
+ lang('menu_items.labels.parent_id'),
37
+ :parent_id,
38
+ :values => menu_item_tree(@menu_id),
39
+ :selected => @menu_item.parent_id,
40
+ :size => 1
41
+ )
42
+
43
+ f.input_text(
44
+ lang('menu_items.labels.html_class'),
45
+ :html_class,
46
+ :placeholder => lang('menu_items.placeholders.html_class')
47
+ )
48
+
49
+ f.input_text(
50
+ lang('menu_items.labels.html_id'),
51
+ :html_id,
52
+ :placeholder => lang('menu_items.placeholders.html_id')
53
+ )
54
+
55
+ f.g.div(:class => :button) do
56
+ f.g.input(:type => :submit, :value => lang('menu_items.buttons.save'))
57
+ end
61
58
  end
62
- end
63
- end
64
- }
59
+ }
60
+ </article>