express_ui 0.5.0 → 0.5.1

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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/express_ui/application.js +36 -38
  3. data/app/assets/stylesheets/express_ui/application.sass +6 -0
  4. data/app/assets/stylesheets/express_ui/atoms/_animations.sass +4 -0
  5. data/app/assets/stylesheets/express_ui/atoms/_buttons.sass +63 -9
  6. data/app/assets/stylesheets/express_ui/atoms/_icons.sass +20 -1
  7. data/app/assets/stylesheets/express_ui/atoms/_reset.sass +5 -2
  8. data/app/assets/stylesheets/express_ui/atoms/_typography.sass +11 -6
  9. data/app/assets/stylesheets/express_ui/atoms/_utilities.sass +5 -0
  10. data/app/assets/stylesheets/express_ui/mixins/_express_ui.sass +75 -13
  11. data/app/assets/stylesheets/express_ui/molecules/_button_group.sass +17 -0
  12. data/app/assets/stylesheets/express_ui/molecules/_container.sass +57 -6
  13. data/app/assets/stylesheets/express_ui/molecules/_flash_messages.sass +42 -12
  14. data/app/assets/stylesheets/express_ui/molecules/_form_groups.sass +75 -6
  15. data/app/assets/stylesheets/express_ui/molecules/_forms.sass +38 -4
  16. data/app/assets/stylesheets/express_ui/molecules/_lists.sass +44 -8
  17. data/app/assets/stylesheets/express_ui/molecules/_nav.sass +7 -2
  18. data/app/assets/stylesheets/express_ui/molecules/_progress_bar.sass +33 -0
  19. data/app/assets/stylesheets/express_ui/molecules/_progress_indicator.sass +5 -1
  20. data/app/assets/stylesheets/express_ui/molecules/_tables.sass +5 -0
  21. data/app/assets/stylesheets/express_ui/organisms/_detail.sass +28 -0
  22. data/app/assets/stylesheets/express_ui/organisms/_dropdown.sass +14 -0
  23. data/app/assets/stylesheets/express_ui/organisms/_header.sass +1 -1
  24. data/app/assets/stylesheets/express_ui/organisms/_panels.sass +41 -0
  25. data/app/assets/stylesheets/express_ui/organisms/_popovers.sass +9 -0
  26. data/app/assets/stylesheets/express_ui/organisms/_sidebar.sass +35 -27
  27. data/app/assets/stylesheets/express_ui/scripts/_accordion.sass +12 -8
  28. data/app/assets/stylesheets/express_ui/scripts/_popup.sass +39 -3
  29. data/app/assets/stylesheets/express_ui/templates/_content_sidebar.sass +0 -1
  30. data/app/assets/stylesheets/express_ui/templates/_full_width.sass +9 -0
  31. data/app/assets/stylesheets/express_ui/templates/_master_detail.sass +53 -1
  32. data/app/controllers/express_ui/uicomponents_controller.rb +3 -0
  33. data/app/helpers/express_ui/application_helper.rb +1 -0
  34. data/app/helpers/express_ui/checks_for_testing.rb +13 -0
  35. data/app/views/express_ui/molecules/_lists.html.erb +0 -0
  36. data/app/views/express_ui/shared/_header.html.erb +0 -1
  37. data/app/views/express_ui/styleguide/index.html.erb +0 -6
  38. data/app/views/express_ui/templates/master_detail_fixed.html.erb +24 -24
  39. data/app/views/layouts/express_ui/_doctype_html.html.erb +9 -0
  40. data/app/views/layouts/express_ui/_head.html.erb +1 -7
  41. data/app/views/layouts/express_ui/content_and_sidebar.html.erb +24 -10
  42. data/app/views/layouts/express_ui/content_and_sidebar_fixed.html.erb +25 -10
  43. data/app/views/layouts/express_ui/full_width.html.erb +10 -6
  44. data/app/views/layouts/express_ui/half_width.html.erb +2 -2
  45. data/app/views/layouts/express_ui/master_detail.html.html.erb +9 -5
  46. data/app/views/layouts/express_ui/master_detail_fixed.html.erb +17 -11
  47. data/app/views/layouts/express_ui/master_detail_sidebar.html.erb +30 -0
  48. data/app/views/layouts/express_ui/styleguide.html.erb +2 -6
  49. data/lib/express_ui/engine.rb +0 -2
  50. data/lib/express_ui/version.rb +1 -1
  51. metadata +15 -56
  52. data/app/components/code_demo.rb +0 -29
  53. data/app/components/component_docitem.rb +0 -140
  54. data/app/components/component_example.rb +0 -100
  55. data/app/components/express_ui/panel.rb +0 -37
  56. data/app/components/express_ui/unordered_list.rb +0 -29
  57. data/app/views/express_ui/molecules/_lists.html.et +0 -65
  58. data/app/views/express_ui/molecules/_nav_mega_menu.html.et +0 -94
  59. data/app/views/express_ui/molecules/_nav_menu.html.et +0 -17
  60. data/app/views/express_ui/molecules/_progress_indicator.html.et +0 -56
  61. data/app/views/express_ui/scripts/_accordion.html.et +0 -69
  62. data/app/views/express_ui/scripts/_calendar.html.et +0 -35
  63. data/app/views/express_ui/scripts/_carousel.html.et +0 -21
  64. data/app/views/express_ui/scripts/_datepicker.html.et +0 -37
  65. data/app/views/express_ui/scripts/_popup.html.et +0 -58
  66. data/app/views/express_ui/scripts/_select.html.et +0 -27
  67. data/app/views/express_ui/scripts/_slider.html.et +0 -58
  68. data/app/views/express_ui/scripts/_tabs.html.et +0 -17
  69. data/app/views/express_ui/scripts/index.html.erb +0 -46
  70. data/app/views/express_ui/uicomponents/_buttons.html.et +0 -10
  71. data/app/views/express_ui/uicomponents/_flash_message.html.et +0 -19
  72. data/app/views/express_ui/uicomponents/_forms.html.et +0 -118
  73. data/app/views/express_ui/uicomponents/_heading.html.et +0 -24
  74. data/app/views/express_ui/uicomponents/_icons.html.et +0 -35
  75. data/app/views/express_ui/uicomponents/_layout.html.et +0 -47
  76. data/app/views/express_ui/uicomponents/_lists.html.et +0 -49
  77. data/app/views/express_ui/uicomponents/_nav.html.et +0 -18
  78. data/app/views/express_ui/uicomponents/_pages.html.erb +0 -30
  79. data/app/views/express_ui/uicomponents/_panels.html.et +0 -14
  80. data/app/views/express_ui/uicomponents/_popup.html.et +0 -19
  81. data/app/views/express_ui/uicomponents/_register.html.erb +0 -14
  82. data/app/views/express_ui/uicomponents/_sidebar.html.et +0 -8
  83. data/app/views/express_ui/uicomponents/_table.html.et +0 -11
  84. data/app/views/express_ui/uicomponents/_widget_box.html.et +0 -14
  85. data/app/views/express_ui/uicomponents/examples/_panel.html.et +0 -9
  86. data/app/views/express_ui/uicomponents/examples/_unordered_list.html.et +0 -5
  87. data/app/views/express_ui/uicomponents/examples/_unordered_list_with_ids.html.et +0 -5
  88. data/app/views/express_ui/uicomponents/index.html.et +0 -52
