zen 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. data/.gems +34 -0
  2. data/.travis.yml +7 -0
  3. data/AUTHORS +5 -0
  4. data/CHANGELOG +14 -0
  5. data/{license.txt → LICENSE} +0 -0
  6. data/MANIFEST +67 -51
  7. data/README.md +18 -25
  8. data/Rakefile +2 -3
  9. data/bin/zen +2 -2
  10. data/lib/zen.rb +93 -57
  11. data/lib/zen/asset.rb +7 -8
  12. data/lib/zen/bin/app.rb +0 -2
  13. data/lib/zen/controller/admin_controller.rb +4 -9
  14. data/lib/zen/controller/base_controller.rb +0 -25
  15. data/lib/zen/controller/main_controller.rb +5 -5
  16. data/lib/zen/controller/preview.rb +50 -0
  17. data/lib/zen/helper/common.rb +4 -68
  18. data/lib/zen/helper/message.rb +82 -0
  19. data/lib/zen/helper/theme.rb +2 -2
  20. data/lib/zen/language.rb +68 -38
  21. data/lib/zen/language/en/zen_general.yml +1 -4
  22. data/lib/zen/language/nl/zen_general.yml +28 -0
  23. data/lib/zen/language/nl/zen_models.yml +13 -0
  24. data/lib/zen/layout/admin.xhtml +1 -1
  25. data/lib/zen/layout/login.xhtml +1 -1
  26. data/lib/zen/model/settings.rb +2 -0
  27. data/lib/zen/package.rb +29 -25
  28. data/lib/zen/package/all.rb +1 -1
  29. data/lib/zen/package/categories/lib/categories/controller/categories.rb +51 -63
  30. data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +45 -52
  31. data/lib/zen/package/categories/lib/categories/language/en/categories.yml +2 -2
  32. data/lib/zen/package/categories/lib/categories/language/nl/categories.yml +39 -0
  33. data/lib/zen/package/categories/lib/categories/language/nl/category_groups.yml +33 -0
  34. data/lib/zen/package/categories/lib/categories/plugin/categories.rb +2 -2
  35. data/lib/zen/package/comments/lib/comments.rb +31 -2
  36. data/lib/zen/package/comments/lib/comments/controller/comments.rb +42 -57
  37. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +36 -51
  38. data/lib/zen/package/comments/lib/comments/language/en/comments.yml +7 -3
  39. data/lib/zen/package/comments/lib/comments/language/nl/comments.yml +48 -0
  40. data/lib/zen/package/comments/lib/comments/model/comment.rb +45 -4
  41. data/lib/zen/package/comments/lib/comments/plugin/anti_spam.rb +152 -0
  42. data/lib/zen/package/comments/lib/comments/plugin/comments.rb +5 -6
  43. data/lib/zen/package/comments/lib/comments/view/admin/comments/index.xhtml +2 -2
  44. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +43 -52
  45. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +68 -67
  46. data/lib/zen/package/custom_fields/lib/custom_fields/language/en/custom_fields.yml +1 -1
  47. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_field_groups.yml +32 -0
  48. data/lib/zen/package/custom_fields/lib/custom_fields/language/nl/custom_fields.yml +52 -0
  49. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +3 -3
  50. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb +4 -7
  51. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +3 -3
  52. data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +37 -44
  53. data/lib/zen/package/menus/lib/menus/controller/menus.rb +33 -43
  54. data/lib/zen/package/menus/lib/menus/helper/menu_item.rb +5 -10
  55. data/lib/zen/package/menus/lib/menus/language/nl/menu_items.yml +41 -0
  56. data/lib/zen/package/menus/lib/menus/language/nl/menus.yml +39 -0
  57. data/lib/zen/package/menus/lib/menus/model/menu.rb +3 -3
  58. data/lib/zen/package/menus/lib/menus/model/menu_item.rb +3 -3
  59. data/lib/zen/package/menus/lib/menus/plugin/menus.rb +5 -6
  60. data/lib/zen/package/menus/migrations/1297184342_create_schema.rb +1 -1
  61. data/lib/zen/package/sections/lib/sections.rb +20 -0
  62. data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +85 -79
  63. data/lib/zen/package/sections/lib/sections/controller/sections.rb +58 -66
  64. data/lib/zen/package/sections/lib/sections/language/en/sections.yml +0 -1
  65. data/lib/zen/package/sections/lib/sections/language/nl/section_entries.yml +43 -0
  66. data/lib/zen/package/sections/lib/sections/language/nl/sections.yml +47 -0
  67. data/lib/zen/package/sections/lib/sections/model/section.rb +11 -15
  68. data/lib/zen/package/sections/lib/sections/model/section_entry.rb +9 -5
  69. data/lib/zen/package/sections/lib/sections/plugin/section_entries.rb +7 -8
  70. data/lib/zen/package/sections/lib/sections/plugin/sections.rb +3 -4
  71. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +0 -4
  72. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +8 -2
  73. data/lib/zen/package/sections/migrations/1306772479_remove_unique_slug.rb +28 -0
  74. data/lib/zen/package/settings/lib/settings.rb +21 -34
  75. data/lib/zen/package/settings/lib/settings/controller/settings.rb +29 -22
  76. data/lib/zen/package/settings/lib/settings/language/en/settings.yml +7 -5
  77. data/lib/zen/package/settings/lib/settings/language/nl/settings.yml +39 -0
  78. data/lib/zen/package/settings/lib/settings/model/setting.rb +3 -5
  79. data/lib/zen/package/settings/lib/settings/plugin/group_base.rb +3 -4
  80. data/lib/zen/package/settings/lib/settings/plugin/setting_base.rb +3 -5
  81. data/lib/zen/package/settings/lib/settings/plugin/settings.rb +11 -4
  82. data/lib/zen/package/settings/lib/settings/view/admin/settings/index.xhtml +5 -5
  83. data/lib/zen/package/settings/migrations/1299538742_add_language_key.rb +8 -8
  84. data/lib/zen/package/settings/migrations/1303196915_settings_plugin.rb +2 -5
  85. data/lib/zen/package/users/lib/users/controller/access_rules.rb +54 -61
  86. data/lib/zen/package/users/lib/users/controller/user_groups.rb +49 -57
  87. data/lib/zen/package/users/lib/users/controller/users.rb +58 -73
  88. data/lib/zen/package/users/lib/users/language/en/users.yml +6 -0
  89. data/lib/zen/package/users/lib/users/language/nl/access_rules.yml +37 -0
  90. data/lib/zen/package/users/lib/users/language/nl/user_groups.yml +31 -0
  91. data/lib/zen/package/users/lib/users/language/nl/users.yml +56 -0
  92. data/lib/zen/package/users/lib/users/model/user.rb +16 -1
  93. data/lib/zen/package/users/lib/users/view/admin/users/form.xhtml +27 -2
  94. data/lib/zen/package/users/lib/users/view/admin/users/index.xhtml +15 -3
  95. data/lib/zen/package/users/migrations/1304939855_user_settings.rb +15 -0
  96. data/lib/zen/plugin.rb +7 -9
  97. data/lib/zen/public/admin/css/{buttons.css → zen/buttons.css} +11 -7
  98. data/lib/zen/public/admin/css/{datepicker.css → zen/datepicker.css} +0 -0
  99. data/lib/zen/public/admin/css/{editor.css → zen/editor.css} +10 -5
  100. data/lib/zen/public/admin/css/{forms.css → zen/forms.css} +1 -1
  101. data/lib/zen/public/admin/css/{general.css → zen/general.css} +7 -7
  102. data/lib/zen/public/admin/css/{grid.css → zen/grid.css} +0 -0
  103. data/lib/zen/public/admin/css/{layout.css → zen/layout.css} +4 -5
  104. data/lib/zen/public/admin/css/zen/messages.css +61 -0
  105. data/lib/zen/public/admin/css/{notifications.css → zen/notifications.css} +4 -4
  106. data/lib/zen/public/admin/css/{reset.css → zen/reset.css} +0 -0
  107. data/lib/zen/public/admin/css/{tables.css → zen/tables.css} +3 -3
  108. data/lib/zen/public/admin/css/{tabs.css → zen/tabs.css} +5 -5
  109. data/lib/zen/public/admin/css/zen/window.css +79 -0
  110. data/lib/zen/public/admin/images/{icons → zen/icons}/accept.png +0 -0
  111. data/lib/zen/public/admin/images/{icons → zen/icons}/add.png +0 -0
  112. data/lib/zen/public/admin/images/{icons → zen/icons}/back.png +0 -0
  113. data/lib/zen/public/admin/images/{icons → zen/icons}/bold.png +0 -0
  114. data/lib/zen/public/admin/images/zen/icons/close.png +0 -0
  115. data/lib/zen/public/admin/images/{icons → zen/icons}/delete.png +0 -0
  116. data/lib/zen/public/admin/images/{icons → zen/icons}/edit.png +0 -0
  117. data/lib/zen/public/admin/images/{icons → zen/icons}/error.png +0 -0
  118. data/lib/zen/public/admin/images/{icons → zen/icons}/help.png +0 -0
  119. data/lib/zen/public/admin/images/{icons → zen/icons}/info.png +0 -0
  120. data/lib/zen/public/admin/images/{icons → zen/icons}/italic.png +0 -0
  121. data/lib/zen/public/admin/images/{icons → zen/icons}/large/error.png +0 -0
  122. data/lib/zen/public/admin/images/{icons → zen/icons}/large/notice.png +0 -0
  123. data/lib/zen/public/admin/images/{icons → zen/icons}/large/success.png +0 -0
  124. data/lib/zen/public/admin/images/{icons → zen/icons}/link.png +0 -0
  125. data/lib/zen/public/admin/images/{icons → zen/icons}/logout.png +0 -0
  126. data/lib/zen/public/admin/images/{icons → zen/icons}/ol.png +0 -0
  127. data/lib/zen/public/admin/images/{icons → zen/icons}/pdf.png +0 -0
  128. data/lib/zen/public/admin/images/zen/icons/preview.png +0 -0
  129. data/lib/zen/public/admin/images/{icons → zen/icons}/ul.png +0 -0
  130. data/lib/zen/public/admin/images/{icons → zen/icons}/user.png +0 -0
  131. data/lib/zen/public/admin/images/{icons → zen/icons}/view.png +0 -0
  132. data/lib/zen/public/admin/js/zen/core.js +73 -0
  133. data/lib/zen/public/admin/js/zen/editor.js +527 -0
  134. data/lib/zen/public/admin/js/zen/editor/markdown.js +84 -0
  135. data/lib/zen/public/admin/js/zen/editor/textile.js +84 -0
  136. data/lib/zen/public/admin/js/zen/init.js +12 -66
  137. data/lib/zen/public/admin/js/zen/tabs.js +5 -0
  138. data/lib/zen/public/admin/js/zen/window.js +206 -0
  139. data/lib/zen/task/build.rake +23 -6
  140. data/lib/zen/task/clean.rake +6 -7
  141. data/lib/zen/task/db.rake +7 -9
  142. data/lib/zen/task/package.rake +6 -6
  143. data/lib/zen/task/test.rake +6 -0
  144. data/lib/zen/task/theme.rake +3 -3
  145. data/lib/zen/theme.rb +3 -4
  146. data/lib/zen/validation.rb +7 -9
  147. data/lib/zen/version.rb +3 -4
  148. data/lib/zen/view/bottom.xhtml +0 -5
  149. data/lib/zen/view/main.xhtml +2 -0
  150. data/proto/app/app.rb +6 -4
  151. data/proto/app/config/config.rb +1 -7
  152. data/proto/app/config/database.rb +47 -43
  153. data/proto/app/config/middlewares.rb +0 -40
  154. data/proto/app/start.rb +1 -6
  155. data/proto/app/{vendor → theme}/.gitkeep +0 -0
  156. data/proto/migration.rb +3 -3
  157. data/proto/package/lib/package.rb +0 -1
  158. data/proto/package/lib/package/controller/controllers.rb +7 -40
  159. data/proto/package/lib/package/model/model.rb +3 -3
  160. metadata +106 -79
  161. data/CHANGELOG.md +0 -27
  162. data/ROADMAP.md +0 -53
  163. data/lib/zen/database.rb +0 -112
  164. data/lib/zen/logger.rb +0 -56
  165. data/lib/zen/public/admin/css/modals.css +0 -63
  166. data/lib/zen/public/admin/images/icons/close.png +0 -0
  167. data/lib/zen/public/admin/js/vendor/yepnope.js +0 -1
  168. data/lib/zen/public/admin/js/zen/editor/base.js +0 -262
  169. data/lib/zen/public/admin/js/zen/editor/drivers/html.js +0 -89
  170. data/lib/zen/public/admin/js/zen/editor/drivers/markdown.js +0 -87
  171. data/lib/zen/public/admin/js/zen/editor/drivers/textile.js +0 -87
  172. data/lib/zen/public/admin/js/zen/modal.js +0 -146
  173. data/lib/zen/public/admin/js/zen/notification.js +0 -211
  174. data/proto/app/config/requires.rb +0 -10
  175. data/proto/app/vendor/theme/.gitkeep +0 -0
  176. data/proto/package/lib/package/view/admin/package/edit.xhtml +0 -0
  177. data/proto/package/lib/package/view/admin/package/form.xhtml +0 -0
  178. data/proto/package/lib/package/view/admin/package/new.xhtml +0 -0
