concerto_simple_rss 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/javascripts/concerto_simple_rss/application.js +13 -0
- data/app/assets/javascripts/concerto_simple_rss/simple_rss.js +41 -0
- data/app/models/simple_rss.rb +4 -1
- data/app/views/contents/simple_rss/_form_top.html.erb +7 -0
- data/lib/concerto_simple_rss/version.rb +1 -1
- metadata +22 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0eceaf899ce25371ae25b97401b6f5f148abcd9c
|
4
|
+
data.tar.gz: 40395c9ad8b3b698176adaaad36505a9fc5ffa77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aaf5f4ccd942a437b4699c6d62ee8a2e00c20c4402f0547a1400c3e77073b2eabb8a857bd05c2442a46c8c3ab58960b08ff725d2fe19c3989ae8c7c6edade4ba
|
7
|
+
data.tar.gz: 2c0ac3d2abadc5461adbd249d5700fb3079d03459dc1f99c47bcb937c76e09ad8c7894f6dfff2e92386caef2addac3ee4f8155a2170e872325d5dc41036ac1aa
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,41 @@
|
|
1
|
+
function initializeSimpleRSSPreview() {
|
2
|
+
// When changes are made to url input, get rss data and build preview
|
3
|
+
$('#simple_rss_config_url').keyup(function (e) {
|
4
|
+
rss_url = $('#simple_rss_config_url').val();
|
5
|
+
getRSSData(rss_url);
|
6
|
+
});
|
7
|
+
}
|
8
|
+
|
9
|
+
function getRSSData(rss_url) {
|
10
|
+
// Get the rss data based in input url
|
11
|
+
$.ajax({
|
12
|
+
type: "GET",
|
13
|
+
dataType: 'jsonp',
|
14
|
+
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(rss_url),
|
15
|
+
success: function (rss_data) {
|
16
|
+
simpleRSSPreview(rss_data);
|
17
|
+
},
|
18
|
+
error: function () {
|
19
|
+
$('#preview_div').html("Could not load preview")
|
20
|
+
}
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
function simpleRSSPreview(rss_data) {
|
25
|
+
|
26
|
+
// Store all article entries and clear preview
|
27
|
+
articles = rss_data['responseData']['feed']['entries'];
|
28
|
+
$('#preview_div').html();
|
29
|
+
|
30
|
+
// Build rss preview for only a sample of article titles
|
31
|
+
rss_preview = "<div><p style='font-weight: bold'>Found " + articles.length + " articles total</p></div>";
|
32
|
+
for (var i = 0; i < Math.min(4, articles.length); i++) {
|
33
|
+
rss_preview += "<div>" +
|
34
|
+
"<p style='font-size: 14px; text-decoration: underline'>" + articles[i]['title'] + "</p>" +
|
35
|
+
"<p>" + articles[i]['contentSnippet'] + "</p>" + "</div>";
|
36
|
+
}
|
37
|
+
$('#preview_div').html(rss_preview);
|
38
|
+
}
|
39
|
+
|
40
|
+
$(document).ready(initializeSimpleRSSPreview);
|
41
|
+
$(document).on('page:change', initializeSimpleRSSPreview);
|
data/app/models/simple_rss.rb
CHANGED
@@ -12,6 +12,9 @@ class SimpleRss < DynamicContent
|
|
12
12
|
|
13
13
|
if (["RSS", "ATOM"].include? type) && !feed_title.blank?
|
14
14
|
# it is a valid feed
|
15
|
+
if !self.config['reverse_order'].blank? && self.config['reverse_order'] == '1'
|
16
|
+
rss.items.reverse!
|
17
|
+
end
|
15
18
|
case self.config['output_format']
|
16
19
|
when 'headlines'
|
17
20
|
rss.items.each_slice(5).with_index do |items, index|
|
@@ -111,7 +114,7 @@ class SimpleRss < DynamicContent
|
|
111
114
|
# Simple RSS processing needs a feed URL and the format of the output content.
|
112
115
|
def self.form_attributes
|
113
116
|
attributes = super()
|
114
|
-
attributes.concat([:config => [:url, :output_format]])
|
117
|
+
attributes.concat([:config => [:url, :output_format, :reverse_order]])
|
115
118
|
end
|
116
119
|
|
117
120
|
# if the feed is valid we store the title in config
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<%= javascript_include_tag "concerto_simple_rss/application.js" %>
|
1
2
|
<fieldset>
|
2
3
|
<legend><span>RSS</span></legend>
|
3
4
|
<%= form.fields_for :config do |config| %>
|
@@ -14,5 +15,11 @@
|
|
14
15
|
<%= config.select :output_format, [["Headlines", "headlines"], ["Articles", "detailed"]], :selected => @content.config['output_format'] %>
|
15
16
|
</div>
|
16
17
|
</div>
|
18
|
+
<div class="clearfix">
|
19
|
+
<%= config.label :reverse_order, 'Reverse order of items?' %>
|
20
|
+
<div class="input">
|
21
|
+
<%= config.select :reverse_order, [["No", 0], ["Yes", 1]] %>
|
22
|
+
</div>
|
23
|
+
</div>
|
17
24
|
<% end %>
|
18
25
|
</fieldset>
|
metadata
CHANGED
@@ -1,39 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concerto_simple_rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Michalski
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
-
default_executable:
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
13
|
- !ruby/object:Gem::Dependency
|
16
14
|
name: rails
|
17
|
-
requirement:
|
18
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
19
16
|
requirements:
|
20
17
|
- - ~>
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 3.2.11
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.11
|
26
27
|
- !ruby/object:Gem::Dependency
|
27
28
|
name: sqlite3
|
28
|
-
requirement:
|
29
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
37
41
|
description: Simple support to render RSS content in Concerto 2.
|
38
42
|
email:
|
39
43
|
- bmichalski@gmail.com
|
@@ -41,6 +45,8 @@ executables: []
|
|
41
45
|
extensions: []
|
42
46
|
extra_rdoc_files: []
|
43
47
|
files:
|
48
|
+
- app/assets/javascripts/concerto_simple_rss/application.js
|
49
|
+
- app/assets/javascripts/concerto_simple_rss/simple_rss.js
|
44
50
|
- app/assets/stylesheets/concerto_simple_rss/application.css
|
45
51
|
- app/models/simple_rss.rb
|
46
52
|
- app/views/contents/simple_rss/_form_top.html.erb
|
@@ -87,31 +93,29 @@ files:
|
|
87
93
|
- test/dummy/script/rails
|
88
94
|
- test/integration/navigation_test.rb
|
89
95
|
- test/test_helper.rb
|
90
|
-
has_rdoc: true
|
91
96
|
homepage: https://github.com/concerto/concerto-simple-rss/
|
92
97
|
licenses:
|
93
98
|
- Apache 2.0
|
99
|
+
metadata: {}
|
94
100
|
post_install_message:
|
95
101
|
rdoc_options: []
|
96
102
|
require_paths:
|
97
103
|
- lib
|
98
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
105
|
requirements:
|
101
|
-
- -
|
106
|
+
- - '>='
|
102
107
|
- !ruby/object:Gem::Version
|
103
108
|
version: '0'
|
104
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
110
|
requirements:
|
107
|
-
- -
|
111
|
+
- - '>='
|
108
112
|
- !ruby/object:Gem::Version
|
109
113
|
version: '0'
|
110
114
|
requirements: []
|
111
115
|
rubyforge_project:
|
112
|
-
rubygems_version:
|
116
|
+
rubygems_version: 2.0.3
|
113
117
|
signing_key:
|
114
|
-
specification_version:
|
118
|
+
specification_version: 4
|
115
119
|
summary: RSS Dynamic Concerto for Concerto 2.
|
116
120
|
test_files:
|
117
121
|
- test/concerto_simple_rss_test.rb
|