zen 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/.gems +17 -15
  2. data/.gitignore +1 -1
  3. data/.travis.yml +1 -1
  4. data/MANIFEST +470 -0
  5. data/README.md +5 -3
  6. data/Rakefile +8 -6
  7. data/bin/zen +2 -7
  8. data/guide/asset_management.md +1 -0
  9. data/guide/autosaving_forms.md +1 -0
  10. data/guide/changelog.md +22 -0
  11. data/guide/faq.md +1 -0
  12. data/guide/getting_started.md +1 -0
  13. data/guide/hacking.md +1 -0
  14. data/guide/images/sections/revisions.png +0 -0
  15. data/guide/images/sections/revisions_diff.png +0 -0
  16. data/guide/images/sections/revisions_diff_multiple.png +0 -0
  17. data/guide/installation.md +4 -3
  18. data/guide/javascript.md +1 -0
  19. data/guide/javascript/zen_autosave.md +1 -0
  20. data/guide/javascript/zen_editor.md +1 -0
  21. data/guide/javascript/zen_form.md +1 -0
  22. data/guide/javascript/zen_hash.md +1 -0
  23. data/guide/javascript/zen_htmltable.md +1 -0
  24. data/guide/javascript/zen_tabs.md +1 -0
  25. data/guide/javascript/zen_window.md +1 -0
  26. data/guide/zen_compared.md +1 -0
  27. data/lib/zen.rb +10 -12
  28. data/lib/zen/event.rb +2 -2
  29. data/lib/zen/helper/controller.rb +13 -13
  30. data/lib/zen/helper/message.rb +3 -3
  31. data/lib/zen/helper/search.rb +4 -4
  32. data/lib/zen/helper/stacked_aspect.rb +9 -9
  33. data/lib/zen/html_diff.rb +151 -0
  34. data/lib/zen/language.rb +9 -7
  35. data/lib/zen/language/translation.rb +8 -8
  36. data/lib/zen/markup.rb +1 -1
  37. data/lib/zen/migrator.rb +2 -2
  38. data/lib/zen/model/helper.rb +4 -4
  39. data/lib/zen/model/plugin/events.rb +16 -16
  40. data/lib/zen/package.rb +2 -2
  41. data/lib/zen/package/all.rb +1 -1
  42. data/lib/zen/package/categories/lib/categories/controller/categories.rb +4 -4
  43. data/lib/zen/package/categories/lib/categories/controller/category_groups.rb +4 -4
  44. data/lib/zen/package/categories/lib/categories/helper/category.rb +3 -3
  45. data/lib/zen/package/categories/lib/categories/model/category.rb +9 -9
  46. data/lib/zen/package/categories/lib/categories/model/category_group.rb +9 -9
  47. data/lib/zen/package/comments/lib/comments/controller/comments.rb +4 -4
  48. data/lib/zen/package/comments/lib/comments/controller/comments_form.rb +2 -2
  49. data/lib/zen/package/comments/lib/comments/helper/comment.rb +1 -1
  50. data/lib/zen/package/comments/lib/comments/model/comment.rb +13 -13
  51. data/lib/zen/package/custom_fields/lib/custom_fields/blue_form_parameters.rb +1 -1
  52. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +4 -4
  53. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_field_types.rb +6 -6
  54. data/lib/zen/package/custom_fields/lib/custom_fields/controller/custom_fields.rb +5 -5
  55. data/lib/zen/package/custom_fields/lib/custom_fields/helper/custom_field.rb +3 -3
  56. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field.rb +9 -9
  57. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_group.rb +9 -9
  58. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_type.rb +9 -9
  59. data/lib/zen/package/custom_fields/lib/custom_fields/model/custom_field_value.rb +8 -3
  60. data/lib/zen/package/custom_fields/migrations/1336171490_revisions.rb +41 -0
  61. data/lib/zen/package/dashboard/lib/dashboard/controller/dashboard.rb +6 -6
  62. data/lib/zen/package/dashboard/lib/dashboard/model/widget.rb +3 -3
  63. data/lib/zen/package/dashboard/lib/dashboard/widget.rb +12 -12
  64. data/lib/zen/package/extensions/lib/extensions/controller/extensions.rb +3 -3
  65. data/lib/zen/package/menus/lib/menus/controller/menu_items.rb +5 -5
  66. data/lib/zen/package/menus/lib/menus/controller/menus.rb +4 -4
  67. data/lib/zen/package/menus/lib/menus/helper/menu.rb +4 -4
  68. data/lib/zen/package/menus/lib/menus/model/menu.rb +11 -11
  69. data/lib/zen/package/menus/lib/menus/model/menu_item.rb +10 -10
  70. data/lib/zen/package/menus/lib/menus/public/admin/menus/js/lib/nested_sortables.js +13 -13
  71. data/lib/zen/package/menus/lib/menus/public/admin/menus/js/menu_items.js +1 -1
  72. data/lib/zen/package/sections/lib/sections.rb +19 -0
  73. data/lib/zen/package/sections/lib/sections/controller/revisions.rb +184 -0
  74. data/lib/zen/package/sections/lib/sections/controller/section_entries.rb +5 -5
  75. data/lib/zen/package/sections/lib/sections/controller/sections.rb +9 -6
  76. data/lib/zen/package/sections/lib/sections/helper/revision.rb +124 -0
  77. data/lib/zen/package/sections/lib/sections/helper/section.rb +17 -15
  78. data/lib/zen/package/sections/lib/sections/helper/section_frontend.rb +104 -6
  79. data/lib/zen/package/sections/lib/sections/language/en/revisions.rb +34 -0
  80. data/lib/zen/package/sections/lib/sections/language/en/sections.rb +1 -0
  81. data/lib/zen/package/sections/lib/sections/language/nl/revisions.rb +35 -0
  82. data/lib/zen/package/sections/lib/sections/language/nl/sections.rb +1 -0
  83. data/lib/zen/package/sections/lib/sections/model/revision.rb +76 -0
  84. data/lib/zen/package/sections/lib/sections/model/section.rb +9 -9
  85. data/lib/zen/package/sections/lib/sections/model/section_entry.rb +47 -12
  86. data/lib/zen/package/sections/lib/sections/view/admin/revisions/index.xhtml +89 -0
  87. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/form.xhtml +1 -1
  88. data/lib/zen/package/sections/lib/sections/view/admin/section-entries/index.xhtml +14 -0
  89. data/lib/zen/package/sections/migrations/1335711557_revisions.rb +40 -0
  90. data/lib/zen/package/settings/lib/settings/controller/settings.rb +12 -4
  91. data/lib/zen/package/settings/lib/settings/setting.rb +6 -6
  92. data/lib/zen/package/users/lib/users/controller/user_groups.rb +4 -4
  93. data/lib/zen/package/users/lib/users/controller/users.rb +12 -12
  94. data/lib/zen/package/users/lib/users/helper/access.rb +1 -1
  95. data/lib/zen/package/users/lib/users/helper/acl.rb +4 -4
  96. data/lib/zen/package/users/lib/users/helper/users.rb +2 -2
  97. data/lib/zen/package/users/lib/users/model/permission.rb +1 -1
  98. data/lib/zen/package/users/lib/users/model/user.rb +11 -11
  99. data/lib/zen/package/users/lib/users/model/user_group.rb +9 -9
  100. data/lib/zen/package/users/lib/users/model/user_status.rb +2 -2
  101. data/lib/zen/public/admin/zen/css/general.css +54 -0
  102. data/lib/zen/public/admin/zen/css/messages.css +6 -3
  103. data/lib/zen/public/admin/zen/css/tables.css +10 -0
  104. data/lib/zen/public/admin/zen/images/icons/undo.png +0 -0
  105. data/lib/zen/public/admin/zen/js/lib/autosave.js +8 -8
  106. data/lib/zen/public/admin/zen/js/lib/base.js +2 -2
  107. data/lib/zen/public/admin/zen/js/lib/events.js +2 -2
  108. data/lib/zen/public/admin/zen/js/lib/form.js +7 -7
  109. data/lib/zen/public/admin/zen/js/lib/hash.js +7 -7
  110. data/lib/zen/public/admin/zen/js/lib/tabs.js +3 -3
  111. data/lib/zen/public/admin/zen/js/lib/window.js +1 -1
  112. data/lib/zen/security.rb +2 -2
  113. data/lib/zen/spec/helper.rb +3 -9
  114. data/lib/zen/spec/helper/capybara.rb +4 -4
  115. data/lib/zen/spec/helper/general.rb +1 -1
  116. data/lib/zen/spec/simplecov.rb +1 -5
  117. data/lib/zen/task/build.rake +22 -16
  118. data/lib/zen/task/db.rake +3 -2
  119. data/lib/zen/task/spelling.rake +10 -10
  120. data/lib/zen/task/test.rake +27 -19
  121. data/lib/zen/theme.rb +6 -6
  122. data/lib/zen/version.rb +1 -1
  123. data/spec/zen/all.rb +4 -0
  124. data/spec/zen/package/sections/controller/revisions.rb +235 -0
  125. data/spec/zen/package/sections/model/revision.rb +76 -0
  126. data/zen.gemspec +23 -21
  127. metadata +88 -29
  128. data/lib/zen/model/methods.rb +0 -27
  129. data/lib/zen/task/clean.rake +0 -20
  130. data/lib/zen/task/setup.rake +0 -4
  131. data/pkg/.gitkeep +0 -0