@@ -32,7 +32,6 @@
32
32
  f.input_hidden(:id, @entry.id)
33
33
 
34
34
  f.g.div(:id => :basic) do
35
-
36
35
  f.input_text(
37
36
  lang('section_entries.labels.title'),
38
37
  :title
@@ -65,11 +64,9 @@
65
64
  :selected => @entry.status,
66
65
  :size => 1
67
66
  )
68
-
69
67
  end
70
68
 
71
69
  f.g.div(:id => :categories) do
72
-
73
70
  if @entry.section.category_groups
74
71
  @entry.section.category_groups.each do |group|
75
72
  categories = {}
@@ -89,7 +86,6 @@
89
86
  else
90
87
  f.g.p(lang('section_entries.messages.no_categories'))
91
88
  end
92
-
93
89
  end
94
90
 
95
91
  # Organize all field values by field ID
@@ -49,8 +49,14 @@
49
49
 
50
50
  <td>#{entry.slug}</td>
51
51
  <td>#{@status_hash[entry.status]}</td>
52
- <td>#{entry.created_at}</td>
53
- <td>#{entry.updated_at}</td>
52
+ <td>#{entry.created_at.strftime(session[:user].date_format)}</td>
53
+ <td>
54
+ #{
55
+ if entry.updated_at
56
+ entry.updated_at.strftime(session[:user].date_format)
57
+ end
58
+ }
59
+ </td>
54
60
  </tr>
