sir-trevor-rails 0.2.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +55 -51
- data/app/assets/javascript/sir-trevor/sir-trevor.js +5 -14
- data/app/views/sir-trevor/blocks/_gallery_block.html.erb +2 -2
- data/app/views/sir-trevor/blocks/_tweet_block.html.erb +2 -2
- data/app/views/sir-trevor/blocks/_video_block.html.erb +3 -3
- data/lib/sir-trevor/helpers/view_helper.rb +20 -7
- data/lib/sir-trevor/version.rb +2 -2
- data/sir-trevor-rails.gemspec +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sir-trevor-rails (0.
|
4
|
+
sir-trevor-rails (0.2.2)
|
5
5
|
activesupport (>= 3.0.7)
|
6
6
|
jquery-rails
|
7
7
|
rails (>= 3.0.7)
|
@@ -11,88 +11,92 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: http://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actionmailer (3.2.
|
15
|
-
actionpack (= 3.2.
|
16
|
-
mail (~> 2.
|
17
|
-
actionpack (3.2.
|
18
|
-
activemodel (= 3.2.
|
19
|
-
activesupport (= 3.2.
|
14
|
+
actionmailer (3.2.13)
|
15
|
+
actionpack (= 3.2.13)
|
16
|
+
mail (~> 2.5.3)
|
17
|
+
actionpack (3.2.13)
|
18
|
+
activemodel (= 3.2.13)
|
19
|
+
activesupport (= 3.2.13)
|
20
20
|
builder (~> 3.0.0)
|
21
21
|
erubis (~> 2.7.0)
|
22
22
|
journey (~> 1.0.4)
|
23
|
-
rack (~> 1.4.
|
23
|
+
rack (~> 1.4.5)
|
24
24
|
rack-cache (~> 1.2)
|
25
25
|
rack-test (~> 0.6.1)
|
26
|
-
sprockets (~> 2.1
|
27
|
-
activemodel (3.2.
|
28
|
-
activesupport (= 3.2.
|
26
|
+
sprockets (~> 2.2.1)
|
27
|
+
activemodel (3.2.13)
|
28
|
+
activesupport (= 3.2.13)
|
29
29
|
builder (~> 3.0.0)
|
30
|
-
activerecord (3.2.
|
31
|
-
activemodel (= 3.2.
|
32
|
-
activesupport (= 3.2.
|
30
|
+
activerecord (3.2.13)
|
31
|
+
activemodel (= 3.2.13)
|
32
|
+
activesupport (= 3.2.13)
|
33
33
|
arel (~> 3.0.2)
|
34
34
|
tzinfo (~> 0.3.29)
|
35
|
-
activeresource (3.2.
|
36
|
-
activemodel (= 3.2.
|
37
|
-
activesupport (= 3.2.
|
38
|
-
activesupport (3.2.
|
39
|
-
i18n (
|
35
|
+
activeresource (3.2.13)
|
36
|
+
activemodel (= 3.2.13)
|
37
|
+
activesupport (= 3.2.13)
|
38
|
+
activesupport (3.2.13)
|
39
|
+
i18n (= 0.6.1)
|
40
40
|
multi_json (~> 1.0)
|
41
41
|
arel (3.0.2)
|
42
|
-
builder (3.0.
|
42
|
+
builder (3.0.4)
|
43
43
|
erubis (2.7.0)
|
44
|
-
hike (1.2.
|
45
|
-
i18n (0.6.
|
44
|
+
hike (1.2.2)
|
45
|
+
i18n (0.6.1)
|
46
46
|
journey (1.0.4)
|
47
|
-
jquery-rails (2.1
|
48
|
-
railties (>= 3.
|
49
|
-
thor (
|
50
|
-
json (1.7.
|
51
|
-
mail (2.
|
47
|
+
jquery-rails (2.2.1)
|
48
|
+
railties (>= 3.0, < 5.0)
|
49
|
+
thor (>= 0.14, < 2.0)
|
50
|
+
json (1.7.7)
|
51
|
+
mail (2.5.3)
|
52
52
|
i18n (>= 0.4.0)
|
53
53
|
mime-types (~> 1.16)
|
54
54
|
treetop (~> 1.4.8)
|
55
|
-
mime-types (1.
|
56
|
-
multi_json (1.
|
55
|
+
mime-types (1.23)
|
56
|
+
multi_json (1.7.2)
|
57
57
|
polyglot (0.3.3)
|
58
|
-
rack (1.4.
|
58
|
+
rack (1.4.5)
|
59
59
|
rack-cache (1.2)
|
60
60
|
rack (>= 0.4)
|
61
|
-
rack-ssl (1.3.
|
61
|
+
rack-ssl (1.3.3)
|
62
62
|
rack
|
63
|
-
rack-test (0.6.
|
63
|
+
rack-test (0.6.2)
|
64
64
|
rack (>= 1.0)
|
65
|
-
rails (3.2.
|
66
|
-
actionmailer (= 3.2.
|
67
|
-
actionpack (= 3.2.
|
68
|
-
activerecord (= 3.2.
|
69
|
-
activeresource (= 3.2.
|
70
|
-
activesupport (= 3.2.
|
65
|
+
rails (3.2.13)
|
66
|
+
actionmailer (= 3.2.13)
|
67
|
+
actionpack (= 3.2.13)
|
68
|
+
activerecord (= 3.2.13)
|
69
|
+
activeresource (= 3.2.13)
|
70
|
+
activesupport (= 3.2.13)
|
71
71
|
bundler (~> 1.0)
|
72
|
-
railties (= 3.2.
|
73
|
-
railties (3.2.
|
74
|
-
actionpack (= 3.2.
|
75
|
-
activesupport (= 3.2.
|
72
|
+
railties (= 3.2.13)
|
73
|
+
railties (3.2.13)
|
74
|
+
actionpack (= 3.2.13)
|
75
|
+
activesupport (= 3.2.13)
|
76
76
|
rack-ssl (~> 1.3.2)
|
77
77
|
rake (>= 0.8.7)
|
78
78
|
rdoc (~> 3.4)
|
79
79
|
thor (>= 0.14.6, < 2.0)
|
80
|
-
rake (0.
|
81
|
-
rdoc (3.12)
|
80
|
+
rake (10.0.4)
|
81
|
+
rdoc (3.12.2)
|
82
82
|
json (~> 1.4)
|
83
83
|
redcarpet (2.0.1)
|
84
|
-
sprockets (2.
|
84
|
+
sprockets (2.2.2)
|
85
85
|
hike (~> 1.2)
|
86
|
+
multi_json (~> 1.0)
|
86
87
|
rack (~> 1.0)
|
87
88
|
tilt (~> 1.1, != 1.3.0)
|
88
|
-
thor (0.
|
89
|
-
tilt (1.3.
|
90
|
-
treetop (1.4.
|
89
|
+
thor (0.18.1)
|
90
|
+
tilt (1.3.7)
|
91
|
+
treetop (1.4.12)
|
91
92
|
polyglot
|
92
93
|
polyglot (>= 0.3.1)
|
93
|
-
twitter-text (1.
|
94
|
-
|
95
|
-
tzinfo (0.3.
|
94
|
+
twitter-text (1.6.1)
|
95
|
+
unf (~> 0.0.5)
|
96
|
+
tzinfo (0.3.37)
|
97
|
+
unf (0.0.5)
|
98
|
+
unf_ext
|
99
|
+
unf_ext (0.0.6)
|
96
100
|
|
97
101
|
PLATFORMS
|
98
102
|
ruby
|
@@ -1,5 +1,3 @@
|
|
1
|
-
// Sir Trevor, v0.2.1
|
2
|
-
|
3
1
|
(function ($, _){
|
4
2
|
|
5
3
|
var root = this,
|
@@ -368,7 +366,6 @@
|
|
368
366
|
}
|
369
367
|
|
370
368
|
};
|
371
|
-
|
372
369
|
/*
|
373
370
|
SirTrevor.Submittable
|
374
371
|
--
|
@@ -507,7 +504,6 @@
|
|
507
504
|
});
|
508
505
|
|
509
506
|
};
|
510
|
-
|
511
507
|
/*
|
512
508
|
Underscore helpers
|
513
509
|
*/
|
@@ -529,7 +525,6 @@
|
|
529
525
|
|
530
526
|
});
|
531
527
|
|
532
|
-
|
533
528
|
var Block = SirTrevor.Block = function(instance, data) {
|
534
529
|
this.instance = instance;
|
535
530
|
this.type = this._getBlockType();
|
@@ -1005,7 +1000,6 @@
|
|
1005
1000
|
});
|
1006
1001
|
|
1007
1002
|
Block.extend = extend; // Allow our Block to be extended.
|
1008
|
-
|
1009
1003
|
var Format = SirTrevor.Formatter = function(options){
|
1010
1004
|
this.formatId = _.uniqueId('format-');
|
1011
1005
|
this._configure(options || {});
|
@@ -1415,7 +1409,6 @@
|
|
1415
1409
|
this.handleTwitterDropPaste(url);
|
1416
1410
|
}
|
1417
1411
|
});
|
1418
|
-
|
1419
1412
|
/*
|
1420
1413
|
Unordered List
|
1421
1414
|
*/
|
@@ -1465,7 +1458,6 @@
|
|
1465
1458
|
}
|
1466
1459
|
|
1467
1460
|
});
|
1468
|
-
|
1469
1461
|
var video_drop_template = '<p>Drop video link here</p><div class="input text"><label>or paste URL:</label><input type="text" class="paste-block"></div>';
|
1470
1462
|
var video_regex = /http[s]?:\/\/(?:www.)?(?:(vimeo).com\/(.*))|(?:(youtu(?:be)?).(?:be|com)\/(?:watch\?v=)?([^&]*)(?:&(?:.))?)/;
|
1471
1463
|
|
@@ -1531,7 +1523,6 @@
|
|
1531
1523
|
this.handleDropPaste(url);
|
1532
1524
|
}
|
1533
1525
|
});
|
1534
|
-
|
1535
1526
|
/* Default Formatters */
|
1536
1527
|
/* Our base formatters */
|
1537
1528
|
|
@@ -1693,7 +1684,7 @@
|
|
1693
1684
|
return this.hide();
|
1694
1685
|
}
|
1695
1686
|
|
1696
|
-
var mouse_enter = (ev) ? ev.originalEvent.pageY
|
1687
|
+
var mouse_enter = (ev) ? ev.originalEvent.pageY : 0;
|
1697
1688
|
|
1698
1689
|
// Do we have any sedit blocks?
|
1699
1690
|
if (this.instance.blocks.length > 0) {
|
@@ -1770,7 +1761,6 @@
|
|
1770
1761
|
|
1771
1762
|
|
1772
1763
|
|
1773
|
-
|
1774
1764
|
/* FormatBar */
|
1775
1765
|
/*
|
1776
1766
|
Format Bar
|
@@ -1832,10 +1822,12 @@
|
|
1832
1822
|
}
|
1833
1823
|
|
1834
1824
|
if ((viewport_top > 5) && viewport_top >= instance_offset) {
|
1835
|
-
this.$el.addClass('fixed')
|
1825
|
+
this.$el.addClass('fixed')
|
1826
|
+
.css({ 'width': this.instance.$wrapper.width() });
|
1827
|
+
|
1836
1828
|
this.instance.$wrapper.css({ 'padding-top': '104px' });
|
1837
1829
|
} else {
|
1838
|
-
this.$el.removeClass('fixed');
|
1830
|
+
this.$el.removeClass('fixed').css({ 'width': '100%' });
|
1839
1831
|
this.instance.$wrapper.css({ 'padding-top': '16px' });
|
1840
1832
|
}
|
1841
1833
|
},
|
@@ -2312,7 +2304,6 @@
|
|
2312
2304
|
}
|
2313
2305
|
});
|
2314
2306
|
|
2315
|
-
|
2316
2307
|
|
2317
2308
|
/* We need a form handler here to handle all the form submits */
|
2318
2309
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% # Remember, a gallery is just an array of images ;-) %>
|
2
2
|
<div class="content-block gallery-block">
|
3
3
|
<% block.each do |image| %>
|
4
|
-
<%= render(:partial => "sir-trevor/blocks/image_block", :locals => {:block => image['data'], :image_type => image_type
|
4
|
+
<%= render(:partial => "sir-trevor/blocks/image_block", :locals => {:block => image['data'], :image_type => image_type}, :formats => formats) if image.has_key?("data") && image['type'] == "image" %>
|
5
5
|
<% end %>
|
6
|
-
</div>
|
6
|
+
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="content-block tweet-block">
|
2
|
-
<%= link_to image_tag("
|
2
|
+
<%= link_to image_tag("//twitter.com/api/users/profile_image/#{ block['user']['screen_name'] }?size=bigger", :class => 'img'), "http://twitter.com/#{ block['user']['screen_name'] }" %>
|
3
3
|
<p><%= auto_link(block['text']).html_safe %></p>
|
4
4
|
<cite>From <%= link_to "@#{ block['user']['screen_name'] }", "http://twitter.com/#{ block['user']['screen_name'] }" %> on Twitter:</cite>
|
5
5
|
<time datetime="<%= block['created_at'] %>">(<%= link_to Time.parse(block['created_at']), "http://twitter.com/#{block['user']['screen_name']}/status/#{block['id_str']}" %>)</time>
|
6
|
-
</div>
|
6
|
+
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="content-block video-block">
|
2
2
|
<% if block['source'] == 'vimeo' %>
|
3
|
-
<iframe src="
|
3
|
+
<iframe src="//player.vimeo.com/video/<%= block['remote_id'] %>?title=1&byline=1&portrait=1&autoplay=0" width="600" height="400" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
4
4
|
<% elsif block['source'] == 'youtube' %>
|
5
|
-
<iframe width="600" height="400" src="
|
5
|
+
<iframe width="600" height="400" src="//www.youtube.com/embed/<%= block['remote_id'] %>" frameborder="0" allowfullscreen></iframe>
|
6
6
|
<% end %>
|
7
|
-
</div>
|
7
|
+
</div>
|
@@ -5,18 +5,24 @@ module SirTrevor
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
include Twitter::Autolink
|
7
7
|
|
8
|
-
def render_sir_trevor(json, image_type =
|
9
|
-
hash =
|
10
|
-
|
11
|
-
|
12
|
-
hash["data"].map { |object|
|
13
|
-
render(:partial => "sir-trevor/blocks/#{object["type"].to_s.downcase}_block", :locals => { :block => object['data'], :image_type => image_type, :protocol => request.protocol} ) if object.has_key?("data")
|
8
|
+
def render_sir_trevor(json, image_type = 'large')
|
9
|
+
if hash = parse_sir_trevor(json)
|
10
|
+
hash.map { |object|
|
11
|
+
render_sir_trevor_block(object, image_type)
|
14
12
|
}.compact.join.html_safe
|
15
13
|
else
|
16
14
|
''
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
18
|
+
def render_sir_trevor_block(object, image_type = 'large')
|
19
|
+
view_name = "sir-trevor/blocks/#{object['type'].to_s.downcase}_block"
|
20
|
+
|
21
|
+
render(view_name,
|
22
|
+
:block => object['data'],
|
23
|
+
:image_type => image_type) if object.has_key?("data")
|
24
|
+
end
|
25
|
+
|
20
26
|
def render_sir_trevor_image(json, image_type = "large")
|
21
27
|
image = pluck_sir_trevor_type(json, "image")
|
22
28
|
|
@@ -54,6 +60,13 @@ module SirTrevor
|
|
54
60
|
markdown.render(text).html_safe
|
55
61
|
end
|
56
62
|
|
63
|
+
def parse_sir_trevor(json)
|
64
|
+
hash = JSON.parse(json)
|
65
|
+
|
66
|
+
return false unless hash.has_key?("data")
|
67
|
+
hash["data"]
|
68
|
+
end
|
69
|
+
|
57
70
|
private
|
58
71
|
# Get's the first instance of a type from the specified JSON
|
59
72
|
def pluck_sir_trevor_type(json, type)
|
@@ -75,4 +88,4 @@ class CustomMarkdownFormatter < Redcarpet::Render::HTML
|
|
75
88
|
def codespan(code)
|
76
89
|
code
|
77
90
|
end
|
78
|
-
end
|
91
|
+
end
|
data/lib/sir-trevor/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module SirTrevor
|
2
|
-
VERSION = "0.2.
|
3
|
-
end
|
2
|
+
VERSION = "0.2.4"
|
3
|
+
end
|
data/sir-trevor-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sir-trevor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -170,5 +170,5 @@ rubyforge_project: sir-trevor-rails
|
|
170
170
|
rubygems_version: 1.8.24
|
171
171
|
signing_key:
|
172
172
|
specification_version: 3
|
173
|
-
summary: sir-trevor-rails-0.2.
|
173
|
+
summary: sir-trevor-rails-0.2.4
|
174
174
|
test_files: []
|