beef-has_assets 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.9
1
+ 0.4.0
@@ -13,4 +13,14 @@ class Admin::FlickrsController < Admin::BaseController
13
13
  end
14
14
  end
15
15
 
16
+ def index
17
+ @flickr_result = {}
18
+ if defined?(Flickr) and File.exists?("#{RAILS_ROOT}/config/flickr.yml")
19
+ flickr = Flickr.new("#{RAILS_ROOT}/config/flickr.yml")
20
+ flickr_params = { :per_page => '12', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
21
+ flickr_params[:tags] = params[:tags] unless params[:tags].blank?
22
+ @flickr_result = flickr.photos.search(flickr_params)
23
+ end
24
+ render :layout => false
25
+ end
16
26
  end
@@ -0,0 +1 @@
1
+ <%= render :partial => 'admin/shared/flickr_image.html.erb', :collection => @flickr_result -%>
@@ -1,11 +1,14 @@
1
1
 
2
2
  <div id="flickr-select">
3
- <% form_remote_tag( :url => admin_flickr_path ) do -%>
3
+ <% form_remote_tag( :url => admin_flickrs_path ) do -%>
4
4
  <p><label for="tags">Search by tag:</label>
5
5
  <%= text_field_tag :tags, params[:tags] %> &nbsp; <%= submit_tag "go" %></p>
6
6
 
7
7
  <% end -%>
8
-
9
- <%= render :partial => 'admin/shared/flickr_image.html.erb', :collection => flickr_images -%>
8
+
9
+ <div id="flickr-image-container">
10
+ <p>Loading Flickr images</p>
11
+ <% #= render :partial => 'admin/shared/flickr_image.html.erb', :collection => flickr_images -%>
12
+ </div>
10
13
 
11
14
  </div>
@@ -1 +1 @@
1
- <img src="<%= flickr_image.url(:square) %>" flickr_src="<%= flickr_image.url(:square) %>" alt="<%= flickr_image.description || flickr_image.title %>" title="<%= flickr_image.title %>" onclick="addLinkedImage('<%= flickr_image.url(:medium) %>',this.alt)"/>
1
+ <img src="<%= flickr_image.url(:square) %>" alt="<%= flickr_image.description || flickr_image.title %>" title="<%= flickr_image.title %>" onclick="addLinkedImage('<%= flickr_image.url(:medium) %>',this.alt)"/>
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
  map.namespace(:admin) do |admin|
3
- admin.resource :flickr
3
+ admin.resources :flickrs
4
4
  admin.resources :assets, :collection => { :by_content_type => :get, :descriptions => :get, :by_category => :get, :categories => :get }, :member => { :set_lead => :put, :rename_category => :post }
5
5
  end
6
6
  end
@@ -392,9 +392,15 @@ var Renameable = Class.create(Holdable, {
392
392
  });
393
393
 
394
394
  var load_flickr_select = function(){
395
- $$('#flickr-select img').each(function(el){
396
-
397
- el.writeAttribute('src', el.readAttribute('flickr_src'));
398
- });
395
+ new Ajax.Updater('flickr-image-container', '/flickrs/', {
396
+ parameters: { format: 'html', authenticity_token: AJ.authenticity_token() },
397
+ onSuccess: swap_flickr_image_src
398
+ });
399
+ }
400
+ var load_flickr_select = function(){
401
+ new Ajax.Updater('flickr-image-container', '/admin/flickrs', {
402
+ method: 'get',
403
+ parameters: { format: 'html', authenticity_token: AJ.authenticity_token() }
404
+ });
399
405
  }
400
- document.observe('dom:loaded', load_flickr_select);
406
+ document.observe('dom:loaded', load_flickr_select);
data/has_assets.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_assets}
8
- s.version = "0.3.9"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve England"]
12
- s.date = %q{2009-09-17}
12
+ s.date = %q{2009-09-22}
13
13
  s.email = %q{steve@wearebeef.co.uk}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
41
41
  "app/views/admin/assets/show.html.erb",
42
42
  "app/views/admin/assets/show.js.rjs",
43
43
  "app/views/admin/flickrs/_selector.html.erb",
44
+ "app/views/admin/flickrs/index.html.erb",
44
45
  "app/views/admin/flickrs/show.html.erb",
45
46
  "app/views/admin/flickrs/show.js.rjs",
46
47
  "app/views/admin/shared/_flickr.html.erb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-has_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve England
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-17 00:00:00 -07:00
12
+ date: 2009-09-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -48,6 +48,7 @@ files:
48
48
  - app/views/admin/assets/show.html.erb
49
49
  - app/views/admin/assets/show.js.rjs
50
50
  - app/views/admin/flickrs/_selector.html.erb
51
+ - app/views/admin/flickrs/index.html.erb
51
52
  - app/views/admin/flickrs/show.html.erb
52
53
  - app/views/admin/flickrs/show.js.rjs
53
54
  - app/views/admin/shared/_flickr.html.erb