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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/components/express_admin/command_button.rb +39 -36
  3. data/app/components/express_admin/command_button_list.rb +25 -21
  4. data/app/components/express_admin/definition_list.rb +54 -50
  5. data/app/components/express_admin/definition_table.rb +16 -12
  6. data/app/components/express_admin/icon.rb +13 -8
  7. data/app/components/express_admin/icon_link.rb +42 -37
  8. data/app/components/express_admin/layout_component.rb +4 -0
  9. data/app/components/express_admin/layout_components/h_box.rb +5 -1
  10. data/app/components/express_admin/layout_components/pane.rb +24 -19
  11. data/app/components/express_admin/layout_components/sidebar_region.rb +5 -1
  12. data/app/components/express_admin/layout_components/v_box.rb +5 -1
  13. data/app/components/express_admin/main_region.rb +5 -1
  14. data/app/components/express_admin/page_header.rb +15 -11
  15. data/app/components/express_admin/smart_form.rb +106 -102
  16. data/app/components/express_admin/smart_table.rb +177 -165
  17. data/app/helpers/express_admin/admin_helper.rb +8 -0
  18. data/lib/express_admin/version.rb +1 -1
  19. data/test/dummy/db/test.sqlite3 +0 -0
  20. data/vendor/gems/express_templates/Gemfile.lock +7 -1
  21. data/vendor/gems/express_templates/express_templates-0.11.2.gem +0 -0
  22. data/vendor/gems/express_templates/express_templates.gemspec +2 -0
  23. data/vendor/gems/express_templates/lib/express_templates/components/all.rb +17 -15
  24. data/vendor/gems/express_templates/lib/express_templates/components/forms.rb +1 -0
  25. data/vendor/gems/express_templates/lib/express_templates/components/forms/country_select.rb +23 -0
  26. data/vendor/gems/express_templates/lib/express_templates/components/tree_for.rb +72 -70
  27. data/vendor/gems/express_templates/lib/express_templates/template/handler.rb +3 -2
  28. data/vendor/gems/express_templates/lib/express_templates/version.rb +1 -1
  29. data/vendor/gems/express_templates/test/components/forms/country_select_test.rb +34 -0
  30. data/vendor/gems/express_templates/test/dummy/log/test.log +654 -0
  31. data/vendor/gems/express_templates/test/test_helper.rb +1 -1
  32. metadata +5 -4
  33. data/vendor/gems/express_templates/express_templates-0.11.0.gem +0 -0
  34. 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: f9460f5701a84778f81b01fc273b3730c1f403b1
4
- data.tar.gz: 1343f5df30af52c64470c72f8032581d99464beb
3
+ metadata.gz: a43f56f4e0dadb43337d599139a3c886d8c5800a
4
+ data.tar.gz: 9797b798d4717832c64ec0679d6b6dc0415d942e
5
5
  SHA512:
6
- metadata.gz: 0ec3af25e93920df8844339bc3d3c62a2e4f690e50657be411c1298e224abf879e31ada2786aac40b329a1a4203b9a427a02601a0f5700f56cc435565dfe378a
7
- data.tar.gz: 0cc4ea6f9051aed939b93da442a36f19c200ba338455f777d87c6d04d1c75fa7f06e4a599a4b66866a00dc2d7da14de4442ffa6da2f905882b24fd52607ab278
6
+ metadata.gz: e3dfd3f8c023ad92b0a13e20dd47bf006c8eeea331abb057e4f1a45acd54ee62af9ca2aa0d1a7ce4775f62292e4519d53a122e8fce736ab881cb80fd1d0e585e
7
+ data.tar.gz: 17d6d0a62dbfc2dfa99314d46f0aedd77fbaf38b042a5fdb3769b673a99815da03aca1906da7a15bbd38d520b9c76ab8541b5f4e9dcf4d9121fc398195dc96e9
@@ -1,42 +1,45 @@
1
1
  module ExpressAdmin
2
- class CommandButton < ExpressTemplates::Components::Configurable
3
- include ExpressTemplates::Components::Capabilities::Resourceful
4
-
5
-
6
- has_argument :id, "The command name. Invoked as an action on the resource.", as: :command, type: :symbol
7
- has_option :disabled, "Disables the button", type: :boolean
8
- has_option :confirm, "Prompt with the question specified."
9
- has_option :resource_name, "The name of the resource for this command. Eg. 'person' for like_person_path()"
10
-
11
- before_build -> {
12
- config[:command] = config[:command].debang
13
- add_class(config[:command])
14
- }
15
-
16
- contains -> {
17
- button_to config[:command].to_s.titleize, action, button_to_options
18
- }
19
-
20
- def resource_name
21
- config[:resource_name] || parent_command_button_list.resource_name
22
- end
23
-
24
- def button_to_options
25
- {remote: true, disabled: config[:disabled], confirm: config[:confirm]}
26
- end
27
-
28
- def action
29
- helpers.send "#{config[:command]}_#{resource_path_helper}", resource.to_param
30
- end
31
-
32
- def parent_command_button_list
33
- @parent_button_list ||= parent
34
- until @parent_button_list.nil? || @parent_button_list.kind_of?(CommandButtonList)
35
- @parent_button_list = @parent_button_list.parent
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
- class CommandButtonList < ExpressTemplates::Components::Configurable
3
- include ExpressTemplates::Components::Capabilities::Resourceful
2
+ module Components
3
+ module Navigation
4
+ class CommandButtonList < ExpressTemplates::Components::Configurable
5
+ include ExpressTemplates::Components::Capabilities::Resourceful
4
6
 
