hancock_cms 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +113 -0
  9. data/Rakefile +1 -0
  10. data/app/assets/images/devices/login-bg.jpg +0 -0
  11. data/app/assets/images/rails-admin/hancock_logo.svg +5 -0
  12. data/app/assets/javascripts/hancock/app/back_to_top.coffee +24 -0
  13. data/app/assets/javascripts/hancock/cms.coffee +11 -0
  14. data/app/assets/javascripts/hancock/cms/flash.coffee +3 -0
  15. data/app/assets/javascripts/hancock/cms/init.coffee +1 -0
  16. data/app/assets/javascripts/hancock/cms/map.coffee +22 -0
  17. data/app/assets/javascripts/hancock/rails_admin/cms.ui.coffee +43 -0
  18. data/app/assets/javascripts/hancock/rails_admin/custom/ui.coffee +0 -0
  19. data/app/assets/javascripts/head.load.js +707 -0
  20. data/app/assets/javascripts/jquery.placeholder.js +157 -0
  21. data/app/assets/javascripts/rails_admin/custom/ui.coffee +2 -0
  22. data/app/assets/stylesheets/hancock/cms.sass +9 -0
  23. data/app/assets/stylesheets/hancock/cms/devise.sass +157 -0
  24. data/app/assets/stylesheets/hancock/cms/flash.sass +69 -0
  25. data/app/assets/stylesheets/hancock/cms/mixins.sass +98 -0
  26. data/app/assets/stylesheets/hancock/cms/normalize.scss +407 -0
  27. data/app/assets/stylesheets/hancock/cms/powered.sass +18 -0
  28. data/app/assets/stylesheets/hancock/rails_admin/cms.theming.sass +703 -0
  29. data/app/assets/stylesheets/hancock/rails_admin/custom/theming.sass +1 -0
  30. data/app/assets/stylesheets/hancock/toplink/toplink.sass +24 -0
  31. data/app/assets/stylesheets/rails_admin/custom/theming.sass +4 -0
  32. data/app/controllers/concerns/hancock/current_user.rb +12 -0
  33. data/app/controllers/concerns/hancock/decorators/home.rb +12 -0
  34. data/app/controllers/concerns/hancock/decorators/registrations.rb +5 -0
  35. data/app/controllers/concerns/hancock/decorators/sessions.rb +5 -0
  36. data/app/controllers/concerns/hancock/errors.rb +94 -0
  37. data/app/controllers/concerns/hancock/fancybox.rb +14 -0
  38. data/app/controllers/concerns/hancock/no_cache.rb +12 -0
  39. data/app/controllers/hancock/home_controller.rb +10 -0
  40. data/app/controllers/hancock/registrations_controller.rb +23 -0
  41. data/app/controllers/hancock/sessions_controller.rb +24 -0
  42. data/app/helpers/hancock/gzip_helper.rb +27 -0
  43. data/app/helpers/hancock/home_helper.rb +2 -0
  44. data/app/helpers/hancock/powered_helper.rb +42 -0
  45. data/app/models/concerns/hancock/boolean_field.rb +21 -0
  46. data/app/models/concerns/hancock/cacheable.rb +33 -0
  47. data/app/models/concerns/hancock/decorators/embedded_element.rb +28 -0
  48. data/app/models/concerns/hancock/enableable.rb +8 -0
  49. data/app/models/concerns/hancock/geocodeable.rb +4 -0
  50. data/app/models/concerns/hancock/hash_field.rb +113 -0
  51. data/app/models/concerns/hancock/html_field.rb +33 -0
  52. data/app/models/concerns/hancock/mappable.rb +91 -0
  53. data/app/models/concerns/hancock/model_localizeable.rb +33 -0
  54. data/app/models/concerns/hancock/rails_admin_patch.rb +86 -0
  55. data/app/models/concerns/hancock/sort_field.rb +20 -0
  56. data/app/models/concerns/hancock/sortable.rb +8 -0
  57. data/app/models/hancock/embedded_element.rb +17 -0
  58. data/app/views/blocks/_favicon.html.slim +60 -0
  59. data/app/views/blocks/_footer.html.slim +1 -0
  60. data/app/views/blocks/_header.html.slim +3 -0
  61. data/app/views/devise/passwords/edit.html.slim +29 -0
  62. data/app/views/devise/passwords/new.html.slim +19 -0
  63. data/app/views/devise/registrations/edit.html.slim +31 -0
  64. data/app/views/devise/registrations/new.html.slim +39 -0
  65. data/app/views/devise/sessions/new.html.slim +39 -0
  66. data/app/views/devise/shared/_links.html.slim +11 -0
  67. data/app/views/hancock/errors/_base.html.slim +3 -0
  68. data/app/views/hancock/errors/error_403.html.slim +1 -0
  69. data/app/views/hancock/errors/error_404.html.slim +1 -0
  70. data/app/views/hancock/errors/error_500.html.slim +1 -0
  71. data/app/views/hancock/home/index.html.slim +1 -0
  72. data/app/views/hancock/simple_captcha/_simple_captcha.html.slim +13 -0
  73. data/app/views/hancock/toplink/_toplink.html.slim +2 -0
  74. data/app/views/layouts/application.html.slim +35 -0
  75. data/app/views/layouts/hancock/devise/confirmations.html.slim +22 -0
  76. data/app/views/layouts/hancock/devise/passwords.html.slim +22 -0
  77. data/app/views/layouts/hancock/devise/registrations.html.slim +22 -0
  78. data/app/views/layouts/hancock/devise/sessions.html.slim +22 -0
  79. data/app/views/layouts/hancock/devise/unlocks.html.slim +22 -0
  80. data/app/views/layouts/rails_admin/_footer.html.slim +2 -0
  81. data/app/views/layouts/rails_admin/_footer_navigation.html.slim +20 -0
  82. data/app/views/layouts/rails_admin/_navigation.html.slim +73 -0
  83. data/app/views/layouts/rails_admin/_secondary_navigation.html.slim +32 -0
  84. data/app/views/layouts/rails_admin/application.html.haml +68 -0
  85. data/app/views/layouts/rails_admin/pjax.html.haml +17 -0
  86. data/app/views/rails_admin/main/_check_boxes.html.slim +27 -0
  87. data/app/views/rails_admin/main/_enum_check_boxes.html.slim +5 -0
  88. data/app/views/rails_admin/main/_enum_radio_buttons.html.slim +5 -0
  89. data/app/views/rails_admin/main/_form_hancock_multiselect.html.slim +48 -0
  90. data/app/views/rails_admin/main/_form_raw.html.slim +1 -0
  91. data/app/views/rails_admin/main/_hancock_hash.html.slim +9 -0
  92. data/app/views/rails_admin/main/_hancock_hash_ml.html.slim +10 -0
  93. data/app/views/rails_admin/main/_hancock_html.html.slim +16 -0
  94. data/app/views/rails_admin/main/_hancock_html_ml.html.slim +53 -0
  95. data/app/views/shared/_admin_link.html.slim +3 -0
  96. data/app/views/shared/_messages.html.slim +7 -0
  97. data/config/initializers/embedded_findable.rb +57 -0
  98. data/config/initializers/hancock_cms.rb +11 -0
  99. data/config/initializers/simple_captcha.rb +70 -0
  100. data/config/locales/en.hancock.yml +29 -0
  101. data/config/locales/en.hancock_admin.yml +6 -0
  102. data/config/locales/ru.cancan.yml +4 -0
  103. data/config/locales/ru.devise.yml +65 -0
  104. data/config/locales/ru.hancock.yml +36 -0
  105. data/config/locales/ru.hancock_admin.yml +6 -0
  106. data/config/locales/ru.models.yml +82 -0
  107. data/config/locales/ru.mongoid.yml +450 -0
  108. data/config/locales/ru.rails_admin.yml +168 -0
  109. data/hancock_cms.gemspec +46 -0
  110. data/lib/filename_to_slug.rb +32 -0
  111. data/lib/generators/hancock/cms/ability_generator.rb +14 -0
  112. data/lib/generators/hancock/cms/admin_generator.rb +21 -0
  113. data/lib/generators/hancock/cms/application_generator.rb +14 -0
  114. data/lib/generators/hancock/cms/assets_generator.rb +35 -0
  115. data/lib/generators/hancock/cms/config_generator.rb +13 -0
  116. data/lib/generators/hancock/cms/controllers/decorators_generator.rb +27 -0
  117. data/lib/generators/hancock/cms/gemfile_generator.rb +13 -0
  118. data/lib/generators/hancock/cms/layout_generator.rb +14 -0
  119. data/lib/generators/hancock/cms/model_generator.rb +39 -0
  120. data/lib/generators/hancock/cms/models/embedded_element_generator.rb +56 -0
  121. data/lib/generators/hancock/cms/models/templates/embedded_element.erb +47 -0
  122. data/lib/generators/hancock/cms/paperclip_optimizer_generator.rb +13 -0
  123. data/lib/generators/hancock/cms/rack_generator.rb +12 -0
  124. data/lib/generators/hancock/cms/robots_generator.rb +14 -0
  125. data/lib/generators/hancock/cms/scripts_generator.rb +31 -0
  126. data/lib/generators/hancock/cms/templates/Gemfile.erb +69 -0
  127. data/lib/generators/hancock/cms/templates/ability.erb +49 -0
  128. data/lib/generators/hancock/cms/templates/admin.erb +74 -0
  129. data/lib/generators/hancock/cms/templates/application.erb +42 -0
  130. data/lib/generators/hancock/cms/templates/assets/javascripts/application.coffee.erb +5 -0
  131. data/lib/generators/hancock/cms/templates/assets/stylesheets/application.sass.erb +88 -0
  132. data/lib/generators/hancock/cms/templates/hancock_cms.erb +30 -0
  133. data/lib/generators/hancock/cms/templates/model.erb +42 -0
  134. data/lib/generators/hancock/cms/templates/paperclip_optimizer.erb +80 -0
  135. data/lib/generators/hancock/cms/templates/rack.erb +15 -0
  136. data/lib/generators/hancock/cms/templates/robots.txt.erb +5 -0
  137. data/lib/generators/hancock/cms/templates/scripts/assets_precompile.sh +3 -0
  138. data/lib/generators/hancock/cms/templates/scripts/bundle_production.sh +4 -0
  139. data/lib/generators/hancock/cms/templates/scripts/db_dump.sh.erb +3 -0
  140. data/lib/generators/hancock/cms/templates/scripts/db_restore.sh +3 -0
  141. data/lib/generators/hancock/cms/templates/scripts/full_assets_precompile.sh +4 -0
  142. data/lib/generators/hancock/cms/templates/scripts/restart_thru_kill.sh +3 -0
  143. data/lib/generators/hancock/cms/templates/scripts/send_hup.sh +3 -0
  144. data/lib/generators/hancock/cms/templates/scripts/send_usr2.sh +3 -0
  145. data/lib/generators/hancock/cms/templates/scripts/server.sh +5 -0
  146. data/lib/generators/hancock/cms/templates/scripts/server_alt.sh +5 -0
  147. data/lib/generators/hancock/cms/templates/unicorn.erb +57 -0
  148. data/lib/generators/hancock/cms/templates/unicorn.god.erb +59 -0
  149. data/lib/generators/hancock/cms/unicorn_god_generator.rb +15 -0
  150. data/lib/generators/hancock/cms/utils.rb +21 -0
  151. data/lib/hancock/admin.rb +60 -0
  152. data/lib/hancock/admin/embedded_element.rb +26 -0
  153. data/lib/hancock/configuration.rb +48 -0
  154. data/lib/hancock/controller.rb +30 -0
  155. data/lib/hancock/engine.rb +48 -0
  156. data/lib/hancock/migration.rb +15 -0
  157. data/lib/hancock/model.rb +53 -0
  158. data/lib/hancock/models/embedded_element.rb +12 -0
  159. data/lib/hancock/models/mongoid/embedded_element.rb +14 -0
  160. data/lib/hancock/plugin.rb +25 -0
  161. data/lib/hancock/plugin_configuration.rb +30 -0
  162. data/lib/hancock/rails_admin_ext/config.rb +129 -0
  163. data/lib/hancock/rails_admin_ext/hancock_hash.rb +84 -0
  164. data/lib/hancock/rails_admin_ext/hancock_html.rb +79 -0
  165. data/lib/hancock/rails_admin_ext/hancock_multiselect.rb +44 -0
  166. data/lib/hancock/rails_admin_ext/hancock_slugs.rb +35 -0
  167. data/lib/hancock/rails_admin_ext/patches/field_patch.rb +14 -0
  168. data/lib/hancock/rails_admin_ext/patches/group_patch.rb +41 -0
  169. data/lib/hancock/rails_admin_ext/patches/hancock_cms_group.rb +61 -0
  170. data/lib/hancock/rails_admin_ext/patches/new_controller_patch.rb +54 -0
  171. data/lib/hancock/routes.rb +20 -0
  172. data/lib/hancock/simple_form_patch.rb +12 -0
  173. data/lib/hancock/tasks.rb +13 -0
  174. data/lib/hancock/version.rb +3 -0
  175. data/lib/hancock_cms.rb +130 -0
  176. data/lib/manual_slug.rb +10 -0
  177. data/lib/manual_slug/active_record.rb +32 -0
  178. data/lib/manual_slug/mongoid.rb +40 -0
  179. data/lib/rails_admin/custom_show_in_app.rb +43 -0
  180. data/release.sh +12 -0
  181. data/template.rb +564 -0
  182. metadata +455 -0
