Skip to content

Commit b438fda

Browse files
committed
Merge branch 'develop' into sf/action-confirm-option-issue-257
2 parents 3e3a6c4 + b58de2e commit b438fda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1687
-18
lines changed

Gemfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ gemspec
1111
# Git. Remember to move these dependencies to your gemspec before releasing
1212
# your gem to rubygems.org.
1313

14-
# To use a debugger
15-
# gem 'byebug', group: [:development, :test]
16-
# gem 'pry-byebug', group: [:development, :test]
17-
1814
gem "trailblazer"
1915
gem "trailblazer-rails"
2016
gem "trailblazer-cells"
@@ -31,6 +27,7 @@ group :development, :test do
3127
gem 'puma'
3228
gem 'simplecov', require: false, group: :test
3329
gem 'byebug'
30+
# gem 'pry-byebug'
3431
gem 'webmock'
3532
gem 'webdrivers', '~> 4.1'
3633
end

Gemfile.lock

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
matestack-ui-core (0.7.2.1)
4+
matestack-ui-core (0.7.3)
55
cells-haml
66
cells-rails
77
haml
@@ -84,7 +84,7 @@ GEM
8484
concurrent-ruby (1.1.5)
8585
crack (0.4.3)
8686
safe_yaml (~> 1.0.0)
87-
crass (1.0.4)
87+
crass (1.0.5)
8888
declarative (0.0.10)
8989
declarative-builder (0.1.0)
9090
declarative-option (< 0.2.0)
@@ -111,7 +111,7 @@ GEM
111111
i18n (1.6.0)
112112
concurrent-ruby (~> 1.0)
113113
json (2.1.0)
114-
loofah (2.2.3)
114+
loofah (2.3.1)
115115
crass (~> 1.0.2)
116116
nokogiri (>= 1.5.9)
117117
mail (2.7.1)
@@ -124,16 +124,17 @@ GEM
124124
mini_portile2 (2.4.0)
125125
minitest (5.11.3)
126126
nio4r (2.5.2)
127-
nokogiri (1.10.4)
127+
nokogiri (1.10.5)
128128
mini_portile2 (~> 2.4.0)
129129
pipetree (0.1.1)
130130
poltergeist (1.18.1)
131131
capybara (>= 2.1, < 4)
132132
cliver (~> 0.3.1)
133133
websocket-driver (>= 0.2.0)
134134
public_suffix (3.0.3)
135-
puma (3.12.0)
136-
rack (2.0.7)
135+
puma (4.3.1)
136+
nio4r (~> 2.0)
137+
rack (2.0.8)
137138
rack-proxy (0.6.5)
138139
rack
139140
rack-test (1.1.0)
@@ -191,7 +192,7 @@ GEM
191192
rspec-mocks (~> 3.8.0)
192193
rspec-support (~> 3.8.0)
193194
rspec-support (3.8.0)
194-
rubyzip (1.2.2)
195+
rubyzip (1.3.0)
195196
safe_yaml (1.0.5)
196197
selenium-webdriver (3.14.1)
197198
childprocess (~> 0.5)
@@ -201,7 +202,7 @@ GEM
201202
json (>= 1.8, < 3)
202203
simplecov-html (~> 0.10.0)
203204
simplecov-html (0.10.2)
204-
sprockets (3.7.2)
205+
sprockets (4.0.0)
205206
concurrent-ruby (~> 1.0)
206207
rack (> 1, < 3)
207208
sprockets-rails (3.2.1)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Click here to see how you can add Matestack UI to your existing Rails applicatio
4242
class Pages::MyPage < Matestack::Ui::Page
4343

4444
def prepare
45-
@technologies = ["Rails", "Vue.js", "Trailblazer", "Rspec", "Capybara"]
45+
@technologies = ["Rails", "Vue.js", "Trailblazer", "RSpec", "Capybara"]
4646
end
4747

4848
def response