55
61
  <?r end ?>
56
62
  </tbody>
@@ -0,0 +1,28 @@
1
+ Sequel.migration do
2
+ # Updates the database with the changes specified in the block.
3
+ up do
4
+ entries = Zen.database[:section_entries].all
5
+
6
+ drop_column(:section_entries, :slug)
7
+ add_column(:section_entries , :slug, String)
8
+ add_index(:section_entries , :slug)
9
+
10
+ entries.each do |entry|
11
+ Zen.database[:section_entries] \
12
+ .filter(:id => entry[:id]).update(:slug => entry[:slug])
13
+ end
14
+ end
15
+
16
+ # Reverts the changes made in the up() block.
17
+ down do
18
+ entries = Zen.database[:section_entries].all
19
+
20
+ drop_column(:section_entries, :slug)
21
+ add_column(:section_entries, :slug, String, :unique => true)
22
+
23
+ entries.each do |entry|
24
+ Zen.database[:section_entries] \
25
+ .filter(:id => entry[:id]).update(:slug => entry[:slug])
26
+ end
27
+ end
28
+ end
@@ -27,16 +27,7 @@ not to allow registration, etc.'
27
27
  end
28
28
 
29
29
  # Create all variables required for the settings
30
- section_hash = {}
31
- theme_hash = {}
32
-
33
- begin
34
- Sections::Model::Section.select(:name, :slug).each do |s|
35
- section_hash[s.slug] = s.name
36
- end
37
- rescue => e
38
- Ramaze::Log.warn("The settings plugin failed to retrieve all sections: #{e.message}")
39
- end
30
+ theme_hash = {}
40
31
 
