This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added flickr js page plugin, lets you give it a flickr json feed and …
…it'll display them rotating.
- Loading branch information
Josh Adams
committed
Dec 23, 2008
1 parent
9017d3d
commit f39a7dd
Showing
9 changed files
with
85 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class Admin::ProtoPagePluginsController < Admin::BaseController | ||
before_filter :load_page_plugin, :only => [:update] | ||
|
||
protected | ||
def load_page_plugin | ||
@page_plugin = PagePlugin.find(params[:id]) | ||
@module = @page_plugin.module | ||
end | ||
|
||
public | ||
def update | ||
@module.settings = params[:settings] | ||
if @module.save | ||
render :update do |page| | ||
page << "notify('Module has been updated');" | ||
end | ||
else | ||
render :update do |page| | ||
page << "notify('An error occurred updating the Module');" | ||
end | ||
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
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
15 changes: 15 additions & 0 deletions
15
vendor/plugins/ansuz_flickr_js/app/models/ansuz/j_adams/flickr_js.rb
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,15 @@ | ||
module Ansuz | ||
module JAdams | ||
class FlickrJs < ProtoPagePlugin | ||
has_settings | ||
|
||
def view_partial | ||
'/admin/flickr_js/flickr_js' | ||
end | ||
|
||
def self.admin_partial | ||
'/admin/flickr_js/edit' | ||
end | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
vendor/plugins/ansuz_flickr_js/app/views/admin/flickr_js/_edit.html.erb
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 @@ | ||
<% remote_form_for :page_plugin, plugin, :url => admin_proto_page_plugin_path(plugin), :html => { :method => :put } do |f| %> | ||
<div class='fullwidth'> | ||
<table class='form-table'> | ||
<%= form_row "Feed URL", text_field_tag("settings[feed_url]", plugin_module.settings[:feed_url]) -%> | ||
</table> | ||
</div> | ||
<br /> | ||
<%= submit_tag "Update Flickr JS Module" %> | ||
<% end %> |
19 changes: 19 additions & 0 deletions
19
vendor/plugins/ansuz_flickr_js/app/views/admin/flickr_js/_flickr_js.html.erb
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,19 @@ | ||
<div id="<%= dom_id(plugin_module) -%>" class='flickr-js-images'></div> | ||
<div class="flickrNav"> | ||
<a id="<%= dom_id(plugin_module) -%>-prev" href="#">Prev</a><a id="<%= dom_id(plugin_module) -%>-next" href="#">Next</a> | ||
</div> | ||
|
||
<%= javascript_tag <<-EOF | ||
jQuery.getJSON("#{plugin_module.settings[:feed_url]}&jsoncallback=?", function(data){ | ||
jQuery.each(data.items, function(i,item){ | ||
jQuery("<img/>").attr("src", item.media.m).appendTo("##{dom_id(plugin_module)}") | ||
.wrap("<a href='" + item.link + "'></a>"); | ||
}); | ||
jQuery('##{dom_id(plugin_module)}').cycle({ | ||
fx: 'fade', | ||
speed: 300, | ||
timeout: 3000 | ||
}); | ||
}); | ||
EOF | ||
%> |
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 @@ | ||
Ansuz::PluginManagerInstance.register_plugin(Ansuz::JAdams::FlickrJs) |