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,56 @@
1
+ require 'rails/generators'
2
+
3
+ module Hancock::Cms
4
+ module Models
5
+
6
+ class EmbeddedElementGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('../templates', __FILE__)
8
+ argument :class_name_arg, type: :string, default: ""
9
+ argument :parent_class_name_arg, type: :string, default: ""
10
+
11
+ desc 'Hancock::CMS EmbeddedElement Model generator'
12
+ def embedded_element
13
+ template 'embedded_element.erb', "app/models/#{file_name}.rb"
14
+ end
15
+
16
+ private
17
+ def class_name
18
+ class_name_arg.blank? ? "SetClassForEmbeddedElement" : class_name_arg
19
+ end
20
+
21
+ def capitalized_class_name
22
+ class_name.capitalize
23
+ end
24
+
25
+ def camelcased_class_name
26
+ class_name.camelcase
27
+ end
28
+
29
+ def file_name
30
+ underscored_class_name
31
+ end
32
+
33
+ def underscored_class_name
34
+ camelcased_class_name.underscore
35
+ end
36
+
37
+ def underscored_pluralized_class_name
38
+ underscored_class_name.pluralize
39
+ end
40
+
41
+
42
+ def underscored_parent_class_name
43
+ parent_class_name.underscore
44
+ end
45
+
46
+ def camelcased_parent_class_name
47
+ parent_class_name.camelcase
48
+ end
49
+
50
+ def parent_class_name
51
+ parent_class_name_arg.blank? ? "SetParentClassForEmbeddedElement" : parent_class_name_arg
52
+ end
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,47 @@
1
+ class <%= camelcased_class_name %> < Hancock::EmbeddedElement
2
+ embedded_in :<%= underscored_parent_class_name %>, class_name: "<%= camelcased_parent_class_name %>"
3
+
4
+ def self.find(id)
5
+ find_through(<%= camelcased_parent_class_name %>, '<%= underscored_pluralized_class_name %>', id)
6
+ end
7
+
8
+ # def image_styles
9
+ # super
10
+ # end
11
+
12
+ # def image_jcrop_options
13
+ # super
14
+ # end
15
+
16
+ ############# rails_admin ##############
17
+ #
18
+ # def self.admin_can_user_defined_actions
19
+ # [].freeze
20
+ # end
21
+ # def self.admin_cannot_user_defined_actions
22
+ # [].freeze
23
+ # end
24
+ # def self.manager_can_user_defined_actions
25
+ # [].freeze
26
+ # end
27
+ # def self.manager_cannot_user_defined_actions
28
+ # [].freeze
29
+ # end
30
+ # def self.rails_admin_user_defined_visible_actions
31
+ # [].freeze
32
+ # end
33
+
34
+ def self.rails_admin_add_fields
35
+ super
36
+ end
37
+
38
+ def self.rails_admin_add_config(config)
39
+ super(config)
40
+ end
41
+
42
+ # rails_admin(&Hancock::Admin::EmbeddedElement.config(%NAV_LABEL%, rails_admin_add_fields) { |config|
43
+ rails_admin(&Hancock::Admin::EmbeddedElement.config(rails_admin_add_fields) { |config|
44
+ rails_admin_add_config(config)
45
+ })
46
+
47
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+
3
+ module Hancock::Cms
4
+ class PaperclipOptimizerGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ desc 'Hancock CMS paperclip_optimizer Config generator'
8
+ def install
9
+ template 'paperclip_optimizer.erb', "config/initializers/paperclip_optimizer.rb"
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ require 'rails/generators'
2
+
3
+ module Hancock::Cms
4
+ class RackGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ desc 'Hancock CMS Rack generator'
8
+ def install
9
+ template('rack.erb', 'config/initializers/rack.rb')
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails/generators'
2
+
3
+ module Hancock::Cms
4
+ class RobotsGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ argument :app_name, type: :string
8
+
9
+ desc 'Hancock CMS robots.txt generator'
10
+ def install
11
+ template('robots.txt.erb', 'public/robots.txt')
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ require 'rails/generators'
2
+
3
+ module Hancock::Cms
4
+ class ScriptsGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates/scripts', __FILE__)
6
+
7
+ argument :app_name, type: :string
8
+
9
+ desc 'Hancock CMS scripts generator'
10
+ def install
11
+ %w( assets_precompile.sh
12
+ full_assets_precompile.sh
13
+ bundle_production.sh
14
+
15
+ restart_thru_kill.sh
16
+ send_usr2.sh
17
+ send_hup.sh
18
+
19
+ db_dump.sh.erb
20
+ db_restore.sh
21
+
22
+ server_alt.sh
23
+ server.sh
24
+ ).each do |template_name|
25
+ script_name = template_name.match(/.+\.sh/)[0]
26
+ template template_name, "scripts/#{script_name}"
27
+ FileUtils.chmod(0755, "#{destination_root}/scripts/#{script_name}") # chmod: 0755 in prev line doesnt work
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,69 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '4.2.6' #'~> 5.0.0.beta3'
4
+ #{if mongoid then "gem 'mongoid'" else "gem 'pg'" end}
5
+
6
+ gem 'sass'
7
+ gem 'sass-rails'
8
+ gem 'compass-rails'
9
+ gem 'compass'
10
+
11
+ #{if mongoid then "gem 'hancock_cms_mongoid'" else "gem 'hancock_cms_activerecord'" end}, path: '/home/ack/www/hancock_cms' #'~> 0.3.7'
12
+
13
+ gem 'devise'
14
+
15
+ gem 'slim-rails'
16
+ gem 'rs_russian'
17
+ gem 'cancancan'
18
+
19
+ # gem 'cloner'
20
+ gem 'unicorn'
21
+ gem 'x-real-ip'
22
+
23
+ #temp
24
+ #gem 'sentry-raven'
25
+
26
+ group :development do
27
+ gem 'better_errors'
28
+ gem 'binding_of_caller'
29
+ gem 'pry-rails'
30
+ gem 'spring'
31
+
32
+ gem 'capistrano', require: false
33
+
34
+ gem 'rvm1-capistrano3', require: false
35
+ gem 'glebtv-capistrano-unicorn', require: false
36
+ gem 'capistrano-bundler', require: false
37
+ gem 'capistrano-rails', require: false
38
+
39
+ gem 'hipchat'
40
+ # gem 'coffee-rails-source-maps'
41
+ # gem 'compass-rails-source-maps'
42
+
43
+ gem 'favicon_maker', '0.3'
44
+ gem 'favicon_maker_rails'
45
+
46
+ gem 'rails_email_preview', '~> 0.2.29'
47
+
48
+ gem 'image_optim_pack'
49
+ end
50
+
51
+ group :test do
52
+ gem 'rspec-rails'
53
+ gem 'database_cleaner'
54
+ gem 'email_spec'
55
+ #{if mongoid then "gem 'mongoid-rspec'" else "" end}
56
+ gem 'ffaker'
57
+ gem 'factory_girl_rails'
58
+ end
59
+
60
+ #{if mongoid then "gem 'mongo_session_store-rails4'" else "gem 'activerecord-session_store'" end}
61
+
62
+ gem 'slim'
63
+ gem 'sprockets'
64
+
65
+ gem 'uglifier'
66
+
67
+ group :production do
68
+ gem "god"
69
+ end
@@ -0,0 +1,49 @@
1
+ class Ability
2
+ include CanCan::Ability
3
+
4
+ def initialize(user)
5
+ if !user.nil? and (user.admin? or user.manager?)
6
+ can :access, :rails_admin # grant access to rails_admin
7
+ can :dashboard # grant access to the dashboard
8
+
9
+ if user.admin?
10
+ admin_ui(user)
11
+ elsif user.manager?
12
+ manager_ui(user)
13
+ end
14
+
15
+ can :index, :all
16
+ can :read, :all
17
+ can :history, :all
18
+ can :export, :all
19
+ can :toggle, :all
20
+
21
+ can :comments, :all #RailsAdminComments::Comments
22
+ can :model_comments, :all #RailsAdminComments::ModelComments
23
+
24
+ user.ability.to_cancancan(self) if user.respond_to?(:ability) and user.ability
25
+
26
+ if defined?(RailsAdminUserAbilities)
27
+ cannot :manage, RailsAdminUserAbilities::UserAbility
28
+ end
29
+ end
30
+ end
31
+
32
+ def admin_ui(user)
33
+ can :manage, :all
34
+ can :manage, User
35
+ can :user_abilities, User
36
+
37
+ Hancock.cancancan_admin_rules self
38
+ end
39
+
40
+ def manager_ui(user)
41
+ can :read, :all
42
+ can :show, :all
43
+ cannot [:edit, :destroy, :new, :create], User
44
+ can :edit, User, _id: user._id
45
+ cannot :user_abilities, :all
46
+
47
+ Hancock.cancancan_manager_rules self
48
+ end
49
+ end
@@ -0,0 +1,74 @@
1
+ require 'rails_admin/custom_show_in_app'
2
+
3
+ <% if Hancock.mongoid? %>
4
+ RailsAdminSettings.track_history!
5
+ <% end %>
6
+
7
+ RailsAdmin.config do |config|
8
+ ## == Devise ==
9
+ # this is required if not using cancan
10
+ #config.authenticate_with do
11
+ #warden.authenticate! scope: :user
12
+ #end
13
+
14
+ config.current_user_method(&:current_user)
15
+
16
+ ## == Cancan ==
17
+ config.authorize_with :cancan
18
+ <% if Hancock.mongoid? %>
19
+ ## == MongoidAudit
20
+ config.audit_with :mongoid_audit, 'HistoryTracker'
21
+ <% elsif Hancock.active_record? %>
22
+ config.audit_with :paper_trail, 'User', 'PaperTrail::Version'
23
+ <% end %>
24
+
25
+
26
+ config.actions do
27
+ dashboard # mandatory
28
+
29
+ # collection actions
30
+ index
31
+ new
32
+ export
33
+ bulk_delete
34
+
35
+ # member actions
36
+ show
37
+ edit
38
+ delete
39
+
40
+ history_index
41
+ history_show
42
+
43
+ toggle
44
+ # toggle_menu # for Hancock::Pages
45
+ # sitemap # for Hancock::Seo
46
+
47
+ Hancock.rails_admin_config_for_actions(self)
48
+ end
49
+
50
+ config.main_app_name = ['<%= Rails.application.class.name.split('::')[0] %>', 'Админка']
51
+
52
+ config.excluded_models ||= []
53
+ config.excluded_models << [
54
+ 'RailsAdmin::CustomShowInApp', 'HistoryTracker',
55
+ 'Ckeditor::Asset', 'Ckeditor::AttachmentFile', 'Ckeditor::Picture',
56
+ 'Hancock::EmbeddedElement'
57
+ ]
58
+ config.excluded_models.flatten!
59
+ end
60
+
61
+ # [required] fix for timezones to be displayed in local time instead of UTC
62
+ module RailsAdmin
63
+ module Config
64
+ module Fields
65
+ module Types
66
+ class Datetime
67
+ def value
68
+ bindings[:object].send(name)
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,42 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_model/railtie"
5
+ #{'#' if Hancock.mongoid?} require "active_record/railtie"
6
+ require "action_controller/railtie"
7
+ # require "action_mailer/railtie" # mailer is off by default
8
+ require "action_view/railtie"
9
+ require "sprockets/railtie"
10
+ # require "rails/test_unit/railtie"
11
+
12
+ # Require the gems listed in Gemfile, including any gems
13
+ # you've limited to :test, :development, or :production.
14
+ Bundler.require(*Rails.groups)
15
+
16
+ module #{app_name.camelize}
17
+ class Application < Rails::Application
18
+ config.generators do |g|
19
+ g.test_framework :rspec
20
+ g.view_specs false
21
+ g.helper_specs false
22
+ g.feature_specs false
23
+ g.template_engine :slim
24
+ g.stylesheets false
25
+ g.javascripts false
26
+ g.helper false
27
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
28
+ end
29
+
30
+ config.i18n.locale = :ru
31
+ config.i18n.default_locale = :ru
32
+ config.i18n.available_locales = [:ru, :en]
33
+ config.i18n.enforce_available_locales = true
34
+ #{'config.active_record.schema_format = :sql' if Hancock.active_record?}
35
+
36
+ #{'config.autoload_paths += %W(#{config.root}/extra)'}
37
+ #{'config.eager_load_paths += %W(#{config.root}/extra)'}
38
+
39
+ config.time_zone = 'Europe/Moscow'
40
+ config.assets.paths << Rails.root.join("app", "assets", "fonts")
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ #= require hancock/cms
2
+
3
+ #= require_tree hancock/app
4
+
5
+ # require_tree ./app
@@ -0,0 +1,88 @@
1
+ @import 'compass'
2
+ @import 'hancock/cms'
3
+
4
+ @import "hancock/toplink/toplink"
5
+
6
+ *
7
+ vertical-align: baseline
8
+ font-weight: inherit
9
+ font-family: inherit
10
+ font-style: inherit
11
+ outline: 0
12
+ padding: 0
13
+ margin: 0
14
+ box-sizing: border-box
15
+ &:focus
16
+ outline: none
17
+
18
+ input
19
+ padding: 5px 10px
20
+ margin: 5px
21
+
22
+ html, body
23
+ padding: 0
24
+ margin: 0
25
+ height: 100%
26
+ font-family: "Helvetica","Arial", sans-serif
27
+ font-size: 14px
28
+ font-weight: 400
29
+ line-height: 20px
30
+
31
+ html
32
+ font-size: 1em
33
+
34
+ body
35
+ font-size: 100%
36
+ overflow-x: hidden
37
+
38
+ a img, :link img, :visited img
39
+ border: 0
40
+
41
+ a
42
+ text-decoration: none
43
+ outline: none
44
+
45
+ #header
46
+ width: 100%
47
+ height: 100px
48
+ padding: 10px 25px 10px 25px
49
+
50
+ #main-nav
51
+ float: right
52
+ ul
53
+ list-style: none
54
+ li
55
+ display: inline-block
56
+ margin: 10px
57
+
58
+ #root
59
+ width: 100%
60
+ min-height: 100%
61
+ height: auto !important
62
+ height: 100%
63
+ margin: 0 auto -80px
64
+ &::after
65
+ content: ""
66
+ display: block
67
+ height: 80px
68
+
69
+ #content
70
+ width: 100%
71
+ padding: 25px
72
+
73
+ #footer
74
+ width: 100%
75
+ height: 80px
76
+ padding: 10px 25px 10px 25px
77
+ text-align: center
78
+
79
+ .cf:before, .cf:after
80
+ content: "."
81
+ display: block
82
+ height: 0
83
+ overflow: hidden
84
+ .cf:after
85
+ clear: both
86
+ .cf
87
+ zoom: 1
88
+ clear: both