41
32
  Zen::Theme::Registered.each do |name, theme|
42
33
  name = name.to_s
@@ -103,18 +94,17 @@ plugin(:settings, :register) do |setting|
103
94
  setting.group = 'general'
104
95
  setting.default = 'en'
105
96
  setting.type = 'select'
106
- setting.values = {
107
- 'en' => lang('zen_general.special.language_hash.en')
108
- }
97
+ setting.values = Zen::Language::Languages
109
98
  end
110
99
 
111
100
  plugin(:settings, :register) do |setting|
112
- setting.title = lang('settings.labels.default_section')
113
- setting.description = lang('settings.placeholders.default_section')
114
- setting.name = 'default_section'
101
+ setting.title = lang('settings.labels.frontend_language')
102
+ setting.description = lang('settings.placeholders.frontend_language')
103
+ setting.name = 'frontend_language'
115
104
  setting.group = 'general'
105
+ setting.default = 'en'
116
106
  setting.type = 'select'
117
- setting.values = section_hash
107
+ setting.values = Zen::Language::Languages
118
108
  end
119
109
 
120
110
  plugin(:settings, :register) do |setting|
@@ -126,6 +116,20 @@ plugin(:settings, :register) do |setting|
126
116
  setting.values = theme_hash
127
117
  end
