hancock_cms 1.0.0.3 → 1.0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8048a48f1d926cdbafa92b70bdde1121b9b9aabe
4
- data.tar.gz: b62cfdc5efc681a63654bab5d24d2ba9d9406807
3
+ metadata.gz: c73c9919e423af71ff0ea336d745c1cf035c5bac
4
+ data.tar.gz: 438396bab11dc25461ac958065000a3b40f1c971
5
5
  SHA512:
6
- metadata.gz: a6ee9eed742e29caa87904fc2c34c6cce43cff69a64a7ef77d484e11eaa5b1a47da43a06a11eec91ce1845ac636112db5f474d6bc14ff0d01a467f8c212f6d84
7
- data.tar.gz: cf940e65c678485fb3744b9721d1e8c82aad881082a2594093497fd1fba4e5607e6147d015fa3fa14071f9698dd0a1dee24d9d811dc5c1bf8db36a4c529a3a56
6
+ metadata.gz: 5dc52a2fb69be182e8035d79380f51a1d7b2e0570aad51d446d0ba3a240840fff6bf84cdbe6d7bcbe90fa21b3d3084e35ef39df9d2ef76543043fde2a9ec695d
7
+ data.tar.gz: 56ee7a7d603e9009310b58baca2cac4da51ad1810c4280308f5dd9519f9f87ea8c3349e389d2d884213e29d1c094951311205b2a7f1728e044b63fcee4e4c4f4
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # HancockCMS
2
2
 
3
+ #### Rails 4 support
4
+
3
5
  #### Inspired by [RocketCMS](https://github.com/rs-pro/rocket_cms)
4
6
  ### Remaded from [EnjoyCMS](https://github.com/enjoycreative/enjoy_cms)
5
7
 
@@ -11,6 +11,23 @@ if Hancock.mongoid?
11
11
  def default_cache_keys
12
12
  self.class.default_cache_keys
13
13
  end
14
+ def set_default_cache_keys(strategy = :append)
15
+ _old_keys = cache_keys
16
+
17
+ _keys = case strategy.to_sym
18
+ when :append
19
+ (_old_keys + default_cache_keys).uniq
20
+ when :overwrite, :replace
21
+ default_cache_keys
22
+ else
23
+ _old_keys
24
+ end
25
+ self
26
+ end
27
+ def set_default_cache_keys!(strategy = :append)
28
+ self.set_default_cache_keys(strategy) and self.save
29
+ end
30
+
14
31
 
15
32
  def cache_keys
16
33
  cache_keys_str.split(/\s+/).map { |k| k.strip }.reject { |k| k.blank? }
File without changes
@@ -6,19 +6,27 @@ html lang="ru"
6
6
  title= yield(:title) || page_title
7
7
  = yield :meta
8
8
  = csrf_meta_tags
9
- = render partial: 'blocks/favicon'
9
+
10
+ / - cache 'favicons', skip_digest: true do
11
+ / = render partial: 'blocks/favicon'
10
12
 
11
13
  - async = false #Rails.env.production?
12
14
  = stylesheet_link_tag "application", media: "all", async: async
13
15
  = javascript_include_tag "application", async: async
14
16
  /[if lt IE 9]
15
17
  = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js", async: async
16
- css:
17
- #{Settings.custom_css(default: '', kind: :css, label: "Дополнительный CSS")}
18
- javascript:
19
- #{Settings.custom_js(default: '', kind: :js, label: "Дополнительный JS")}
18
+ - cache 'layouts/application/custom_head', skip_digest: true do
19
+ - _cache_key = ['views/layouts/application/custom_head']
20
+ css:
21
+ #{Settings.ns('application_layout').custom_css(default: '', kind: :css, label: "Дополнительный CSS", cache_keys: _cache_key)}
22
+ javascript:
23
+ #{Settings.ns('application_layout').custom_js(default: '', kind: :js, label: "Дополнительный JS", cache_keys: _cache_key)}
24
+
25
+ body{class="application_layout #{controller_name} #{action_name} #{controller_name}_#{action_name}"}
20
26
 
