zen 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -17,14 +17,17 @@ module Sections
17
17
  class Sections < Zen::Controller::AdminController
18
18
  include ::Sections::Model
19
19
 
20
- map('/admin')
21
-
20
+ map '/admin'
21
+
22
+ # Load all required Javascript files
23
+ javascript ['zen/tabs']
24
+
22
25
  before_all do
23
26
  csrf_protection(:save, :delete) do
24
27
  respond(lang('zen_general.errors.csrf'), 403)
25
28
  end
26
29
  end
27
-
30
+
28
31
  ##
29
32
  # Constructor method, called upon initialization. It's used to set the
30
33
  # URL to which forms send their data and load the language pack.
@@ -38,19 +41,19 @@ module Sections
38
41
  #
39
42
  def initialize
40
43
  super
41
-
44
+
42
45
  @form_save_url = Sections.r(:save)
43
46
  @form_delete_url = Sections.r(:delete)
44
-
47
+
45
48
  Zen::Language.load('sections')
46
-
49
+
47
50
  # Set the page title
48
51
  if !action.method.nil?
49
52
  method = action.method.to_sym
50
53
  @page_title = lang("sections.titles.#{method}") rescue nil
51
54
  end
52
55
  end
53
-
56
+
54
57
  ##
55
58
  # Show an overview of all existing sections. Using this overview a user
56
59
  # can manage an existing section, delete it or create a new one.
@@ -58,7 +61,7 @@ module Sections
58
61
  # This method requires the following permissions:
59
62
  #
60
63
  # * read
61
- #
64
+ #
62
65
  # @author Yorick Peterse
63
66
  # @since 0.1
64
67
  #
@@ -66,12 +69,12 @@ module Sections
66
69
  if !user_authorized?([:read])
67
70
  respond(lang('zen_general.errors.not_authorized'), 403)
68
71
  end
69
-
72
+
70
73
  set_breadcrumbs(lang('sections.titles.index'))
71
-
74
+
72
75
  @sections = Section.all
73
76
  end
74
-
77
+
75
78
  ##
76
79
  # Show a form that lets the user edit an existing section.
77
80
  #
@@ -84,16 +87,16 @@ module Sections
84
87
  # @param [Integer] id The ID of the section to retrieve so that we can edit it.
85
88
  # @since 0.1
86
89
  #
87
- def edit id
90
+ def edit(id)
88
91
  if !user_authorized?([:read, :update])
89
92
  respond(lang('zen_general.errors.not_authorized'), 403)
90
93
  end
91
-
94
+
92
95
  set_breadcrumbs(
93
- anchor_to(lang('sections.titles.index'), Sections.r(:index)),
96
+ anchor_to(lang('sections.titles.index'), Sections.r(:index)),
94
97
  @page_title
95
98
  )
96
-
99
+
97
100
  @custom_field_group_pk_hash = CustomFields::Model::CustomFieldGroup.pk_hash(:name)
98
101
  @category_group_pk_hash = Categories::Model::CategoryGroup.pk_hash(:name)
99
102
 
@@ -103,7 +106,7 @@ module Sections
103
106
  @section = Section[id.to_i]
104
107
  end
105
108
  end
106
-
109
+
107
110
  ##
108
111
  # Show a form that lets the user create a new section.
109
112
  #
@@ -119,17 +122,17 @@ module Sections
119
122
  if !user_authorized?([:create, :read])
120
123
  respond(lang('zen_general.errors.not_authorized'), 403)
121
124
  end
122
-
125
+
123
126
  set_breadcrumbs(
124
- anchor_to(lang('sections.titles.index'), Sections.r(:index)),
127
+ anchor_to(lang('sections.titles.index'), Sections.r(:index)),
125
128
  @page_title
126
129
  )
127
-
130
+
128
131
  @custom_field_group_pk_hash = CustomFields::Model::CustomFieldGroup.pk_hash(:name)
129
132
  @category_group_pk_hash = Categories::Model::CategoryGroup.pk_hash(:name)
130
133
  @section = Section.new