@@ -0,0 +1,30 @@
1
+ <%= render 'layouts/express_ui/doctype_html' do %>
2
+ <%= render partial: 'layouts/express_ui/head' %>
3
+ <body>
4
+ <header class="<%= for_testing? ? "ae-testing-header" : "" %>">
5
+ <%= content_for(:header) || render(partial: 'shared/header') rescue nil %>
6
+ </header>
7
+ <div class="ae-template-master-detail-sidebar">
8
+
9
+ <%= content_for(:sidebar_link) rescue nil %>
10
+
11
+ <div class="ae-sidebar ae-sidebar-left js-ae-sidebar">
12
+ <%= content_for(:sidebar) rescue nil %>
13
+ </div>
14
+
15
+ <div class="ae-sidebar ae-sidebar-right js-ae-sidebar-right ae-detail-view">
16
+ <%= content_for(:detail) rescue nil %>
17
+ </div>
18
+
19
+ <div class="ae-container">
20
+ <div class="ae-content">
21
+ <%= yield %>
22
+
23
+
24
+ </div>
25
+ </div>
26
+
27
+
28
+ </div>
29
+ </body>
30
+ <% end %>
@@ -1,8 +1,4 @@
1
- <html>
2
- <!--[if IE 7]><html class='no-js ie7 no-freight base #{yield :document_class}' data-topic="#{yield :topic}" lang='en'><![endif]-->
3
- <!--[if IE 8]><html class='no-js ie8 no-freight base #{yield :document_class}' data-topic="#{yield :topic}" lang='en'><![endif]-->
4
- <!--[if IE 9]><html class='no-js ie9 no-freight base #{yield :document_class}' data-topic="#{yield :topic}" lang='en'><![endif]-->
5
- <!--[if gt IE 9]><!--><html class='no-js no-freight base #{yield :document_class}' data-topic="#{yield :topic}" lang='en'><!--<![endif]-->
1
+ <%= render 'layouts/express_ui/doctype_html' do %>
6
2
  <head>
