showcase 0.2.0.beta.2 → 0.2.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -8
- data/lib/showcase/traits/share.rb +2 -1
- data/lib/showcase/version.rb +1 -1
- data/spec/traits/share_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d6a631420d19d2a548cdf36d56577c48ae24930
|
4
|
+
data.tar.gz: bd24f9fc93109defc060e10b88d2dc2c57980a6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df878541e87c19106087fa2f1a8eb7610fca82637b6e7ed13e056a98284fafbb55ec428e9922c0b16d9e9404b8e95a8c543595f0ba9a179472376b76a6a3a4dc
|
7
|
+
data.tar.gz: 2075e6deb475f90d8f4f215478e2b027af35def0f9abb5fc10a4e2f26d068a78957457009a3f4d7877331517a9cdf5a121064d37270c75455b9119a5d4fad82c
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
A simple (< 100 lines of code) but powerful exhibit/presenter implementation.
|
4
4
|
It's framework agnostic: works with Rails, Padrino or just Sinatra.
|
5
5
|
|
6
|
-
Since version 0.2.0 Showcase is bundled with [a set of "traits"](https://github.com/stefanoverna/showcase#traits)
|
6
|
+
Since version 0.2.0 Showcase is bundled with [a set of optional "traits"](https://github.com/stefanoverna/showcase#traits)
|
7
7
|
you can pick and choose to augment your presenters with additional sugar
|
8
8
|
(available in Rails 3+ only).
|
9
9
|
|
@@ -15,15 +15,21 @@ See [Avdi's Exhibits introductory post](http://devblog.avdi.org/2012/06/04/displ
|
|
15
15
|
|
16
16
|
Add this line to your application's Gemfile:
|
17
17
|
|
18
|
-
|
18
|
+
```ruby
|
19
|
+
gem 'showcase'
|
20
|
+
```
|
19
21
|
|
20
22
|
And then execute:
|
21
23
|
|
22
|
-
|
24
|
+
```
|
25
|
+
$ bundle
|
26
|
+
```
|
23
27
|
|
24
28
|
Or install it yourself as:
|
25
29
|
|
26
|
-
|
30
|
+
```
|
31
|
+
$ gem install showcase
|
32
|
+
```
|
27
33
|
|
28
34
|
## Usage
|
29
35
|
|
@@ -90,7 +96,7 @@ rails generate showcase:presenter User
|
|
90
96
|
|
91
97
|
Will generate `app/presenters/user_presenter.rb`. If your Rails app has the file
|
92
98
|
`app/presenters/base_presenter.rb`, the newly created presenter will inherit
|
93
|
-
from `BasePresenter` instead of `
|
99
|
+
from `BasePresenter` instead of `Showcase::Presenter`.
|
94
100
|
|
95
101
|
### Traits
|
96
102
|
|
@@ -126,7 +132,7 @@ Super useful in acceptance testing to check the presence of a record inside a
|
|
126
132
|
view:
|
127
133
|
|
128
134
|
```erb
|
129
|
-
<% present(@project).box do %>
|
135
|
+
<% present(@project, class: 'big').box do %>
|
130
136
|
<p>Hi there!</p>
|
131
137
|
<% end %>
|
132
138
|
```
|
@@ -134,9 +140,10 @@ view:
|
|
134
140
|
Produces the following:
|
135
141
|
|
136
142
|
```html
|
137
|
-
<div class="project" id="project_12">
|
143
|
+
<div class="project big" id="project_12">
|
138
144
|
<p>Hi there</p>
|
139
145
|
</div>
|
146
|
+
```
|
140
147
|
|
141
148
|
Additional HTML attributes can be optionally specified within a config block
|
142
149
|
inside the presenter:
|
@@ -228,7 +235,7 @@ In your views:
|
|
228
235
|
#### `Showcase::Traits::Seo`
|
229
236
|
|
230
237
|
Useful to produce SEO meta tags (title, description, Facebook OpenGraph,
|
231
|
-
Twitter cards, and canonical
|
238
|
+
Twitter cards, and canonical URLs):
|
232
239
|
|
233
240
|
```ruby
|
234
241
|
class ProjectPresenter < Showcase::Presenter
|
@@ -242,6 +249,7 @@ class ProjectPresenter < Showcase::Presenter
|
|
242
249
|
end
|
243
250
|
end
|
244
251
|
```
|
252
|
+
|
245
253
|
In your views:
|
246
254
|
|
247
255
|
```erb
|
@@ -42,6 +42,7 @@ module Showcase
|
|
42
42
|
|
43
43
|
link_to link_name do |c|
|
44
44
|
meta = Helpers::ConfigObject.new(self, &block).to_struct
|
45
|
+
html_options = meta.html_options || {}
|
45
46
|
params = Hash[
|
46
47
|
settings[:params].map do |param, meta_key|
|
47
48
|
[ param, meta.send(meta_key) ]
|
@@ -49,7 +50,7 @@ module Showcase
|
|
49
50
|
]
|
50
51
|
c.url "#{settings[:url]}?#{params.to_query}"
|
51
52
|
c.label settings[:label]
|
52
|
-
c.html_options =
|
53
|
+
c.html_options = html_options.reverse_merge(target: '_blank')
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
data/lib/showcase/version.rb
CHANGED
data/spec/traits/share_spec.rb
CHANGED
@@ -15,6 +15,7 @@ module Showcase::Traits
|
|
15
15
|
c.url = 'url'
|
16
16
|
c.text = 'text'
|
17
17
|
c.image_url = 'image'
|
18
|
+
c.html_options = { role: 'share' }
|
18
19
|
end
|
19
20
|
|
20
21
|
share :foo do |c|
|
@@ -39,10 +40,19 @@ module Showcase::Traits
|
|
39
40
|
it "produces a #{provider} share link" do
|
40
41
|
expect(subject.send("#{provider}_share_link")).to have_tag(:a)
|
41
42
|
end
|
43
|
+
|
42
44
|
it "produces a #{provider} share url" do
|
43
45
|
expect(subject.send("#{provider}_share_url")).to eq url
|
44
46
|
end
|
45
47
|
|
48
|
+
it "adds a target :blank to the link" do
|
49
|
+
expect(subject.send("#{provider}_share_link")).to have_tag(:a, with: { target: '_blank' })
|
50
|
+
end
|
51
|
+
|
52
|
+
it "merges additional html_options" do
|
53
|
+
expect(subject.send("#{provider}_share_link")).to have_tag(:a, with: { role: 'share' })
|
54
|
+
end
|
55
|
+
|
46
56
|
context 'with prefix' do
|
47
57
|
it 'prefixes link method' do
|
48
58
|
expect(subject).to respond_to "foo_#{provider}_share_link"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: showcase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.beta.
|
4
|
+
version: 0.2.0.beta.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|