128
118
 
119
+ plugin(:settings, :register) do |setting|
120
+ setting.title = lang('settings.labels.date_format')
121
+ setting.description = lang('settings.placeholders.date_format')
122
+ setting.name = 'date_format'
123
+ setting.group = 'general'
124
+ setting.type = 'select'
125
+ setting.default = '%Y-%m-%d %H:%I:%S'
126
+ setting.values = {
127
+ '%Y-%m-%d %H:%I:%S' => '2011-05-10 13:30:12',
128
+ '%d-%m-%Y %H:%I:%S' => '10-05-2011 13:30:12',
129
+ '%A, %B %d, %Y' => 'Tuesday, May 10, 2011'
130
+ }
131
+ end
132
+
129
133
  plugin(:settings, :register) do |setting|
130
134
  setting.title = lang('settings.labels.enable_antispam')
131
135
  setting.description = lang('settings.placeholders.enable_antispam')
@@ -137,20 +141,3 @@ plugin(:settings, :register) do |setting|
137
141
  lang('zen_general.special.boolean_hash.false') => '0'
138
142
  }
139
143
  end
140
-
141
- plugin(:settings, :register) do |setting|
142
- setting.title = lang('settings.labels.defensio_key')
143
- setting.description = lang('settings.placeholders.defensio_key')
144
- setting.name = 'defensio_key'
145
- setting.group = 'security'
146
- setting.type = 'textbox'
147
- end
148
-
149
- # Migrate all settings
150
- begin
151
- plugin(:settings, :migrate)
152
- rescue
153
- Ramaze::Log.warn(
154
- "Failed to migrate the current settings, make sure the database table is up to date."
155
- )
156
- end
@@ -12,14 +12,17 @@ module Settings
12
12
  class Settings < Zen::Controller::AdminController
13
13
  include ::Settings::Model
14
14
 
15
- map('/admin/settings')
16
-
15
+ map '/admin/settings'
16
+
17
+ # Load all required Javascript files
18
+ javascript ['zen/tabs']
19
+
17
20
  before_all do
18
21
  csrf_protection(:save, :delete) do
19
22
  respond(lang('zen_general.errors.csrf'), 403)
20
23
  end
21
24
  end
22
-
25
+
23
26
  ##
24
27
  # Load our language packs, set the form URLs and define our page title.
25
28
  #
@@ -32,7 +35,7 @@ module Settings
32
35
  #
33
36
  def initialize
34
37
  super
35
-
38
+
36
39
  @form_save_url = Settings.r(:save)
37
40
 
38
41
  # Set the page title
@@ -41,7 +44,7 @@ module Settings
41
44
  @page_title = lang("settings.titles.#{method}") rescue nil
42
45
  end
43
46
  end
44
-
47
+
45
48
  ##
46
49
  # Show all settings and allow the user to change them.
47
50
  # The values of each setting item are stored in the database,
@@ -60,23 +63,23 @@ module Settings
60
63
  if !user_authorized?([:read, :update])
61
64
  respond(lang('zen_general.errors.not_authorized'), 403)
62
65
  end
63
-
66
+
64
67
  set_breadcrumbs(lang('settings.titles.index'))
65
-
68
+
66
69
  @settings_ordered = {}
67
70
  @groups = ::Settings::Plugin::Settings::Registered[:groups]
68
-
71
+
69
72
  # Organize the settings so that each item is a child
70
73
  # item of it's group.