131
134
  end
132
-
135
+
133
136
  ##
134
137
  # Method used for processing the form data and redirecting the user back to
135
138
  # the proper URL. Based on the value of a hidden field named "id" we'll determine
@@ -147,8 +150,11 @@ module Sections
147
150
  if !user_authorized?([:create, :update])
148
151
  respond(lang('zen_general.errors.not_authorized'), 403)
149
152
  end
150
-
151
- post = request.params.dup
153
+
154
+ post = request.subset(
155
+ :id, :name, :slug, :description, :comment_allow, :comment_require_account,
156
+ :comment_moderate, :comment_format, :custom_field_group_pks, :category_group_pks
157
+ )
152
158
 
153
159
  if post['id'] and !post['id'].empty?
154
160
  @section = Section[post['id']]
@@ -157,49 +163,47 @@ module Sections
157
163
  @section = Section.new
158
164
  save_action = :new
159
165
  end
160
-
166
+
161
167
  flash_success = lang("sections.success.#{save_action}")
162
168
  flash_error = lang("sections.errors.#{save_action}")
163
-
169
+
170
+
171
+ post['custom_field_group_pks'] ||= []
172
+ post['category_group_pks'] ||= []
173
+
164
174
  # The primary keys have to be integers otherwise Sequel will soil it's pants
165
- if !post['custom_field_group_pks'].nil?
166
- post['custom_field_group_pks'].map! { |value| value.to_i }
167
- else
168
- post['custom_field_group_pks'] = []
169
- end
170
-
171
- if !post['category_group_pks'].nil?
172
- post['category_group_pks'].map! { |value| value.to_i }
173
- else
174
- post['category_group_pks'] = []
175
+ ['custom_field_group_pks', 'category_group_pks'].each do |k|
176
+ post[k].map! { |value| value.to_i }
175
177
  end
176
178
 
177
179
  # Auto generate the slug if it's empty
178
180
  post.delete('slug') if post['slug'].empty?
179
-
181
+ post.delete('id')
182
+
180
183
  begin
181
184
  @section.update(post)
182
-
185
+
183
186
  if save_action == :new
184
187
  @section.custom_field_group_pks = post['custom_field_group_pks']
185
188
  @section.category_group_pks = post['category_group_pks']
186
189
  end
187
-
188
- notification(:success, lang('sections.titles.index'), flash_success)
189
- rescue
190
- notification(:error, lang('sections.titles.index'), flash_error)
191
-
190
+
191
+ message(:success, flash_success)
192
+ rescue => e
193
+ Ramaze::Log.error(e.inspect)
194
+ message(:error, flash_error)
195
+
192
196
  flash[:form_data] = @section
193
197
  flash[:form_errors] = @section.errors
194
198
  end
195
-
199
+
196
200
  if @section.id
197
201
  redirect(Sections.r(:edit, @section.id))
198
202
  else
199
203
  redirect_referrer
200
204
  end
201
205
  end
202
-
206
+
203
207
  ##
204
208
  # Delete an existing section. Poor section, what did he do wrong?
205
209
  # In order to delete a section you'll need to send a POST request that contains
@@ -217,36 +221,24 @@ module Sections
217
221
  if !user_authorized?([:delete])
218
222
  respond(lang('zen_general.errors.not_authorized'), 403)
219
223
  end
220
-
221
- if !request.params['section_ids'] or request.params['section_ids'].empty?
222
- notification(
223
- :error,
224
- lang('sections.titles.index'),
225
- lang('sections.errors.no_delete')
226
- )
227
224
 
225
+ if !request.params['section_ids'] or request.params['section_ids'].empty?
226
+ message(:error, lang('sections.errors.no_delete'))
228
227
  redirect_referrer
229
228
  end
230
-
229
+
231
230
  request.params['section_ids'].each do |id|
232
231
  begin
233
232
  Section[id.to_i].destroy