app/concepts/matestack/ui/core/action/action.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,27 @@ const componentDef = {
3030
if (self.componentConfig["success"] != undefined && self.componentConfig["success"]["emit"] != undefined) {
3131
matestackEventHub.$emit(self.componentConfig["success"]["emit"], response.data);
3232
}
33-
if (self.componentConfig["success"] != undefined && self.componentConfig["success"]["transition"] != undefined && self.$store != undefined) {
33+
if (self.componentConfig["success"] != undefined
34+
&& self.componentConfig["success"]["transition"] != undefined
35+
&& (
36+
self.componentConfig["success"]["transition"]["follow_response"] == undefined
37+
||
38+
self.componentConfig["success"]["transition"]["follow_response"] === false
39+
)
40+
&& self.$store != undefined
41+
) {
3442
let path = self.componentConfig["success"]["transition"]["path"]
3543
self.$store.dispatch('navigateTo', {url: path, backwards: false})
44+
return;
45+
}
46+
if (self.componentConfig["success"] != undefined
47+
&& self.componentConfig["success"]["transition"] != undefined
48+
&& self.componentConfig["success"]["transition"]["follow_response"] === true
49+
&& self.$store != undefined
50+
) {
51+
let path = response.data["transition_to"] || response.request.responseURL;
52+
self.$store.dispatch('navigateTo', {url: path, backwards: false});
53+
return;
3654
}
3755
})
3856
.catch(function(error){
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%bdi{@tag_attributes}
2+
- if options[:text].blank? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Matestack::Ui::Core::Bdi
2+
class Bdi < Matestack::Ui::Core::Component::Static
3+
end
4+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%bdo{@tag_attributes}
2+
- if options[:text].blank? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module Matestack::Ui::Core::Bdo
2+
class Bdo < Matestack::Ui::Core::Component::Static
3+
REQUIRED_KEYS = [:dir]
4+
5+
def setup
6+
@tag_attributes.merge!({
7+
"dir": options[:dir]
8+
})
9+
end
10+
end
11+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%data{@tag_attributes}
2+
- if options[:text].blank? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Matestack::Ui::Core::Data
2+
class Data < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!({
5+
"value": options[:value] ||= nil
6+
})
7+
end
8+
end
9+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%del{@tag_attributes.merge({:cite => options[:cite], :datetime => options[:datetime]})}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Matestack::Ui::Core::Del
2+
class Del < Matestack::Ui::Core::Component::Static
3+
end
4+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%dfn{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Matestack::Ui::Core::Dfn
2+
class Dfn < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end
6+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%dialog{@tag_attributes}
2+
- if options[:text].blank? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Matestack::Ui::Core::Dialog
2+
class Dialog < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!({
5+
"open": options[:open] ||= nil
6+
})
7+
end
8+
end
9+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%iframe{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Matestack::Ui::Core::Iframe
2+
class Iframe < Matestack::Ui::Core::Component::Static
3+
4+
def setup
5+
@tag_attributes.merge!({
6+
src: options[:src],
7+
height: options[:height],
8+
width: options[:width],
9+
srcdoc: options[:srcdoc]
10+
})
11+
end
12+
13+
end
14+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%optgroup{@tag_attributes}
2+
- if block_given?
3+
= yield
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Matestack::Ui::Core::Optgroup
2+
class Optgroup < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!(
5+
disabled: options[:disabled] ||= nil,
6+
label: options[:label]
7+
)
8+
end
9+
end
10+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%option{@tag_attributes}
2+
- if options[:text].blank? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module Matestack::Ui::Core::Option
2+
class Option < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!(
5+
disabled: options[:disabled] ||= nil,
6+
selected: options[:selected] ||= nil,
7+
label: options[:label],
8+
value: options[:value]
9+
)
10+
end
11+
end
12+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%picture{@tag_attributes}
2+
- if block_given?
3+
= yield
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Matestack::Ui::Core::Picture
2+
class Picture < Matestack::Ui::Core::Component::Static
3+
end
4+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%samp{@tag_attributes}
2+
- if options[:text].blank? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Matestack::Ui::Core::Samp
2+
class Samp < Matestack::Ui::Core::Component::Static
3+
end
4+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%u{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]

app/concepts/matestack/ui/core/u/u.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Matestack::Ui::Core::U
2+
class U < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end
6+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%wbr{@tag_attributes}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Matestack::Ui::Core::Wbr
2+
class Wbr < Matestack::Ui::Core::Component::Static
3+
end
4+
end

docs/components/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ You can build your [own components](/docs/extend/README.md) as well, both static
1212
- [article](/docs/components/article.md)
1313
- [aside](/docs/components/aside.md)
1414
- [b](/docs/components/b.md)
15+
- [bdi](/docs/components/bdi.md)
16+
- [bdi](/docs/components/bdo.md)
1517
- [blockquote](/docs/components/blockquote.md)
1618
- [br](/docs/components/br.md)
1719
- [button](/docs/components/button.md)
1820
- [caption](/docs/components/caption.md)
1921
- [cite](/docs/components/cite.md)
2022
- [code](/docs/components/code.md)
23+
- [data](/docs/components/data.md)
24+
- [dfn](/docs/components/dfn.md)
2125
- [dl](/docs/components/dl.md)
2226
- dd
2327
- dt
28+
- [dialog](/docs/components/dialog.md)
2429
- [div](/docs/components/div.md)
2530
- [em](/docs/components/em.md)
2631
- [fieldset](/docs/components/fieldset.md)
@@ -47,10 +52,13 @@ You can build your [own components](/docs/extend/README.md) as well, both static
4752
- [nav](/docs/components/nav.md)
4853
- [noscript](/docs/components/noscript.md)
4954
- [object](/docs/components/object.md)
55+
- [optgroup](/docs/components/optgroup.md)
56+
- [option](/docs/components/option.md)
5057
- [output](/docs/components/output.md)
5158
- [paragraph](/docs/components/paragraph.md)
5259
- [param](/docs/components/param.md)
5360
- [pg](/docs/components/pg.md)
61+
- [picture](/docs/components/picture.md)
5462
- [plain](/docs/components/plain.md)
5563
- [pre](/docs/components/pre.md)
5664
- [progress](/docs/components/progress.md)
@@ -59,6 +67,7 @@ You can build your [own components](/docs/extend/README.md) as well, both static
5967
- [rt](/docs/components/rt.md)
6068
- [ruby](/docs/components/ruby.md)
6169
- [s](/docs/components/s.md)
70+
- [samp](/docs/components/samp.md)
6271
- [section](/docs/components/section.md)
6372
- [small](/docs/components/small.md)
6473
- [span](/docs/components/span.md)
@@ -69,9 +78,11 @@ You can build your [own components](/docs/extend/README.md) as well, both static
6978
- th
7079
- tr
7180
- td
81+
- [u](/docs/components/u.md)
7282
- [var](/docs/components/var.md)
7383
- [video](/docs/components/video.md)
7484
- [youtube](/docs/components/youtube.md)
85+
- [wbr](/docs/components/wbr.md)
7586

7687
## Dynamic Core Components
7788

docs/components/action.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,33 @@ success: {
7878
}
7979
```
8080

81+
When the server redirects to a url, for example after creating a new record, the transition needs to be configured to follow this redirect of the server response.
82+
83+
```ruby
84+
success: {
85+
emit: 'my_action_success',
86+
transition: {
87+
follow_response: true
88+
}
89+
}
90+
```
91+
92+
A controller action that would create a record and then respond with the url the page should transition to, could look like this:
93+
94+
```ruby
95+
class TestModelsController < ApplicationController
96+
include Matestack::Ui::Core::ApplicationHelper
97+
98+
def create
99+
@test_model = TestModel.create(test_model_params)
100+
101+
render json: {
102+
transition_to: test_model_path(@test_model)
103+
}, status: :ok
104+
end
105+
end
106+
```
107+
81108
### Failure
82109

83110
As counterpart to the success part of the action component, there is also the possibility to define the failure behavior. This is what gets triggered after the response to our action returns a failure code, usually in the range of `400` or `500` HTTP status codes.

0 commit comments

Comments
 (0)