71
74
  ::Settings::Plugin::Settings::Registered[:settings].each do |name, setting|
72
75
  if !@settings_ordered.key?(setting.group)
73
76
  @settings_ordered[setting.group] = []
74
77
  end
75
-
78
+
76
79
  @settings_ordered[setting.group].push(setting)
77
80
  end
78
81
  end
79
-
82
+
80
83
  ##
81
84
  # Saves the values of each setting. Since each setting
82
85
  # is a new row we'll have to loop through them and execute quite
@@ -85,42 +88,46 @@ module Settings
85
88
  # This method requires the following permissions:
86
89
  #
87
90
  # * update
88
- #
91
+ #
89
92
  # @author Yorick Peterse
90
93
  # @since 0.1
91
- #
94
+ #
92
95
  def save
93
96
  if !user_authorized?([:update])
94
97
  respond(lang('zen_general.errors.not_authorized'), 403)
95
98
  end
96
-
99
+
97
100
  post = request.params.dup
98
101
  post.delete('csrf_token')
102
+ post.delete('id')
99
103
 
100
104
  flash_success = lang('settings.success.save')
101
105
  flash_error = lang('settings.errors.save')
106
+ success = true
102
107
 
103
108
  # Update all settings
104
109
  post.each do |key, value|
105
110
  setting = Setting[:name => key]
106
111
 
107
112
  begin
108
- # Update the DB record
109
113
  setting.update(:value => value)
110
- notification(:success, lang('settings.titles.index'), flash_success)
111
114
 
112
115
  # Update the internal settings
113
- if ::Zen::Settings[key.to_sym] != value
114
- ::Zen::Settings[key.to_sym] = value
116
+ if ::Zen.settings[key.to_sym] != value
117
+ ::Zen.settings[key.to_sym] = value
115
118
  end
116
- rescue
117
- notification(:error, lang('settings.titles.index'), flash_error)
119
+ rescue => e
120
+ Ramaze::Log.error(e.inspect)
121
+ message(:error, flash_error)
122
+
118
123
  flash[:form_errors] = setting.errors
124
+ success = false
119
125
  end
120
126
  end
121
127
 
128
+ message(:success, flash_success) if success === true
122
129
  redirect_referrer
123
130
  end
124
- end
125
- end
126
- end
131
+ end # Settings
132
+ end # Controller
133
+ end # Settings
@@ -7,10 +7,11 @@ labels:
7
7
  website_description : 'Website description'
8
8
  website_enabled : 'Website enabled'
9
9
  language : 'Language'
10
+ frontend_language : 'Frontend language'
10
11
  default_section : 'Default section'
11
12
  theme : 'Theme'
12
13
  enable_antispam : 'Enable anti-spam'
13
- defensio_key : 'Defensio API key'
14
+ date_format : 'Date format'
14
15
 
15
16
  placeholders:
16
17
  website_name : 'The name of the website.'
@@ -19,12 +20,13 @@ placeholders:
19
20
  language : 'The language to use for the system.'
20
21
  default_section : 'The default section to use on the homepage.'
21
22
  theme : 'The frontend theme to use.'
22
- enable_antispam : "Whether or not Defensio's anti-spam system should be used."
23
- defensio_key : 'The API key to use for the Defensio anti-spam system.'
23
+ enable_antispam : 'Whether or not anti-spam protection should be used for comments'
24
+ frontend_language : 'The language to use for the frontend of the website.'
25
+ date_format : 'A custom format used for all the dates displayed in the backend.'
24
26
 
25
27
  tabs:
26
- general : 'General'
27
- security : 'Security'
28
+ general : 'General'
29
+ security : 'Security'
28
30
 
29
31
  buttons:
30
32
  save: 'Save'
