hancock_cms 2.0.0.2 → 2.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +4 -0
  3. data/app/assets/images/{devices → hancock/devise}/login-bg.jpg +0 -0
  4. data/app/assets/images/{rails-admin → hancock/rails_admin}/hancock_logo.svg +0 -0
  5. data/app/assets/javascripts/hancock/cms.coffee +1 -1
  6. data/app/assets/javascripts/hancock/rails_admin/cms.ui.coffee +11 -37
  7. data/app/assets/javascripts/hancock/rails_admin/en_ru_switcher.coffee +90 -0
  8. data/app/assets/javascripts/hancock/rails_admin/enum_with_custom.coffee +42 -0
  9. data/app/assets/javascripts/hancock/rails_admin/form_controls_fixed.coffee +44 -0
  10. data/app/assets/javascripts/hancock/rails_admin/leftside_hider.coffee +106 -0
  11. data/app/assets/javascripts/hancock/rails_admin/multiselect.coffee +8 -0
  12. data/app/assets/javascripts/hancock/rails_admin/navigation_dropdown.coffee +25 -0
  13. data/app/assets/javascripts/hancock/rails_admin/navigation_filter.coffee +108 -0
  14. data/app/assets/javascripts/hancock/rails_admin/navigation_scroll.coffee +12 -0
  15. data/app/assets/javascripts/hancock/rails_admin/plugins.coffee.erb +16 -0
  16. data/app/assets/javascripts/jquery.placeholder.js +3 -2
  17. data/app/assets/javascripts/rails_admin/custom/ui.coffee +1 -0
  18. data/app/assets/stylesheets/hancock/cms/devise.sass +4 -1
  19. data/app/assets/stylesheets/hancock/rails_admin/cms.theming.sass +354 -147
  20. data/app/assets/stylesheets/hancock/rails_admin/fieldsets.sass +198 -0
  21. data/app/assets/stylesheets/hancock/rails_admin/plugins.sass.erb +6 -0
  22. data/app/assets/stylesheets/rails_admin/custom/theming.sass +1 -1
  23. data/app/controllers/concerns/hancock/decorators/home.rb +1 -1
  24. data/app/controllers/concerns/hancock/errors.rb +5 -7
  25. data/app/controllers/hancock/registrations_controller.rb +2 -7
  26. data/app/controllers/hancock/sessions_controller.rb +3 -7
  27. data/app/helpers/hancock/powered_helper.rb +3 -3
  28. data/app/helpers/hancock/settings_helper.rb +44 -0
  29. data/app/helpers/rails_admin/application/hancock_helper.rb +19 -0
  30. data/app/helpers/rails_admin/hancock/form_builder.rb +44 -0
  31. data/app/helpers/rails_admin/main/hancock_helper.rb +51 -0
  32. data/app/models/concerns/hancock/boolean_field.rb +7 -2
  33. data/app/models/concerns/hancock/decorators/embedded_element.rb +1 -9
  34. data/app/models/concerns/hancock/enableable.rb +1 -0
  35. data/app/models/concerns/hancock/hash_field.rb +9 -8
  36. data/app/models/concerns/hancock/html_field.rb +6 -3
  37. data/app/models/concerns/hancock/insertion_field.rb +115 -0
  38. data/app/models/concerns/hancock/mappable.rb +1 -0
  39. data/app/models/concerns/hancock/master_collection.rb +31 -0
  40. data/app/models/concerns/hancock/model_localizeable.rb +4 -1
  41. data/app/models/concerns/hancock/rails_admin_patch.rb +22 -3
  42. data/app/models/concerns/hancock/sort_field.rb +26 -3
  43. data/app/models/concerns/hancock/sortable.rb +3 -0
  44. data/app/models/concerns/hancock/user_defined.rb +53 -0
  45. data/app/views/blocks/_footer.html.slim +1 -1
  46. data/app/views/devise/passwords/edit.html.slim +0 -2
  47. data/app/views/devise/passwords/new.html.slim +0 -2
  48. data/app/views/devise/registrations/edit.html.slim +0 -2
  49. data/app/views/devise/registrations/new.html.slim +0 -2
  50. data/app/views/devise/sessions/new.html.slim +0 -2
  51. data/app/views/hancock/home/index.html.slim +4 -1
  52. data/app/views/layouts/application.html.slim +1 -11
  53. data/app/views/layouts/hancock/_assets.html.slim +15 -0
  54. data/app/views/layouts/hancock/devise/confirmations.html.slim +7 -4
  55. data/app/views/layouts/hancock/devise/passwords.html.slim +7 -4
  56. data/app/views/layouts/hancock/devise/registrations.html.slim +7 -4
  57. data/app/views/layouts/hancock/devise/sessions.html.slim +7 -4
  58. data/app/views/layouts/hancock/devise/unlocks.html.slim +7 -4
  59. data/app/views/layouts/rails_admin/_footer.html.slim +2 -2
  60. data/app/views/layouts/rails_admin/_footer_navigation.html.slim +20 -4
  61. data/app/views/layouts/rails_admin/_navigation.html.slim +13 -47
  62. data/app/views/layouts/rails_admin/_secondary_navigation.html.slim +5 -12
  63. data/app/views/layouts/rails_admin/_sidebar_navigation.html.slim +2 -0
  64. data/app/views/layouts/rails_admin/_sidebar_navigation_filter.html.slim +3 -0
  65. data/app/views/layouts/rails_admin/application.html.haml +3 -38
  66. data/app/views/rails_admin/main/_enum_for_settings_kinds.html.slim +24 -0
  67. data/app/views/rails_admin/main/_form_hancock_enum.html.slim +18 -0
  68. data/app/views/rails_admin/main/_form_hancock_enum_with_custom.slim +20 -0
  69. data/app/views/rails_admin/main/_hancock_html.html.slim +2 -2
  70. data/app/views/rails_admin/main/_hancock_html_ml.html.slim +31 -34
  71. data/app/views/rails_admin/main/edit.html.haml +18 -0
  72. data/app/views/rails_admin/main/new.html.haml +17 -0
  73. data/app/views/shared/_admin_link.html.slim +4 -2
  74. data/config/initializers/nested_set_patch.rb +76 -73
  75. data/config/initializers/rails_admin_mongoid_patch.rb +27 -0
  76. data/config/initializers/sprockets_patch.rb +159 -0
  77. data/config/locales/en.hancock.yml +1 -0
  78. data/config/locales/ru.devise.yml +22 -18
  79. data/config/locales/ru.hancock.yml +5 -5
  80. data/config/locales/ru.rails_admin.yml +3 -0
  81. data/hancock_cms.gemspec +7 -2
  82. data/lib/filename_to_slug.rb +0 -20
  83. data/lib/generators/hancock/cms/ability_generator.rb +1 -0
  84. data/lib/generators/hancock/cms/admin_generator.rb +1 -0
  85. data/lib/generators/hancock/cms/application_generator.rb +1 -0
  86. data/lib/generators/hancock/cms/assets_generator.rb +1 -0
  87. data/lib/generators/hancock/cms/layout_generator.rb +1 -0
  88. data/lib/generators/hancock/cms/model_generator.rb +1 -0
  89. data/lib/generators/hancock/cms/models/templates/embedded_element.erb +2 -2
  90. data/lib/generators/hancock/cms/rack_generator.rb +1 -0
  91. data/lib/generators/hancock/cms/raven_generator.rb +13 -0
  92. data/lib/generators/hancock/cms/robots_generator.rb +1 -0
  93. data/lib/generators/hancock/cms/scripts_generator.rb +1 -0
  94. data/lib/generators/hancock/cms/setup_generator.rb +146 -33
  95. data/lib/generators/hancock/cms/templates/Gemfile.erb +4 -5
  96. data/lib/generators/hancock/cms/templates/ability.erb +1 -1
  97. data/lib/generators/hancock/cms/templates/admin.erb +12 -4
  98. data/lib/generators/hancock/cms/templates/hancock_cms.erb +6 -3
  99. data/lib/generators/hancock/cms/templates/model.erb +5 -6
  100. data/lib/generators/hancock/cms/templates/raven.erb +13 -0
  101. data/lib/generators/hancock/cms/templates/robots.txt.erb +6 -2
  102. data/lib/generators/hancock/cms/templates/scripts/db_dump.sh.erb +1 -1
  103. data/lib/generators/hancock/cms/unicorn_god_generator.rb +1 -0
  104. data/lib/generators/hancock/cms/utils.rb +2 -0
  105. data/lib/hancock/admin.rb +153 -21
  106. data/lib/hancock/admin/embedded_element.rb +7 -2
  107. data/lib/hancock/configuration.rb +49 -4
  108. data/lib/hancock/controller.rb +1 -1
  109. data/lib/hancock/engine.rb +32 -36
  110. data/lib/hancock/model.rb +10 -0
  111. data/lib/hancock/models/embedded_element.rb +2 -0
  112. data/lib/hancock/models/mongoid/embedded_element.rb +17 -0
  113. data/lib/hancock/plugin_configuration.rb +1 -1
  114. data/lib/hancock/rails_admin_ext/config.rb +21 -4
  115. data/lib/hancock/rails_admin_ext/hancock_array.rb +19 -0
  116. data/lib/hancock/rails_admin_ext/hancock_enum.rb +33 -0
  117. data/lib/hancock/rails_admin_ext/hancock_enum_with_custom.rb +34 -0
  118. data/lib/hancock/rails_admin_ext/hancock_hash.rb +8 -1
  119. data/lib/hancock/rails_admin_ext/hancock_html.rb +17 -2
  120. data/lib/hancock/rails_admin_ext/hancock_multiselect.rb +1 -5
  121. data/lib/hancock/rails_admin_ext/hancock_slugs.rb +2 -6
  122. data/lib/hancock/rails_admin_ext/patches/field_patch.rb +2 -1
  123. data/lib/hancock/rails_admin_ext/patches/fieldset_patch.rb +14 -0
  124. data/lib/hancock/rails_admin_ext/patches/group_patch.rb +9 -0
  125. data/lib/hancock/rails_admin_ext/patches/hancock_cms_group.rb +2 -0
  126. data/lib/hancock/rails_admin_ext/patches/has_fields.rb +27 -0
  127. data/lib/hancock/rails_admin_ext/patches/navigation_patch.rb +25 -0
  128. data/lib/hancock/rails_admin_settings_patch.rb +219 -0
  129. data/lib/hancock/version.rb +1 -1
  130. data/lib/hancock_cms.rb +12 -9
  131. data/lib/manual_slug/active_record.rb +8 -8
  132. data/lib/manual_slug/mongoid.rb +6 -1
  133. data/lib/rails_admin/custom_show_in_app.rb +21 -32
  134. data/template.rb +19 -20
  135. metadata +104 -12
  136. data/app/controllers/concerns/hancock/no_cache.rb +0 -12
  137. data/app/models/concerns/hancock/cacheable.rb +0 -51