@@ -5,12 +5,12 @@ module Sections
5
5
  # Model that represents a single section.
6
6
  #
7
7
  # @since 0.1
8
- # @event before_new_section
9
- # @event after_new_section
10
- # @event before_edit_section
11
- # @event after_edit_section
12
- # @event before_delete_section
13
- # @event after_delete_section
8
+ # @event before\_new\_section
9
+ # @event after\_new\_section
10
+ # @event before\_edit\_section
11
+ # @event after\_edit\_section
12
+ # @event before\_delete\_section
13
+ # @event after\_delete\_section
14
14
  #
15
15
  class Section < Sequel::Model
16
16
  include Zen::Model::Helper
@@ -18,7 +18,7 @@ module Sections
18
18
  ##
19
19
  # Array containing all the columns that can be set by the user.
20
20
  #
21
- # @since 17-02-2012
21
+ # @since 2012-02-17
22
22
  #
23
23
  COLUMNS = [
24
24
  :name,
@@ -64,7 +64,7 @@ module Sections
64
64
  # @example
65
65
  # Sections::Model::Section.search('pages')
66
66
  #
67
- # @since 16-10-2011
67
+ # @since 2011-10-16
68
68
  # @param [String] query The search query.
69
69
  # @return [Mixed]
70
70
  #
@@ -101,7 +101,7 @@ module Sections
101
101
  ##
102
102
  # Hook that is executed before creating or saving an object.
103
103
  #
104
- # @since 03-01-2012
104
+ # @since 2012-01-03
105
105
  #
106
106
  def before_save
107
107
  sanitize_fields([:name, :slug, :description, :comment_format])
@@ -5,12 +5,12 @@ module Sections
5
5
  # Model that represents a singe section entry.
6
6
  #
7
7
  # @since 0.1
8
- # @event before_new_section_entry
9
- # @event after_new_section_entry
10
- # @event before_edit_section_entry
11
- # @event after_edit_section_entry
12
- # @event before_delete_section_entry
13
- # @event after_delete_section_entry
8
+ # @event before\_new\_section\_entry
9
+ # @event after\_new\_section\_entry
10
+ # @event before\_edit\_section\_entry
11
+ # @event after\_edit\_section\_entry
12
+ # @event before\_delete\_section\_entry
13
+ # @event after\_delete\_section\_entry
14
14
  #
15
15
  class SectionEntry < Sequel::Model
16
16
  include Zen::Model::Helper
@@ -18,7 +18,7 @@ module Sections
18
18
  ##
19
19
  # Array containing all the columns that can be set by the user.
20
20
  #
21
- # @since 17-02-2012
21
+ # @since 2012-02-17
22
22
  #
23
23
  COLUMNS = [
24
24
  :title,
@@ -37,6 +37,11 @@ module Sections
37
37
  :class => 'CustomFields::Model::CustomFieldValue',
38
38
  :eager => [:custom_field]
39
39
 
40
+ one_to_many :revisions,
41
+ :class => 'Sections::Model::Revision',
42
+ :eager => [:user],
43
+ :order => :id.desc
44
+
40
45
  many_to_one :user,
41
46
  :class => 'Users::Model::User'
42
47
 
@@ -76,7 +81,7 @@ module Sections
76
81
  # Searches for a set of section entries based on the specified search
77
82
  # query.
78
83
  #
79
- # @since 16-10-2011
84
+ # @since 2011-10-16
80
85
  # @param [String] query The search query.
81
86
  # @return [Mixed]
82
87
  #
@@ -217,9 +222,11 @@ module Sections
217
222
  # Index the custom field values hash so that the keys are the IDs of the
218
223
  # custom fields and the values the instances of
219
224
  # CustomFields::Model::CustomFieldValue.
220
- custom_field_values.each do |val|
221
- values[val.custom_field_id] = val
222
- end
225
+ CustomFields::Model::CustomFieldValue \
226
+ .filter(:section_entry_id => id, :revision_id => revision_id) \
227
+ .each do |val|
228
+ values[val.custom_field_id] = val
229
+ end
223
230
 
224
231
  # Build the hash containing all the details of each field
225
232
  groups.each do |group|
@@ -244,11 +251,39 @@ module Sections
244
251
  return result
245
252
  end
246
253
 
254
+ ##
255
+ # Returns a hash containing all custom fields and their values for a given
256
+ # revision. The keys of the has are the IDs of the custom fields, the
257
+ # values are hashes with two keys:
258
+ #
259
+ # * :name
260
+ # * :value
261
+ #
262
+ # @since 2012-04-30
263
+ # @param [Fixnum] rev_id The ID of the revision for which to
264
+ # retrieve the fields and values.
265
+ # @return [Array]
266
+ #
267
+ def custom_fields_and_values(rev_id = revision_id)
268
+ fields = {}
269
+ values = CustomFields::Model::CustomFieldValue \
270
+ .filter(:section_entry_id => id, :revision_id => rev_id) \
271
+ .eager(:custom_field) \
272
+ .all
273
+
274
+ values.each do |value|
275
+ field = value.custom_field
276
+ fields[field.id] = {:name => field.name, :value => value.value}
277
+ end
278
+
279
+ return fields
280
+ end
281
+
247
282
  ##
248
283
  # Returns a string containing the name of the entry's status in the
249
284
  # currently used language.
250
285
  #
251
- # @since 17-12-2011
286
+ # @since 2011-12-17
252
287
  # @return [String]
253
288
  #
254
289
  def status_name
@@ -0,0 +1,89 @@
1
+ <section>
2
+ <header>
3
+ <h1>#{get_breadcrumbs}</h1>
4
+ </header>
5
+
6
+ <div class="body">
7
+ <?r if @diff ?>
8
+
9
+ <h2>#{lang('revisions.titles.differences')}</h2>
10
+
11
+ <?r if !@diff.empty? ?>
12
+
13
+ <table class="no_sort no_background">
14
+ <tbody>
15
+ <?r @diff.each do |name, diff| ?>
16
+ <tr>
17
+ <td>#{name}</td>
18
+ <td>#{diff}</td>
19
+ </tr>
20
+ <?r end ?>
21
+ </tbody>
22
+ </table>
23
+
24
+ <?r else ?>
25
+
26
+ <p>#{lang('revisions.messages.no_differences')}</p>
27
+
28
+ <?r end ?>
29
+
30
+ <?r end ?>
31
+
32
+ <?r if @revisions and !@revisions.empty? ?>
33
+
34
+ <h2>#{lang('revisions.titles.revisions_for') % @entry_url}</h2>
35
+
36
+ <form method="post" action="#{Sections::Controller::Revisions.r(
37
+ :index,
38
+ @entry.section_id,
39
+ @entry.id
40
+ )}">
41
+
42
+ <table class="no_sort">
43
+ <thead>
44
+ <tr>
45
+ <th class="narrow">#{lang('revisions.labels.old')}</th>
46
+ <th class="narrow">#{lang('revisions.labels.new')}</th>
47
+ <th>#{lang('revisions.labels.id')}</th>
48
+ <th>#{lang('revisions.labels.user')}</th>
49
+ <th>#{lang('revisions.labels.created_at')}</th>
50
+ <th></th>
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ <?r @revisions.each do |rev| ?>
55
+ <tr>
56
+ <td>
57
+ #{old_revision_radio(rev.id, @old_rev_id)}
58
+ </td>
59
+ <td>
60
+ #{new_revision_radio(rev.id, @new_rev_id)}
61
+ </td>
62
+ <td>#{rev.id}</td>
63
+ <td>#{rev.user.name}</td>
64
+ <td>#{format_date(rev.created_at)}</td>
65
+ <td>
66
+ <a href="#{Sections::Controller::Revisions.r(
67
+ :restore,
68
+ rev.id
69
+ )}" class="icon undo">
70
+ #{lang('revisions.labels.restore')}
71
+ </a>
72
+ </td>
73
+ </tr>
74
+ <?r end ?>
75
+ </tbody>
76
+ </table>
77
+
78
+ <input type="submit" class="button"
79
+ value="#{lang('revisions.buttons.compare')}" />
80
+
81
+ </form>
82
+
83
+ <?r else ?>
84
+
85
+ <p>#{lang('revisions.messages.no_revisions')}</p>
86
+
87
+ <?r end ?>
88
+ </div>
89
+ </section>
@@ -72,7 +72,7 @@
72
72
  f.select(
73
73
  lang('section_entries.labels.author'),
74
74
  :user_id,
75
- :values => ::Users::Model::User.pk_hash(:name),
75
+ :values => ::Users::Model::User.to_hash(:id, :name),
76
76
  :size => 1,
77
77
  :required => :required,
78
78
  :selected => @entry.user_id
@@ -29,6 +29,7 @@
29
29
  <th>#{lang('section_entries.labels.status')}</th>
30
30
  <th>#{lang('section_entries.labels.created_at')}</th>
31
31
  <th>#{lang('section_entries.labels.updated_at')}</th>
32
+ <th></th>
32
33
  </tr>
33
34
  </thead>
34
35
  <tbody>
@@ -62,6 +63,19 @@
62
63
  <td>#{entry.status_name}</td>
63
64
  <td>#{format_date(entry.created_at)}</td>
64
65
  <td>#{format_date(entry.updated_at)}</td>
66
+
67
+ <?r if user_authorized?(:show_revision) ?>
68
+ <td>
69
+ #{manage_link(
70
+ Sections::Controller::Revisions.r(
71
+ :index,
72
+ entry.section_id,
73
+ entry.id
74
+ ),
75
+ lang('revisions.titles.index')
76
+ )}
77
+ </td>
78
+ <?r end ?>
65
79
  </tr>
