hancock_cms 2.0.1.2 → 2.0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hancock/cms.coffee +1 -0
- data/app/assets/javascripts/hancock/rails_admin/cms.ui.coffee +3 -0
- data/app/assets/javascripts/hancock/rails_admin/hancock_array.coffee +43 -0
- data/app/assets/javascripts/hancock/rails_admin/hancock_hash.coffee +90 -0
- data/app/assets/javascripts/hancock/rails_admin/navigation_filter.coffee +10 -3
- data/app/assets/javascripts/rails_admin/custom/ui.coffee +8 -0
- data/app/assets/stylesheets/hancock/rails_admin/cms.theming.sass +27 -3
- data/app/assets/stylesheets/hancock/rails_admin/hancock_hash.sass +4 -0
- data/app/assets/stylesheets/hancock/rails_admin/settings.sass +19 -0
- data/app/assets/stylesheets/hancock/rails_admin/tables.sass +15 -0
- data/app/controllers/hancock/registrations_controller.rb +1 -1
- data/app/controllers/hancock/sessions_controller.rb +1 -1
- data/app/helpers/rails_admin/application/hancock_helper.rb +19 -1
- data/app/helpers/rails_admin/hancock/form_builder.rb +4 -4
- data/app/helpers/rails_admin/main/hancock_helper.rb +1 -1
- data/app/models/concerns/hancock/insertion_field.rb +7 -5
- data/app/models/concerns/hancock/mappable.rb +2 -2
- data/app/models/concerns/hancock/rails_admin_patch.rb +30 -0
- data/app/views/{layouts/hancock → hancock}/_assets.html.slim +11 -7
- data/app/views/layouts/application.html.slim +2 -2
- data/app/views/layouts/rails_admin/_preloader.html.slim +125 -0
- data/app/views/layouts/rails_admin/application.html.haml +4 -1
- data/app/views/rails_admin/main/_hancock_array.html.slim +9 -0
- data/app/views/rails_admin/main/_hancock_hash.html.slim +36 -9
- data/app/views/rails_admin/main/hancock_array/_element.html.slim +8 -0
- data/app/views/rails_admin/main/hancock_hash/_fixed_keys.html.slim +8 -0
- data/app/views/rails_admin/main/hancock_hash/_full.html.slim +6 -0
- data/config/initializers/nested_set_patch.rb +2 -2
- data/config/locales/ru.hancock_admin.yml +4 -1
- data/hancock_cms.gemspec +1 -1
- data/lib/hancock/admin.rb +1 -2
- data/lib/hancock/model.rb +10 -6
- data/lib/hancock/rails_admin_ext/hancock_array.rb +4 -0
- data/lib/hancock/rails_admin_ext/hancock_enum.rb +13 -2
- data/lib/hancock/rails_admin_ext/hancock_hash.rb +44 -10
- data/lib/hancock/rails_admin_ext/patches/hancock_cms_group.rb +26 -17
- data/lib/hancock/rails_admin_ext/patches/lazy_model.rb +13 -0
- data/lib/hancock/rails_admin_ext/patches/section_list_patch.rb +30 -0
- data/lib/hancock/rails_admin_settings_patch.rb +49 -0
- data/lib/hancock/version.rb +1 -1
- data/lib/hancock_cms.rb +2 -0
- data/template.rb +1 -1
- metadata +17 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10e89db845873d72c3c7cc2af8ecbc9ef4e82cb7
|
4
|
+
data.tar.gz: 38b09a986571dccb38748dc529bdbf981630ce76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f2e6ced5a464438a0d72edd90eb8c57c6fbec8847c459d9c884366b23c6add4d1e0ef93b56ce4b732be496701908bb1ff64f47b0911e207bcaea0460537cae7
|
7
|
+
data.tar.gz: 675d2cf95e60c4b3e999a4192c9dd4e2c589aac3e3c05488529afdd834b2a9c44bec12abfe3f0c673720cd9046497fbd56caa54e4788a78a51337c8b67e9298d
|
@@ -0,0 +1,43 @@
|
|
1
|
+
$(document).on "click", ".hancock_array_type .array_element_add_link", (e)->
|
2
|
+
e.preventDefault()
|
3
|
+
link = $(e.currentTarget)
|
4
|
+
link_parent = link.parent()
|
5
|
+
link_parent.before(link.data('template'))
|
6
|
+
link_parent.prev().find('input:first').focus().select().trigger('change')
|
7
|
+
return false
|
8
|
+
|
9
|
+
|
10
|
+
$(document).on 'click', '.hancock_array_type .array_element_delete_link', (e)->
|
11
|
+
e.preventDefault()
|
12
|
+
hidden_field = $(e.currentTarget).closest(".hancock_array_type").find("[type='hidden']")
|
13
|
+
$(e.currentTarget).parent().remove()
|
14
|
+
hidden_field.trigger('change')
|
15
|
+
return false
|
16
|
+
|
17
|
+
|
18
|
+
$(document).on 'click', '.hancock_array_type .array_element_move_link', (e)->
|
19
|
+
e.preventDefault()
|
20
|
+
link = $(e.currentTarget)
|
21
|
+
array_element_block = link.parent()
|
22
|
+
if link.hasClass("up")
|
23
|
+
prev = array_element_block.prev(".array_element_block")
|
24
|
+
array_element_block.insertBefore(prev) if prev.length > 0
|
25
|
+
if link.hasClass("down")
|
26
|
+
next = array_element_block.next(".array_element_block")
|
27
|
+
array_element_block.insertAfter(next) if next.length > 0
|
28
|
+
return false
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
$(document).on "change", ".hancock_array_type :input, .hancock_enum_type :input, .hancock_enum_with_custom_type :input, .enum_type :input", (e)->
|
33
|
+
field_block = $(e.currentTarget).closest(".hancock_array_type, .hancock_enum_type, .hancock_enum_with_custom_type, .enum_type")
|
34
|
+
hidden_field = field_block.find("[type='hidden']")
|
35
|
+
if field_block.find(":input:not([type='hidden'])").serializeArray().length == 0
|
36
|
+
hidden_field.prop('name', hidden_field.data('name')) if hidden_field.data('name')
|
37
|
+
else
|
38
|
+
hidden_field.data('name', hidden_field.prop('name')) if hidden_field.prop('name')
|
39
|
+
hidden_field.prop('name', '')
|
40
|
+
|
41
|
+
|
42
|
+
$(document).on "rails_admin.dom_ready", (e)->
|
43
|
+
$(".hancock_array_type, .hancock_enum_type, .hancock_enum_with_custom_type, .enum_type").find(":input[type='hidden']").trigger('change')
|
@@ -0,0 +1,90 @@
|
|
1
|
+
$(document).on "click", ".hancock_hash_type .hash_element_renamer_link", (ev)->
|
2
|
+
ev.preventDefault()
|
3
|
+
renamer_link = $(ev.currentTarget)
|
4
|
+
label = renamer_link.closest('.hash_element_block').find('label')
|
5
|
+
input = renamer_link.closest('.hash_element_block').find('input')
|
6
|
+
new_renamer_link = renamer_link.clone()
|
7
|
+
renamer_field = $("<input>").addClass('hash_element_renamer_field').prop("type", "string").prop("placeholder", "Новое имя").prop("value", label.text())
|
8
|
+
renamer_link.replaceWith(renamer_field)
|
9
|
+
label.hide()
|
10
|
+
input.hide()
|
11
|
+
renamer_field.focus().blur( ->
|
12
|
+
renamer_field.replaceWith(renamer_link)
|
13
|
+
label.show()
|
14
|
+
input.show()
|
15
|
+
).keypress((e)->
|
16
|
+
key = e.which || e.keyCode
|
17
|
+
if key == 13
|
18
|
+
e.preventDefault()
|
19
|
+
new_name = renamer_field.val().trim()
|
20
|
+
if new_name.length > 0
|
21
|
+
old_id = input.prop('id')
|
22
|
+
old_name = input.prop('name')
|
23
|
+
reg_for_id = /\[[^\[\]]+\]$/i
|
24
|
+
reg_for_name = /\[[^\[\]]+\]\]$/i
|
25
|
+
label.prop('for', old_id.replace(reg_for_id, "[" + new_name + "]")).text(new_name)
|
26
|
+
input.prop('id', old_id.replace(reg_for_id, "[" + new_name + "]"))
|
27
|
+
input.prop('name', old_name.replace(reg_for_name, "[" + new_name + "]]"))
|
28
|
+
renamer_field.blur()
|
29
|
+
input.focus()
|
30
|
+
return false
|
31
|
+
).keydown((e)->
|
32
|
+
key = e.which || e.keyCode
|
33
|
+
if key == 27
|
34
|
+
renamer_field.blur()
|
35
|
+
return false
|
36
|
+
).select()
|
37
|
+
return false
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
$(document).on "click", ".hancock_hash_type .hash_element_add_link", (e)->
|
42
|
+
e.preventDefault()
|
43
|
+
link = $(e.currentTarget)
|
44
|
+
link_parent = link.parent()
|
45
|
+
link_parent.before(link.data('template'))
|
46
|
+
# link_parent.prev().find('input:first').focus().select()
|
47
|
+
link_parent.prev().find('.hash_element_renamer_link').click()
|
48
|
+
return false
|
49
|
+
|
50
|
+
|
51
|
+
$(document).on 'click', '.hancock_hash_type .hash_element_delete_link', (e)->
|
52
|
+
e.preventDefault()
|
53
|
+
$(e.currentTarget).parent().remove()
|
54
|
+
return false
|
55
|
+
|
56
|
+
$(document).on 'blur', '.hancock_hash_type .hash_element_key_field', (e)->
|
57
|
+
e.preventDefault()
|
58
|
+
input = $(e.currentTarget).siblings('input')
|
59
|
+
old_id = input.prop('id')
|
60
|
+
old_name = input.prop('name')
|
61
|
+
new_name = e.currentTarget.value
|
62
|
+
reg_for_id = /\[[^\[\]]+\]$/i
|
63
|
+
reg_for_name = /\[[^\[\]]+\]\]$/i
|
64
|
+
input.prop('id', old_id.replace(reg_for_id, "[" + new_name + "]"))
|
65
|
+
input.prop('name', old_name.replace(reg_for_name, "[" + new_name + "]]"))
|
66
|
+
return false
|
67
|
+
|
68
|
+
|
69
|
+
$(document).on 'blur', '.hancock_hash_type .hash_element_block input', (e)->
|
70
|
+
fields_block = $(e.currentTarget).closest(".controls")
|
71
|
+
fields_block.find('.value_field').each ->
|
72
|
+
$(this).parent().removeClass('duplicate')
|
73
|
+
fields_block.find('.value_field').not($(this)).filter("[name='" + this.name + "']").parent().addClass('duplicate')
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
# $(document).on 'click', '.hash_element_duplicate_trigger', (e)->
|
79
|
+
# e.preventDefault()
|
80
|
+
# link = $(e.currentTarget)
|
81
|
+
# link.data('show-duplicates', link.data('show-duplicates') ^ 1)
|
82
|
+
# fields_block = link.closest(".controls")
|
83
|
+
# fields_block.find('.value_field').each ->
|
84
|
+
# $(this).parent().removeClass('duplicate')
|
85
|
+
# if link.data('show-duplicates')
|
86
|
+
# fields_block.find('.value_field').not($(this)).filter("[name='" + this.name + "']").parent().addClass('duplicate')
|
87
|
+
# old_text = link.text()
|
88
|
+
# new_text = link.data('text')
|
89
|
+
# link.text(new_text).data('text', old_text)
|
90
|
+
# return false
|
@@ -11,8 +11,11 @@ $(document).on 'keydown', '#navigation_filter', (e)->
|
|
11
11
|
_navig = $(e.currentTarget).parent().siblings('.toolbar').find('.nav')
|
12
12
|
return true if _navig.find("li:visible").length == 0 and _code != 13
|
13
13
|
if (_selected = _navig.find("li.current_selected")).length == 1
|
14
|
-
if _selected.find(
|
15
|
-
|
14
|
+
if (_link = _selected.find('a')).length > 0
|
15
|
+
if e.ctrlKey
|
16
|
+
window.open(_link[0].href, "_blank")
|
17
|
+
else
|
18
|
+
_link.click()
|
16
19
|
else
|
17
20
|
if _selected.hasClass('opened')
|
18
21
|
_selected.addClass('forced-closed').removeClass('forced-opened').click()
|
@@ -22,7 +25,11 @@ $(document).on 'keydown', '#navigation_filter', (e)->
|
|
22
25
|
else
|
23
26
|
return true if _code == 37
|
24
27
|
if (_selected = _navig.find('li.visible[data-model]')).length == 1
|
25
|
-
_selected.find('a')
|
28
|
+
_link = _selected.find('a')
|
29
|
+
if e.ctrlKey
|
30
|
+
window.open(_link[0].href, "_blank")
|
31
|
+
else
|
32
|
+
_link.click()
|
26
33
|
else
|
27
34
|
return true if _code == 39
|
28
35
|
|
@@ -1,3 +1,11 @@
|
|
1
1
|
#= require_self
|
2
2
|
#= require hancock/rails_admin/cms.ui
|
3
3
|
#= require hancock/rails_admin/custom/ui
|
4
|
+
|
5
|
+
$(window).load ->
|
6
|
+
$('#preloader').fadeOut 'slow', ->
|
7
|
+
$(this).remove()
|
8
|
+
|
9
|
+
$(document).on 'ready pjax:success', ->
|
10
|
+
$('#preloader').fadeOut 'slow', ->
|
11
|
+
$(this).remove()
|
@@ -1,6 +1,9 @@
|
|
1
1
|
@import 'jquery.mCustomScrollbar'
|
2
2
|
|
3
|
-
@import
|
3
|
+
@import 'hancock/rails_admin/fieldsets'
|
4
|
+
@import 'hancock/rails_admin/settings'
|
5
|
+
@import 'hancock/rails_admin/tables'
|
6
|
+
@import 'hancock/rails_admin/hancock_hash'
|
4
7
|
|
5
8
|
.btn
|
6
9
|
+transition(all 0.3s)
|
@@ -860,6 +863,29 @@ body.rails_admin .nav.nav-tabs
|
|
860
863
|
white-space: nowrap
|
861
864
|
text-overflow: ellipsis
|
862
865
|
|
866
|
+
body.rails_admin .nav-tabs.filter
|
867
|
+
li
|
868
|
+
max-width: none
|
869
|
+
a
|
870
|
+
text-overflow: clip
|
871
|
+
#filters
|
872
|
+
li
|
873
|
+
display: block
|
874
|
+
width: 100%
|
875
|
+
|
876
|
+
#filters_box
|
877
|
+
.label-info
|
878
|
+
color: #fff
|
879
|
+
background-color: #e53935
|
880
|
+
+transition(all 0.3s ease-in-out)
|
881
|
+
&:hover
|
882
|
+
color: #fff
|
883
|
+
background-color: darken(#e53935, 10%)
|
884
|
+
a
|
885
|
+
color: #fff
|
886
|
+
a:hover
|
887
|
+
color: #fff
|
888
|
+
|
863
889
|
.form-group.form-actions
|
864
890
|
margin-left: 0px
|
865
891
|
margin-right: 0px
|
@@ -906,5 +932,3 @@ body.rails_admin .nav.nav-tabs
|
|
906
932
|
|
907
933
|
|
908
934
|
@import "hancock/rails_admin/plugins"
|
909
|
-
|
910
|
-
@import "hancock/rails_admin/custom/theming"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.form-group.raw_field
|
2
|
+
input, textarea
|
3
|
+
display: block
|
4
|
+
width: 100%
|
5
|
+
min-width: 406px
|
6
|
+
min-height: 34px
|
7
|
+
padding: 6px 12px
|
8
|
+
font-size: 14px
|
9
|
+
line-height: 1.42857
|
10
|
+
color: #555555
|
11
|
+
background-color: #fff
|
12
|
+
background-image: none
|
13
|
+
border: 1px solid #ccc
|
14
|
+
border-radius: 4px
|
15
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075)
|
16
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075)
|
17
|
+
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
|
18
|
+
-o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
|
19
|
+
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'rails_admin/application_helper'
|
1
|
+
# require 'rails_admin/application_helper'
|
2
2
|
module RailsAdmin::Application
|
3
3
|
module HancockHelper
|
4
4
|
|
@@ -15,5 +15,23 @@ module RailsAdmin::Application
|
|
15
15
|
end.join.html_safe
|
16
16
|
end
|
17
17
|
|
18
|
+
def hancock_show_path(obj, opts = {})
|
19
|
+
if obj.is_a?(Hash)
|
20
|
+
(opts ||= {}).merge!(obj)
|
21
|
+
else
|
22
|
+
(opts ||= {}).merge!({model_name: obj.rails_admin_model, id: obj.id})
|
23
|
+
end
|
24
|
+
show_path(opts)
|
25
|
+
end
|
26
|
+
|
27
|
+
def hancock_edit_path(obj, opts = {})
|
28
|
+
if obj.is_a?(Hash)
|
29
|
+
(opts ||= {}).merge!(obj)
|
30
|
+
else
|
31
|
+
(opts ||= {}).merge!({model_name: obj.rails_admin_model, id: obj.id})
|
32
|
+
end
|
33
|
+
edit_path(opts)
|
34
|
+
end
|
35
|
+
|
18
36
|
end
|
19
37
|
end
|
@@ -11,10 +11,10 @@ module RailsAdmin::Hancock
|
|
11
11
|
).visible_fields
|
12
12
|
return if fields.empty?
|
13
13
|
|
14
|
-
|
15
|
-
@template.content_tag :fieldset, class:
|
16
|
-
if fieldset.leftside_hider
|
17
|
-
leftside_hider = @template.content_tag(:div, class: 'control-group leftside_hider', title:
|
14
|
+
_default_fieldset = fieldset.name == :default
|
15
|
+
@template.content_tag :fieldset, class: _default_fieldset ? 'default_fieldset' : '' do
|
16
|
+
if fieldset.leftside_hider and !nested_in
|
17
|
+
leftside_hider = @template.content_tag(:div, class: 'control-group leftside_hider', title: _default_fieldset ? "" : "Свернуть блок") do
|
18
18
|
@template.content_tag(:div, class: 'scroll_fieldset_block') do
|
19
19
|
ret = []
|
20
20
|
ret << @template.content_tag(:div, class: 'scroll_fieldset_top', title: "Вверх блока") do
|
@@ -13,11 +13,13 @@ module Hancock::InsertionField
|
|
13
13
|
# /(\[\[(\w+?)\]\] | \{\{(self\.(\w+?))\}\} | \{\{(([\w\-\.]+?)\.(\w+?))\}\} | \{\{(\w+?)\}\} | \{\{(BS\|(\w+?))\}\})/
|
14
14
|
#
|
15
15
|
# reg1 = /\[\[(?<new_bs>(?<new_bs_name>\w+?))\]\]/i
|
16
|
-
# reg2 = /\
|
17
|
-
# reg3 = /\{\{(?<
|
18
|
-
# reg4 = /\{\{(?<
|
19
|
-
# reg5 = /\{\{(?<
|
20
|
-
# reg6 = /\{\{
|
16
|
+
# reg2 = /\[\[\[\[(?<new_helper>(?<new_helper_name>\w+?))\]\]\]\]/i
|
17
|
+
# reg3 = /\{\{(?<insertion_old>self\.(?<insertion_old_name>\w+?))\}\}/i
|
18
|
+
# reg4 = /\{\{(?<setting_with_ns>(?<setting_with_ns_ns>[\w\-\.]+?)\.(?<setting_with_ns_name>\w+?))\}\}/i
|
19
|
+
# reg5 = /\{\{(?<setting>(?<setting_name>\w+?))\}\}/i
|
20
|
+
# reg6 = /\{\{(?<old_bs>BS\|(?<old_bs_name>\w+?))\}\}/i
|
21
|
+
# reg7 = /\{\{(?<old_helper>HELPER\|(?<old_helper_name>\w+?))\}\}/i
|
22
|
+
# reg8 = /\{\{\{\{(?<insertion>(?<insertion_name>\w+?))\}\}\}\}/i
|
21
23
|
private
|
22
24
|
def process_with_insertions(_data)
|
23
25
|
if _data.nil?
|
@@ -5,7 +5,7 @@ module Hancock::Mappable
|
|
5
5
|
|
6
6
|
if Hancock.mongoid?
|
7
7
|
include ::Geocoder::Model::Mongoid
|
8
|
-
field :coordinates, type: Array
|
8
|
+
field :coordinates, type: Array, default: []
|
9
9
|
field :address, type: String, localize: Hancock.configuration.localize
|
10
10
|
|
11
11
|
field :map_address, type: String
|
@@ -88,5 +88,5 @@ module Hancock::Mappable
|
|
88
88
|
map_address
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
end
|
@@ -1,6 +1,34 @@
|
|
1
1
|
module Hancock::RailsAdminPatch
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
|
+
included do
|
5
|
+
if respond_to?(:rails_admin_block) and (_block = rails_admin_block).is_a?(Proc)
|
6
|
+
rails_admin &_block
|
7
|
+
end
|
8
|
+
class << self
|
9
|
+
def inherited(base)
|
10
|
+
super
|
11
|
+
base_name = base.name.to_sym
|
12
|
+
self_name = self.name.to_sym
|
13
|
+
registry = ::RailsAdmin::Config.registry
|
14
|
+
if registry.keys.include?(self_name) and !registry.keys.include?(base_name)
|
15
|
+
# puts "inheriting #{base_name} from #{self_name}"
|
16
|
+
registry[base_name] = RailsAdmin::Config.model(base)
|
17
|
+
# puts registry[self_name].get_deferred_blocks.inspect
|
18
|
+
registry[self_name].get_deferred_blocks.each do |b|
|
19
|
+
registry[base_name].add_deferred_block &b
|
20
|
+
end
|
21
|
+
end
|
22
|
+
# puts "inheriting #{base_name} from #{self_name}"
|
23
|
+
if self.respond_to?(:rails_admin_block) and (_block = self.rails_admin_block).is_a?(Proc)
|
24
|
+
base.rails_admin &_block
|
25
|
+
end
|
26
|
+
# puts registry[base_name].get_deferred_blocks.inspect
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
4
32
|
def rails_admin_model
|
5
33
|
self.class.rails_admin_model
|
6
34
|
end
|
@@ -19,6 +47,8 @@ module Hancock::RailsAdminPatch
|
|
19
47
|
end
|
20
48
|
|
21
49
|
class_methods do
|
50
|
+
def rails_admin_block
|
51
|
+
end
|
22
52
|
def rails_admin_model
|
23
53
|
name.split('::').collect(&:underscore).join('~')
|
24
54
|
end
|
@@ -1,15 +1,19 @@
|
|
1
|
-
- layout_name
|
2
|
-
- stylesheet_name
|
3
|
-
- javascript_name
|
1
|
+
- layout_name ||= controller.send(:_layout, []) || 'application' rescue 'application'
|
2
|
+
- stylesheet_name ||= layout_name
|
3
|
+
- javascript_name ||= layout_name
|
4
|
+
- custom_head_cache_key ||= "layouts/#{layout_name}/custom_head"
|
4
5
|
- async = false unless defined?(async) #Rails.env.production?
|
5
6
|
- defer = true unless defined?(defer) #Rails.env.production?
|
6
7
|
= stylesheet_link_tag stylesheet_name, media: "all", async: async, defer: defer
|
7
8
|
= javascript_include_tag javascript_name, async: async, defer: defer
|
8
9
|
/[if lt IE 9]
|
9
10
|
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js", async: async, defer: defer
|
10
|
-
|
11
|
-
|
11
|
+
|
12
|
+
== hancock_settings "custom_head", ns: "#{layout_name}_layout", default: '', kind: :code, label: "Дополнительный код в head"
|
13
|
+
|
14
|
+
- cache custom_head_cache_key, skip_digest: true do
|
15
|
+
- _cache_keys = [custom_head_cache_key]
|
12
16
|
css:
|
13
|
-
#{{Settings.ns("#{layout_name}_layout").custom_css(default: '', kind: :css, label: "Дополнительный CSS", cache_keys:
|
17
|
+
#{{Settings.ns("#{layout_name}_layout").custom_css(default: '', kind: :css, label: "Дополнительный CSS", cache_keys: _cache_keys)}}
|
14
18
|
javascript:
|
15
|
-
#{{Settings.ns("#{layout_name}_layout").custom_js(default: '', kind: :js, label: "Дополнительный JS", cache_keys:
|
19
|
+
#{{Settings.ns("#{layout_name}_layout").custom_js(default: '', kind: :js, label: "Дополнительный JS", cache_keys: _cache_keys)}}
|
@@ -8,9 +8,9 @@ html lang="ru"
|
|
8
8
|
= csrf_meta_tags
|
9
9
|
|
10
10
|
/ - cache 'favicons', skip_digest: true do
|
11
|
-
/ = render partial: 'blocks/favicon'
|
11
|
+
/ = render partial: 'blocks/favicon'
|
12
12
|
|
13
|
-
= render partial: 'assets'
|
13
|
+
= render partial: 'hancock/assets'
|
14
14
|
|
15
15
|
body{class="application_layout #{controller_name} #{action_name} #{controller_name}_#{action_name}"}
|
16
16
|
|
@@ -0,0 +1,125 @@
|
|
1
|
+
ruby:
|
2
|
+
preloader_style = []
|
3
|
+
preloader_style << "position: fixed"
|
4
|
+
preloader_style << "left: 0px"
|
5
|
+
preloader_style << "top: 0px"
|
6
|
+
preloader_style << "right: 0px"
|
7
|
+
preloader_style << "bottom: 0px"
|
8
|
+
preloader_style << "z-index: 9999"
|
9
|
+
preloader_style << "overflow: visible"
|
10
|
+
preloader_style << "background: #e53935 no-repeat center center"
|
11
|
+
|
12
|
+
spinner_style = []
|
13
|
+
spinner_style << "width: 60px"
|
14
|
+
spinner_style << "height: 60px"
|
15
|
+
spinner_style << "top: 50%"
|
16
|
+
spinner_style << "margin-top: -20px"
|
17
|
+
spinner_style << "left: 50%"
|
18
|
+
spinner_style << "margin-left: -20px"
|
19
|
+
spinner_style << "position: relative"
|
20
|
+
# spinner_style << "-webkit-animation: rotate 2.0s infinite linear"
|
21
|
+
# spinner_style << "animation: rotate 2.0s infinite linear"
|
22
|
+
|
23
|
+
circle1_style = []
|
24
|
+
circle1_style << "background-color: #FF8682"
|
25
|
+
circle1_style << "width: 20px"
|
26
|
+
circle1_style << "height: 20px"
|
27
|
+
circle1_style << "position: absolute"
|
28
|
+
circle1_style << "top: 20px"
|
29
|
+
circle1_style << "left: 20px"
|
30
|
+
circle1_style << "border-radius: 50%"
|
31
|
+
circle1_style << "-webkit-border-radius: 50%"
|
32
|
+
circle1_style << "-moz-border-radius: 50%"
|
33
|
+
circle1_style << "-webkit-animation: circlebounce 1.8s infinite ease-in-out"
|
34
|
+
circle1_style << "animation: circlebounce 1.8s infinite ease-in-out"
|
35
|
+
|
36
|
+
circle2_style = []
|
37
|
+
circle2_style << "background-color: #FFB8B4"
|
38
|
+
circle2_style << "width: 20px"
|
39
|
+
circle2_style << "height: 20px"
|
40
|
+
circle2_style << "position: absolute"
|
41
|
+
circle2_style << "top: 20px"
|
42
|
+
circle2_style << "left: 20px"
|
43
|
+
circle2_style << "border-radius: 50%"
|
44
|
+
circle2_style << "-webkit-border-radius: 50%"
|
45
|
+
circle2_style << "-moz-border-radius: 50%"
|
46
|
+
circle2_style << "-webkit-animation: circlebounce2 1.8s infinite ease-in-out"
|
47
|
+
circle2_style << "animation: circlebounce2 1.8s infinite ease-in-out"
|
48
|
+
|
49
|
+
#preloader{style="#{preloader_style.join(";")}"}
|
50
|
+
.spinner{style="#{spinner_style.join(";")}"}
|
51
|
+
.circle1{style="#{circle1_style.join(";")}"}
|
52
|
+
.circle2{style="#{circle2_style.join(";")}"}
|
53
|
+
|
54
|
+
css:
|
55
|
+
@-webkit-keyframes circlebounce {
|
56
|
+
0% {
|
57
|
+
-webkit-transform: scale(0);
|
58
|
+
}
|
59
|
+
25% {
|
60
|
+
z-index: 2;
|
61
|
+
}
|
62
|
+
50% {
|
63
|
+
-webkit-transform: scale(2);
|
64
|
+
}
|
65
|
+
75% {
|
66
|
+
z-index: 1;
|
67
|
+
}
|
68
|
+
100% {
|
69
|
+
-webkit-transform: scale(0);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
@keyframes circlebounce {
|
74
|
+
0% {
|
75
|
+
-webkit-transform: scale(0);
|
76
|
+
}
|
77
|
+
25% {
|
78
|
+
z-index: 2;
|
79
|
+
}
|
80
|
+
50% {
|
81
|
+
-webkit-transform: scale(2);
|
82
|
+
}
|
83
|
+
75% {
|
84
|
+
z-index: 1;
|
85
|
+
}
|
86
|
+
100% {
|
87
|
+
-webkit-transform: scale(0);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
@-webkit-keyframes circlebounce2 {
|
92
|
+
0% {
|
93
|
+
-webkit-transform: scale(2);
|
94
|
+
}
|
95
|
+
25% {
|
96
|
+
z-index: 1;
|
97
|
+
}
|
98
|
+
50% {
|
99
|
+
-webkit-transform: scale(0);
|
100
|
+
}
|
101
|
+
75% {
|
102
|
+
z-index: 2;
|
103
|
+
}
|
104
|
+
100% {
|
105
|
+
-webkit-transform: scale(2);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
@keyframes circlebounce2 {
|
110
|
+
0% {
|
111
|
+
-webkit-transform: scale(2);
|
112
|
+
}
|
113
|
+
25% {
|
114
|
+
z-index: 1;
|
115
|
+
}
|
116
|
+
50% {
|
117
|
+
-webkit-transform: scale(0);
|
118
|
+
}
|
119
|
+
75% {
|
120
|
+
z-index: 2;
|
121
|
+
}
|
122
|
+
100% {
|
123
|
+
-webkit-transform: scale(2);
|
124
|
+
}
|
125
|
+
}
|
@@ -13,7 +13,8 @@
|
|
13
13
|
RailsAdmin.I18n.init('#{I18n.locale}', JSON.parse("#{j I18n.t("admin.js").to_json}"))
|
14
14
|
|
15
15
|
%body.rails_admin
|
16
|
-
#loading.label.label-warning
|
16
|
+
#loading.label.label-warning = t('admin.loading')
|
17
|
+
|
17
18
|
%nav.admin-navbar.admin-navbar-fixed.bg-red{:role => "navigation"}
|
18
19
|
= render "layouts/rails_admin/navigation"
|
19
20
|
|
@@ -31,3 +32,5 @@
|
|
31
32
|
|
32
33
|
%footer.admin-footer
|
33
34
|
= render "layouts/rails_admin/footer"
|
35
|
+
|
36
|
+
= render "layouts/rails_admin/preloader"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= form.hidden_field field.method_name, value: "", multiple: true
|
2
|
+
- (field.value || []).each do |val|
|
3
|
+
= render partial: 'rails_admin/main/hancock_array/element', locals: {form: form, field: field, val: val}
|
4
|
+
|
5
|
+
- _template = capture do
|
6
|
+
= render partial: 'rails_admin/main/hancock_array/element', locals: {form: form, field: field, val: ""}
|
7
|
+
p
|
8
|
+
= link_to "добавить", "#", class: "array_element_add_link", data: {template: _template.html_safe}
|
9
|
+
|
@@ -1,9 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
=
|
1
|
+
- case field.editor_type.to_sym
|
2
|
+
- when :default, :standard, :main, :text, :text_area, :textarea, :string
|
3
|
+
ruby:
|
4
|
+
_opts = {}
|
5
|
+
_opts[:rows] = 10
|
6
|
+
_opts[:cols] = 80
|
7
|
+
_opts[:class] = 'form-control'
|
8
|
+
_opts[:value] = field.formatted_value
|
9
|
+
_opts[:style] = "font-family: monospace"
|
10
|
+
|
11
|
+
= form.text_area field.string_method, _opts
|
12
|
+
|
13
|
+
- when :fixed_keys
|
14
|
+
- (field.value || {}).each_pair do |name, val|
|
15
|
+
= render partial: 'rails_admin/main/hancock_hash/fixed_keys', locals: {form: form, field: field, name: name, val: val}
|
16
|
+
|
17
|
+
- _template = capture do
|
18
|
+
- name, val = "new", ""
|
19
|
+
= render partial: 'rails_admin/main/hancock_hash/fixed_keys', locals: {form: form, field: field, name: name, val: val}
|
20
|
+
p
|
21
|
+
= link_to "добавить", "#", class: "hash_element_add_link", data: {template: _template.html_safe}
|
22
|
+
/ = " | "
|
23
|
+
/ = link_to "показать дубликаты", "#", class: "hash_element_duplicate_trigger", data: {text: "скрыть дубликаты"}
|
24
|
+
|
25
|
+
|
26
|
+
- when :full
|
27
|
+
- (field.value || {}).each_pair do |name, val|
|
28
|
+
= render partial: 'rails_admin/main/hancock_hash/full', locals: {form: form, field: field, name: name, val: val}
|
29
|
+
|
30
|
+
- _template = capture do
|
31
|
+
- name, val = "new", ""
|
32
|
+
= render partial: 'rails_admin/main/hancock_hash/full', locals: {form: form, field: field, name: name, val: val}
|
33
|
+
p
|
34
|
+
= link_to "добавить", "#", class: "hash_element_add_link", data: {template: _template.html_safe}
|
35
|
+
/ = " | "
|
36
|
+
/ = link_to "показать дубликаты", "#", class: "hash_element_duplicate_trigger", data: {text: "скрыть дубликаты"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
.array_element_block
|
2
|
+
= form.text_field field.method_name, value: val, multiple: true
|
3
|
+
span= " "
|
4
|
+
= link_to "(удалить)", "#", class: "array_element_delete_link", tabindex: -1
|
5
|
+
span= " "
|
6
|
+
= link_to "/\\", "#", class: "array_element_move_link array_element_move_up_link up", tabindex: -1
|
7
|
+
span= " "
|
8
|
+
= link_to "\\/", "#", class: "array_element_move_link array_element_move_down_link down", tabindex: -1
|
@@ -0,0 +1,8 @@
|
|
1
|
+
.hash_element_block
|
2
|
+
= link_to "(изм)", "#", class: "hash_element_renamer_link", tabindex: -1
|
3
|
+
span= " "
|
4
|
+
= form.label "#{field.method_name}[#{name}]", name
|
5
|
+
span= ": "
|
6
|
+
= form.text_field "#{field.method_name}[#{name}]", value: val, class: 'value_field'
|
7
|
+
span= " "
|
8
|
+
= link_to "(удалить)", "#", class: "hash_element_delete_link", tabindex: -1
|
@@ -0,0 +1,6 @@
|
|
1
|
+
.hash_element_block
|
2
|
+
= form.text_field nil, value: name, class: 'hash_element_key_field', name: ""
|
3
|
+
span= ": "
|
4
|
+
= form.text_field "#{field.method_name}[#{name}]", value: val, class: 'value_field'
|
5
|
+
span= " #{name} "
|
6
|
+
= link_to "(удалить)", "#", class: "hash_element_delete_link", tabindex: -1
|
@@ -30,8 +30,8 @@ if defined?(Mongoid)
|
|
30
30
|
:left_field => 'lft',
|
31
31
|
:right_field => 'rgt',
|
32
32
|
:outline_number_field => nil,
|
33
|
-
:dependent => :
|
34
|
-
:klass => self
|
33
|
+
:dependent => :destroy,
|
34
|
+
:klass => self
|
35
35
|
}.merge(options)
|
36
36
|
|
37
37
|
if options[:scope].is_a?(Symbol) && options[:scope].to_s !~ /_id$/
|
data/hancock_cms.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency 'bundler'
|
21
21
|
spec.add_development_dependency 'rake'
|
22
22
|
|
23
|
-
spec.add_dependency 'rails', ['>= 5.0.0', '<
|
23
|
+
spec.add_dependency 'rails', ['>= 5.0.0', '< 5.1']
|
24
24
|
|
25
25
|
spec.add_dependency 'sprockets', '~> 3.7.1'
|
26
26
|
|
data/lib/hancock/admin.rb
CHANGED
@@ -5,7 +5,7 @@ module Hancock
|
|
5
5
|
is_active, options = (is_active[:active] || false), is_active
|
6
6
|
end
|
7
7
|
fields = (options[:fields] ||= {})
|
8
|
-
field_names = [:
|
8
|
+
field_names = [:address, :map_address, :map_hint, :coordinates, :lat, :lon]
|
9
9
|
field_showings = get_field_showings(fields, field_names)
|
10
10
|
|
11
11
|
Proc.new {
|
@@ -38,7 +38,6 @@ module Hancock
|
|
38
38
|
searchable true
|
39
39
|
end if field_showings[:lon]
|
40
40
|
|
41
|
-
|
42
41
|
Hancock::RailsAdminGroupPatch::hancock_cms_group(self, options[:fields])
|
43
42
|
|
44
43
|
if block_given?
|
data/lib/hancock/model.rb
CHANGED
@@ -4,12 +4,6 @@ module Hancock
|
|
4
4
|
included do
|
5
5
|
Hancock.register_model(self)
|
6
6
|
|
7
|
-
def self.inherited(base)
|
8
|
-
super
|
9
|
-
Hancock.register_model(base)
|
10
|
-
Hancock.register_model(self)
|
11
|
-
end
|
12
|
-
|
13
7
|
if Hancock.mongoid?
|
14
8
|
include Mongoid::Document
|
15
9
|
include Mongoid::Timestamps::Short
|
@@ -45,5 +39,15 @@ module Hancock
|
|
45
39
|
include Hancock::RailsAdminPatch
|
46
40
|
end
|
47
41
|
|
42
|
+
|
43
|
+
class_methods do
|
44
|
+
|
45
|
+
def inherited(base)
|
46
|
+
Hancock.register_model(base)
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
48
52
|
end
|
49
53
|
end
|
@@ -8,6 +8,10 @@ module RailsAdmin
|
|
8
8
|
# Register field type for the type loader
|
9
9
|
RailsAdmin::Config::Fields::Types.register(self)
|
10
10
|
|
11
|
+
register_instance_option :partial do
|
12
|
+
enum.blank? ? :hancock_array : :form_hancock_enum_with_custom
|
13
|
+
end
|
14
|
+
|
11
15
|
register_instance_option :multiple do
|
12
16
|
true
|
13
17
|
end
|
@@ -12,18 +12,29 @@ module RailsAdmin
|
|
12
12
|
true
|
13
13
|
end
|
14
14
|
register_instance_option :searchable_columns do
|
15
|
-
|
15
|
+
if enum_method
|
16
|
+
[{column: "#{abstract_model.table_name}.#{enum_method}" , type: :string}]
|
17
|
+
else
|
18
|
+
[]
|
19
|
+
end
|
16
20
|
end
|
17
21
|
register_instance_option :queryable do
|
18
22
|
true
|
19
23
|
end
|
20
24
|
|
25
|
+
register_instance_option :enum_method do
|
26
|
+
if bindings and (_obj = bindings[:object])
|
27
|
+
_class = _obj.class
|
28
|
+
@enum_method ||= _class.respond_to?("#{name}_enum") || _obj.respond_to?("#{name}_enum") ? "#{name}_enum" : name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
21
32
|
register_instance_option :partial do
|
22
33
|
:form_hancock_enum
|
23
34
|
end
|
24
35
|
|
25
36
|
register_instance_option :help do
|
26
|
-
'Двойной клик перемещает между списками'
|
37
|
+
'Двойной клик перемещает между списками' if multiple
|
27
38
|
end
|
28
39
|
|
29
40
|
end
|
@@ -10,12 +10,21 @@ module RailsAdmin
|
|
10
10
|
RailsAdmin::Config::Fields::Types::register(self)
|
11
11
|
include RailsAdmin::Engine.routes.url_helpers
|
12
12
|
|
13
|
+
register_instance_option :editor_type do
|
14
|
+
:default
|
15
|
+
end
|
16
|
+
|
13
17
|
register_instance_option :string_method do
|
14
18
|
"#{name}_str"
|
15
19
|
end
|
16
20
|
|
17
21
|
register_instance_option :hash_method do
|
18
|
-
|
22
|
+
case editor_type
|
23
|
+
when :default, :standard, :main, :text, :text_area, :textarea, :string
|
24
|
+
"#{name}_hash"
|
25
|
+
else
|
26
|
+
name
|
27
|
+
end
|
19
28
|
end
|
20
29
|
|
21
30
|
register_instance_option :value do
|
@@ -36,7 +45,13 @@ module RailsAdmin
|
|
36
45
|
|
37
46
|
############ localize ######################
|
38
47
|
register_instance_option :translations_field do
|
39
|
-
|
48
|
+
case editor_type
|
49
|
+
when :default, :standard, :main, :text, :text_area, :textarea, :string
|
50
|
+
(string_method.to_s + '_translations').to_sym
|
51
|
+
else
|
52
|
+
(name.to_s + '_translations').to_sym
|
53
|
+
end
|
54
|
+
|
40
55
|
end
|
41
56
|
|
42
57
|
register_instance_option :localized? do
|
@@ -62,23 +77,42 @@ module RailsAdmin
|
|
62
77
|
register_instance_option :formatted_value do
|
63
78
|
if localized?
|
64
79
|
_val = bindings[:object].send((hash_method.to_s + '_translations').to_sym)
|
65
|
-
|
80
|
+
|
81
|
+
case editor_type
|
82
|
+
when :default, :standard, :main, :text, :text_area, :textarea, :string
|
83
|
+
_val.each_pair { |l, _hash|
|
84
|
+
begin
|
85
|
+
_val[l] = JSON.pretty_generate(_hash)
|
86
|
+
rescue
|
87
|
+
end
|
88
|
+
}
|
89
|
+
else
|
90
|
+
_val
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
else
|
95
|
+
case editor_type
|
96
|
+
when :default, :standard, :main, :text, :text_area, :textarea, :string
|
66
97
|
begin
|
67
|
-
|
98
|
+
JSON.pretty_generate(bindings[:object].send hash_method)
|
68
99
|
rescue
|
100
|
+
bindings[:object].send hash_method
|
69
101
|
end
|
70
|
-
|
71
|
-
else
|
72
|
-
begin
|
73
|
-
JSON.pretty_generate(bindings[:object].send hash_method)
|
74
|
-
rescue
|
102
|
+
else
|
75
103
|
bindings[:object].send hash_method
|
76
104
|
end
|
77
105
|
end
|
78
106
|
end
|
79
107
|
|
80
108
|
register_instance_option :allowed_methods do
|
81
|
-
|
109
|
+
case editor_type
|
110
|
+
when :default, :standard, :main, :text, :text_area, :textarea, :string
|
111
|
+
localized? ? [string_method, translations_field] : [string_method]
|
112
|
+
else
|
113
|
+
localized? ? [hash_method, translations_field] : [hash_method]
|
114
|
+
end
|
115
|
+
|
82
116
|
end
|
83
117
|
|
84
118
|
register_instance_option :partial do
|
@@ -3,40 +3,49 @@ module Hancock::RailsAdminGroupPatch
|
|
3
3
|
class << self
|
4
4
|
def hancock_cms_group(config, fields = {})
|
5
5
|
return unless fields
|
6
|
+
if fields.is_a?(Proc)
|
7
|
+
return config.group :default, &fields
|
8
|
+
end
|
6
9
|
|
7
10
|
if fields.is_a?(Array)
|
8
11
|
fields.reject { |f| f.empty? }.each do |_group|
|
9
12
|
_name_default = :default
|
10
|
-
_name = _group.delete(:name) || _name_default
|
13
|
+
_name = _group.delete(:name) || _group.delete(:group) || _name_default
|
11
14
|
_active_default = _name == :default
|
12
15
|
_group[:active] ||= _active_default
|
13
16
|
_fields_default = {}
|
14
17
|
_group_fields = (_group.delete(:fields) || _fields_default)
|
15
18
|
|
16
|
-
|
17
|
-
|
19
|
+
if _group_fields.is_a?(Proc)
|
20
|
+
config.group _name, &_group_fields
|
21
|
+
|
22
|
+
else
|
23
|
+
config.group _name do
|
24
|
+
_group.each_pair do |name, val|
|
18
25
|
|
19
|
-
|
20
|
-
begin
|
26
|
+
# TODO: find more logical solution
|
21
27
|
begin
|
22
|
-
|
23
|
-
|
24
|
-
|
28
|
+
begin
|
29
|
+
send name, val
|
30
|
+
rescue
|
31
|
+
send name
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
|
-
end
|
28
35
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
if type.is_a?(Array)
|
35
|
-
field name, type[0], &type[1]
|
36
|
+
_group_fields.each_pair do |name, type|
|
37
|
+
next if type == false
|
38
|
+
if type.blank?
|
39
|
+
field name
|
36
40
|
else
|
37
|
-
|
41
|
+
if type.is_a?(Array)
|
42
|
+
field name, type[0], &type[1]
|
43
|
+
else
|
44
|
+
field name, type
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
48
|
+
|
40
49
|
end
|
41
50
|
|
42
51
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails_admin/config/sections/list'
|
2
|
+
module RailsAdmin
|
3
|
+
module Config
|
4
|
+
module Sections
|
5
|
+
# Configuration of the list view
|
6
|
+
class List < RailsAdmin::Config::Sections::Base
|
7
|
+
|
8
|
+
register_instance_option :sort_by do
|
9
|
+
# _fields = parent.abstract_model.model.fields.keys
|
10
|
+
# ret = :order if _fields.include?(:order)
|
11
|
+
# ret ||= :lft if _fields.include?(:lft)
|
12
|
+
# # ret ||= :counter if _fields.include?(:counter)
|
13
|
+
# ret ||= parent.abstract_model.primary_key
|
14
|
+
# ret
|
15
|
+
end
|
16
|
+
|
17
|
+
register_instance_option :sort_reverse? do
|
18
|
+
true # By default show latest first
|
19
|
+
end
|
20
|
+
|
21
|
+
register_instance_option :scopes do
|
22
|
+
_model_scopes = parent.abstract_model.model.scopes.keys
|
23
|
+
_possible_scopes = [:sorted, :by_date, :enabled]
|
24
|
+
(_possible_scopes & _model_scopes ) + [nil]
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -25,6 +25,23 @@ module Hancock
|
|
25
25
|
self.for_admin
|
26
26
|
end
|
27
27
|
|
28
|
+
def val
|
29
|
+
((upload_kind? and !file.blank?) ? file.url : value)
|
30
|
+
end
|
31
|
+
def value
|
32
|
+
((upload_kind? and !file.blank?) ? file.url : super)
|
33
|
+
end
|
34
|
+
def processed_value
|
35
|
+
((upload_kind? and !file.blank?) ? file.url : super)
|
36
|
+
end
|
37
|
+
def blank?
|
38
|
+
if upload_kind?
|
39
|
+
file.blank?
|
40
|
+
else
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
28
45
|
# def self.manager_can_default_actions
|
29
46
|
# # [:index, :show, :read, :edit, :update]
|
30
47
|
# super - [:new, :create]
|
@@ -217,3 +234,35 @@ module Hancock
|
|
217
234
|
|
218
235
|
end
|
219
236
|
end
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
class ::Settings
|
241
|
+
|
242
|
+
def self.exists?(key)
|
243
|
+
!getnc(key).nil?
|
244
|
+
end
|
245
|
+
def self.enabled?(key)
|
246
|
+
getnc(key).enabled?
|
247
|
+
end
|
248
|
+
def self.rename(old_key, new_key)
|
249
|
+
get_default_ns.rename(old_key, new_key)
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
class ::RailsAdminSettings::Namespaced
|
254
|
+
|
255
|
+
def exists?(key)
|
256
|
+
!getnc(key).nil?
|
257
|
+
end
|
258
|
+
def enabled?(key)
|
259
|
+
getnc(key).enabled?
|
260
|
+
end
|
261
|
+
def rename(old_key, new_key)
|
262
|
+
_obj = getnc(old_key)
|
263
|
+
if _obj
|
264
|
+
_obj.key = new_key
|
265
|
+
_obj.save
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
data/lib/hancock/version.rb
CHANGED
data/lib/hancock_cms.rb
CHANGED
@@ -31,6 +31,7 @@ require 'hancock/rails_admin_ext/hancock_html'
|
|
31
31
|
require 'hancock/rails_admin_ext/hancock_slugs'
|
32
32
|
require 'hancock/rails_admin_ext/hancock_multiselect'
|
33
33
|
|
34
|
+
require 'hancock/rails_admin_ext/patches/lazy_model'
|
34
35
|
require 'hancock/rails_admin_ext/patches/navigation_patch'
|
35
36
|
require 'hancock/rails_admin_ext/patches/field_patch'
|
36
37
|
require 'hancock/rails_admin_ext/patches/fieldset_patch'
|
@@ -38,6 +39,7 @@ require 'hancock/rails_admin_ext/patches/new_controller_patch'
|
|
38
39
|
require 'hancock/rails_admin_ext/patches/group_patch'
|
39
40
|
require 'hancock/rails_admin_ext/patches/hancock_cms_group'
|
40
41
|
require 'hancock/rails_admin_ext/patches/has_fields'
|
42
|
+
require 'hancock/rails_admin_ext/patches/section_list_patch'
|
41
43
|
|
42
44
|
|
43
45
|
require 'rails_admin_nested_set'
|
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: 2.0.1.
|
4
|
+
version: 2.0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: 5.0.0
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '5.1'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: 5.0.0
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '5.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: sprockets
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -324,6 +324,8 @@ files:
|
|
324
324
|
- app/assets/javascripts/hancock/rails_admin/en_ru_switcher.coffee
|
325
325
|
- app/assets/javascripts/hancock/rails_admin/enum_with_custom.coffee
|
326
326
|
- app/assets/javascripts/hancock/rails_admin/form_controls_fixed.coffee
|
327
|
+
- app/assets/javascripts/hancock/rails_admin/hancock_array.coffee
|
328
|
+
- app/assets/javascripts/hancock/rails_admin/hancock_hash.coffee
|
327
329
|
- app/assets/javascripts/hancock/rails_admin/leftside_hider.coffee
|
328
330
|
- app/assets/javascripts/hancock/rails_admin/multiselect.coffee
|
329
331
|
- app/assets/javascripts/hancock/rails_admin/navigation_dropdown.coffee
|
@@ -342,7 +344,10 @@ files:
|
|
342
344
|
- app/assets/stylesheets/hancock/rails_admin/cms.theming.sass
|
343
345
|
- app/assets/stylesheets/hancock/rails_admin/custom/theming.sass
|
344
346
|
- app/assets/stylesheets/hancock/rails_admin/fieldsets.sass
|
347
|
+
- app/assets/stylesheets/hancock/rails_admin/hancock_hash.sass
|
345
348
|
- app/assets/stylesheets/hancock/rails_admin/plugins.sass.erb
|
349
|
+
- app/assets/stylesheets/hancock/rails_admin/settings.sass
|
350
|
+
- app/assets/stylesheets/hancock/rails_admin/tables.sass
|
346
351
|
- app/assets/stylesheets/hancock/toplink/toplink.sass
|
347
352
|
- app/assets/stylesheets/rails_admin/custom/theming.sass
|
348
353
|
- app/controllers/concerns/hancock/current_user.rb
|
@@ -387,6 +392,7 @@ files:
|
|
387
392
|
- app/views/devise/registrations/new.html.slim
|
388
393
|
- app/views/devise/sessions/new.html.slim
|
389
394
|
- app/views/devise/shared/_links.html.slim
|
395
|
+
- app/views/hancock/_assets.html.slim
|
390
396
|
- app/views/hancock/errors/_base.html.slim
|
391
397
|
- app/views/hancock/errors/error_403.html.slim
|
392
398
|
- app/views/hancock/errors/error_404.html.slim
|
@@ -395,7 +401,6 @@ files:
|
|
395
401
|
- app/views/hancock/simple_captcha/_simple_captcha.html.slim
|
396
402
|
- app/views/hancock/toplink/_toplink.html.slim
|
397
403
|
- app/views/layouts/application.html.slim
|
398
|
-
- app/views/layouts/hancock/_assets.html.slim
|
399
404
|
- app/views/layouts/hancock/devise/confirmations.html.slim
|
400
405
|
- app/views/layouts/hancock/devise/passwords.html.slim
|
401
406
|
- app/views/layouts/hancock/devise/registrations.html.slim
|
@@ -404,6 +409,7 @@ files:
|
|
404
409
|
- app/views/layouts/rails_admin/_footer.html.slim
|
405
410
|
- app/views/layouts/rails_admin/_footer_navigation.html.slim
|
406
411
|
- app/views/layouts/rails_admin/_navigation.html.slim
|
412
|
+
- app/views/layouts/rails_admin/_preloader.html.slim
|
407
413
|
- app/views/layouts/rails_admin/_secondary_navigation.html.slim
|
408
414
|
- app/views/layouts/rails_admin/_sidebar_navigation.html.slim
|
409
415
|
- app/views/layouts/rails_admin/_sidebar_navigation_filter.html.slim
|
@@ -417,11 +423,15 @@ files:
|
|
417
423
|
- app/views/rails_admin/main/_form_hancock_enum_with_custom.slim
|
418
424
|
- app/views/rails_admin/main/_form_hancock_multiselect.html.slim
|
419
425
|
- app/views/rails_admin/main/_form_raw.html.slim
|
426
|
+
- app/views/rails_admin/main/_hancock_array.html.slim
|
420
427
|
- app/views/rails_admin/main/_hancock_hash.html.slim
|
421
428
|
- app/views/rails_admin/main/_hancock_hash_ml.html.slim
|
422
429
|
- app/views/rails_admin/main/_hancock_html.html.slim
|
423
430
|
- app/views/rails_admin/main/_hancock_html_ml.html.slim
|
424
431
|
- app/views/rails_admin/main/edit.html.haml
|
432
|
+
- app/views/rails_admin/main/hancock_array/_element.html.slim
|
433
|
+
- app/views/rails_admin/main/hancock_hash/_fixed_keys.html.slim
|
434
|
+
- app/views/rails_admin/main/hancock_hash/_full.html.slim
|
425
435
|
- app/views/rails_admin/main/new.html.haml
|
426
436
|
- app/views/shared/_admin_link.html.slim
|
427
437
|
- app/views/shared/_messages.html.slim
|
@@ -509,8 +519,10 @@ files:
|
|
509
519
|
- lib/hancock/rails_admin_ext/patches/group_patch.rb
|
510
520
|
- lib/hancock/rails_admin_ext/patches/hancock_cms_group.rb
|
511
521
|
- lib/hancock/rails_admin_ext/patches/has_fields.rb
|
522
|
+
- lib/hancock/rails_admin_ext/patches/lazy_model.rb
|
512
523
|
- lib/hancock/rails_admin_ext/patches/navigation_patch.rb
|
513
524
|
- lib/hancock/rails_admin_ext/patches/new_controller_patch.rb
|
525
|
+
- lib/hancock/rails_admin_ext/patches/section_list_patch.rb
|
514
526
|
- lib/hancock/rails_admin_settings_patch.rb
|
515
527
|
- lib/hancock/routes.rb
|
516
528
|
- lib/hancock/simple_form_patch.rb
|