@@ -28,11 +28,7 @@ module RailsAdmin
28
28
  def nested_form
29
29
  false
30
30
  end
31
-
32
- # def method_name
33
- # "#{super.to_s.singularize}_ids".to_sym
34
- # end
35
-
31
+
36
32
  # Reader for validation errors of the bound object
37
33
  def errors
38
34
  bindings[:object].errors[name]
@@ -1,17 +1,13 @@
1
- require 'rails_admin/config/fields/types/enum'
1
+ require 'hancock/rails_admin_ext/hancock_enum'
2
2
 
3
3
  module RailsAdmin
4
4
  module Config
5
5
  module Fields
6
6
  module Types
7
- class HancockSlugs < RailsAdmin::Config::Fields::Types::Enum
7
+ class HancockSlugs < RailsAdmin::Config::Fields::Types::HancockEnum
8
8
  # Register field type for the type loader
9
9
  RailsAdmin::Config::Fields::Types::register(self)
10
10
 
11
- register_instance_option :searchable do
12
- true
13
- end
14
-
15
11
  register_instance_option :enum_method do
16
12
  :slugs
17
13
  end
@@ -5,8 +5,9 @@ module RailsAdmin
5
5
 
6
6
  class Base
7
7
  register_instance_option :weight do
8
- name.to_sym == :default ? -1_000_000 : 0
8
+ 0
9
9
  end