66
80
  <?r end ?>
67
81
  </tbody>
@@ -0,0 +1,40 @@
1
+ Sequel.migration do
2
+ up do
3
+ create_table :revisions do
4
+ primary_key :id
5
+
6
+ Time :created_at
7
+
8
+ foreign_key :user_id,
9
+ :users,
10
+ :on_delete => :cascade,
11
+ :on_update => :cascade,
12
+ :key => :id
13
+
14
+ foreign_key :section_entry_id,
15
+ :section_entries,
16
+ :on_delete => :cascade,
17
+ :on_update => :cascade,
18
+ :key => :id
19
+ end
20
+
21
+ alter_table :section_entries do
22
+ add_foreign_key :revision_id, :revisions,
23
+ :on_update => :cascade,
24
+ :on_delete => :set_null,
25
+ :key => :id
26
+ end
27
+ end
28
+
29
+ down do
30
+ alter_table :section_entries do
31
+ if Zen.database.database_type.to_s.include?('mysql')
32
+ drop_constraint :custom_field_values_ibfk_4, :type => :foreign_key
33
+ end
34
+
35
+ drop_column :revision_id
36
+ end
37
+
38
+ drop_table :revisions
39
+ end
40
+ end
@@ -90,6 +90,14 @@ module Settings
90
90
  # When set users are allowed to register user accounts.