@@ -0,0 +1,39 @@
1
+ ---
2
+ titles:
3
+ index: 'Instellingen'
4
+
5
+ labels:
6
+ website_name : 'Website naam'
7
+ website_description: 'Website beschrijving'
8
+ website_enable : 'Website beschikbaar'
9
+ language : 'Taal'
10
+ frontend_langauge : 'Taal voor bezoekers'
11
+ default_section : 'Standaard sectie'
12
+ theme : 'Thema'
13
+ enable_antispam : 'Anti-spam inschakelen'
14
+ date_format : 'Datum formaat'
15
+
16
+ placeholders:
17
+ website_name : 'De naam van de website.'
18
+ website_description: 'De beschrijving van de website.'
19
+ website_enabled : 'Is de website wel of niet beschikbaar?'
20
+ language : 'De taal die gebruikt moet worden voor het admin gedeelte.'
21
+ default_section : 'De standaard sectie die moet worden gebruikt.'
22
+ theme : 'Het thema dat bezoekers zullen zien.'
23
+ enable_antispam : 'Waarde die aangeeft of het anti-spam systeem moet worden gebruikt
24
+ voor reacties.'
25
+ frontend_language : 'De taal die gebruikt moet worden voor bezoekers.'
26
+ date_format : 'Het formaat van de datum voor het admin gedeelte.'
27
+
28
+ tabs:
29
+ general : 'Algemeen'
30
+ security: 'Beveiliging'
31
+
32
+ buttons:
33
+ save: 'Opslaan'
34
+
35
+ success:
36
+ save: 'De instellingen zijn opgeslagen.'
37
+
38
+ errors:
39
+ save: 'De instellingen konden niet worden opgeslagen.'
@@ -23,7 +23,6 @@ module Settings
23
23
  # idea to refactor this and put it in it's own class/plugin/whatever.
24
24
  #
25
25
  class Setting < Sequel::Model
26
-
27
26
  ##
28
27
  # Retrieves all settings and returns them as a key/value hash.
29
28
  #
@@ -46,7 +45,6 @@ module Settings
46
45
 
47
46
  return settings
48
47
  end
49
-
50
- end
51
- end
52
- end
48
+ end # Setting
49
+ end # Model
50
+ end # Settings
@@ -34,7 +34,6 @@ module Settings
34
34
  )
35
35
  end
36
36
  end
37
-
38
- end
39
- end
40
- end
37
+ end # GroupBase
38
+ end # Plugin
39
+ end # Settings
@@ -69,8 +69,6 @@ module Settings
69
69
  raise(::Zen::ValidationError, "The settings group #{group} doesn't exist.")
70
70
  end
71
71
  end
72
-
73
- end
74
- end
75
- end
76
-
72
+ end # SettingBase
73
+ end # Plugin
74
+ end # Settings
@@ -201,12 +201,20 @@ module Settings
201
201
  settings = Setting.all.map { |s| s.name }
202
202
 
203
203
  Registered[:settings].each do |name, setting|
204
+ name = name.to_s
205
+
204
206
  if !settings.include?(name)
205
207
  # Insert the new setting
206
208
  Setting.new(
207
209
  :name => setting.name , :group => setting.group,
208
210
  :default => setting.default, :type => setting.type
209
211
  ).save
212
+
213
+ # Update everything but the value
214
+ else
215
+ Setting.filter[:name => setting.name].update(
216
+ :group => setting.group, :default => setting.default, :type => setting.type
217
+ )
210
218
  end
211
219
  end
212
220
  end
@@ -230,7 +238,6 @@ module Settings
230
238
 
231
239
  Setting.filter(:name => names).delete
232
240
  end
233
-
234
- end
235
- end
236
- end
241
+ end # Settings
242
+ end # Plugin
243
+ end # Settings
@@ -12,7 +12,8 @@
12
12
  <?r end ?>
13
13
  </ul>
14
14
  </div>
15
- #{
15
+
16
+ #{
16
17
  form_for(@settings_ordered, :method => :post, :action => @form_save_url, :id => :setting_form) do |f|
17
18
  f.input_hidden(:csrf_token, get_csrf_token)
18
19
 
@@ -20,10 +21,10 @@
20
21
  f.g.div(:id => "group_#{group}") do
21
22
  items.each do |s|
22
23
  # Get the value from either the value or default getter
23
- if ::Zen::Settings[s.name.to_sym].nil?
24
+ if ::Zen.settings[s.name.to_sym].nil?
24
25
  value = s.default
25
26
  else
26
- value = ::Zen::Settings[s.name.to_sym]
27
+ value = ::Zen.settings[s.name.to_sym]
27
28
  end
28
29
 
29
30
  case s.type
@@ -77,6 +78,5 @@
77
78
  end
78
79
  end
79
80
  end
80
- }
81
-
81
+ }
82
82
  </article>