beef-has_assets 0.2.10 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.3.1
@@ -0,0 +1,16 @@
1
+ class Admin::FlickrsController < Admin::BaseController
2
+ def create
3
+ flickr = Flickr.new("#{RAILS_ROOT}/config/flickr.yml")
4
+ redirect_to flickr.auth.url(:write)
5
+ end
6
+ def show
7
+ respond_to do |format|
8
+ format.html do
9
+ flickr = Flickr.new("#{RAILS_ROOT}/config/flickr.yml")
10
+ flickr.auth.cache_token
11
+ end
12
+ format.js
13
+ end
14
+ end
15
+
16
+ end
@@ -31,5 +31,14 @@ module Admin::AssetsHelper
31
31
  session_key = ActionController::Base.session_options[:key]
32
32
  replace_thumbnail_admin_asset_path(asset, session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token)
33
33
  end
34
+
35
+ def flickr_select
36
+ return unless defined?(Flickr) and File.exists?("#{RAILS_ROOT}/config/flickr.yml")
37
+ flickr = Flickr.new("#{RAILS_ROOT}/config/flickr.yml")
38
+ flickr_params = { :per_page => '12', :page => params[:page], :user_id => Settings.flickr_user_id, :sort => 'date-taken-desc', :tag_mode => 'all' }
39
+ flickr_params[:tags] = params[:tags] unless params[:tags].blank?
40
+ flickr_result = flickr.photos.search(flickr_params)
41
+ render :partial => 'admin/flickrs/selector', :locals => { :flickr_images => flickr_result }
42
+ end
34
43
 
35
44
  end
@@ -0,0 +1,12 @@
1
+ <div id="flickr-select">
2
+ <h2>Flickr Images</h2>
3
+ <% form_remote_tag( :url => admin_flickr_path, :method => :get ) do -%>
4
+ <p><label for="tags">Search by tag:</label>
5
+ <%= text_field_tag :tags, params[:tags] %> &nbsp; <%= submit_tag "go" %></p>
6
+ <% end -%>
7
+
8
+ <% for photo in flickr_images %>
9
+ <%= link_to "#{image_tag photo.url(:square)}", "#{photo.url(:large)}", :title => "#{photo.title}", :onclick => "addLinkedImage('#{photo.url(:medium)}',this.title); return false;" %>
10
+ <% end -%>
11
+
12
+ </div>
@@ -0,0 +1,2 @@
1
+ <h1>Flickr</h1>
2
+ <%= link_to "Authorise", admin_flickr_path, :method => :post %>
@@ -0,0 +1 @@
1
+ page.replace 'flickr-select', flickr_select
data/config/routes.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
2
  map.namespace(:admin) do |admin|
3
+ admin.resource :flickr
3
4
  admin.resources :assets, :collection => { :by_content_type => :get, :descriptions => :get, :by_category => :get, :categories => :get }, :member => { :set_lead => :put, :rename_category => :post }
4
5
  end
5
6
  end
data/has_assets.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{has_assets}
5
- s.version = "0.2.10"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steve England"]
9
- s.date = %q{2009-09-03}
9
+ s.date = %q{2009-09-07}
10
10
  s.email = %q{steve@wearebeef.co.uk}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  "Rakefile",
21
21
  "VERSION",
22
22
  "app/controllers/admin/assets_controller.rb",
23
+ "app/controllers/admin/flickrs_controller.rb",
23
24
  "app/helpers/admin/assets_helper.rb",
24
25
  "app/helpers/assets_helper.rb",
25
26
  "app/models/asset.rb",
@@ -36,6 +37,9 @@ Gem::Specification.new do |s|
36
37
  "app/views/admin/assets/rename_category.js.rjs",
37
38
  "app/views/admin/assets/show.html.erb",
38
39
  "app/views/admin/assets/show.js.rjs",
40
+ "app/views/admin/flickrs/_selector.html.erb",
41
+ "app/views/admin/flickrs/show.html.erb",
42
+ "app/views/admin/flickrs/show.js.rjs",
39
43
  "config/routes.rb",
40
44
  "generators/asset_migration/asset_migration_generator.rb",
41
45
  "generators/asset_migration/templates/migration.rb",
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.2.10
4
+ version: 0.3.1
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-03 00:00:00 -07:00
12
+ date: 2009-09-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,6 +30,7 @@ files:
30
30
  - Rakefile
31
31
  - VERSION
32
32
  - app/controllers/admin/assets_controller.rb
33
+ - app/controllers/admin/flickrs_controller.rb
33
34
  - app/helpers/admin/assets_helper.rb
34
35
  - app/helpers/assets_helper.rb
35
36
  - app/models/asset.rb
@@ -46,6 +47,9 @@ files:
46
47
  - app/views/admin/assets/rename_category.js.rjs
47
48
  - app/views/admin/assets/show.html.erb
48
49
  - app/views/admin/assets/show.js.rjs
50
+ - app/views/admin/flickrs/_selector.html.erb
51
+ - app/views/admin/flickrs/show.html.erb
52
+ - app/views/admin/flickrs/show.js.rjs
49
53
  - config/routes.rb
50
54
  - generators/asset_migration/asset_migration_generator.rb
51
55
  - generators/asset_migration/templates/migration.rb