hancock_cms 1.0.0.3 → 1.0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/models/concerns/hancock/cacheable.rb +17 -0
- data/app/views/blocks/_preloader.html.slim +0 -0
- data/app/views/layouts/application.html.slim +15 -7
- data/lib/generators/hancock/cms/setup_generator.rb +16 -4
- data/lib/generators/hancock/cms/templates/hancock_cms.erb +2 -2
- data/lib/hancock/configuration.rb +2 -2
- data/lib/hancock/controller.rb +1 -1
- data/lib/hancock/model.rb +1 -1
- data/lib/hancock/rails_admin_ext/config.rb +11 -1
- data/lib/hancock/version.rb +1 -1
- data/lib/hancock_cms.rb +1 -1
- data/template.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c73c9919e423af71ff0ea336d745c1cf035c5bac
|
4
|
+
data.tar.gz: 438396bab11dc25461ac958065000a3b40f1c971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dc52a2fb69be182e8035d79380f51a1d7b2e0570aad51d446d0ba3a240840fff6bf84cdbe6d7bcbe90fa21b3d3084e35ef39df9d2ef76543043fde2a9ec695d
|
7
|
+
data.tar.gz: 56ee7a7d603e9009310b58baca2cac4da51ad1810c4280308f5dd9519f9f87ea8c3349e389d2d884213e29d1c094951311205b2a7f1728e044b63fcee4e4c4f4
|
data/README.md
CHANGED
@@ -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
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
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
|
data/lib/hancock/controller.rb
CHANGED
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?
|
data/lib/hancock/version.rb
CHANGED
data/lib/hancock_cms.rb
CHANGED
data/template.rb
CHANGED
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.
|
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-
|
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
|