Skip to content

Commit e54f05e

Browse files
Merge branch 'develop' into document_link_param_option
2 parents 87b0c87 + 5b2a975 commit e54f05e

File tree

45 files changed

+608
-289
lines changed

Some content is hidden

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

45 files changed

+608
-289
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ group :development, :test do
3232
gem 'simplecov', require: false, group: :test
3333
gem 'byebug'
3434
gem 'webmock'
35+
gem 'webdrivers', '~> 4.1'
3536
end
3637

3738
group :test do

Gemfile.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ GEM
231231
tzinfo (1.2.5)
232232
thread_safe (~> 0.1)
233233
uber (0.1.0)
234+
webdrivers (4.1.2)
235+
nokogiri (~> 1.6)
236+
rubyzip (~> 1.0)
237+
selenium-webdriver (>= 3.0, < 4.0)
234238
webmock (3.5.1)
235239
addressable (>= 2.3.6)
236240
crack (>= 0.3.2)
@@ -264,6 +268,7 @@ DEPENDENCIES
264268
trailblazer
265269
trailblazer-cells
266270
trailblazer-rails
271+
webdrivers (~> 4.1)
267272
webmock
268273
webpacker (~> 3.5)
269274

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%output{@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::Output
2+
class Output < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!(
5+
name: options[:name],
6+
for: options[:for],
7+
form: options[:form]
8+
)
9+
end
10+
end
11+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%param{@tag_attributes}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Matestack::Ui::Core::Param
2+
class Param < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!({
5+
name: options[:name],
6+
value: options[:value]
7+
})
8+
end
9+
end
10+
end
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
= video_tag(@tag_attributes, ActionController::Base.helpers.asset_path(options[:path]), height: options[:height], width: options[:width], preload: options[:preload], autoplay: options[:autoplay], muted: options[:muted], playsinline: options[:playsinline], loop: options[:loop], controls: options[:controls])
1+
%video{@tag_attributes}
2+
%source{:src => @source, :type => @type}
3+
Your browser does not support the video tag.
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
module Matestack::Ui::Core::Video
22
class Video < Matestack::Ui::Core::Component::Static
33

4-
REQUIRED_KEYS = [:path]
4+
REQUIRED_KEYS = [:path, :type]
5+
6+
def setup
7+
@tag_attributes.merge!({
8+
autoplay: options[:autoplay],
9+
controls: options[:controls],
10+
height: options[:height],
11+
loop: options[:loop],
12+
muted: options[:muted],
13+
playsinline: options[:playsinline],
14+
preload: options[:preload],
15+
width: options[:width]
16+
})
17+
18+
@source = ActionController::Base.helpers.asset_path(options[:path])
19+
@type = "video/#{@options[:type]}"
20+
end
521

622
end
723
end

docs/components/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ You can build your [own components](/docs/extend/custom_components.md) as well,
3434
- [button](/docs/components/button.md)
3535
- [link](/docs/components/link.md)
3636
- [label](/docs/components/label.md)
37+
- [param](/docs/components/param.md)
3738
- [progress](/docs/components/progress.md)
3839
- [ruby](/docs/components/ruby.md)
3940
- [rt](/docs/components/rb.md)
4041
- [rp](/docs/components/rt.md)
4142
- [legend](/docs/components/legend.md)
4243
- [mark](/docs/components/mark.md)
4344
- [noscript](/docs/components/noscript.md)
45+
- [output](/docs/components/output.md)
4446
- [sup](/docs/components/sup.md)
4547
- [sub](/docs/components/sub.md)
4648
- [var](/docs/components/var.md)

docs/components/output.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# matestack core component: Output
2+
3+
Show [specs](/spec/usage/components/output_spec.rb)
4+
5+
The HTML `<output>` tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take up to 5 optional configuration params and either yield content or display what gets passed to the `text` configuration param.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the `<output>` should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the `<output>` should have.
16+
17+
#### # name (optional)
18+
Specifies a name for the `<output>` element
19+
20+
#### # for (optional)
21+
Specifies the relationship between the result of the calculation, and the elements used in the calculation
22+
23+
#### # form (optional)
24+
Specifies one or more forms the `<output>` element belongs to
25+
26+
## Example 1:
27+
28+
```ruby
29+
output name: 'x', for: 'a b', text: ''
30+
```
31+
32+
returns
33+
34+
```html
35+
<output for="a b" name="x"></output>
36+
```
37+
38+
## Example 2:
39+
40+
```ruby
41+
output id: 'my-id', class: 'my-class', name: 'x', for: 'a b', form: 'form_id' do
42+
plain 'All attributes'
43+
end
44+
```
45+
46+
returns
47+
48+
```html
49+
<output for="a b" form="form_id" id="my-id" name="x" class="my-class">
50+
All attributes
51+
</output>
52+
```

docs/components/param.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# matestack core component: Param
2+
3+
Show [specs](/spec/usage/components/param_spec.rb)
4+
5+
The HTML `<param>` tag implemented in ruby.
6+
7+
## Parameters
8+
9+
This component can take 4 optional configuration params.
10+
11+
#### # id (optional)
12+
Expects a string with all ids the `<param>` should have.
13+
14+
#### # class (optional)
15+
Expects a string with all classes the `<param>` should have.
16+
17+
#### # name (optional)
18+
Specifies the name of a parameter.
19+
20+
#### # value (optional)
21+
Specifies the value of the parameter
22+
23+
24+
## Example 1:
25+
26+
```ruby
27+
param name: 'autoplay', value: 'true'
28+
```
29+
30+
returns
31+
32+
```html
33+
<param name="autoplay" value="true">
34+
```
35+
36+
## Example 2:
37+
38+
```ruby
39+
param name: 'autoplay', value: 'true', id: 'my-id', class: 'my-class'
40+
```
41+
42+
returns
43+
44+
```html
45+
<param id="my-id" name="autoplay" value="true" class="my-class">
46+
```

docs/components/video.md

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,56 @@
22

33
Show [specs](/spec/usage/components/video_spec.rb)
44

5-
The HTML video tag implemented in ruby.
5+
The HTML video tag implemented in Ruby.
66

77
## Parameters
8-
The video tag takes a mandatory path argument and can take a number of optional configuration params.
8+
The video component takes mandatory path and type arguments and can take a number of optional configuration params.
99

10-
#### # path
11-
Expects a string with the source to the video. It looks for the video in the `assets/videos` folder and uses the standard Rails asset pipeline.
10+
#### # autoplay (optional)
11+
Expects a boolean and specifies whether the video should start playing as soon as it is ready.
1212

13-
#### # id, class
14-
Like most of the core components, you can give a video an id and a class.
13+
#### # controls (optional)
14+
Expects a boolean and specifies whether the video controls (play/pause button etc) should be displayed.
1515

1616
#### # height (optional)
1717
Expects an integer with the height of the video in px.
1818

19-
#### # width (optional)
20-
Expects an integer with the width of the video in px.
19+
#### # id, class (optional)
20+
Like most of the core components, you can give a video an id and a class.
2121

22-
#### # alt (optional)
23-
Expects a string with the alt text the video should have.
22+
#### # loop (optional)
23+
Expects a boolean and specifies whether the video will start over again every time it is finished.
2424

25-
#### # preload
26-
Expects a string (`auto`, `metadata` or `none`) and specifies whether the whole video/only metadata/nothing should be loaded on pageload. Default (if not specified) depends on the client's browser.
25+
#### # muted (optional)
26+
Expects a boolean and specifies whether the audio output of the video should be muted.
2727

28-
#### # autoplay
29-
Expects a boolean and specifies whether the video should start playing as soon as it is ready.
28+
#### # path
29+
Expects a string with the source to the video. It looks for the video in the `assets/videos` folder and uses the standard Rails asset pipeline.
3030

31-
#### # muted
32-
Expects a boolean and specifies whether the audio output of the video should be muted.
31+
#### # type
32+
Expects a string with the type to the video.
3333

34-
#### # playsinline
34+
#### # playsinline (optional)
3535
Expects a boolean and specifies whether the video should be played inline on iOS Safari.
3636

37-
#### # loop
38-
Expects a boolean and specifies whether the video will start over again every time it is finished.
37+
#### # preload (optional)
38+
Expects a string (`auto`, `metadata` or `none`) and specifies whether the whole video/only metadata/nothing should be loaded on pageload. Default (if not specified) depends on the client's browser.
3939

40-
#### # controls
41-
Expects a boolean and specifies whether the video controls (play/pause button etc) should be displayed.
40+
#### # width (optional)
41+
Expects an integer with the width of the video in px.
42+
43+
## Example
44+
45+
46+
```ruby
47+
video path: 'corgi.mp4', type: "mp4", width: 500, height: 300
48+
```
49+
50+
returns
51+
52+
```HTML
53+
<video height='300' width='500'>
54+
<source src='/assets/corgi-[...].mp4' type='video/mp4'>
55+
Your browser does not support the video tag.
56+
</video>
57+
```

docs/contribute/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ bundle exec rspec
5555

5656
Tests follow quite the same rules as the documentation: Make sure to either add relevant tests (when introducing new concepts or components) or change existing ones to fit your changes (updating existing concepts and components). Pull requests that add/change concepts & components and do not come with corresponding tests will not be approved.
5757

58+
### Note: Running tests on macOS
59+
60+
Make sure you have installed `chromedriver` on your machine. You can install `chromedriver` via `brew` with
61+
62+
```shell
63+
brew cask install chromedriver
64+
```
65+
66+
You can then run your the testsuite with `bundle exec rspec`.
67+
68+
If you get an error about a version mismatch similar to this one:
69+
70+
`Chrome version must be between X and Y (Driver info: chromedriver=X.Y.Z)`
71+
72+
Make sure you update your chromedriver by executing this command in the project root:
73+
74+
```shell
75+
rails app:webdrivers:chromedriver:update
76+
```
77+
5878
## Release
5979

6080
Webpacker is used for managing all JS assets. In order to deploy a packed JS, we use a "builder" app found in `repo_root/builder`. This builder app uses a symlink in order to reference the actual core found in `builder/vendor`.

docs/tooling/generators/matestack_app_generator.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ Generates matestack apps to `app/matestack/apps`.
1313
## Example 1
1414

1515
```bash
16-
rails generate matestack_app example_app
16+
rails generate matestack:app example_app
1717
```
1818

1919
Creates an ExampleApp in `app/matestack/apps/example_app.rb`.
2020

2121
## Example 2
2222

2323
```bash
24-
rails generate matestack_app simple_app --all_inclusive
24+
rails generate matestack:app simple_app --all_inclusive
2525
```
2626

2727
Creates:
@@ -32,5 +32,5 @@ Creates:
3232

3333
To see all options, run
3434
```bash
35-
rails generate matestack_app -h
35+
rails generate matestack:app -h
3636
```

docs/tooling/generators/matestack_component_generator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ Generates matestack components to `app/matestack/components`.
1717
## Example
1818

1919
```bash
20-
rails generate matestack_component simple_component
20+
rails generate matestack:component simple_component
2121
```
2222

2323
Creates a SimpleComponent in `app/matestack/components/simple_component.rb`.
2424

2525
To see all options, run
2626
```bash
27-
rails generate matestack_component -h
27+
rails generate matestack:component -h
2828
```

docs/tooling/generators/matestack_page_generator.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Generates matestack pages to `app/matestack/pages`.
1717
## Example 1
1818

1919
```bash
20-
rails generate matestack_page simple_page --app_name example_app
20+
rails generate matestack:page simple_page --app_name example_app
2121
```
2222

2323
Creates a SimplePage in `app/matestack/pages/example_app/simple_page.rb`.
@@ -33,7 +33,7 @@ in the terminal to use in your controller.
3333
## Example 2
3434

3535
```bash
36-
rails generate matestack_page second_page --app_name example_app --namespace sample_namespace
36+
rails generate matestack:page second_page --app_name example_app --namespace sample_namespace
3737
```
3838

3939
Creates a SimplePage in `app/matestack/pages/example_app/sample_namespace/second_page.rb`.
@@ -48,5 +48,5 @@ in the terminal to use in your, e.g., `example_app_controller.rb`.
4848

4949
To see all options, run
5050
```bash
51-
rails generate matestack_page -h
51+
rails generate matestack:page -h
5252
```

lib/generators/matestack/app/USAGE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Description:
2+
Stubs out a new matestack app. Pass the app name under_scored.
3+
4+
If you want so, pass the option '--all_inclusive' to also create
5+
a corresponding matestack example_page, a controller, its action
6+
and the route in 'config/routes.rb'.
7+
8+
Example 1:
9+
`rails generate matestack:app example_app`
10+
11+
This will create:
12+
app/matestack/apps/example_app.rb
13+
14+
Example 2:
15+
`rails generate matestack:app example_app --all_inclusive`
16+
17+
This will create:
18+
app/matestack/apps/example_app.rb
19+
app/matestack/pages/example_app/example_page.rb
20+
app/controllers/example_app_controller.rb
21+
route get 'example_app/example_page', to: 'example_app#example_page'

0 commit comments

Comments
 (0)