10
+
10
11
  end
11
12
 
12
13
  end
@@ -0,0 +1,14 @@
1
+ require 'rails_admin'
2
+ module RailsAdmin
3
+ module Config
4
+ module Fields
5
+
6
+ class Group
7
+ register_instance_option :leftside_hider do
8
+ true
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -15,6 +15,15 @@ module RailsAdmin
15
15
  a.weight <=> b.weight
16
16
  end
17
17
  end
18
+
19
+ def group(name, &block)
20
+ _groups = parent.groups rescue root.groups
21
+ group = _groups.detect { |g| name == g.name }
22
+ group ||= (parent.groups << RailsAdmin::Config::Fields::Group.new(self, name)).last
23
+ group.tap { |g| g.section = self }.instance_eval(&block) if block
24
+ group
25
+ end
26
+
18
27
  end
19
28
 
20
29
  end
@@ -27,6 +27,7 @@ module Hancock::RailsAdminGroupPatch
27
27
  end
28
28
 
29
29
  _group_fields.each_pair do |name, type|
30
+ next if type == false
30
31
  if type.blank?
31
32
  field name
32
33
  else
@@ -44,6 +45,7 @@ module Hancock::RailsAdminGroupPatch
44
45
 
45
46
  else
46
47
  fields.each_pair do |name, type|
