scrivito_twitter_widget 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/app/assets/javascripts/scrivito_twitter_widget.js +25 -5
- data/app/models/twitter_widget.rb +34 -1
- data/app/views/twitter_widget/details.html.erb +54 -6
- data/app/views/twitter_widget/show.html.erb +1 -1
- data/lib/scrivito_twitter_widget/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf79930c0d8d7523eb95f6cba60fe214268c5ddc
|
4
|
+
data.tar.gz: e21d77ee1415b3ed9434d7ae83cd1b84392f0329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d79e8d8796118a2ef10f6c0f1870db5bafaafe21319534d929a9688a1a3c2a60758c8627a387ca672a72a33dd8610c8841c8450d74146861c06a5ca5fd0623c
|
7
|
+
data.tar.gz: 437a0be062e5b700be390b55d2b6d0d841479f4c90f34ef697b2735b6579848b5c58bf84d5e2c53ee68d4fadcc145a8df0e26c64daff86d17405d6c8c263924f
|
data/README.md
CHANGED
@@ -24,7 +24,15 @@ en:
|
|
24
24
|
description: Add tweets to the Page
|
25
25
|
details:
|
26
26
|
type: Type
|
27
|
-
tweet_id: Id for
|
27
|
+
tweet_id: Id for tweet or twittername for timeline
|
28
28
|
create: Create a new Timline
|
29
29
|
no_tweet_id: No id is present. Insert one in details view.
|
30
|
+
timeline: Timeline
|
31
|
+
chrome: Toggle design elements
|
32
|
+
height: Height
|
33
|
+
limit: Tweet limit
|
34
|
+
conversation: Show conversation
|
35
|
+
cards: Show images, videos, text by twitter cards
|
36
|
+
align: Alignment
|
37
|
+
theme: Theme
|
30
38
|
```
|
@@ -30,12 +30,32 @@ window.twttr = (function(d, s, id) {
|
|
30
30
|
var type = $(elem).data('type');
|
31
31
|
|
32
32
|
$(elem).html('');
|
33
|
-
if(type == "
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
if(type == "timeline") {
|
34
|
+
var sourceType = $(elem).data('source-type');
|
35
|
+
|
36
|
+
var options = {
|
37
|
+
sourceType: sourceType,
|
38
|
+
};
|
39
|
+
|
40
|
+
var key = 'screenName';
|
41
|
+
key = sourceType == 'collection' ? 'id' : key
|
42
|
+
key = sourceType == 'widget' ? 'widgetId' : key
|
43
|
+
|
44
|
+
options[key] = id;
|
45
|
+
twttr.widgets.createTimeline(options,
|
46
|
+
elem,
|
47
|
+
{
|
48
|
+
chrome: $(elem).data('chrome'),
|
49
|
+
height: $(elem).data('height'),
|
50
|
+
tweetLimit: $(elem).data('limit')
|
51
|
+
})
|
37
52
|
} else {
|
38
|
-
twttr.widgets.createTweet(id, elem
|
53
|
+
twttr.widgets.createTweet(id, elem, {
|
54
|
+
conversation: $(elem).data('conversation'),
|
55
|
+
cards: $(elem).data('cards'),
|
56
|
+
align: $(elem).data('align'),
|
57
|
+
theme: $(elem).data('theme')
|
58
|
+
})
|
39
59
|
}
|
40
60
|
});
|
41
61
|
}
|
@@ -1,4 +1,37 @@
|
|
1
1
|
class TwitterWidget < Widget
|
2
2
|
attribute :tweet_id, :string
|
3
|
-
attribute :type, :enum, values: ['tweet', 'timeline'
|
3
|
+
attribute :type, :enum, values: ['tweet', 'timeline'], default: 'tweet'
|
4
|
+
|
5
|
+
attribute :conversation, :enum, values: ['none', 'all'], default: 'all'
|
6
|
+
attribute :cards, :enum, values: ['hidden', 'visible']
|
7
|
+
attribute :align, :enum, values: ['left', 'center', 'right'], default: 'left'
|
8
|
+
attribute :theme, :enum, values: ['dark','light'], default: 'light'
|
9
|
+
|
10
|
+
attribute :chrome, :multienum, values: ['noheader', 'nofooter', 'noborders', 'transparent', 'noscrollbar']
|
11
|
+
attribute :height, :integer, default: 600
|
12
|
+
attribute :limit, :integer, default: 7
|
13
|
+
attribute :source_type, :enum, values: ['profile','likes','collection','widget'], default: 'profile'
|
14
|
+
|
15
|
+
def data_attributes
|
16
|
+
data = {
|
17
|
+
id: tweet_id,
|
18
|
+
type: type
|
19
|
+
}
|
20
|
+
|
21
|
+
if type == 'timeline'
|
22
|
+
data[:chrome] = (chrome || []).join(',')
|
23
|
+
data[:height] = height || 600
|
24
|
+
data[:limit] = limit || 7
|
25
|
+
data[:source_type] = source_type || 'profile'
|
26
|
+
end
|
27
|
+
|
28
|
+
if type == 'tweet'
|
29
|
+
data[:conversation] = conversation || 'all'
|
30
|
+
data[:cards] = cards
|
31
|
+
data[:align] = align
|
32
|
+
data[:theme] = theme || 'light'
|
33
|
+
end
|
34
|
+
|
35
|
+
return data
|
36
|
+
end
|
4
37
|
end
|
@@ -2,12 +2,60 @@
|
|
2
2
|
<%= scrivito_toggle_button_editor widget, :type %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
<%= scrivito_details_for t('scrivito_timeline_widget.details.tweet_id', default: 'Id for tweet') do %>
|
5
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.tweet_id', default: 'Id for tweet or twittername for timeline') do %>
|
6
6
|
<%= scrivito_tag :div, widget, :tweet_id %>
|
7
7
|
<% end %>
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
<%=
|
12
|
-
|
13
|
-
|
9
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.tweet', default: 'Tweet') do %>
|
10
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.conversation', default: 'Show conversation') do %>
|
11
|
+
<%= scrivito_tag :div, widget, :conversation %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.cards', default: 'Show images, videos, text by twitter cards') do %>
|
15
|
+
<%= scrivito_tag :div, widget, :cards %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.theme', default: 'Theme') do %>
|
19
|
+
<%= scrivito_tag :div, widget, :theme %>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.align', default: 'Alignment') do %>
|
23
|
+
<%= scrivito_tag :div, widget, :align %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.timeline', default: 'Timeline') do %>
|
28
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.limit', default: 'Tweet limit') do %>
|
29
|
+
<%= scrivito_tag :div, widget, :source_type %>
|
30
|
+
<div class="alert alert-info">
|
31
|
+
<p>For type profile or likes you have to use a twitter username e.g. scrivito.</p>
|
32
|
+
<p>For type widget or collection you have to use the id of it.</p>
|
33
|
+
<p>You can create a new widget at the twitter <a href="https://twitter.com/settings/widgets" target="_blank">preference page</a> when you are logged in.</p>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.chrome', default: 'Toggle design elements') do %>
|
38
|
+
<%= scrivito_tag :div, widget, :chrome %>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.height', default: 'Height') do %>
|
42
|
+
<%= scrivito_tag :div, widget, :height, {data: {
|
43
|
+
scrivito_editors_min: 0,
|
44
|
+
scrivito_editors_max: 2000,
|
45
|
+
scrivito_editors_step: 10,
|
46
|
+
scrivito_editors_allow_delete: false,
|
47
|
+
}
|
48
|
+
} %>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<%= scrivito_details_for t('scrivito_timeline_widget.details.limit', default: 'Tweet limit') do %>
|
52
|
+
<%= scrivito_tag :div, widget, :limit, {data: {
|
53
|
+
scrivito_editors_min: 1,
|
54
|
+
scrivito_editors_max: 20,
|
55
|
+
scrivito_editors_step: 1,
|
56
|
+
scrivito_editors_allow_delete: false,
|
57
|
+
}
|
58
|
+
} %>
|
59
|
+
<% end %>
|
60
|
+
<% end %>
|
61
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if widget.tweet_id.present? %>
|
2
|
-
|
2
|
+
<%= content_tag :div, '', data: widget.data_attributes, class: 'tweet_by_id' %>
|
3
3
|
<% else %>
|
4
4
|
<div class="alert alert-info">
|
5
5
|
<%= t('scrivito_twitter_widget.details.no_tweet_id', default: 'No id is present. Insert one in details view.') %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_twitter_widget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scrivito
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.5.1
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: A widget for scrivito to create a twitter stream.
|