futurism 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -11
- data/lib/futurism/helpers.rb +3 -2
- data/lib/futurism/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a13955e5c2902320a9eb601cd12058c16782a4002ec2c05ca1dff9eddd3190
|
4
|
+
data.tar.gz: 636b6c0b298bb686600026d5f065190e2c94edec85a25c0afa715891841c0b38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee386095ed1c02325e6eea34b0f8a85e67709a0a4b17d5705de035cf7bac667487687a99135654f15bc24f202b81af9d6320d70b61c296279e6c8bc437fc9d96
|
7
|
+
data.tar.gz: 8e73598941f69c36aac9e2b53536369e1cb689a50e76986692c37cc04fca2d253abe7dfb7b3416fa657f0bdbc29f7d34aac4920ec5b9ecff3ce44f4368e672c6
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Futurism
|
2
2
|
[![Twitter follow](https://img.shields.io/twitter/follow/julian_rubisch?style=social)](https://twitter.com/julian_rubisch)
|
3
3
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
4
|
-
[![All Contributors](https://img.shields.io/badge/all_contributors-
|
4
|
+
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
|
5
5
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
6
6
|
Lazy-load Rails partials via CableReady
|
7
7
|
|
@@ -93,6 +93,16 @@ You can also use the shorthand syntax:
|
|
93
93
|
<% end %>
|
94
94
|
```
|
95
95
|
|
96
|
+
#### Collections
|
97
|
+
|
98
|
+
Collection rendering is also possible:
|
99
|
+
|
100
|
+
```erb
|
101
|
+
<%= futurize partial: "items/card", collection: @cards, extends: :div do %>
|
102
|
+
<div class="spinner"></div>
|
103
|
+
<% end %>
|
104
|
+
```
|
105
|
+
|
96
106
|
### HTML Options
|
97
107
|
|
98
108
|
You can pass a hash of attribute/value pairs which will be mixed into the HTML markup for the placeholder element. This is important for layouts that require elements to have dimensionality. For example, many scripts calculate size based on element height and width. This option ensures that your elements have integrity, even if they are gone before you see them.
|
@@ -111,16 +121,6 @@ This will output the following:
|
|
111
121
|
</tr>
|
112
122
|
```
|
113
123
|
|
114
|
-
#### Collections
|
115
|
-
|
116
|
-
Collection rendering is also possible:
|
117
|
-
|
118
|
-
```erb
|
119
|
-
<%= futurize partial: "items/card", collection: @cards, extends: :div do %>
|
120
|
-
<div class="spinner"></div>
|
121
|
-
<% end %>
|
122
|
-
```
|
123
|
-
|
124
124
|
## Events
|
125
125
|
|
126
126
|
Once your futurize element has been rendered, the `futurize:appeared` custom event will be called.
|
@@ -187,6 +187,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
187
187
|
</tr>
|
188
188
|
<tr>
|
189
189
|
<td align="center"><a href="http://fractaledmind.com"><img src="https://avatars3.githubusercontent.com/u/5077225?v=4" width="100px;" alt=""/><br /><sub><b>Stephen Margheim</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/commits?author=fractaledmind" title="Code">💻</a></td>
|
190
|
+
<td align="center"><a href="http://hass.codes"><img src="https://avatars2.githubusercontent.com/u/1064205?v=4" width="100px;" alt=""/><br /><sub><b>Hassanin Ahmed</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/commits?author=sas1ni69" title="Code">💻</a></td>
|
191
|
+
<td align="center"><a href="https://marcoroth.dev"><img src="https://avatars2.githubusercontent.com/u/6411752?v=4" width="100px;" alt=""/><br /><sub><b>Marco Roth</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/commits?author=marcoroth" title="Code">💻</a></td>
|
190
192
|
</tr>
|
191
193
|
</table>
|
192
194
|
|
data/lib/futurism/helpers.rb
CHANGED
@@ -17,9 +17,10 @@ module Futurism
|
|
17
17
|
if collection.nil?
|
18
18
|
render_element(extends: extends, placeholder: placeholder, options: options)
|
19
19
|
else
|
20
|
-
collection_class_name = collection.
|
20
|
+
collection_class_name = collection.klass.name
|
21
|
+
as = options.delete(:as) || collection_class_name.downcase
|
21
22
|
collection.map { |record|
|
22
|
-
render_element(extends: extends, placeholder: placeholder, options: options.
|
23
|
+
render_element(extends: extends, placeholder: placeholder, options: options.deep_merge(locals: {as.to_sym => record}))
|
23
24
|
}.join.html_safe
|
24
25
|
end
|
25
26
|
end
|
data/lib/futurism/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: futurism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Rubisch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|