express_admin 1.6.3 → 1.6.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/app/components/express_admin/command_button.rb +39 -36
- data/app/components/express_admin/command_button_list.rb +25 -21
- data/app/components/express_admin/definition_list.rb +54 -50
- data/app/components/express_admin/definition_table.rb +16 -12
- data/app/components/express_admin/icon.rb +13 -8
- data/app/components/express_admin/icon_link.rb +42 -37
- data/app/components/express_admin/layout_component.rb +4 -0
- data/app/components/express_admin/layout_components/h_box.rb +5 -1
- data/app/components/express_admin/layout_components/pane.rb +24 -19
- data/app/components/express_admin/layout_components/sidebar_region.rb +5 -1
- data/app/components/express_admin/layout_components/v_box.rb +5 -1
- data/app/components/express_admin/main_region.rb +5 -1
- data/app/components/express_admin/page_header.rb +15 -11
- data/app/components/express_admin/smart_form.rb +106 -102
- data/app/components/express_admin/smart_table.rb +177 -165
- data/app/helpers/express_admin/admin_helper.rb +8 -0
- data/lib/express_admin/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/vendor/gems/express_templates/Gemfile.lock +7 -1
- data/vendor/gems/express_templates/express_templates-0.11.2.gem +0 -0
- data/vendor/gems/express_templates/express_templates.gemspec +2 -0
- data/vendor/gems/express_templates/lib/express_templates/components/all.rb +17 -15
- data/vendor/gems/express_templates/lib/express_templates/components/forms.rb +1 -0
- data/vendor/gems/express_templates/lib/express_templates/components/forms/country_select.rb +23 -0
- data/vendor/gems/express_templates/lib/express_templates/components/tree_for.rb +72 -70
- data/vendor/gems/express_templates/lib/express_templates/template/handler.rb +3 -2
- data/vendor/gems/express_templates/lib/express_templates/version.rb +1 -1
- data/vendor/gems/express_templates/test/components/forms/country_select_test.rb +34 -0
- data/vendor/gems/express_templates/test/dummy/log/test.log +654 -0
- data/vendor/gems/express_templates/test/test_helper.rb +1 -1
- metadata +5 -4
- data/vendor/gems/express_templates/express_templates-0.11.0.gem +0 -0
- data/vendor/gems/express_templates/express_templates-0.11.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a43f56f4e0dadb43337d599139a3c886d8c5800a
|
4
|
+
data.tar.gz: 9797b798d4717832c64ec0679d6b6dc0415d942e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3dfd3f8c023ad92b0a13e20dd47bf006c8eeea331abb057e4f1a45acd54ee62af9ca2aa0d1a7ce4775f62292e4519d53a122e8fce736ab881cb80fd1d0e585e
|
7
|
+
data.tar.gz: 17d6d0a62dbfc2dfa99314d46f0aedd77fbaf38b042a5fdb3769b673a99815da03aca1906da7a15bbd38d520b9c76ab8541b5f4e9dcf4d9121fc398195dc96e9
|
@@ -1,42 +1,45 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
2
|
+
module Components
|
3
|
+
module Navigation
|
4
|
+
class CommandButton < ExpressTemplates::Components::Configurable
|
5
|
+
include ExpressTemplates::Components::Capabilities::Resourceful
|
6
|
+
|
7
|
+
|
8
|
+
has_argument :id, "The command name. Invoked as an action on the resource.", as: :command, type: :symbol
|
9
|
+
has_option :disabled, "Disables the button", type: :boolean
|
10
|
+
has_option :confirm, "Prompt with the question specified."
|
11
|
+
has_option :resource_name, "The name of the resource for this command. Eg. 'person' for like_person_path()"
|
12
|
+
|
13
|
+
before_build -> {
|
14
|
+
config[:command] = config[:command].debang
|
15
|
+
add_class(config[:command])
|
16
|
+
}
|
17
|
+
|
18
|
+
contains -> {
|
19
|
+
button_to config[:command].to_s.titleize, action, button_to_options
|
20
|
+
}
|
21
|
+
|
22
|
+
def resource_name
|
23
|
+
config[:resource_name] || parent_command_button_list.resource_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def button_to_options
|
27
|
+
{remote: true, disabled: config[:disabled], confirm: config[:confirm]}
|
28
|
+
end
|
29
|
+
|
30
|
+
def action
|
31
|
+
helpers.send "#{config[:command]}_#{resource_path_helper}", resource.to_param
|
32
|
+
end
|
33
|
+
|
34
|
+
def parent_command_button_list
|
35
|
+
@parent_button_list ||= parent
|
36
|
+
until @parent_button_list.nil? || @parent_button_list.kind_of?(CommandButtonList)
|
37
|
+
@parent_button_list = @parent_button_list.parent
|
38
|
+
end
|
39
|
+
return @parent_button_list
|
40
|
+
end
|
36
41
|
end
|
37
|
-
return @parent_button_list
|
38
42
|
end
|
39
43
|
|
40
|
-
|
41
44
|
end
|
42
45
|
end
|
@@ -1,32 +1,36 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
3
|
-
|
2
|
+
module Components
|
3
|
+
module Navigation
|
4
|
+
class CommandButtonList < ExpressTemplates::Components::Configurable
|
5
|
+
include ExpressTemplates::Components::Capabilities::Resourceful
|
4
6
|
|
5
|
-
|
7
|
+
tag :ul
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
has_argument :id, "The name of the resource for this command. Eg. 'person' for like_person_path()", as: :resource_name, type: :symbol
|
10
|
+
# has_option :exclude, "Exclude some buttons"
|
11
|
+
# has_option :only, "only some buttons"
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
contains -> {
|
14
|
+
commands.each do |command|
|
15
|
+
li {
|
16
|
+
command_button(command, disabled: !available?(command))
|
17
|
+
}
|
18
|
+
end
|
15
19
|
}
|
16
|
-
end
|
17
|
-
}
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
def resource_name
|
22
|
+
config[:resource_name]
|
23
|
+
end
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
def available?(command)
|
26
|
+
resource.available_commands.include?(command)
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
def commands
|
30
|
+
resource.commands
|
31
|
+
end
|
30
32
|
|
33
|
+
end
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
@@ -1,58 +1,62 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
2
|
+
module Components
|
3
|
+
module Presenters
|
4
|
+
class DefinitionList < ExpressTemplates::Components::Configurable
|
5
|
+
include ExpressTemplates::Components::Capabilities::Resourceful
|
6
|
+
|
7
|
+
tag :dl
|
8
|
+
|
9
|
+
list_types = {}
|
10
|
+
list_types[:array] = {description: "List of fields on the current resource",
|
11
|
+
options: -> {resource.columns.map(&:name)}}
|
12
|
+
list_types[:hash] = {description: "List of terms and definitions."}
|
13
|
+
|
14
|
+
has_argument :list, "A list of things to define, presented as <label>: <definition>.",
|
15
|
+
as: :list, type: list_types
|
16
|
+
|
17
|
+
contains -> {
|
18
|
+
definitions.each do |label, content|
|
19
|
+
dt { label }
|
20
|
+
dd { content }
|
21
|
+
end
|
22
|
+
}
|
23
|
+
|
24
|
+
def definitions
|
25
|
+
if config[:list].kind_of?(Array)
|
26
|
+
definitions_from_array(config[:list])
|
27
|
+
elsif config[:list].kind_of?(Hash)
|
28
|
+
definitions_from_hash(config[:list])
|
29
|
+
end
|
30
|
+
end
|
21
31
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
32
|
+
def definitions_from_hash(hash)
|
33
|
+
processed = hash.map do |k,v|
|
34
|
+
value = if v.kind_of? Symbol
|
35
|
+
resource.send(v)
|
36
|
+
elsif v.respond_to?(:call)
|
37
|
+
v.call(resource).html_safe
|
38
|
+
else
|
39
|
+
v
|
40
|
+
end
|
41
|
+
[promptify(k), value]
|
42
|
+
end
|
43
|
+
Hash[processed]
|
44
|
+
end
|
29
45
|
|
30
|
-
|
31
|
-
|
32
|
-
value = if v.kind_of? Symbol
|
33
|
-
resource.send(v)
|
34
|
-
elsif v.respond_to?(:call)
|
35
|
-
v.call(resource).html_safe
|
36
|
-
else
|
37
|
-
v
|
46
|
+
def definitions_from_array(fields)
|
47
|
+
Hash[fields.map {|field| ["#{field.to_s.titleize}:", "{{resource.#{field}}}"]}]
|
38
48
|
end
|
39
|
-
[promptify(k), value]
|
40
|
-
end
|
41
|
-
Hash[processed]
|
42
|
-
end
|
43
49
|
|
44
|
-
|
45
|
-
|
46
|
-
|
50
|
+
private
|
51
|
+
def promptify(k)
|
52
|
+
if k.kind_of?(Symbol)
|
53
|
+
k.to_s.promptify
|
54
|
+
else
|
55
|
+
k.to_s
|
56
|
+
end
|
57
|
+
end
|
47
58
|
|
48
|
-
private
|
49
|
-
def promptify(k)
|
50
|
-
if k.kind_of?(Symbol)
|
51
|
-
k.to_s.promptify
|
52
|
-
else
|
53
|
-
k.to_s
|
54
|
-
end
|
55
59
|
end
|
56
|
-
|
60
|
+
end
|
57
61
|
end
|
58
|
-
end
|
62
|
+
end
|
@@ -1,19 +1,23 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
3
|
-
|
2
|
+
module Components
|
3
|
+
module Presenters
|
4
|
+
class DefinitionTable < DefinitionList
|
5
|
+
include ExpressTemplates::Components::Capabilities::Resourceful
|
4
6
|
|
5
|
-
|
7
|
+
tag :table
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
contains -> {
|
10
|
+
tbody {
|
11
|
+
definitions.each do |label, content|
|
12
|
+
tr {
|
13
|
+
th(align: "right") { label }
|
14
|
+
td { content }
|
15
|
+
}
|
16
|
+
end
|
13
17
|
}
|
14
|
-
|
15
|
-
}
|
16
|
-
}
|
18
|
+
}
|
17
19
|
|
20
|
+
end
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
@@ -1,14 +1,19 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
2
|
+
module Components
|
3
|
+
module Navigation
|
3
4
|
|
4
|
-
|
5
|
+
class Icon < ExpressTemplates::Components::Configurable
|
5
6
|
|
6
|
-
|
7
|
-
as: :name,
|
8
|
-
type: [:symbol, :string]
|
7
|
+
tag :i
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
has_argument :id, "The name of the ionic icon withouth the ion- prefix. See http://ionicons.com/cheatsheet.html",
|
10
|
+
as: :name,
|
11
|
+
type: [:symbol, :string]
|
12
|
+
|
13
|
+
before_build {
|
14
|
+
add_class("ion-#{config[:name]}")
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
@@ -1,41 +1,46 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
has_option :href, "Link path, URL or anchor.",
|
15
|
-
default: '#', attribute: true
|
16
|
-
has_option :title, "Title text for accessibility; appears on mouse hover.",
|
17
|
-
attribute: true
|
18
|
-
has_option :confirm, "Should trigger a confirm message.",
|
19
|
-
type: :boolean
|
20
|
-
has_option :delete, "Should perform a delete action.",
|
21
|
-
type: :boolean
|
22
|
-
has_option :target, "The link target attribute. Set to open in a new window or tab.",
|
23
|
-
attribute: true
|
24
|
-
|
25
|
-
before_build -> {
|
26
|
-
set_attribute 'data-delete', config[:delete] if config[:delete]
|
27
|
-
set_attribute 'data-confirm', config[:confirm] if config[:confirm]
|
28
|
-
}
|
29
|
-
|
30
|
-
contains -> {
|
31
|
-
if config[:right]
|
32
|
-
text_node config[:text]
|
33
|
-
icon(config[:icon_name].to_sym)
|
34
|
-
else
|
35
|
-
icon(config[:icon_name].to_sym)
|
36
|
-
text_node config[:text]
|
37
|
-
end
|
38
|
-
}
|
2
|
+
module Components
|
3
|
+
module Navigation
|
4
|
+
|
5
|
+
class IconLink < ExpressTemplates::Components::Configurable
|
6
|
+
|
7
|
+
tag :a
|
8
|
+
|
9
|
+
has_argument :id, "The name of the ionic icon withouth the ion- prefix. See http://ionicons.com/cheatsheet.html",
|
10
|
+
as: :icon_name,
|
11
|
+
type: [:symbol, :string]
|
12
|
+
|
13
|
+
has_option :text, "Link text to accompany the icon."
|
39
14
|
|
15
|
+
has_option :right, "Aligns the icon to the right of the text.",
|
16
|
+
default: false
|
17
|
+
has_option :href, "Link path, URL or anchor.",
|
18
|
+
default: '#', attribute: true
|
19
|
+
has_option :title, "Title text for accessibility; appears on mouse hover.",
|
20
|
+
attribute: true
|
21
|
+
has_option :confirm, "Should trigger a confirm message.",
|
22
|
+
type: :boolean
|
23
|
+
has_option :delete, "Should perform a delete action.",
|
24
|
+
type: :boolean
|
25
|
+
has_option :target, "The link target attribute. Set to open in a new window or tab.",
|
26
|
+
attribute: true
|
27
|
+
|
28
|
+
before_build -> {
|
29
|
+
set_attribute 'data-delete', config[:delete] if config[:delete]
|
30
|
+
set_attribute 'data-confirm', config[:confirm] if config[:confirm]
|
31
|
+
}
|
32
|
+
|
33
|
+
contains -> {
|
34
|
+
if config[:right]
|
35
|
+
text_node config[:text]
|
36
|
+
icon(config[:icon_name].to_sym)
|
37
|
+
else
|
38
|
+
icon(config[:icon_name].to_sym)
|
39
|
+
text_node config[:text]
|
40
|
+
end
|
41
|
+
}
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
40
45
|
end
|
41
46
|
end
|
@@ -1,29 +1,34 @@
|
|
1
1
|
module ExpressAdmin
|
2
|
-
|
2
|
+
module Components
|
3
|
+
module Layout
|
3
4
|
|
4
|
-
|
5
|
-
has_option :status, 'Status of the pane'
|
5
|
+
class Pane < LayoutComponent
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
}
|
7
|
+
has_option :title, 'The title of the pane', default: ''
|
8
|
+
has_option :status, 'Status of the pane'
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
prepends -> {
|
11
|
+
heading if title || status
|
12
|
+
}
|
13
|
+
|
14
|
+
def heading
|
15
|
+
h4(class: 'title') {
|
16
|
+
current_arbre_element.add_child title
|
17
|
+
if status
|
18
|
+
span(class: 'status') { status }
|
19
|
+
end
|
20
|
+
}
|
16
21
|
end
|
17
|
-
}
|
18
|
-
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
def title
|
24
|
+
config[:title]
|
25
|
+
end
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
def status
|
28
|
+
config[:status]
|
29
|
+
end
|
27
30
|
|
31
|
+
end
|
32
|
+
end
|
28
33
|
end
|
29
34
|
end
|