7
3
  <meta charset="utf-8"/>
8
4
  <meta content="AppExpress" name="author"/>
@@ -20,4 +16,4 @@
20
16
  <body>
21
17
  <%= yield %>
22
18
  </body>
23
- </head>
19
+ <% end %>
@@ -1,5 +1,3 @@
1
- require 'express_templates'
2
-
3
1
  module ExpressUi
4
2
  class Engine < ::Rails::Engine
5
3
  require 'jquery-rails'
@@ -1,3 +1,3 @@
1
1
  module ExpressUi
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: express_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Talcott Smith
@@ -10,36 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-06-09 00:00:00.000000000 Z
13
+ date: 2018-05-30 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: express_templates
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '0.11'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '0.11'
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: rails
31
17
  requirement: !ruby/object:Gem::Requirement
32
18
  requirements:
33
19
  - - "~>"
34
20
  - !ruby/object:Gem::Version
35
- version: '5.0'
21
+ version: '5.1'
36
22
  type: :runtime
37
23
  prerelease: false
38
24
  version_requirements: !ruby/object:Gem::Requirement
39
25
  requirements:
40
26
  - - "~>"
41
27
  - !ruby/object:Gem::Version
42
- version: '5.0'
28
+ version: '5.1'
43
29
  - !ruby/object:Gem::Dependency
44
30
  name: sass-rails
45
31
  requirement: !ruby/object:Gem::Requirement
@@ -177,6 +163,7 @@ files:
177
163
  - app/assets/stylesheets/express_ui/atoms/_media_queries.sass
178
164
  - app/assets/stylesheets/express_ui/atoms/_reset.sass
179
165
  - app/assets/stylesheets/express_ui/atoms/_typography.sass
166
+ - app/assets/stylesheets/express_ui/atoms/_utilities.sass
180
167
  - app/assets/stylesheets/express_ui/mixins/_express_ui.sass
181
168
  - app/assets/stylesheets/express_ui/molecules/_button_group.sass
182
169
  - app/assets/stylesheets/express_ui/molecules/_container.sass
@@ -185,11 +172,16 @@ files:
185
172
  - app/assets/stylesheets/express_ui/molecules/_forms.sass
186
173
  - app/assets/stylesheets/express_ui/molecules/_lists.sass
187
174
  - app/assets/stylesheets/express_ui/molecules/_nav.sass
175
+ - app/assets/stylesheets/express_ui/molecules/_progress_bar.sass
188
176
  - app/assets/stylesheets/express_ui/molecules/_progress_indicator.sass
189
177
  - app/assets/stylesheets/express_ui/molecules/_tables.sass
190
178
  - app/assets/stylesheets/express_ui/molecules/_tabs.sass
179
+ - app/assets/stylesheets/express_ui/organisms/_detail.sass
180
+ - app/assets/stylesheets/express_ui/organisms/_dropdown.sass
191
181
  - app/assets/stylesheets/express_ui/organisms/_footer.sass
192
182
  - app/assets/stylesheets/express_ui/organisms/_header.sass
183
+ - app/assets/stylesheets/express_ui/organisms/_panels.sass
184
+ - app/assets/stylesheets/express_ui/organisms/_popovers.sass
193
185
  - app/assets/stylesheets/express_ui/organisms/_sidebar.sass
194
186
  - app/assets/stylesheets/express_ui/scripts/_accordion.sass
195
187
  - app/assets/stylesheets/express_ui/scripts/_calendar.sass
@@ -203,11 +195,6 @@ files:
203
195
  - app/assets/stylesheets/express_ui/templates/_full_width.sass
204
196
  - app/assets/stylesheets/express_ui/templates/_half_width.sass
205
197
  - app/assets/stylesheets/express_ui/templates/_master_detail.sass
206
- - app/components/code_demo.rb
207
- - app/components/component_docitem.rb
208
- - app/components/component_example.rb
209
- - app/components/express_ui/panel.rb
210
- - app/components/express_ui/unordered_list.rb
211
198
  - app/controllers/express_ui/about_controller.rb
