turbo_modal 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1a0c324d77710010d3d592e4c12f4978aebe32db754dcd6b9b9ca98c2de0d8d
4
- data.tar.gz: '028ea286edf98dda94c3eab35135fb9f7a9052793cd46864f7a654f1e30934d8'
3
+ metadata.gz: 486a73b0741ef4b281dccae887aaafbddb19e523fb1af08004cc5f5a89512b2a
4
+ data.tar.gz: a447a48602b34351111934c794bcea834af6913aed49e12555e1bbe4d29f9b08
5
5
  SHA512:
6
- metadata.gz: b40bde5c79717d35e361292ec4a1bee89ccae813891656352cb47220110c1fe39e16885627821a9e56bb836343489ba4c1dd97efab71143f322761517b3b7710
7
- data.tar.gz: 140066b0316bdd7e8ce3a69f3bc349395cae2b38e34a4dc64d500fd175147e9821fa4c5110792ca4e756d0572f7e861ad6f7548297e65364d551e12bf8e0a198
6
+ metadata.gz: b642136bf41429454a2b03229cba52923608162822d1627ac5b08bbe9e5ef62e14e3f038e6bd040ada635c785949ec8c6be195aee5204096ee272e05c9fae53e
7
+ data.tar.gz: fce574173273f78864d6a3a97ab2711479b9d06da63aca5d4278ce736f1e7196247c9c852532245161eafde46c4e8d4b1db241ca48c8828ba290da7b6de6aabe
data/README.md CHANGED
@@ -1,28 +1,57 @@
1
1
  # TurboModal
2
- Short description and motivation.
2
+ Turbo Frame driven modal
3
3
 
4
4
  ## Usage
5
- How to use my plugin.
5
+ Add the following to the body tag to link controllers required to trigger scrim + modal transitions
6
+ ```html
7
+ <body data-controller="scrim modal" data-action="hide-scrim@window->scrim#hide show-scrim@window->show"></body>
8
+ ```
6
9
 
7
- ## Installation
8
- Add this line to your application's Gemfile:
10
+ Turbo modal provides helpers to add a basic scrim and modal target frame. These should be placed inside the body:
11
+ ```html
12
+ <body data-controller="scrim modal" data-action="hide-scrim@window->scrim#hide show-scrim@window->show">
13
+ <%= scrim_tag %>
14
+ <%= modal_tag %>
15
+ </body>
16
+ ```
9
17
 
10
- ```ruby
11
- gem 'turbo_modal'
18
+ ###Import tubo_modal styles
19
+ ```css
20
+ /* application.css */
21
+
22
+ @import "~@katalyst-interactive/turbo_modal";
12
23
  ```
13
24
 
14
- And then execute:
15
- ```bash
16
- $ bundle
25
+ To get a modal displaying you will need 2 things:
26
+ 1. A `modal_link`
27
+ 2. Some `modal_content`
28
+
29
+ `modal_link`'s are similar to a `link_to` in rails but it will point the path of the link to target the modal turbo frame.
30
+ The resulting path will need to wrap some content in a `modal_content` helper tag.
31
+
32
+ eg:
33
+ ```html
34
+ <!-- app/views/homepage/index.html.erb -->
35
+ <%= modal_link "click to open modal", modal_path("example") %>
17
36
  ```
18
37
 
19
- Or install it yourself as:
38
+ ```html
39
+ <!-- app/views/modals/show.html.erb -->
40
+ <%= modal_content do %>
41
+ <div>
42
+ <h1>Modal title</h1>
43
+ </div>
44
+ <% end %>
45
+ ```
46
+
47
+ ## Installation
48
+ Run these commands:
20
49
  ```bash
21
- $ gem install turbo_modal
50
+ $ bundle add 'turbo_modal'
51
+ $ rails turbo_modal:install
22
52
  ```
23
53
 
24
- ## Contributing
25
- Contribution directions go here.
54
+ `rails turbo_modal:install` will add the `turbo_modal` npm packages required. It also sets up stimulus and turbo packages.
26
55
 
27
56
  ## License
28
57
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -12,7 +12,7 @@ def stimulus_installed?
12
12
  end
13
13
 
14
14
  def switch_on_stimulus
15
- system "yarn add stimulus@2.0.0"
15
+ Rake::Task["webpacker:install:stimulus"].invoke
16
16
  end
17
17
 
18
18
  def switch_on_turbo
@@ -1,3 +1,3 @@
1
1
  module TurboModal
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_modal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Cornthwaite