91
91
  # </td>
92
92
  # </tr>
93
+ # <tr>
94
+ # <td>Revision amount</td>
95
+ # <td>
96
+ # The maximum amount of revisions to keep for each section
97
+ # entry. After this limit has been exceeded the oldest
98
+ # revision will be removed.
99
+ # </td>
100
+ # </tr>
93
101
  # </tbody>
94
102
  # </table>
95
103
  #
@@ -97,8 +105,8 @@ module Settings
97
105
  #
98
106
  # This controller uses the following permissions:
99
107
  #
100
- # * show_setting
101
- # * edit_setting
108
+ # * show\_setting
109
+ # * edit\_setting
102
110
  #
103
111
  # ## Events
104
112
  #
@@ -116,7 +124,7 @@ module Settings
116
124
  #
117
125
  # @since 0.1
118
126
  # @map /admin/settings
119
- # @event after_edit_setting
127
+ # @event after\_edit\_setting
120
128
  #
121
129
  class Settings < Zen::Controller::AdminController
122
130
  map '/admin/settings'
@@ -156,7 +164,7 @@ module Settings
156
164
  #
157
165
  # @since 0.1
158
166
  # @permission edit_setting
159
- # @event after_edit_setting
167
+ # @event after\_edit\_setting
160
168
  #