212
199
  - app/controllers/express_ui/application_controller.rb
213
200
  - app/controllers/express_ui/pages_controller.rb
@@ -216,6 +203,7 @@ files:
216
203
  - app/controllers/express_ui/templates_controller.rb
217
204
  - app/controllers/express_ui/uicomponents_controller.rb
218
205
  - app/helpers/express_ui/application_helper.rb
206
+ - app/helpers/express_ui/checks_for_testing.rb
219
207
  - app/jobs/express_ui/application_job.rb
220
208
  - app/mailers/express_ui/application_mailer.rb
221
209
  - app/models/express_ui/application_record.rb
@@ -238,11 +226,8 @@ files:
238
226
  - app/views/express_ui/molecules/_forms_checkbox.html.erb
239
227
  - app/views/express_ui/molecules/_forms_radio.html.erb
240
228
  - app/views/express_ui/molecules/_forms_select.html.erb
241
- - app/views/express_ui/molecules/_lists.html.et
229
+ - app/views/express_ui/molecules/_lists.html.erb
242
230
  - app/views/express_ui/molecules/_nav.html.erb
243
- - app/views/express_ui/molecules/_nav_mega_menu.html.et
244
- - app/views/express_ui/molecules/_nav_menu.html.et
245
- - app/views/express_ui/molecules/_progress_indicator.html.et
246
231
  - app/views/express_ui/molecules/_table.html.erb
247
232
  - app/views/express_ui/molecules/_table_with_filtering.html.erb
248
233
  - app/views/express_ui/organisms/_header.html.erb
@@ -253,15 +238,6 @@ files:
253
238
  - app/views/express_ui/pages/register.html.erb
254
239
  - app/views/express_ui/pages/show_detail.js.erb
255
240
  - app/views/express_ui/pages/static.html.erb
256
- - app/views/express_ui/scripts/_accordion.html.et
257
- - app/views/express_ui/scripts/_calendar.html.et
258
- - app/views/express_ui/scripts/_carousel.html.et
259
- - app/views/express_ui/scripts/_datepicker.html.et
260
- - app/views/express_ui/scripts/_popup.html.et
261
- - app/views/express_ui/scripts/_select.html.et
262
- - app/views/express_ui/scripts/_slider.html.et
263
- - app/views/express_ui/scripts/_tabs.html.et
264
- - app/views/express_ui/scripts/index.html.erb
265
241
  - app/views/express_ui/shared/_header.html.erb
266
242
  - app/views/express_ui/shared/_search_box.html.erb
267
243
  - app/views/express_ui/shared/_sidebar_left.html.erb
@@ -276,25 +252,7 @@ files:
276
252
  - app/views/express_ui/templates/half_width.html.erb
277
253
  - app/views/express_ui/templates/master_detail.html.erb
278
254
  - app/views/express_ui/templates/master_detail_fixed.html.erb
279
- - app/views/express_ui/uicomponents/_buttons.html.et
280
- - app/views/express_ui/uicomponents/_flash_message.html.et
281
- - app/views/express_ui/uicomponents/_forms.html.et
282
- - app/views/express_ui/uicomponents/_heading.html.et
283
- - app/views/express_ui/uicomponents/_icons.html.et
284
- - app/views/express_ui/uicomponents/_layout.html.et
285
- - app/views/express_ui/uicomponents/_lists.html.et
286
- - app/views/express_ui/uicomponents/_nav.html.et
287
- - app/views/express_ui/uicomponents/_pages.html.erb
288
- - app/views/express_ui/uicomponents/_panels.html.et
289
- - app/views/express_ui/uicomponents/_popup.html.et
290
- - app/views/express_ui/uicomponents/_register.html.erb
291
- - app/views/express_ui/uicomponents/_sidebar.html.et
292
- - app/views/express_ui/uicomponents/_table.html.et
293
- - app/views/express_ui/uicomponents/_widget_box.html.et
294
- - app/views/express_ui/uicomponents/examples/_panel.html.et
295
- - app/views/express_ui/uicomponents/examples/_unordered_list.html.et
296
- - app/views/express_ui/uicomponents/examples/_unordered_list_with_ids.html.et
297
- - app/views/express_ui/uicomponents/index.html.et
255
+ - app/views/layouts/express_ui/_doctype_html.html.erb
298
256
  - app/views/layouts/express_ui/_head.html.erb
