-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,175 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2010 [name of plugin creator] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Feed | ||
==== | ||
|
||
Introduction goes here. | ||
|
||
|
||
Example | ||
======= | ||
|
||
Example goes here. | ||
|
||
|
||
Copyright (c) 2010 [name of plugin creator], released under the MIT license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test | ||
|
||
desc 'Test the feed plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = true | ||
end | ||
|
||
desc 'Generate documentation for the feed plugin.' | ||
Rake::RDocTask.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'Feed' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ActionView::Base.send :include, Feed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Install hook code here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Feed | ||
require 'rss/1.0' | ||
require 'rss/2.0' | ||
|
||
def get_feed(path) | ||
content = "" | ||
open(path) do |p| | ||
content = p.read | ||
end | ||
return RSS::Parser.parse(content, false) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Feed plugin javascript functions | ||
Pieter Loubser | ||
October 2010 | ||
Version 0.8 | ||
*/ | ||
|
||
var lastTarget = ""; | ||
|
||
//Update feed item periodically. | ||
// - currently hardcoded at 10s. | ||
function update_feed(size){ | ||
jQuery('#feed0').show(); | ||
var feedSize = size; | ||
var currentFeed = 0; | ||
var container = null; | ||
var interval = setInterval(function(){ | ||
jQuery('.feed').hide(); | ||
jQuery('#feed' + currentFeed).show(); | ||
container = jQuery('#feed' + currentFeed).parent().parent(); | ||
//This deals with the sudden descruction of the item container | ||
//Implemented to handle delete from rightclick menu | ||
if(jQuery(container).attr("id") == null){ | ||
clearInterval(interval); | ||
} | ||
else{ | ||
resizeText(container, currentFeed); | ||
} | ||
|
||
if(currentFeed < feedSize -1){ | ||
currentFeed++; | ||
} | ||
else{ | ||
currentFeed = 0; | ||
} | ||
}, 10000); | ||
} | ||
|
||
//Resize feed story text to fit in container | ||
function resizeText(container, currentFeed){ | ||
var max = 12; //Default max font size. Might change. #Issue 6 | ||
jQuery('#feed-description' + currentFeed).wrapInner('<div id="fontfit' + currentFeed + '"></div>'); | ||
var dheight = jQuery(container).height() - jQuery('#feed-header' + currentFeed).height(); | ||
var cheight = jQuery("#fontfit" + currentFeed).height(); | ||
var fsize = ((jQuery('#feed-description' + currentFeed).css("font-size")).slice(0,-2))*1; | ||
while(cheight<dheight-jQuery(container).css("borderWidth").slice(0,-2)*2 && fsize<max) { | ||
fsize+=1; | ||
jQuery('#feed-description' + currentFeed).css("font-size",fsize+"px"); | ||
cheight = jQuery("#fontfit" + currentFeed).height(); | ||
} | ||
while(cheight>dheight-jQuery(container).css("borderWidth").slice(0,-2)*2 || fsize>max && fsize > 1) { | ||
fsize-=1; | ||
jQuery('#feed-description' + currentFeed).css("font-size",fsize+"px"); | ||
cheight = jQuery("#fontfit"+ currentFeed).height(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% feed = get_feed(@parameters["url"])%> | ||
|
||
<div class="ui-widget"> | ||
<div class="ui-widget-header"> | ||
<%= @parameters["title"] %> | ||
</div> | ||
|
||
<% feed.items.each_with_index do |topic,i| %> | ||
<div id="feed<%=i%>" class="feed" style="display:none;"> | ||
<div id="feed-header<%=i%>" | ||
<%= image_tag "rss_icon.gif", :html => {"align" => "left"}%> | ||
<%= topic.title %><br> | ||
<small> Added on <%= topic.date.strftime('%m/%d/%Y')%> </small> | ||
<HR> | ||
</div> | ||
|
||
<div id="feed-description<%=i%>"><%= topic.description.gsub(/<[^>]+>/,"").squeeze(" ").strip %></div> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<%= javascript_tag "update_feed(#{feed.items.size})"%> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<% form_remote_tag :html => { :action => url_for(:controller => "griditems", :action =>"create_grid_item"), :id => "form_for"} do %> | ||
Title : <%= text_field_tag "title" %><br> | ||
Width : <%= text_field_tag "width", "", :size=>4%><br> | ||
Height: <%= text_field_tag "height", "", :size=>4%><br> | ||
RSS url: <%= text_field_tag "url", "", :size=>24 %><br> | ||
<%= hidden_field_tag "refresh_rate", "0" %> | ||
<%= submit_to_remote "create_grid_item", "Create", :url => {:action => "create_grid_item", :type => type}, :html => {:class => "create"} %> <br> | ||
<%= submit_to_remote "update_grid_item", "Update", :url => {:action => "update_grid_item", :type => type}, :html => {:class => "update"} %> | ||
<% end %> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace :feed do | ||
desc "Sync plugin files with Bernard-Board" | ||
task :sync do | ||
a = system "rsync -ruv vendor/plugins/feed/lib/views/* app/views/griditems/plugins/feed" | ||
a = system "rsync -ruv vendor/plugins/feed/lib/javascripts/* public/javascripts" | ||
if a == true | ||
system "echo '\n\nSync was successful!'" | ||
else | ||
system "echo '\n\nSync failed!" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'test_helper' | ||
|
||
class FeedTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'rubygems' | ||
require 'active_support' | ||
require 'active_support/test_case' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Uninstall hook code here |