48
+ next if type == false
47
49
  if type.nil?
48
50
  config.field name
49
51
  else
@@ -0,0 +1,27 @@
1
+ require 'rails_admin'
2
+ module RailsAdmin
3
+ module Config
4
+ # Provides accessors and autoregistering of model's fields.
5
+ module HasFields
6
+
7
+ protected
8
+
9
+ # Raw fields.
10
+ # Recursively returns parent section's raw fields
11
+ # Duping it if accessed for modification.
12
+ def _fields(readonly = false)
13
+ return @_fields if @_fields
14
+ return @_ro_fields if readonly && @_ro_fields
15
+
16
+ if self.class == RailsAdmin::Config::Sections::Base
17
+ @_ro_fields = @_fields = RailsAdmin::Config::Fields.factory(self)
18
+ else
19
+ # parent is RailsAdmin::Config::Model, recursion is on Section's classes
20
+ @_ro_fields ||= parent.send(self.class.superclass.to_s.underscore.split('/').last)._fields(true)
21
+ @_ro_fields.freeze if Rails.env.production? or Rails.env.staging?
22
+ end
23
+ readonly ? @_ro_fields : (@_fields ||= @_ro_fields.collect(&:clone))
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ require 'rails_admin'
2
+ module RailsAdmin
3
+ module Config
4
+
5
+ class Model
6
+ register_instance_option :navigation_icon do
7
+ abstract_model.model.try('rails_admin_navigation_icon')
8
+ end
9
+
10
+ register_instance_option :name_synonyms do
11
+ if name_synonyms_method
12
+ ret = abstract_model.model.try(name_synonyms_method)
13
+ ret = ret.join(" ") if ret.is_a?(Array)
14
+ else
15
+ ret = ''
16
+ end
17
+ ret.freeze
18
+ end
19
+ register_instance_option :name_synonyms_method do
20
+ :rails_admin_name_synonyms
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,219 @@
1
+ module Hancock
2
+ module RailsAdminSettingsPatch
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ ::Hancock.register_model(self)
7
+
8
+ include ::Hancock::RailsAdminPatch
9
+ if ::Hancock.config.mongoid_single_collection
10
+ include ::Hancock::MasterCollection
11
+ end
12
+
13
+ # t = {_all: 'Все'}
14
+ ::RailsAdminSettings::Setting.distinct(:ns).each do |c|
15
+ s = "ns_#{c.gsub('-', '_')}".to_sym
16
+ scope s, -> { where(ns: c) }
17
+ # t[s] = c
18
+ end
19
+ # I18n.backend.store_translations(:ru, {admin: {scopes: {'rails_admin_settings/setting': t}}})
20
+
21
+ field :for_admin, type: Boolean, default: -> {
22
+ !!(self.ns == "admin" or self.ns =~ /\Aadmin(\.\w+)*\z/)
23
+ }
24
+ def for_admin?
25
+ self.for_admin
26
+ end
27
+
28
+ # def self.manager_can_default_actions
29
+ # # [:index, :show, :read, :edit, :update]
30
+ # super - [:new, :create]
31
+ # end
32
+ # def self.manager_can_default_actions
33
+ # ret = []
34
+ # # ret << :model_accesses if ::Hancock::Goto.config.user_abilities_support
35
+ # ret
36
+ # end
37
+ def self.manager_can_add_actions
38
+ ret = []
39
+ # ret << :model_accesses if defined?(::RailsAdminUserAbilities)
40
+ ret += [:comments, :model_comments] if defined?(::RailsAdminComments)
41
+ ret << :hancock_touch if defined?(::Hancock::Cache::Cacheable)
42
+ ret.freeze
43
+ end
44
+ def self.manager_cannot_add_actions
45
+ [:new, :create, :delete, :destroy]
46
+ end
47
+
48
+ def self.rails_admin_add_visible_actions
49
+ ret = manager_can_actions.dup
50
+ ret << :model_accesses if defined?(::RailsAdminUserAbilities)
51
+ ret += [:comments, :model_comments] if defined?(::RailsAdminComments)
52
+ ret << :hancock_touch if defined?(::Hancock::Cache::Cacheable)
53
+ ret.freeze
54
+ end
55
+
56
+ rails_admin do
57
+ navigation_label I18n.t('admin.settings.label')
58
+
59
+ list do
60
+ field :label do
61
+ visible false
62
+ searchable true
63
+ weight 1
64
+ end
65
+ field :enabled, :toggle do
66
+ weight 2
67
+ end
68
+ field :loadable, :toggle do
69
+ weight 3
70
+ end
71
+ field :ns do
72
+ searchable true
73
+ weight 4
74
+ end
75
+ field :key do
76
+ searchable true
77
+ weight 5
78
+ end
79
+ field :name do
80
+ weight 6
81
+ end
82
+ field :kind do
83
+ searchable true
84
+ weight 7
85
+ end
86
+ field :raw do
87
+ weight 8
88
+ searchable true
89
+ pretty_value do
90
+ if bindings[:object].file_kind?
91
+ "<a href='#{CGI::escapeHTML(bindings[:object].file.url)}'>#{CGI::escapeHTML(bindings[:object].to_path)}</a>".html_safe.freeze
92
+ elsif bindings[:object].image_kind?
93
+ "<a href='#{CGI::escapeHTML(bindings[:object].file.url)}'><img src='#{CGI::escapeHTML(bindings[:object].file.url)}' /></a>".html_safe.freeze
94
+ else
95
+ value
96
+ end
97
+ end
98
+ end
99
+ field :cache_keys_str, :text do
100
+ weight 10
101
+ searchable true
102
+ end
103
+ if ::Settings.table_exists?
104
+ nss = ::RailsAdminSettings::Setting.distinct(:ns).map { |c| "ns_#{c.gsub('-', '_')}".to_sym }
105
+ scopes([nil] + nss)
106
+ end
107
+ end
108
+
109
+ edit do
110
+ field :enabled, :toggle do
111
+ weight 1
112
+ visible do
113
+ if bindings[:object].for_admin?
114
+ render_object = (bindings[:controller] || bindings[:view])
115
+ render_object and (render_object.current_user.admin?)
116
+ else
117
+ true
118
+ end
119
+ end
120
+ end
121
+ field :loadable, :toggle do
122
+ weight 2
123
+ visible do
124
+ render_object = (bindings[:controller] || bindings[:view])
125
+ render_object and (render_object.current_user.admin?)
126
+ end
127
+ end
128
+ field :for_admin, :toggle do
129
+ weight 3
130
+ visible do
131
+ render_object = (bindings[:controller] || bindings[:view])
132
+ render_object and (render_object.current_user.admin?)
133
+ end
134
+ end
135
+ field :ns do
136
+ weight 4
137
+ read_only true
138
+ help false
139
+ visible do
140
+ render_object = (bindings[:controller] || bindings[:view])
141
+ render_object and (render_object.current_user.admin?)
142
+ end
143
+ end
144
+ field :key do
145
+ weight 5
146
+ read_only true
147
+ help false
148
+ visible do
149
+ render_object = (bindings[:controller] || bindings[:view])
150
+ render_object and (render_object.current_user.admin?)
151
+ end
152
+ end
153
+ field :label, :string do
154
+ weight 6
155
+ read_only do
156
+ render_object = (bindings[:controller] || bindings[:view])
157
+ !render_object or !(render_object.current_user.admin?)
158
+ end
159
+ help false
160
+ end
161
+ field :kind, :enum do
162
+ weight 7
163
+ read_only do
164
+ render_object = (bindings[:controller] || bindings[:view])
165
+ !render_object or !(render_object.current_user.admin?)
166
+ end
167
+ enum do
168
+ RailsAdminSettings.kinds
169
+ end
170
+ partial "enum_for_settings_kinds".freeze
171
+ help false
172
+ end
173
+ field :raw do
174
+ weight 8
175
+ partial "setting_value".freeze
176
+ visible do
177
+ !bindings[:object].upload_kind?
178
+ end
179
+ read_only do
180
+ if bindings[:object].for_admin?
181
+ render_object = (bindings[:controller] || bindings[:view])
182
+ !(render_object and (render_object.current_user.admin?))
183
+ else
184
+ false
185
+ end
186
+ end
187
+ end
188
+ if Settings.file_uploads_supported
189
+ field :file, Settings.file_uploads_engine do
190
+ weight 9
191
+ visible do
192
+ bindings[:object].upload_kind?
193
+ end
194
+ read_only do
195
+ if bindings[:object].for_admin?
196
+ render_object = (bindings[:controller] || bindings[:view])
197
+ !(render_object and (render_object.current_user.admin?))
198
+ else
199
+ false
200
+ end
201
+ end
202
+ end
203
+ end
204
+
205
+ field :cache_keys_str, :text do
206
+ weight 10
207
+ visible do
208
+ render_object = (bindings[:controller] || bindings[:view])
209
+ render_object and render_object.current_user.admin?
210
+ end
211
+ end
212
+
213
+ end
214
+ end
215
+
216
+ end
217
+
218
+ end
219
+ end
@@ -1,3 +1,3 @@
1
1
  module Hancock
