matestack-ui-core 0.7.6 → 1.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +8 -0
  3. data/README.md +27 -215
  4. data/app/concepts/matestack/ui/core/abbr/abbr.haml +2 -2
  5. data/app/concepts/matestack/ui/core/abbr/abbr.rb +3 -2
  6. data/app/concepts/matestack/ui/core/action/action.rb +23 -19
  7. data/app/concepts/matestack/ui/core/address/address.haml +2 -2
  8. data/app/concepts/matestack/ui/core/address/address.rb +1 -1
  9. data/app/concepts/matestack/ui/core/app/app.haml +2 -3
  10. data/app/concepts/matestack/ui/core/app/app.js +4 -1
  11. data/app/concepts/matestack/ui/core/app/app.rb +32 -56
  12. data/app/concepts/matestack/ui/core/app/store.js +23 -1
  13. data/app/concepts/matestack/ui/core/area/area.rb +12 -10
  14. data/app/concepts/matestack/ui/core/async/async.haml +6 -2
  15. data/app/concepts/matestack/ui/core/async/async.js +37 -3
  16. data/app/concepts/matestack/ui/core/async/async.rb +29 -4
  17. data/app/concepts/matestack/ui/core/async/children_wrapper.haml +2 -0
  18. data/app/concepts/matestack/ui/core/bdo/bdo.rb +1 -1
  19. data/app/concepts/matestack/ui/core/collection/content/content.rb +2 -2
  20. data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +4 -2
  21. data/app/concepts/matestack/ui/core/collection/filter/filter.rb +4 -5
  22. data/app/concepts/matestack/ui/core/collection/filter/select/select.haml +10 -0
  23. data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +29 -0
  24. data/app/concepts/matestack/ui/core/collection/helper.rb +14 -6
  25. data/app/concepts/matestack/ui/core/collection/order/order.js +1 -1
  26. data/app/concepts/matestack/ui/core/collection/order/order.rb +4 -5
  27. data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +6 -5
  28. data/app/concepts/matestack/ui/core/component/base.rb +424 -0
  29. data/app/concepts/matestack/ui/core/component/children.haml +2 -2
  30. data/app/concepts/matestack/ui/core/component/component.js +1 -55
  31. data/app/concepts/matestack/ui/core/component/dynamic.haml +1 -1
  32. data/app/concepts/matestack/ui/core/component/dynamic.rb +24 -247
  33. data/app/concepts/matestack/ui/core/component/rerender.rb +8 -0
  34. data/app/concepts/matestack/ui/core/component/static.rb +3 -12
  35. data/app/concepts/matestack/ui/core/form/checkbox/checkbox.rb +79 -0
  36. data/app/concepts/matestack/ui/core/form/form.js +25 -20
  37. data/app/concepts/matestack/ui/core/form/form.rb +7 -2
  38. data/app/concepts/matestack/ui/core/form/has_errors.rb +54 -0
  39. data/app/concepts/matestack/ui/core/form/has_input_html_attributes.rb +13 -0
  40. data/app/concepts/matestack/ui/core/form/input/input.rb +32 -52
  41. data/app/concepts/matestack/ui/core/form/radio/radio.rb +71 -0
  42. data/app/concepts/matestack/ui/core/form/select/select.haml +9 -80
  43. data/app/concepts/matestack/ui/core/form/select/select.rb +61 -56
  44. data/app/concepts/matestack/ui/core/form/submit/submit.rb +4 -1
  45. data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +28 -0
  46. data/app/concepts/matestack/ui/core/form/utils.rb +47 -0
  47. data/app/concepts/matestack/ui/core/heading/heading.rb +2 -0
  48. data/app/concepts/matestack/ui/core/input/input.haml +1 -2
  49. data/app/concepts/matestack/ui/core/input/input.rb +4 -0
  50. data/app/concepts/matestack/ui/core/isolated/children_wrapper.haml +2 -0
  51. data/app/concepts/matestack/ui/core/isolated/isolated.haml +10 -0
  52. data/app/concepts/matestack/ui/core/isolated/isolated.js +108 -0
  53. data/app/concepts/matestack/ui/core/isolated/isolated.rb +59 -0
  54. data/app/concepts/matestack/ui/core/js/core.js +5 -4
  55. data/app/concepts/matestack/ui/core/link/link.rb +7 -7
  56. data/app/concepts/matestack/ui/core/map/map.rb +1 -1
  57. data/app/concepts/matestack/ui/core/onclick/onclick.rb +1 -0
  58. data/app/concepts/matestack/ui/core/page/{content.js → content/content.js} +8 -2
  59. data/app/concepts/matestack/ui/core/page/content/content.rb +29 -0
  60. data/app/concepts/matestack/ui/core/page/page.haml +3 -9
  61. data/app/concepts/matestack/ui/core/page/page.rb +15 -179
  62. data/app/concepts/matestack/ui/core/progress/progress.rb +1 -1
  63. data/app/concepts/matestack/ui/core/slot/slot.rb +2 -2
  64. data/app/concepts/matestack/ui/core/textarea/textarea.haml +2 -0
  65. data/app/concepts/matestack/ui/core/textarea/textarea.rb +10 -0
  66. data/app/concepts/matestack/ui/core/toggle/toggle.haml +2 -0
  67. data/app/concepts/matestack/ui/core/toggle/toggle.js +71 -0
  68. data/app/concepts/matestack/ui/core/toggle/toggle.rb +14 -0
  69. data/app/concepts/matestack/ui/core/transition/transition.js +1 -0
  70. data/app/concepts/matestack/ui/core/transition/transition.rb +1 -0
  71. data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +1 -1
  72. data/app/concepts/matestack/ui/core/video/video.rb +1 -1
  73. data/app/concepts/matestack/ui/core/view/view.haml +1 -0
  74. data/app/concepts/matestack/ui/core/view/view.rb +30 -0
  75. data/app/concepts/matestack/ui/core/youtube/youtube.rb +1 -1
  76. data/app/helpers/matestack/ui/core/application_helper.rb +89 -20
  77. data/app/lib/matestack/ui/component.rb +1 -0
  78. data/app/lib/matestack/ui/core/has_view_context.rb +4 -4
  79. data/app/lib/matestack/ui/core/html_attributes.rb +43 -0
  80. data/app/lib/matestack/ui/core/properties.rb +88 -0
  81. data/app/lib/matestack/ui/core/rendering/default_renderer_class_determiner.rb +33 -0
  82. data/app/lib/matestack/ui/core/rendering/main_renderer.rb +199 -0
  83. data/app/lib/matestack/ui/isolated_component.rb +1 -0
  84. data/app/lib/matestack/ui/vue_js_component.rb +1 -0
  85. data/lib/matestack/ui/core.rb +4 -2
  86. data/lib/matestack/ui/core/cell.rb +0 -2
  87. data/lib/matestack/ui/core/component/registry.rb +47 -0
  88. data/lib/matestack/ui/core/components.rb +267 -0
  89. data/lib/matestack/ui/core/dsl.rb +6 -0
  90. data/lib/matestack/ui/core/engine.rb +16 -0
  91. data/lib/matestack/ui/core/version.rb +1 -1
  92. data/vendor/assets/javascripts/dist/matestack-ui-core.js +329 -122
  93. data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +1 -1
  94. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +1 -1
  95. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.gz +0 -0
  96. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map +1 -1
  97. data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.gz +0 -0
  98. metadata +47 -64
  99. data/MIT-LICENSE +0 -20
  100. data/app/concepts/matestack/ui/core/absolute/absolute.haml +0 -3
  101. data/app/concepts/matestack/ui/core/absolute/absolute.rb +0 -17
  102. data/app/concepts/matestack/ui/core/component/response.haml +0 -2
  103. data/app/concepts/matestack/ui/core/component/response_dynamic.haml +0 -7
  104. data/app/concepts/matestack/ui/core/component/response_dynamic_without_rerender.haml +0 -3
  105. data/app/concepts/matestack/ui/core/component/static.haml +0 -1
  106. data/app/concepts/matestack/ui/core/form/inline/inline.haml +0 -6
  107. data/app/concepts/matestack/ui/core/form/inline/inline.rb +0 -9
  108. data/app/concepts/matestack/ui/core/form/input/input.haml +0 -46
  109. data/app/concepts/matestack/ui/core/html/html.haml +0 -3
  110. data/app/concepts/matestack/ui/core/html/html.js +0 -10
  111. data/app/concepts/matestack/ui/core/html/html.rb +0 -17
  112. data/app/concepts/matestack/ui/core/isolate/isolate.haml +0 -2
  113. data/app/concepts/matestack/ui/core/isolate/isolate.rb +0 -11
  114. data/app/concepts/matestack/ui/core/page/content.haml +0 -7
  115. data/app/concepts/matestack/ui/core/page/content.rb +0 -5
  116. data/app/concepts/matestack/ui/core/pg/pg.haml +0 -5
  117. data/app/concepts/matestack/ui/core/pg/pg.rb +0 -5
  118. data/app/lib/matestack/ui/core/app_node.rb +0 -53
  119. data/app/lib/matestack/ui/core/component_node.rb +0 -87
  120. data/app/lib/matestack/ui/core/page_node.rb +0 -100
  121. data/app/lib/matestack/ui/core/render.rb +0 -89
  122. data/app/lib/matestack/ui/core/to_cell.rb +0 -129
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c4bb181fa03aec3eb151af547eec43d6f12f692c8cdfa0dfe70a6e963ede262
4
- data.tar.gz: 24088d7379448e215604593de26c89d8a026bbef1054c7d3cb78e22f01803f22
3
+ metadata.gz: 137c2f647ff054f09a0579d87a69a8db93ee92b084f7d0c20c8113ed7d995345
4
+ data.tar.gz: de53377ab8eabb7e0b4600cbb08e5f9545b95c38d4880feb3626da5a8a5c6440
5
5
  SHA512:
6
- metadata.gz: ee17b5c4423b505a5a6dacb837fe44987ce8fc26f1569314d7b7afbcdcb1c0feaadbf436ccf901583b94e9d1161f81ba99a6cab6237f48cd5854b685685fb1ca
7
- data.tar.gz: 677a09c88813b82d2c2cbf32885f90845b0e3a24739c1fd3ebe0b371b8a2e2208df7a3b0cdb9d8b83368eb34480edc769250cc932dc5fb6c645a2de0896ce007
6
+ metadata.gz: ca823a70552dc8f98f04517236ad16f9cc40ab1074f3a363f5b9276ca8fa706919b031c084da1d782bf6d2c4717cc67765f084a40c9f22ff79af53fc2b12f7cb
7
+ data.tar.gz: e4cd65cd6a80535193cd17a7249562c2c196929a0b9ba84684ecf9242bac3db49dc605fce3809596d27ca8870ee703d72aef4da8f69961d70f973de1a7870207
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright (c) Matestack GmbH
2
+
3
+ matestack-ui-core is an Open Source project licensed under the terms of
4
+ the LGPLv3 license. Please see <http://www.gnu.org/licenses/lgpl-3.0.html>
5
+ for license text.
6
+
7
+ Matestack will provide a commercial-friendly license allowing private forks
8
+ and modifications of matestack-ui-core. Please request at jonas@matestack.io
data/README.md CHANGED
@@ -1,240 +1,52 @@
1
1
  ![](https://github.com/matestack/matestack-ui-core/workflows/specs/badge.svg)
2
2
  [![Gitter](https://badges.gitter.im/basemate/community.svg)](https://gitter.im/basemate/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
3
3
  [![Gem Version](https://badge.fury.io/rb/matestack-ui-core.svg)](https://badge.fury.io/rb/matestack-ui-core)
4
- [![Docs](https://img.shields.io/badge/docs-matestack-blue.svg)](https://www.matestack.org/docs/install)
4
+ [![Docs](https://img.shields.io/badge/docs-matestack-blue.svg)](https://docs.matestack.io/docs/guides/install)
5
5
 
6
6
  ![matestack logo](./logo.png)
7
7
 
8
- # matestack: Escape the frontend hustle
8
+ # matestack-ui-core
9
9
 
10
- ## Create maintainable, dynamic and beautiful UIs easily
10
+ ## Escape the frontend hustle & easily create interactive web apps in pure Ruby
11
11
 
12
- As a Rails Engine, matestack deeply integrates a Vue.js based UI into Rails, offering optional prebuilt components. Use it to write dynamic Web-UIs with minimum effort and maximum dev happiness in pure Ruby. The main goals are:
12
+ `matestack-ui-core` is a Rails engine for Ruby on Rails developers.
13
+
14
+ `matestack-ui-core` enables you to craft interactive web UIs without JavaScript in pure Ruby with minimum effort.
15
+ UI code becomes a native and fun part of your Rails app.
16
+
17
+ Work with pure Ruby. If necessary, extend with pure JavaScript. No Opal involved.
18
+
19
+ The main goals are:
13
20
 
14
21
  - Reduction of complexity of modern web development, moving front and backend closer together
15
22
  - More maintainable UI code, using a component-based structure written in Ruby
16
- - Increased development speed and happiness, offering prebuilt UI-Components for classic requirements
23
+ - Increased development speed and happiness, offering prebuilt UI-Components for typical requirements
17
24
  - Modern, dynamic UI feeling without the need to implement a separate JavaScript Application
18
25
 
19
- matestack can progressively replace the classic Rails-View-Layer. You are able to use
26
+ `matestack-ui-core` can progressively replace the classic Rails-View-Layer. You are able to use
20
27
  it alongside your classic views and incrementally turn your Rails-App into a
21
28
  dynamic Web-App.
22
29
 
23
- ### Current State:
24
-
25
- We love to see more and more people using and contributing to matestack-ui-core. Our current version is 0.7.4 and it's not perfect yet. We recommend you to start using matestack-ui-core in a side project and report issues as this helps us to push matestack-ui-core towards a production ready 1.0.0. At matestack, we already use matestack-ui-core in production as we know how to handle current issues and bypass them with deep insights of the core implementation. We plan to invest time and money (yes, we're hiring) on following improvements:
26
-
27
- * debugging and error handling
28
- * core refactoring, increased core maintainability and code quality
29
- * better integration in existing rails apps
30
- * improved documentation
31
- * improved dynamic core components (especially form components)
32
-
33
-
34
- ### Installation:
35
-
36
- Click here to see how you can add Matestack UI to your existing Rails application: [Installation Guide](./docs/install)
37
-
38
- ### Features:
39
-
40
- #### Define your UI in a Ruby Class
41
- ```ruby
42
- class Pages::MyPage < Matestack::Ui::Page
43
-
44
- def prepare
45
- @technologies = ["Rails", "Vue.js", "Trailblazer", "RSpec", "Capybara"]
46
- end
47
-
48
- def response
49
- components{
50
- div id: "technologies" do
51
- @technologies.each do |technology|
52
- plain "matestack uses #{technology}"
53
- end
54
- end
55
- }
56
- end
57
-
58
- end
59
- ```
60
- #### Create a Single Page Application without JavaScript
61
-
62
- ```ruby
63
- class Apps::MyApp < Matestack::Ui::App
64
-
65
- def response
66
- components{
67
- header do
68
- heading size: 1, text: "My App"
69
- end
70
- nav do
71
- transition path: :my_first_page_path do
72
- button text: "Page 1"
73
- end
74
- transition path: :my_second_page_path do
75
- button text: "Page 2"
76
- end
77
- end
78
- main do
79
- page_content #pages are dynamically yielded here, when buttons are clicked!
80
- end
81
- footer do
82
- plain "That's it!"
83
- end
84
- }
85
- end
86
-
87
- end
88
- ```
89
-
90
- ```ruby
91
- class Pages::MyApp::MyFirstPage < Matestack::Ui::Page
92
-
93
- def response
94
- components{
95
- div id: "div-on-page-1" do
96
- plain "My First Page"
97
- end
98
- }
99
- end
100
-
101
- end
102
- ```
103
- ```ruby
104
- class Pages::MyApp::MySecondPage < Matestack::Ui::Page
105
-
106
- def response
107
- components{
108
- div id: "div-on-page-2" do
109
- plain "My Second Page"
110
- end
111
- }
112
- end
113
-
114
- end
115
- ```
116
- #### Handle User Interaction dynamically without JavaScript
117
- ```ruby
118
- class Pages::MyPage < Matestack::Ui::Page
119
-
120
- def response
121
- components {
122
- action my_action_config do
123
- button text: "Click me!"
124
- end
125
- #content gets rerendered without page reload if action succeeded
126
- async rerender_on: "my_action_succeeded" do
127
- div id: "my-div" do
128
- plain DateTime.now
129
- end
130
- end
131
- }
132
- end
133
-
134
- def my_action_config
135
- {
136
- method: :post,
137
- path: :some_rails_routing_path,
138
- success: {
139
- emit: "my_action_succeeded"
140
- }
141
- }
142
- end
143
-
144
- end
145
- ```
146
- #### Handle User Input dynamically without JavaScript
147
- ```ruby
148
- class Pages::MyApp::MyFirstPage < Matestack::Ui::Page
149
-
150
- def prepare
151
- @my_model = MyModel.new
152
- end
153
-
154
- def response
155
- components {
156
- form my_form_config, :include do
157
- form_input key: :some_model_attribute, type: :text
158
- form_submit do
159
- button text: "Submit me!"
160
- end
161
- end
162
- async show_on: "form_has_errors", hide_after: 5000 do
163
- plain "Data could not be submitted, please check form"
164
- end
165
- }
166
- end
167
-
168
- def my_form_config
169
- {
170
- for: @my_model,
171
- method: :post,
172
- path: :some_action_path,
173
- success: {
174
- transition: {
175
- path: :my_second_page_path,
176
- }
177
- },
178
- failure: {
179
- emit: "form_has_errors"
180
- }
181
- }
182
- end
183
-
184
- end
185
- ```
186
- #### Websocket Integration without JavaScript
187
- ```ruby
188
- class Pages::MyPage < Matestack::Ui::Page
189
-
190
- def prepare
191
- @comments = Comment.last(5)
192
- end
193
-
194
- def response
195
- components {
196
- #content gets rerendered without page reload when
197
- #websocket event is received
198
- async rerender_on: "comments_changed" do
199
- @comments.each do |comment|
200
- div do
201
- plain comment.content
202
- end
203
- end
204
- end
205
- }
206
- end
207
-
208
- end
209
- ```
210
- somewhere else on the backend:
211
-
212
- ```ruby
213
- ActionCable.server.broadcast("matestack_ui_core", {
214
- message: "comments_changed"
215
- })
216
- ```
217
-
218
- ### Documentation
219
-
220
- Documentation can be found [here](https://www.matestack.org/docs/install)
221
-
222
- ### Changelog
30
+ ## Features
223
31
 
224
- Changelog can be found [here](./CHANGELOG.md)
32
+ Please have a look at our [landingpage](https://www.matestack.io), presenting the main features of `matestack-ui-core`
225
33
 
226
- ### Roadmap
34
+ ## Documentation/Installation
35
+
36
+ Documentation can be found [here](https://docs.matestack.io/docs/guides/install)
37
+
38
+ ## Changelog
39
+
40
+ Changelog can be found [here](./CHANGELOG.md)
227
41
 
228
- In order to see what we planned to add and release the upcoming months, just have a look at our future [milestones](https://github.com/basemate/matestack-ui-core/milestones) and get in touch via our [chat](https://gitter.im/basemate/community) for feedback! The upcoming issues and feature requests will be added to one of these milestones regarding priority and implementation effort.
229
42
 
230
- ### Community
43
+ ## Community
231
44
 
232
45
  As a low-barrier feedback channel for our early users, we have set up a Gitter chat that can be found [here](https://gitter.im/basemate/community). You are very welcome to ask questions and send us feedback there!
233
46
 
234
- ### Contribution
47
+ ## Contribution
235
48
 
236
- We are happy to accept contributors of any kind. Please refer to the [Contribution Guide](./docs/contribute)
49
+ We are happy to accept contributors of any kind. Please refer to the [Contribution Guide](https://docs.matestack.io/docs/guides/contribute)
237
50
 
238
- ### License
239
- The gem is available as open source under the terms of the
240
- [MIT License](https://opensource.org/licenses/MIT).
51
+ ## License
52
+ matestack-ui-core is an Open Source project licensed under the terms of the [LGPLv3 license](./LICENSE)
@@ -1,5 +1,5 @@
1
1
  %abbr{@tag_attributes}
2
- - if options[:text].blank? && block_given?
2
+ - if text.blank? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,10 +1,11 @@
1
1
  module Matestack::Ui::Core::Abbr
2
2
  class Abbr < Matestack::Ui::Core::Component::Static
3
- REQUIRED_KEYS = [:title]
3
+ requires :title
4
+ optional :text
4
5
 
5
6
  def setup
6
7
  @tag_attributes.merge!({
7
- "title": options[:title]
8
+ "title": title
8
9
  })
9
10
  end
10
11
 
@@ -1,41 +1,45 @@
1
1
  module Matestack::Ui::Core::Action
2
2
  class Action < Matestack::Ui::Core::Component::Dynamic
3
+ vue_js_component_name 'matestack-ui-core-action'
4
+
5
+ optional :path, :success, :failure, :notify, :confirm,
6
+ method: { as: :action_method }, params: { as: :action_params }
3
7
 
4
8
  def setup
5
9
  @component_config[:action_path] = action_path
6
- @component_config[:method] = options[:method]
7
- @component_config[:success] = options[:success]
8
- unless options[:success].nil?
9
- unless options[:success][:transition].nil?
10
- @component_config[:success][:transition][:path] = transition_path options[:success]
10
+ @component_config[:method] = action_method
11
+ @component_config[:success] = success
12
+ unless success.nil?
13
+ unless success[:transition].nil?
14
+ @component_config[:success][:transition][:path] = transition_path success
11
15
  end
12
- unless options[:success][:redirect].nil?
13
- @component_config[:success][:redirect][:path] = redirect_path options[:success]
16
+ unless success[:redirect].nil?
17
+ @component_config[:success][:redirect][:path] = redirect_path success
14
18
  end
15
19
  end
16
- @component_config[:failure] = options[:failure]
17
- unless options[:failure].nil?
18
- unless options[:failure][:transition].nil?
19
- @component_config[:failure][:transition][:path] = transition_path options[:failure]
20
+ @component_config[:failure] = failure
21
+ unless failure.nil?
22
+ unless failure[:transition].nil?
23
+ @component_config[:failure][:transition][:path] = transition_path failure
20
24
  end
21
- unless options[:failure][:redirect].nil?
22
- @component_config[:failure][:redirect][:path] = redirect_path options[:failure]
25
+ unless failure[:redirect].nil?
26
+ @component_config[:failure][:redirect][:path] = redirect_path failure
23
27
  end
24
28
  end
25
- if options[:notify].nil?
29
+ if notify.nil?
26
30
  @component_config[:notify] = true
27
31
  end
28
- if @component_config[:confirm] = options[:confirm]
29
- @component_config[:confirm_text] = options[:confirm].try(:[], :text) || "Are you sure?"
32
+ if @component_config[:confirm] = confirm
33
+ @component_config[:confirm_text] = confirm.try(:[], :text) || "Are you sure?"
30
34
  end
31
35
  end
32
36
 
33
37
  def action_path
34
38
  begin
35
- if options[:path].is_a?(Symbol)
36
- return ::Rails.application.routes.url_helpers.send(options[:path], options[:params])
39
+ if path.is_a?(Symbol)
40
+ return ::Rails.application.routes.url_helpers.send(path, action_params)
37
41
  else
38
- return options[:path]
42
+ return path
39
43
  end
40
44
  rescue
41
45
  raise "Action path not found"
@@ -1,5 +1,5 @@
1
1
  %address{@tag_attributes}
2
- - if options[:text].nil? && block_given?
2
+ - if text.nil? && block_given?
3
3
  = yield
4
4
  - else
5
- = options[:text]
5
+ = text
@@ -1,5 +1,5 @@
1
1
  module Matestack::Ui::Core::Address
2
2
  class Address < Matestack::Ui::Core::Component::Static
3
-
3
+ optional :text
4
4
  end
5
5
  end
@@ -1,4 +1,3 @@
1
1
  %component{"is": "matestack-ui-core-app", "inline-template": true}
2
- %div{"class": "matestack_app"}
3
- - @cells.each do |key, cell|
4
- = cell.call(:show)
2
+ %div{class: "matestack-app-wrapper"}
3
+ = render_content
@@ -2,6 +2,7 @@ import Vue from 'vue/dist/vue.esm'
2
2
  import VRuntimeTemplate from "v-runtime-template"
3
3
  import Vuex from 'vuex'
4
4
  import isNavigatingToAnotherPage from "./location"
5
+ import matestackEventHub from '../js/event-hub'
5
6
 
6
7
  const componentDef = {
7
8
  props: ['appConfig', 'params'],
@@ -22,7 +23,9 @@ const componentDef = {
22
23
  pathName: self.currentPathName,
23
24
  search: self.currentSearch
24
25
  }, document.location)){
25
- self.$store.dispatch("navigateTo", { url: document.location.pathname + document.location.search, backwards: true } );
26
+ matestackEventHub.$emit("page_loading_triggered", document.location.pathname + document.location.search);
27
+ this.$store.commit('setPageLoading', true);
28
+ self.$store.dispatch("navigateTo", { url: document.location.pathname + document.location.search, backwards: true } );
26
29
  }
27
30
  })
28
31
  },
@@ -1,75 +1,51 @@
1
1
  module Matestack::Ui::Core::App
2
- class App < Trailblazer::Cell
3
-
2
+ # TODO: Similar to page, App doesn't need everything base offers atm
3
+ class App < Matestack::Ui::Core::Component::Base
4
4
  include Matestack::Ui::Core::Cell
5
5
  include Matestack::Ui::Core::ApplicationHelper
6
- include Matestack::Ui::Core::ToCell
6
+ # include Matestack::Ui::Core::ToCell
7
7
  include Matestack::Ui::Core::HasViewContext
8
8
 
9
- view_paths << "#{Matestack::Ui::Core::Engine.root}/app/concepts"
10
-
11
- extend ViewName::Flat
12
-
13
- def self.prefixes
14
- _prefixes = super
15
- modified_prefixes = _prefixes.map do |prefix|
16
- prefix_parts = prefix.split("/")
17
-
18
- if prefix_parts.last.include?(self.name.split("::")[-1].downcase)
19
- prefix_parts[0..-2].join("/")
20
- else
21
- prefix
22
- end
23
-
24
- end
25
-
26
- return modified_prefixes
27
- end
28
-
29
- def self.views_dir
30
- return ""
31
- end
32
-
33
- def initialize(model=nil, options={})
34
- super
35
- @nodes = {}
36
- @cells = {}
37
- @page_block = nil
38
- @page_id = ""
39
- setup
40
- end
41
-
42
- def setup
43
- true
44
- end
9
+ def initialize(page_class, controller_instance, context)
10
+ super(nil, context: context)
45
11
 
46
- def prepare
47
- true
12
+ @page_class = page_class
13
+ @controller_instance = controller_instance
48
14
  end
49
15
 
50
- def show(page_id, page_nodes, &block)
51
- @page_id = page_id
52
- @page_nodes = page_nodes
53
- prepare
54
- response
55
- render(view: :app, &block)
16
+ def show
17
+ render :app
56
18
  end
57
19
 
58
- def page_nodes
59
- @page_nodes
20
+ # Default "response" for just rendering the page without a more
21
+ # sophisticated app being supplied
22
+ def response
23
+ page_content
60
24
  end
61
25
 
62
- def components(&block)
63
- @nodes = Matestack::Ui::Core::AppNode.build(self, &block)
64
-
65
- @nodes.each do |key, node|
66
- @cells[key] = to_cell(key, node["component_name"], node["config"], node["argument"], node["components"], nil, node["cached_params"])
26
+ # new alternative method name to be used in app defentions
27
+ # slots may contain a loading state element will be rendered during form start to finish of a transition
28
+ def yield_page slots: {}
29
+ page_content_wrapper slots: slots do
30
+ add_child @page_class,
31
+ controller_instance: @controller_instance,
32
+ context: context
67
33
  end
68
34
  end
69
35
 
70
- def partial(&block)
71
- Matestack::Ui::Core::AppNode.build(self, &block)
36
+ def page_content slots: {}
37
+ yield_page slots: slots
72
38
  end
73
39
 
40
+
41
+ # def page_content loading_state_element_slot: nil
42
+ # # TODO: Content probably needs/would benefit from a better name - like "DynamicWrapper" ?
43
+ # context[:loading_state_element_slot] = loading_state_element_slot
44
+ # add_child Matestack::Ui::Core::Page::Content, context: context do
45
+ # add_child @page_class,
46
+ # controller_instance: @controller_instance,
47
+ # context: context
48
+ # end
49
+ # end
74
50
  end
75
51
  end