234
- notification(
235
- :success,
236
- lang('sections.titles.index'),
237
- lang('sections.success.delete')
238
- )
239
- rescue
240
- notification(
241
- :error,
242
- lang('sections.titles.index'),
243
- lang('sections.errors.delete') % id
244
- )
233
+ message(:success, lang('sections.success.delete'))
234
+ rescue => e
235
+ Ramaze::Log.error(e.inspect)
236
+ message(:error, lang('sections.errors.delete') % id)
245
237
  end
246
238
  end
247
-
239
+
248
240
  redirect_referrer
249
241
  end
250
- end
251
- end
252
- end
242
+ end # Sections
243
+ end # Controller
244
+ end # Sections
@@ -45,4 +45,3 @@ buttons:
45
45
  new : 'Add section'
46
46
  delete : 'Delete selected sections'
47
47
  save : 'Save section'
48
-
@@ -0,0 +1,43 @@
1
+ ---
2
+ titles:
3
+ index: 'Sectie items'
4
+ edit : 'Sectie item aanpassen'
5
+ new : 'Sectie item aanmaken'
6
+
7
+ labels:
8
+ id : '#'
9
+ title : 'Titel'
10
+ slug : 'Slug'
11
+ status : 'Status'
12
+ created_at: 'Aanmaak datum'
13
+ updated_at: 'Aanpas datum'
14
+ author : 'Auteur'
15
+
16
+ special:
17
+ status_hash:
18
+ draft : 'Voorbeeld'
19
+ published: 'Gepubliceerd'
20
+
21
+ tabs:
22
+ basic : 'Algemeen'
23
+ categories: 'Categoriën'
24
+
25
+ messages:
26
+ no_entries : 'Er zijn nog geen items aangemaakt.'
27
+ no_categories: 'De huidige sectie bevat geen categoriën.'
28
+
29
+ success:
30
+ new : 'Het sectie item is aangemaakt.'
31
+ save : 'Het sectie item is aangepast.'
32
+ delete: 'Alle geselecteerde items zijn verwijderd.'
33
+
34
+ errors:
35
+ new : 'Het sectie item kon niet worden aangemaakt.'
36
+ save : 'Het sectie item kon niet worden aangepast.'
37
+ delete : 'Het sectie item met ID #%s kon niet worden verwijderd.'
38
+ no_delete: 'U moet ten minste 1 item specificeren om te verwijderen.'
39
+
40
+ buttons:
41
+ new : 'Sectie item toevoegen'
42
+ save : 'Sectie item opslaan'
43
+ delete: 'Geselecteerde items verwijderen'
@@ -0,0 +1,47 @@
1
+ ---
2
+ titles:
3
+ index: 'Secties'
4
+ edit : 'Sectie aanpassen'
5
+ new : 'Sectie toevoegen'
6
+
7
+ labels:
8
+ id : '#'
9
+ name : 'Naam'
10
+ slug : 'Slug'
11
+ description : 'Beschrijving'
12
+ comment_allow : 'Reacties toegestaan'
13
+ comment_require_account: 'Reacties vereisen een account'
14
+ comment_moderate : 'Beheer reacties'
15
+ comment_format : 'Text opmaak'
16
+ custom_field_groups : 'Veld groepen'
17
+ category_groups : 'Categorie groepen'
18
+ manage_entries : 'Beheer items'
19
+
20
+ special:
21
+ boolean_hash:
22
+ 'true' : 'Ja'
23
+ 'false': 'Nee'
24
+
25
+ tabs:
26
+ general : 'Algemeen'
27
+ comment_settings : 'Reactie instellingen'
28
+ group_assignments: 'Groepen'
29
+
30
+ messages:
31
+ no_sections: 'Er zijn nog geen secties aangemaakt.'
32
+
33
+ success:
34
+ new : 'De sectie is aangemaakt.'
35
+ save : 'De sectie is aangepast.'
36
+ delete: 'Alle geselecteerde secties zijn verwijderd.'
37
+
38
+ errors:
39
+ new : 'De sectie kon niet worden aangemaakt.'
40
+ save : 'De sectie kon niet worden aangepast.'
41
+ delete : 'De sectie met ID #%s kon niet worden verwijderd.'
42
+ no_delete: 'U moet ten minste 1 sectie specificeren om te verwijderen.'
43
+
44
+ buttons:
45
+ new : 'Sectie toevoegen'
46
+ save : 'Sectie opslaan'
47
+ delete: 'Geselecteerde secties verwijderen'
@@ -24,15 +24,8 @@ module Sections
24
24
  :eager => [:custom_field_values]