299
257
  - app/views/layouts/express_ui/content_and_sidebar.html.erb
300
258
  - app/views/layouts/express_ui/content_and_sidebar_fixed.html.erb
@@ -302,6 +260,7 @@ files:
302
260
  - app/views/layouts/express_ui/half_width.html.erb
303
261
  - app/views/layouts/express_ui/master_detail.html.html.erb
304
262
  - app/views/layouts/express_ui/master_detail_fixed.html.erb
263
+ - app/views/layouts/express_ui/master_detail_sidebar.html.erb
305
264
  - app/views/layouts/express_ui/styleguide.html.erb
306
265
  - config/initializers/components.rb
307
266
  - config/routes.rb
@@ -345,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
304
  version: '0'
346
305
  requirements: []
347
306
  rubyforge_project:
348
- rubygems_version: 2.6.12
307
+ rubygems_version: 2.5.2
349
308
  signing_key:
350
309
  specification_version: 4
351
310
  summary: User interface library for AppExpress components
@@ -1,29 +0,0 @@
1
- class CodeDemo < ExpressTemplates::Components::Container
2
-
3
- before_build -> {
4
- set_attribute(:class, 'ae-demo-container')
5
- }
6
-
7
- contains -> (&block) {
8
- ul(class: 'ae-tabs') {
9
- li(class: 'ae-tab active-tab', 'data-tab' => 'input'){
10
- "Input"
11
- }
12
- li(class: 'ae-tab', 'data-tab' => 'output'){
13
- "Output"
14
- }
15
- }
16
-
17
- div(id: 'input', class: 'ae-tab-content active-tab'){
18
- highlight_code_block {
19
- block.call
20
- }
21
- }
22
-
23
- div(id: 'output', class: 'ae-tab-content'){
24
- div(class: 'demo-container'){
25
- eval block.call.html_safe
26
- }
27
- }
28
- }
29
- end
@@ -1,140 +0,0 @@
1
- class ComponentDocitem < ExpressTemplates::Container
2
-
3
- has_option :examples, "Examples. Keys are partial names. :assigns and :expected_output are passed to component_example.", type: :hash
4
-
5
- # TODO: See if we could pull this from RDoc
6
- has_option :description, "A description of the component."
7
-
8
- prepends -> {
9
- h3(style: 'text-transform: none') { component_class.to_s.demodulize }
10
-
11
- h4 "General Information"
12
-
13
- para(style: 'padding: 0 0.25rem 1rem 0.25rem', only_when: !!config[:description]) {
14
- config[:description]
15
- }
16
-
17
- table {
18
- tbody {
19
- tr {
20
- th(width: "25%", style: "text-transform: none") { "Builder Method" }
21
- td {
22
- code "#{builder_method}()"
23
- }
24
- }
25
- tr {
26
- th(width: "25%", style: "text-transform: none") { "Module" }
27
- td { component_class.to_s.split("::")[0..-2].join("::") }
28
- }
29
- tr {
30
- th(width: "25%", style: "text-transform: none") { "Ancestors" }
31
- td { express_ancestors.join("<br>").html_safe }
32
- }
33
- tr {
34
- th(width: "25%", style: "text-transform: none") { "Capabilities" }
35
- td { express_capabilities.join("<br>").html_safe }
36
- }
37
- }
38
- }
39
-
40
- if component_class.respond_to?(:supported_arguments) &&
41
- component_class.supported_arguments.any?
42
-
43
- h4 "Supported Arguments"
44
-
45
- table {
46
- thead {
47
- th { "option" }
48
- th { "type" }
49
- th { "default" }
50
- th { "required" }
51
- th { "Description" }
52
- }
53
- tbody {
54
- component_class.supported_arguments.each do |arg, config|
55
- tr {
56
- td(style: "text-transform: none") {
57
- code { arg.inspect }
58
- }
59
- td { pre { option_types(config[:type]) } }
60
- td { pre { config[:default] } }
61
- td { pre { config[:required] ? 'yes' : 'no' } }
62
- td(width: "50%") {
63
- config[:description].html_safe
64
- }
65
- }
66
- end
67
- }
68
- }
69
-
70
- end
71
-
72
-
73
- if component_class.respond_to?(:supported_options)
74
- h4 "Supported Options"
75
-
76
- table {
77
- thead {
78
- th { "option" }
79
- th { "type" }
80
- th { "default" }
81
- th { "required" }
82
- th { "Description" }
83
- }
84
- tbody {
85
- component_class.supported_options.each do |option, config|
86
- tr {
87
- td(style: "text-transform: none") {
88
- code { option.inspect }
89
- }
90
- td { pre { option_types(config[:type]) } }
91
- td { pre { config[:default] } }
92
- td { pre { config[:required] ? 'yes' : 'no' } }
93
- td(width: "50%") {
94
- config[:description].html_safe
95
- }
96
- }
97
- end
98
- }
99
- }
100
-
101
-
102
- end
103
- }
104
-
105
- def component_class
106
- ET::Components::Registry[builder_method]
107
- end
108
-
109
- def express_ancestors
110
- (component_class.ancestors - [component_class])
111
- .select { |c| c.to_s.match(/Express/) &&
112
- !c.to_s.match(/Capabilities/) }
113
- end
114
-
115
- def express_capabilities
116
- (component_class.ancestors - [component_class])
117
- .map(&:to_s)
118
- .select { |c| c.match /Capabilities/ }
119
- .map(&:demodulize)
120
- end
121
-
122
- def builder_method
123
- config[:id].to_s
124
- end
125
-
126
- def option_types(types)
127
- case
128
- when types.kind_of?(Hash)
129
- types.keys.map(&:inspect).join(', ')
130
- when config[:type].kind_of?(Array)
131
- types.map(&:inspect).join(', ')
132
- when types.nil?
133
- ''
134
- else
135
- types.inspect
136
- end
137
- end
138
-
139
-
140
- end
@@ -1,100 +0,0 @@
1
- class ComponentExample < ExpressTemplates::Component
2
-
3
- tag :section
4
-
5
- has_option :expected_output, "The markup that the example is expected to produce."
6
- has_option :assigns, "Values to be passed in.", type: :hash
7
- has_option :example_name, "A distinguishing name for the example if part of a set."
8
-
9
- contains -> {
10
-
11
- h4 { example_title }
12
-
13
- panel(only_when: config[:assigns].present?) {
14
- para { "Input:" }
15
- table {
16
- tbody {
17
- config[:assigns].each do |key, value|
18
- tr {
19
- td { code { key.to_s } }
20
- td { pre { format(value) } }
21
- }
22
- end
23
- }
24
- }
25
- }
26
-
27
- div(class: 'ae-demo-container') {
28
- ul(class: 'ae-tabs') {
29
- li(class: 'ae-tab active-tab', 'data-tab' => usage_id){
30
- "Usage"
31
- }
32
- li(class: 'ae-tab', 'data-tab' => output_id){
33
- "Output"
34
- }
35
- li(class: 'ae-tab', 'data-tab' => expected_id,
36
- :only_when => !!config[:expected_output]){
37
- "Expected Output"
38
- }
39
- }
40
-
41
- div(id: usage_id, class: 'ae-tab-content active-tab'){
42
- highlight_code_block {
43
- partial_body
44
- }
45
- }
46
-
47
- div(id: output_id, class: 'ae-tab-content'){
48
- div(class: 'demo-container'){
49
- render(partial: example_partial_path, locals: config[:assigns])
50
- }
51
- }
52
-
53
- div(id: expected_id, class: 'ae-tab-content',
54
- only_when: !!config[:expected_output]){
55
- div(class: 'demo-container'){
56
- highlight_code_block {
57
- config[:expected_output]
58
- }
59
- }
60
- }
61
- }
62
- }
63
-
64
- def format(value)
65
- io = StringIO.new
66
- PP.pp value, io
67
- io.string.html_safe
68
- end
69
-
70
- def usage_id; "#{example_partial_name}_usage"; end
71
- def output_id; "#{example_partial_name}_output"; end
72
- def expected_id; "#{example_partial_name}_expected"; end
73
-
74
- def example_title
75
- if config[:example_name]
76
- "Example #{config[:example_name].to_s.titleize}"
77
- else
78
- "Example"
79
- end
80
- end
81
-
82
- def example_partial_path
83
- "express_ui/uicomponents/examples/#{example_partial_name}"
84
- end
85
-
86
- def example_partial_name
87
- s = component_name.dup
88
- s << "_#{config[:example_name]}" if config[:example_name]
89
- s
90
- end
91
-
92
- def partial_body
93
- location = File.dirname(__FILE__)
94
- File.read(File.join(location, '..', 'views', 'express_ui', 'uicomponents', 'examples', "_#{example_partial_name}.html.et"))
95
- end
96
-
97
- def component_name
98
- config[:id].to_s
99
- end
100
- end