21
- body{class="#{controller_name} #{action_name} #{controller_name}_#{action_name}"}
27
+ - cache 'preloader', skip_digest: true do
28
+ = render partial: 'blocks/preloader'
29
+
22
30
  #root role="main"
23
31
 
24
32
  header#header
@@ -32,4 +40,4 @@ html lang="ru"
32
40
  footer#footer
33
41
  = render partial: 'blocks/footer'
34
42
 
35
- = render partial: 'hancock/toplink/toplink'
43
+ = render partial: 'hancock/toplink/toplink'
@@ -24,15 +24,15 @@ TEXT
24
24
  end
25
25
 
26
26
  generate "devise", "User"
27
+
28
+
27
29
  ####### ROUTES #######
28
30
 
29
31
  remove_file 'config/routes.rb'
30
32
  create_file 'config/routes.rb' do <<-TEXT
31
33
  Rails.application.routes.draw do
32
34
  devise_for :users, controllers: {sessions: 'hancock/sessions'}
33
-
34
35
  mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
35
-
36
36
  hancock_cms_routes
37
37
  end
38
38
  TEXT
@@ -141,10 +141,18 @@ include Hancock::Model
141
141
  def self.manager_can_default_actions
142
142
  [:show, :read]
143
143
  end
144
- def manager_cannot_actions
144
+ def self.manager_cannot_actions
145
145
  [:new, :create, :delete, :destroy]
146
146
  end
147
147
 
148
+ ######################### RailsAdminUserAbilities #########################
149
+ # def self.rails_admin_user_defined_visible_actions
150
+ # [:user_abilities]
151
+ # end
152
+ # has_one :ability, class_name: "RailsAdminUserAbilities::UserAbility", as: :rails_admin_user_abilitable
153
+ # scope :for_rails_admin, -> { where(:roles.in => ['admin', 'manager']) } # could be any you want, just need to
154
+ ###########################################################################
155
+
148
156
  cattr_accessor :current_user
149
157
 
150
158
  # Include default devise modules. Others available are:
@@ -185,7 +193,11 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
185
193
  if ::User.admins.all.count == 0
186
194
  _email_pass = 'admin@#{app_name.dasherize.downcase}.ru'
187
195
  if ::User.new(roles: ["admin"], email: _email_pass, password: _email_pass, password_confirmation: _email_pass).save
196
+ puts "#################################################################################"
197
+ puts "#################################################################################"
188
198
  puts "AdminUser with email and password '\#{_email_pass}' was created!"
199
+ puts "#################################################################################"
200
+ puts "#################################################################################"
189
201
  else
190
202
  puts 'Creating AdminUser error'
191
203
  end
@@ -348,7 +360,7 @@ git commit: %Q{ -m 'Initial commit' }
348
360
  end
349
361
 
350
362
  def mongoid
351
- defined? Mongoid
363
+ !!defined? Mongoid
352
364
  end
353
365
 
354
366
  def app_name
@@ -20,8 +20,8 @@ Hancock.configure do |config|
20
20
  # actions: :manage
21
21
  # }
22
22
  #
23
- # config.recaptcha_support = defined?(Recaptcha)
24
- # config.simple_captcha_support = defined?(SimpleCaptcha)
23
+ # config.recaptcha_support = !!defined?(Recaptcha)
24
+ # config.simple_captcha_support = !!defined?(SimpleCaptcha)
25
25
  #
26
26
  # config.admin_enter_captcha = config.recaptcha_support or config.simple_captcha_support
27
27
  # config.registration_captcha = config.admin_enter_captcha
@@ -38,8 +38,8 @@ module Hancock
38
38
  @ability_manager_config = []
39
39
  @ability_admin_config = []
40
40
 
41
- @recaptcha_support = defined?(Recaptcha)
42
- @simple_captcha_support = defined?(SimpleCaptcha)
41
+ @recaptcha_support = !!defined?(Recaptcha)
42
+ @simple_captcha_support = !!defined?(SimpleCaptcha)
43
43
 