2
- VERSION = "2.0.0.2".freeze
2
+ VERSION = "2.0.1.1".freeze
3
3
  end
data/lib/hancock_cms.rb CHANGED
@@ -15,8 +15,6 @@ require 'hancock/simple_form_patch'
15
15
 
16
16
  require 'geocoder'
17
17
 
18
- # require 'simple_captcha'
19
- # require 'validates_email_format_of'
20
18
  require 'filename_to_slug'
21
19
 
22
20
  require 'codemirror-rails'
@@ -25,29 +23,34 @@ require 'codemirror-rails'
25
23
  require 'rails_admin'
26
24
  require 'hancock/rails_admin_ext/config'
27
25
 
26
+ require 'hancock/rails_admin_ext/hancock_enum'
27
+ require 'hancock/rails_admin_ext/hancock_enum_with_custom'
28
+ require 'hancock/rails_admin_ext/hancock_array'
28
29
  require 'hancock/rails_admin_ext/hancock_hash'
29
30
  require 'hancock/rails_admin_ext/hancock_html'
30
31
  require 'hancock/rails_admin_ext/hancock_slugs'
31
32
  require 'hancock/rails_admin_ext/hancock_multiselect'
32
33
 
34
+ require 'hancock/rails_admin_ext/patches/navigation_patch'
33
35
  require 'hancock/rails_admin_ext/patches/field_patch'
