enjoy_cms 0.4.0.4 → 0.4.0.5
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/lib/enjoy/rails_admin_ext/{group_patch.rb → patches/enjoy_cms_group.rb} +5 -1
- data/lib/enjoy/rails_admin_ext/patches/field_patch.rb +14 -0
- data/lib/enjoy/rails_admin_ext/patches/group_patch.rb +41 -0
- data/lib/enjoy/version.rb +1 -1
- data/lib/enjoy_cms.rb +7 -1
- data/template.rb +17 -8
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a875f96cd3f0979334375b90a822d6da795fd8
|
4
|
+
data.tar.gz: 61b29499b40cb6da3fb76d986071437d6ef3820a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 691effa0962a688b062e4234d99c34d6f1628421c86d5faebbbd9c900d069357488f36a911e9e9758e44ff44f859a39b8c0724797d78ce9f6e640e2158987ca3
|
7
|
+
data.tar.gz: ee13c9219748151350df6bc8c0d46062a8d7f5497a9fc97978096f17371b22c9315a0dfb8ac9380ecbc0af980f852b50bff45f436180af10e1c736b3e37d5e25
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rails_admin'
|
1
2
|
module Enjoy::RailsAdminGroupPatch
|
2
3
|
class << self
|
3
4
|
def enjoy_cms_group(config, fields = {})
|
@@ -5,8 +6,11 @@ module Enjoy::RailsAdminGroupPatch
|
|
5
6
|
|
6
7
|
if fields.is_a?(Array)
|
7
8
|
fields.each do |_group|
|
8
|
-
config.group (_group[:name] ||
|
9
|
+
config.group (_group[:name] || :default) do
|
9
10
|
active (_group[:active] || false)
|
11
|
+
label _group[:label] if _group[:label].present?
|
12
|
+
help _group[:help] if _group[:help].present?
|
13
|
+
weight _group[:weight] if _group[:weight].present?
|
10
14
|
(_group[:fields] || {}).each_pair do |name, type|
|
11
15
|
if type.blank?
|
12
16
|
field name
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rails_admin'
|
2
|
+
module RailsAdmin
|
3
|
+
module Config
|
4
|
+
module Fields
|
5
|
+
|
6
|
+
class Group
|
7
|
+
register_instance_option :weight do
|
8
|
+
name.to_sym == :default ? -1_000_000 : 0
|
9
|
+
end
|
10
|
+
|
11
|
+
def visible_fields
|
12
|
+
section.with(bindings).visible_fields.select { |f|
|
13
|
+
f.group == self
|
14
|
+
}.sort do |a, b|
|
15
|
+
a.weight <=> b.weight
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module RailsAdmin
|
25
|
+
module Config
|
26
|
+
module HasGroups
|
27
|
+
|
28
|
+
def visible_groups
|
29
|
+
parent.groups.collect { |f|
|
30
|
+
f.section = self
|
31
|
+
f.with(bindings)
|
32
|
+
}.select(&:visible?).select { |g|
|
33
|
+
g.visible_fields.present?
|
34
|
+
}.sort do |a, b|
|
35
|
+
a.weight <=> b.weight
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/enjoy/version.rb
CHANGED
data/lib/enjoy_cms.rb
CHANGED
@@ -17,13 +17,19 @@ require 'geocoder'
|
|
17
17
|
# require 'validates_email_format_of'
|
18
18
|
require 'filename_to_slug'
|
19
19
|
|
20
|
+
|
20
21
|
require 'rails_admin'
|
21
22
|
require 'enjoy/rails_admin_ext/config'
|
22
23
|
|
23
24
|
# require 'enjoy/rails_admin_ext/enjoy_hash'
|
24
25
|
require 'enjoy/rails_admin_ext/enjoy_html'
|
25
26
|
require 'enjoy/rails_admin_ext/enjoy_slugs'
|
26
|
-
|
27
|
+
|
28
|
+
require 'enjoy/rails_admin_ext/patches/field_patch'
|
29
|
+
require 'enjoy/rails_admin_ext/patches/field_patch'
|
30
|
+
require 'enjoy/rails_admin_ext/patches/group_patch'
|
31
|
+
require 'enjoy/rails_admin_ext/patches/enjoy_cms_group'
|
32
|
+
|
27
33
|
|
28
34
|
require 'rails_admin_nested_set'
|
29
35
|
require 'rails_admin_toggleable'
|
data/template.rb
CHANGED
@@ -327,15 +327,28 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
|
|
327
327
|
end
|
328
328
|
|
329
329
|
def self.generate_first_admin_user
|
330
|
-
if User.all.count == 0
|
330
|
+
if User.admins.all.count == 0
|
331
331
|
_email_pass = 'admin@#{app_name.dasherize.downcase}.ru'
|
332
332
|
if User.new(roles: ["admin"], email: _email_pass, password: _email_pass, password_confirmation: _email_pass).save
|
333
|
-
puts "
|
333
|
+
puts "AdminUser with email and password '\#{_email_pass}' was created!"
|
334
334
|
else
|
335
|
-
puts 'Creating
|
335
|
+
puts 'Creating AdminUser error'
|
336
336
|
end
|
337
337
|
else
|
338
|
-
puts '
|
338
|
+
puts 'AdminUsers are here already'
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def self.generate_first_manager_user
|
343
|
+
if User.managers.all.count == 0
|
344
|
+
_email_pass = 'manager@#{app_name.dasherize.downcase}.ru'
|
345
|
+
if User.create(roles: ["manager"], email: _email_pass, password: _email_pass, password_confirmation: _email_pass)
|
346
|
+
puts "ManagerUser with email and password '\#{_email_pass}' was created!"
|
347
|
+
else
|
348
|
+
puts 'Creating ManagerUser error'
|
349
|
+
end
|
350
|
+
else
|
351
|
+
puts 'ManagerUsers are here already'
|
339
352
|
end
|
340
353
|
end
|
341
354
|
|
@@ -483,12 +496,8 @@ generate "enjoy:cms:assets", app_name
|
|
483
496
|
remove_file 'public/robots.txt'
|
484
497
|
generate "enjoy:cms:robots"
|
485
498
|
|
486
|
-
|
487
499
|
#god+unicorn
|
488
500
|
generate "enjoy:cms:unicorn_god", app_name
|
489
|
-
|
490
|
-
|
491
|
-
|
492
501
|
#scripts
|
493
502
|
generate "enjoy:cms:scripts", app_name
|
494
503
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enjoy_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.5
|
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-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -320,7 +320,9 @@ files:
|
|
320
320
|
- lib/enjoy/rails_admin_ext/enjoy_hash.rb
|
321
321
|
- lib/enjoy/rails_admin_ext/enjoy_html.rb
|
322
322
|
- lib/enjoy/rails_admin_ext/enjoy_slugs.rb
|
323
|
-
- lib/enjoy/rails_admin_ext/
|
323
|
+
- lib/enjoy/rails_admin_ext/patches/enjoy_cms_group.rb
|
324
|
+
- lib/enjoy/rails_admin_ext/patches/field_patch.rb
|
325
|
+
- lib/enjoy/rails_admin_ext/patches/group_patch.rb
|
324
326
|
- lib/enjoy/rails_admin_settings_patch.rb
|
325
327
|
- lib/enjoy/routes.rb
|
326
328
|
- lib/enjoy/simple_form_patch.rb
|