25
25
  )
26
26
 
27
- many_to_many(
28
- :custom_field_groups,
29
- :class => "CustomFields::Model::CustomFieldGroup"
30
- )
31
-
32
- many_to_many(
33
- :category_groups,
34
- :class => "Categories::Model::CategoryGroup"
35
- )
27
+ many_to_many(:custom_field_groups, :class => "CustomFields::Model::CustomFieldGroup")
28
+ many_to_many(:category_groups, :class => "Categories::Model::CategoryGroup")
36
29
 
37
30
  plugin(:sluggable, :source => :name, :freeze => false)
38
31
 
@@ -43,9 +36,12 @@ module Sections
43
36
  # @since 0.1
44
37
  #
45
38
  def validate
46
- validates_presence([
47
- :name, :comment_allow, :comment_require_account, :comment_moderate, :comment_format
48
- ])
39
+ validates_presence(
40
+ [
41
+ :name, :comment_allow, :comment_require_account, :comment_moderate,
42
+ :comment_format
43
+ ]
44
+ )
49
45
 
50
46
  validates_presence(:slug) unless new?
51
47
  validates_max_length(255, [:name, :slug])
@@ -57,6 +53,6 @@ module Sections
57
53
 
58
54
  validates_unique(:slug)
59
55
  end
60
- end
61
- end
62
- end
56
+ end # Section
57
+ end # Model
58
+ end # Sections
@@ -20,7 +20,6 @@ module Sections
20
20
  # @since 0.1
21
21
  #
22
22
  class SectionEntry < Sequel::Model
23
-
24
23
  one_to_many(:comments, :class => "Comments::Model::Comment")
25
24
 
26
25
  one_to_many(
@@ -45,8 +44,13 @@ module Sections
45
44
  def validate
46
45
  validates_presence([:title, :status, :user_id])
47
46
  validates_presence(:slug) unless new?
48
- end
49
47
 
50
- end
51
- end
52
- end
48
+ # Check if the slug is unique for the current section
49
+ if !SectionEntry.filter({:slug => slug, :section_id => section_id}, ~{:id => id}) \
50
+ .all.empty?
51
+ errors.add(:slug, lang('zen_models.unique'))
52
+ end
53
+ end
54
+ end # SectionEntry
55
+ end # Model
56
+ end # Sections
@@ -143,9 +143,9 @@ module Sections
143
143
  end
144
144
 
145
145
  # Get the entries
146
- entries = SectionEntry.filter(filter_hash)
147
- .eager(*eager_models)
148
- .limit(@options[:limit], @options[:offset])
146
+ entries = SectionEntry.filter(filter_hash) \
147
+ .eager(*eager_models) \
148
+ .limit(@options[:limit], @options[:offset]) \
149
149
  .all
150
150
 
151
151
  comment_format = nil
@@ -177,7 +177,7 @@ module Sections
177
177
  # Get all the comments if the developer wants them
178
178
  if @options[:comments] === true
179
179
  entry.comments.each do |c|
180
- comment = c.values
180
+ comment = c.values
181
181
 
182
182
  if c.user
183
183
  comment[:user] = c.user.values
@@ -218,7 +218,6 @@ module Sections
218
218
 
219
219
  return entries
220
220
  end
221
-
222
- end
223
- end
224
- end
221
+ end # SectionEntries
222
+ end # Plugin
223
+ end # Sections
@@ -79,7 +79,6 @@ module Sections
79
79
 
80
80
  return sections
81
81
  end
82
-
83
- end
84
- end
85
- end
82
+ end # Sections
83
+ end # Plugin
84
+ end # Sections