36
+ require 'hancock/rails_admin_ext/patches/fieldset_patch'
34
37
  require 'hancock/rails_admin_ext/patches/new_controller_patch'
35
38
  require 'hancock/rails_admin_ext/patches/group_patch'
36
39
  require 'hancock/rails_admin_ext/patches/hancock_cms_group'
40
+ require 'hancock/rails_admin_ext/patches/has_fields'
37
41
 
38
42
 
39
43
  require 'rails_admin_nested_set'
40
44
  require 'rails_admin_toggleable'
41
45
 
42
46
  require 'ack_rails_admin_settings'
43
-
44
- # require 'x-real-ip'
47
+ require 'hancock/rails_admin_settings_patch'
45
48
 
46
49
  require 'ckeditor'
47
50
 
48
- # require 'kaminari'
49
- # require 'addressable/uri'
50
- # require 'turbolinks'
51
+ require 'kaminari/actionview'
52
+
53
+ require 'stickykit/rails'
51
54
 
52
55
  require 'hancock/model'
53
56
  require 'hancock/engine'
@@ -89,11 +92,11 @@ module Hancock
89
92
  end
90
93
  rescue
91
94
  end
92
- end
95
+ end if defined?(::HistoryTracker)
93
96
  end
94
97
 
95
98
  def clear_history!
96
- ::HistoryTracker.delete_all
99
+ ::HistoryTracker.delete_all if defined?(::HistoryTracker)
97
100
  end
98
101
 
99
102
  end
@@ -3,16 +3,16 @@ module ManualSlug::ActiveRecord
3
3
 
4
4
  included do
5
5
  extend FriendlyId
6
- end
7
6
 
8
- def text_slug
9
- slug
10
- end
11
- def text_slug=(s)
12
- self.slug = s
7
+ def text_slug
8
+ slug
9
+ end
10
+ def text_slug=(s)
11
+ self.slug = s
12
+ end
13
13
  end
14
14
 
15
- module ClassMethods
15
+ class_methods do
16
16
  def manual_slug(field, options = {}, callback = true)
17
17
  friendly_id field, use: [:slugged, :finders]
18
18
  define_method(:should_generate_new_friendly_id?) do
@@ -28,5 +28,5 @@ module ManualSlug::ActiveRecord
28
28
  end if callback
29
29
  end
30
30
  end
31
+
31
32
  end
32
-