@@ -0,0 +1,113 @@
1
+ if Hancock.mongoid?
2
+ module Hancock::HashField
3
+ extend ActiveSupport::Concern
4
+
5
+ module ClassMethods
6
+ def hancock_cms_hash_field(name, opts = {})
7
+ opts.merge!({type: Hash, default: {}})
8
+ field "#{name}_hash", opts
9
+
10
+ meth = name
11
+ meth_str = "#{name}_str".freeze
12
+ meth_hsh = "#{name}_hash".freeze
13
+ meth_json = "#{name}_json".freeze
14
+ if opts[:localize]
15
+ meth_str_t = "#{meth_str}_translations".freeze
16
+ meth_hsh_t = "#{meth_hsh}_translations".freeze
17
+ class_eval <<-EVAL
18
+ def #{meth_str_t}=(val)
19
+ return self.#{meth_hsh_t} = {} if val.blank?
20
+ _hash = {}
21
+ self[:#{meth_str_t}] ||= {}
22
+ I18n.available_locales.each do |l|
23
+ begin
24
+ _hash[l] = JSON.parse(val[l])
25
+ self[:#{meth_str_t}][l]= val[l]
26
+ rescue
27
+ self[:#{meth_str_t}][l]= val[l]
28
+ end
29
+ end
30
+ self.#{meth_hsh_t} = _hash
31
+ end
32
+ def #{meth_str_t}
33
+ self[:#{meth_str_t}] ||= self.#{meth} if self.#{meth}
34
+ end
35
+ def #{meth_str}
36
+ self.#{meth_str_t}[I18n.locale] if self.#{meth_str_t}
37
+ end
38
+ def #{meth}
39
+ self.#{meth_hsh}
40
+ end
41
+ def #{meth}=(val)
42
+ self.#{meth_str} = val
43
+ end
44
+ def #{meth_json}
45
+ self.#{meth_hsh}.to_json if self.#{meth_hsh}
46
+ end
47
+
48
+ validate do
49
+ unless self.#{meth_hsh_t}.nil?
50
+ _has_errors = false
51
+ I18n.available_locales.each do |l|
52
+ I18n.with_locale(l) do
53
+ if self.#{meth_hsh_t}[l].nil? and !self[:#{meth_str_t}][l].blank?
54
+ _has_errors ||= true
55
+ _meth = "#{meth_hsh_t}_\#{l}".to_s
56
+ self.errors.add(_meth, "Неверный формат данных")
57
+ else
58
+ self[:#{meth_str_t}].delete(l) if self[:#{meth_str_t}]
59
+ end
60
+ end
61
+ end
62
+ self.remove_attribute :#{meth_str_t} unless _has_errors
63
+ end
64
+ true
65
+ end
66
+ EVAL
67
+
68
+ else
69
+ class_eval <<-EVAL
70
+ def #{meth_str}=(val)
71
+ return self.#{meth_hsh} = {} if val.blank?
72
+ if val.is_a?(String)
73
+ begin
74
+ begin
75
+ self[:#{meth_str}] = JSON.parse(val)
76
+ rescue
77
+ self[:#{meth_str}] = YAML.load(val)
78
+ end
79
+ rescue
80
+ end
81
+ elsif val.is_a?(Hash)
82
+ self[:#{meth_str}] = val
83
+ end
84
+ end
85
+ def #{meth_str}
86
+ self[:#{meth_str}] ||= self.#{meth}.to_json if self.#{meth}
87
+ end
88
+ def #{meth}
89
+ self.#{meth_hsh}
90
+ end
91
+ def #{meth}=(val)
92
+ self.#{meth_str} = val
93
+ end
94
+ def #{meth_json}
95
+ self.#{meth_hsh}.to_json if self.#{meth_hsh}
96
+ end
97
+
98
+ validate do
99
+ unless self.#{meth}.nil?
100
+ if self.#{meth_str} != self.#{meth}.to_json
101
+ self.errors.add(:#{meth}, "Неверный формат данных")
102
+ else
103
+ self.remove_attribute :#{meth_str}
104
+ end
105
+ true
106
+ end
107
+ end
108
+ EVAL
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,33 @@
1
+ if Hancock.mongoid?
2
+ module Hancock::HtmlField
3
+ extend ActiveSupport::Concern
4
+
5
+ module ClassMethods
6
+ def hancock_cms_html_field(name, opts = {})
7
+ clear_by_default = opts.delete(:clear_by_default)
8
+ clear_by_default = false unless clear_by_default == true
9
+
10
+ _html_field_name = "#{name}_html".freeze
11
+
12
+ field _html_field_name, opts
13
+ field "#{name}_clear", type: Boolean, default: clear_by_default, localize: opts[:localize]
14
+
15
+ class_eval <<-EVAL
16
+ def #{name}
17
+ self.#{_html_field_name} ||= ""
18
+ return self.#{_html_field_name} unless self.#{name}_clear
19
+ clean_#{name}
20
+ end
21
+ def #{name}=(val)
22
+ self.#{_html_field_name} = val
23
+ end
24
+
25
+ def clean_#{name}
26
+ self.#{_html_field_name} ||= ""
27
+ Rails::Html::FullSanitizer.new.sanitize(self.#{_html_field_name}.strip)
28
+ end
29
+ EVAL
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,91 @@
1
+ module Hancock::Mappable
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+
6
+ if Hancock.mongoid?
7
+ include ::Geocoder::Model::Mongoid
8
+ field :coordinates, type: Array
9
+ field :address, type: String, localize: Hancock.configuration.localize
10
+
11
+ field :map_address, type: String
12
+ field :map_hint, type: String
13
+
14
+ field :lat, type: Float
15
+ field :lon, type: Float
16
+ end
17
+
18
+ geocoded_by :geo_address
19
+ after_validation :do_geocode
20
+ end
21
+
22
+ if Hancock.active_record?
23
+ def coordinates
24
+ if latitude.nil? || longitude.nil?
25
+ nil
26
+ else
27
+ [longitude, latitude]
28
+ end
29
+ end
30
+ end
31
+
32
+ def do_geocode
33
+ if geo_address.blank?
34
+ if Hancock.mongoid?
35
+ self.coordinates = nil
36
+ else
37
+ self.latitude = nil
38
+ self.longitude = nil
39
+ end
40
+ else
41
+ if (lat.nil? || lon.nil?) && (new_record? || address_changed? || coordinates.nil? || map_address_changed?)
42
+ geocode
43
+ end
44
+ end
45
+ end
46
+
47
+ def get_lat
48
+ if lat.blank?
49
+ if coordinates.nil?
50
+ nil
51
+ else
52
+ coordinates[1]
53
+ end
54
+ else
55
+ lat
56
+ end
57
+ end
58
+ def get_lon
59
+ if lon.blank?
60
+ if coordinates.nil?
61
+ nil
62
+ else
63
+ coordinates[0]
64
+ end
65
+ else
66
+ lon
67
+ end
68
+ end
69
+
70
+ def has_map?
71
+ (!lat.blank? && !lon.blank?) || !coordinates.nil?
72
+ end
73
+
74
+ def to_map
75
+ {
76
+ id: id.to_s,
77
+ hint: map_hint,
78
+ addr: address,
79
+ lat: get_lat,
80
+ lon: get_lon,
81
+ }
82
+ end
83
+
84
+ def geo_address
85
+ if map_address.blank?
86
+ address
87
+ else
88
+ map_address
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,33 @@
1
+ module Hancock::ModelLocalizeable
2
+ extend ActiveSupport::Concern
3
+
4
+ module ClassMethods
5
+ def convert2localize
6
+ self.all.to_a.map do |p|
7
+ p.convert2localize
8
+ end
9
+ end
10
+ end
11
+
12
+ def convert2localize(save_it = true)
13
+ arr = {}
14
+ self.localized_fields.keys.each do |f|
15
+ if self[f].is_a?(Hash) and f !~ /_translations$/
16
+ self[f + '_translations'] = self.remove_attribute(f)
17
+ else
18
+ arr[f] = self.remove_attribute(f)
19
+ self[f] = {}
20
+ end
21
+ end
22
+ self.save if save_it
23
+
24
+ I18n.available_locales.each do |l|
25
+ I18n.with_locale(l) do
26
+ arr.each_pair do |f, v|
27
+ self.send(f + "=", v)
28
+ end
29
+ end
30
+ end
31
+ self.save if save_it
32
+ end
33
+ end
@@ -0,0 +1,86 @@
1
+ module Hancock::RailsAdminPatch
2
+ extend ActiveSupport::Concern
3
+
4
+ def rails_admin_model
5
+ self.class.rails_admin_model
6
+ end
7
+
8
+ module ClassMethods
9
+ def rails_admin_model
10
+ to_param.gsub("::", "~").underscore
11
+ end
12
+
13
+ def rails_admin_add_fields
14
+ []
15
+ end
16
+
17
+ def rails_admin_add_config(config)
18
+ end
19
+
20
+
21
+
22
+ def admin_can_default_actions
23
+ [:manage].freeze
24
+ end
25
+ def admin_can_add_actions
26
+ [].freeze
27
+ end
28
+ def admin_can_user_defined_actions
29
+ [].freeze
30
+ end
31
+ def admin_can_actions
32
+ (admin_can_default_actions + admin_can_add_actions + admin_can_user_defined_actions).uniq.freeze
33
+ end
34
+ def admin_cannot_default_actions
35
+ [].freeze
36
+ end
37
+ def admin_cannot_add_actions
38
+ [].freeze
39
+ end
40
+ def admin_cannot_user_defined_actions
41
+ [].freeze
42
+ end
43
+ def admin_cannot_actions
44
+ (admin_cannot_default_actions + admin_cannot_add_actions + admin_cannot_user_defined_actions).uniq.freeze
45
+ end
46
+
47
+ def manager_can_default_actions
48
+ [:index, :show, :read, :new, :create, :edit, :update].freeze
49
+ end
50
+ def manager_can_add_actions
51
+ [].freeze
52
+ end
53
+ def manager_can_user_defined_actions
54
+ [].freeze
55
+ end
56
+ def manager_can_actions
57
+ (manager_can_default_actions + manager_can_add_actions + manager_can_user_defined_actions).uniq.freeze
58
+ end
59
+ def manager_cannot_default_actions
60
+ [].freeze
61
+ end
62
+ def manager_cannot_add_actions
63
+ [].freeze
64
+ end
65
+ def manager_cannot_user_defined_actions
66
+ [].freeze
67
+ end
68
+ def manager_cannot_actions
69
+ (manager_cannot_default_actions + manager_cannot_add_actions + manager_cannot_user_defined_actions).uniq.freeze
70
+ end
71
+
72
+ def rails_admin_default_visible_actions
73
+ [].freeze
74
+ end
75
+ def rails_admin_add_visible_actions
76
+ [].freeze
77
+ end
78
+ def rails_admin_user_defined_visible_actions
79
+ [].freeze
80
+ end
81
+ def rails_admin_visible_actions
82
+ (rails_admin_default_visible_actions + rails_admin_add_visible_actions + rails_admin_user_defined_visible_actions).uniq.freeze
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,20 @@
1
+ module Hancock::SortField
2
+ extend ActiveSupport::Concern
3
+
4
+ module ClassMethods
5
+ def sort_field(prefix = '')
6
+ prefix = "#{prefix}_" unless prefix == ''
7
+
8
+ if Hancock.mongoid?
9
+ field "#{prefix}order".to_sym, type: Integer
10
+ alias_method "#{prefix}sort", "#{prefix}order"
11
+ scope "#{prefix}ordered".to_sym, -> { asc("#{prefix}order".to_sym) }
12
+ scope "#{prefix}sorted".to_sym, -> { asc("#{prefix}order".to_sym) }
13
+ end
14
+ if Hancock.active_record?
15
+ scope "#{prefix}ordered".to_sym, -> { order("#{prefix}order".to_sym => :asc) }
16
+ scope "#{prefix}sorted".to_sym, -> { order("#{prefix}order".to_sym => :asc) }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ module Hancock::Sortable
2
+ extend ActiveSupport::Concern
3
+ include Hancock::SortField
4
+
5
+ included do
6
+ sort_field
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ module Hancock
2
+ if Hancock.mongoid?
3
+ class EmbeddedElement
4
+ include Hancock::Models::EmbeddedElement
5
+
6
+ include Hancock::Decorators::EmbeddedElement
7
+
8
+ rails_admin(&Hancock::Admin::EmbeddedElement.config(rails_admin_add_fields) { |config|
9
+ rails_admin_add_config(config)
10
+ })
11
+
12
+ # use it in rails_admin in parent model for sort
13
+ # sort_embedded({fields: [:embedded_field_1, :embedded_field_2...]})
14
+ # or u need to override rails_admin in inherited model to add sort field
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,60 @@
1
+ / http://realfavicongenerator.net/faq#.VxlagR8VxCW
2
+
3
+ - data = {:rel => 'shortcut icon', :type => 'image/vnd.microsoft.icon'}
4
+ = favicon_link_tag '/favicon.ico', data
5
+ - data = {:rel => 'shortcut icon', :type => 'image/png'}
6
+ = favicon_link_tag '/favicon.png', data
7
+
8
+ - data = {:rel => 'shortcut icon', :type => 'image/vnd.microsoft.icon'}
9
+ = favicon_link_tag '/favicons/favicon.ico', data
10
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '16x16'}
11
+ = favicon_link_tag '/favicons/favicon-16x16.png', data
12
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '32x32'}
13
+ = favicon_link_tag '/favicons/favicon-32x32.png', data
14
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '96x96'}
15
+ = favicon_link_tag '/favicons/favicon-96x96.png', data
16
+
17
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '36x36'}
18
+ = favicon_link_tag '/favicons/android-chrome-36x36.png', data
19
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '48x48'}
20
+ = favicon_link_tag '/favicons/android-chrome-48x48.png', data
21
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '72x72'}
22
+ = favicon_link_tag '/favicons/android-chrome-72x72.png', data
23
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '96x96'}
24
+ = favicon_link_tag '/favicons/android-chrome-96x96.png', data
25
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '144x144'}
26
+ = favicon_link_tag '/favicons/android-chrome-144x144.png', data
27
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '192x192'}
28
+ = favicon_link_tag '/favicons/android-chrome-192x192.png', data
29
+
30
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '70x70'}
31
+ = favicon_link_tag '/favicons/mstile-70x70.png', data
32
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '144x144'}
33
+ = favicon_link_tag '/favicons/mstile-144x144.png', data
34
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '150x150'}
35
+ = favicon_link_tag '/favicons/mstile-150x150.png', data
36
+ - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '310x310'}
37
+ = favicon_link_tag '/favicons/mstile-310x310.png', data
38
+ / - data = {:rel => 'shortcut icon', :type => 'image/png', :sizes => '310x150'}
39
+ / = favicon_link_tag '/favicons/mstile-310x150.png', data
40
+
41
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '57x57'}
42
+ = favicon_link_tag '/favicons/apple-touch-icon-57x57-precomposed.png', data
43
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '60x60'}
44
+ = favicon_link_tag '/favicons/apple-touch-icon-60x60-precomposed.png', data
45
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'}
46
+ = favicon_link_tag '/favicons/apple-touch-icon-72x72-precomposed.png', data
47
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '76x76'}
48
+ = favicon_link_tag '/favicons/apple-touch-icon-76x76-precomposed.png', data
49
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '120x120'}
50
+ = favicon_link_tag '/favicons/apple-touch-icon-120x120-precomposed.png', data
51
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'}
52
+ = favicon_link_tag '/favicons/apple-touch-icon-144x144-precomposed.png', data
53
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '152x152'}
54
+ = favicon_link_tag '/favicons/apple-touch-icon-152x152-precomposed.png', data
55
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '180x180'}
56
+ = favicon_link_tag '/favicons/apple-touch-icon-180x180-precomposed.png', data
57
+ - data = {:rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '57x57'}
58
+ = favicon_link_tag '/favicons/apple-touch-icon-precomposed.png', data
59
+ - data = {:rel => 'apple-touch-icon', :type => 'image/png', :sizes => '57x57'}
60
+ = favicon_link_tag '/favicons/apple-touch-icon.png', data