161
169
  def save
162
170
  authorize_user!(:edit_setting)
@@ -46,7 +46,7 @@ module Settings
46
46
  # * checkbox
47
47
  # * date
48
48
  # * select
49
- # * select_multiple
49
+ # * select\_multiple
50
50
  #
51
51
  # ## Migrating Settings
52
52
  #
@@ -158,7 +158,7 @@ module Settings
158
158
  # values of these settings will also be removed from the database.
159
159
  #
160
160
  # @since 0.2.5
161
- # @param [Array] namese An array with setting names to remove.
161
+ # @param [Array] names An array with setting names to remove.
162
162
  #
163
163
  def remove(names)
164
164
  if names.class != Array
@@ -241,7 +241,7 @@ module Settings
241
241
  ##
242
242
  # Returns the description of the setting and translates it.
243
243
  #
244
- # @since 13-11-2011
244
+ # @since 2011-11-13
245
245
  # @return [String]
246
246
  #
247
247
  def description
@@ -331,7 +331,7 @@ module Settings
331
331
  #
332
332
  # get_setting(:allow_registration).true?
333
333
  #
334
- # @since 12-11-2011
334
+ # @since 2011-11-12
335
335
  # @return [TrueClass|FalseClass]
336
336
  #
337
337
  def true?
@@ -344,7 +344,7 @@ module Settings
344
344
  # Serializes a value using Marshal and packs it so that it can be stored in