44
44
  @admin_enter_captcha = @recaptcha_support or @simple_captcha_support
45
45
  @registration_captcha = @admin_enter_captcha
@@ -3,7 +3,7 @@ module Hancock::Controller
3
3
  included do
4
4
  include Hancock::Errors
5
5
  include Hancock::Fancybox
6
- if defined?(Hancock::Pages)
6
+ if !!defined?(Hancock::Pages)
7
7
  include Hancock::Pages::SeoPages
8
8
  include Hancock::Pages::NavMenu
9
9
  include Hancock::Pages::Blocksetable
data/lib/hancock/model.rb CHANGED
@@ -33,7 +33,7 @@ module Hancock
33
33
  include Hancock::BooleanField
34
34
  include Hancock::SortField
35
35
 
36
- if Hancock.mongoid? and defined?(RailsAdminComments)
36
+ if Hancock.mongoid? and !!defined?(RailsAdminComments)
37
37
  include RailsAdminComments::Commentable
38
38
  include RailsAdminComments::ModelCommentable
39
39
  end
@@ -40,6 +40,16 @@ module Hancock
40
40
 
41
41
  action_unvisible_for(:custom_show_in_app, Proc.new { false })
42
42
  action_visible_for(:model_settings, Proc.new { false })
43
+
44
+ if defined?(RailsAdminNestedSet)
45
+ action_visible_for(:nested_set, Proc.new { false })
46
+ end
47
+
48
+ if defined?(RailsAdminMultipleFileUpload)
49
+ action_visible_for(:multiple_file_upload, Proc.new { false })
50
+ action_visible_for(:multiple_file_upload_collection, Proc.new { false })
51
+ end
52
+
43
53
  end
44
54
 
45
55
  def add_action(action_name)
@@ -81,7 +91,7 @@ module Hancock
81
91
  def actions_config(rails_admin_actions)
82
92
 
83
93
  @actions_list.each do |action|
84
- if rails_admin_actions.respond_to?(action)
94
+ if rails_admin_actions.respond_to?(action) and !RailsAdmin::Config::Actions.all.map { |a| a.class.name.demodulize.underscore }.include?(action.to_s)
85
95
  rails_admin_actions.send(action) do
86
96
  visible do
87
97
  if !bindings or bindings[:abstract_model].blank?
@@ -1,3 +1,3 @@
1
1
  module Hancock
2
- VERSION = "1.0.0.3".freeze
2
+ VERSION = "1.0.0.4".freeze
3
3
  end
data/lib/hancock_cms.rb CHANGED
@@ -81,7 +81,7 @@ module Hancock
81
81
  }
82
82
  end
83
83
  def register_plugin(plugin)
84
- Hancock::PLUGINS << plugin unless Hancock::MODELS.include?(plugin)
84
+ Hancock::PLUGINS << plugin unless Hancock::PLUGINS.include?(plugin)
85
85
  end
86
86
 
87
87
  def clear_history_from_empty_objects
data/template.rb CHANGED
@@ -106,7 +106,7 @@ gem 'glebtv_mongoid_userstamp', '0.6.2'
106
106
  TEXT
107
107
  end
108
108
 
109
- RVM_RUBY_VERSION = "2.3.1"
109
+ RVM_RUBY_VERSION = "2.3.3"
110
110
  create_file '.ruby-version', "#{RVM_RUBY_VERSION}\n"
111
111
  create_file '.ruby-gemset', "#{app_name.underscore}\n"
112
112
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hancock_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.3
4
+ version: 1.0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -307,6 +307,7 @@ files:
307
307
  - app/views/blocks/_favicon.html.slim
308
308
  - app/views/blocks/_footer.html.slim
309
309
  - app/views/blocks/_header.html.slim
310
+ - app/views/blocks/_preloader.html.slim
310
311
  - app/views/devise/passwords/edit.html.slim
311
312
  - app/views/devise/passwords/new.html.slim
312
313
  - app/views/devise/registrations/edit.html.slim