5
- tag :ul
7
+ tag :ul
6
8
 
7
- has_argument :id, "The name of the resource for this command. Eg. 'person' for like_person_path()", as: :resource_name, type: :symbol
8
- # has_option :exclude, "Exclude some buttons"
9
- # has_option :only, "only some buttons"
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
- contains -> {
12
- commands.each do |command|
13
- li {
14
- command_button(command, disabled: !available?(command))
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
- def resource_name
20
- config[:resource_name]
21
- end
21
+ def resource_name
22
+ config[:resource_name]
23
+ end
22
24
 
23
- def available?(command)
24
- resource.available_commands.include?(command)
25
- end
25
+ def available?(command)
26
+ resource.available_commands.include?(command)
27
+ end
26
28
 
27
- def commands
28
- resource.commands
29
- end
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
- class DefinitionList < ExpressTemplates::Components::Configurable
3
- include ExpressTemplates::Components::Capabilities::Resourceful
4
-
5
- tag :dl
6
-
7
- list_types = {}
8
- list_types[:array] = {description: "List of fields on the current resource",
9
- options: -> {resource.columns.map(&:name)}}
10
- list_types[:hash] = {description: "List of terms and definitions."}
11
-
12
- has_argument :list, "A list of things to define, presented as <label>: <definition>.",
13
- as: :list, type: list_types
14
-
15
- contains -> {
16
- definitions.each do |label, content|
17
- dt { label }
18
- dd { content }
19
- end
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
- def definitions
23
- if config[:list].kind_of?(Array)
24
- definitions_from_array(config[:list])
25
- elsif config[:list].kind_of?(Hash)
26
- definitions_from_hash(config[:list])
27
- end
28
- end
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
- def definitions_from_hash(hash)
31
- processed = hash.map do |k,v|
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
- def definitions_from_array(fields)
45
- Hash[fields.map {|field| ["#{field.to_s.titleize}:", "{{resource.#{field}}}"]}]
46
- end
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
- class DefinitionTable < DefinitionList
3
- include ExpressTemplates::Components::Capabilities::Resourceful
2
+ module Components
3
+ module Presenters
4
+ class DefinitionTable < DefinitionList
5
+ include ExpressTemplates::Components::Capabilities::Resourceful
4
6
 
5
- tag :table
7
+ tag :table
6
8
 
7
- contains -> {
8
- tbody {
9
- definitions.each do |label, content|
10
- tr {
11
- th(align: "right") { label }
12
- td { content }
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
- end
15
- }
16
- }
18
+ }
17
19
 
20
+ end
21
+ end
18
22
  end
19
23
  end
@@ -1,14 +1,19 @@
1
1
  module ExpressAdmin
2
- class Icon < ExpressTemplates::Components::Configurable
2
+ module Components
3
+ module Navigation
3
4
 
4
- tag :i
5
+ class Icon < ExpressTemplates::Components::Configurable
5
6
 
6
- has_argument :id, "The name of the ionic icon withouth the ion- prefix. See http://ionicons.com/cheatsheet.html",
7
- as: :name,
8
- type: [:symbol, :string]
7
+ tag :i
9
8
 
10
- before_build {
11
- add_class("ion-#{config[:name]}")
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
- class IconLink < ExpressTemplates::Components::Configurable
3
-
4
- tag :a
5
-
6
- has_argument :id, "The name of the ionic icon withouth the ion- prefix. See http://ionicons.com/cheatsheet.html",
7
- as: :icon_name,
8
- type: [:symbol, :string]
9
-
10
- has_option :text, "Link text to accompany the icon."
11
-
12
- has_option :right, "Aligns the icon to the right of the text.",
13
- default: false
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
@@ -3,6 +3,10 @@ module ExpressAdmin
3
3
 
4
4
  has_option :style, 'Add inline styles to the element'
5
5
 
6
+ before_build {
7
+ set_attribute :style, style_attributes
8
+ }
9
+
6
10
  def style_attributes
7
11
  attribs = config[:style] || {}
8
12
  attribs.map do |k, v|
@@ -1,4 +1,8 @@
1
1
  module ExpressAdmin
2
- class HBox < LayoutComponent
2
+ module Components
3
+ module Layout
4
+ class HBox < LayoutComponent
5
+ end
6
+ end
3
7
  end
4
8
  end
@@ -1,29 +1,34 @@
1
1
  module ExpressAdmin
2
- class Pane < LayoutComponent
2
+ module Components
3
+ module Layout
3
4
 
4
- has_option :title, 'The title of the pane', default: ''
5
- has_option :status, 'Status of the pane'
5
+ class Pane < LayoutComponent
6
6
 
7
- prepends -> {
8
- heading if title || status
9
- }
7
+ has_option :title, 'The title of the pane', default: ''
8
+ has_option :status, 'Status of the pane'
10
9
 
11
- def heading
12
- h4(class: 'title') {
13
- current_arbre_element.add_child title
14
- if status
15
- span(class: 'status') { status }
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
- def title
21
- config[:title]
22
- end
23
+ def title
24
+ config[:title]
25
+ end
23
26
 
24
- def status
25
- config[:status]
26
- end
27
+ def status
28
+ config[:status]
29
+ end
27
30
 
31
+ end
32
+ end
28
33
  end
29
34
  end