345
345
  # the database.
346
346
  #
347
- # @since 13-11-2011
347
+ # @since 2011-11-13
348
348
  # @param [Mixed] value The value to serialize.
349
349
  # @return [String]
350
350
  #
@@ -356,7 +356,7 @@ module Settings
356
356
  # Unserializes a value that was serialized using
357
357
  # {Settings::Setting#serialize}.
358
358
  #
359
- # @since 13-11-2011
359
+ # @since 2011-11-13
360
360
  # @param [String] value The value to unserialize.
361
361
  # @return [Mixed]
362
362
  #
@@ -75,10 +75,10 @@ module Users
75
75
  #
76
76
  # This controller uses the following permissions:
77
77
  #
78
- # * show_user_group
79
- # * edit_user_group
80
- # * new_user_group
81
- # * delete_user_group
78
+ # * show\_user\_group
79
+ # * edit\_user\_group
80
+ # * new\_user\_group
81
+ # * delete\_user\_group
82
82
  #
83
83
  # @since 0.1
84
84
  # @map /admin/user-groups
@@ -135,16 +135,16 @@ module Users
135
135
  #
136
136
  # This controller uses the following permissions:
137
137
  #
138
- # * show_user
139
- # * new_user
140
- # * edit_user
141
- # * delete_user
138
+ # * show\_user
139
+ # * new\_user
140
+ # * edit\_user
141
+ # * delete\_user
142
142
  #
143
143
  # @since 0.1
144
144
  # @map /admin/users
145
- # @event user_login
146
- # @event before_register_user
147
- # @event after_register_user
145
+ # @event user\_login
146
+ # @event before\_register\_user
147
+ # @event after\_register\_user
148
148
  #
149
149
  class Users < Zen::Controller::AdminController
150
150
  helper :users, :layout
@@ -202,7 +202,7 @@ module Users
202
202
  @user = validate_user(id)
203
203
  @user.set(flash[:form_data]) if flash[:form_data]
204
204
 
205
- @user_group_pks = Model::UserGroup.pk_hash(:name).invert
205
+ @user_group_pks = Model::UserGroup.to_hash(:id, :name).invert
206
206
  @permissions = @user.permissions.map { |p| p.permission.to_sym }
207
207
 
208
208
  render_view(:form)
@@ -223,7 +223,7 @@ module Users
223
223
  )
224
224
 
225
225
  @user = Model::User.new
226
- @user_group_pks = Model::UserGroup.pk_hash(:name).invert
226
+ @user_group_pks = Model::UserGroup.to_hash(:id, :name).invert
227
227
 
228
228
  @user.set(flash[:form_data]) if flash[:form_data]
229
229
 
@@ -234,7 +234,7 @@ module Users
234
234
  # Show a form that allows a user to log in.
235
235
  #
236
236
  # @since 0.1
237
- # @event user_login
237
+ # @event user\_login
238
238
  #
239
239
  def login
240
240
  if request.post?
@@ -277,8 +277,8 @@ module Users
277
277
  # specified by the user.
278
278
  #
279
279
  # @since 0.3
280
- # @event before_register_user
281
- # @event after_register_user
280
+ # @event before\_register\_user
281
+ # @event after\_register\_user
282
282
  #
283
283
  def register
284
284
  redirect(Dashboard::Controller::Dashboard.r(:index)) if logged_in?