beef-has_assets 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
@@ -49,6 +49,16 @@ class Admin::AssetsController < Admin::BaseController
49
49
  format.js { render :layout => false}
50
50
  end
51
51
  end
52
+
53
+ def content_type
54
+ @assets = Asset.not_thumbnails.all(:conditions => ["content_type = ?",params[:category]])
55
+
56
+ respond_to do |format|
57
+ format.html { render :layout => false, :action => 'category'}
58
+ format.xml { @assets.to_xml }
59
+ format.js { render :layout => false, :action => 'category'}
60
+ end
61
+ end
52
62
 
53
63
  def descriptions
54
64
  @descriptions = Asset.not_thumbnails.find(:all, :select => 'description', :group => 'description', :order => 'description', :conditions => 'description IS NOT NULL')
@@ -8,10 +8,9 @@
8
8
  <dd id="<%= asset_type.parameterize %>-description">
9
9
  <h3 class="type-heading"><%= asset_type %></h3>
10
10
  <ul id="<%= asset_type.parameterize %>-list" class="asset-list">
11
- <%= render :partial => "admin/assets/category_contents", :locals => { :assets => assets, :for_content => for_content } unless ajaxify %>
12
11
  </ul>
13
12
  </dd>
14
13
  <% end -%>
15
14
  </dl>
16
- <%= javascript_tag "new AssetBrowser('#{@grouping}', '#{params[:folder]}', #{for_content.to_s}, #{ajaxify.to_s});" %>
15
+ <%= javascript_tag "new AssetBrowser('#{(@grouping || 'by_category')}', '#{params[:folder]}', #{for_content.to_s});" %>
17
16
 
@@ -1,7 +1,7 @@
1
1
  <h1>Browse for Files</h1>
2
2
  <%= toggle_grouping_links %>
3
3
  <div id="main-browser">
4
- <%= render :partial => 'browser', :locals => { :ajaxify => true, :asset_types => @asset_types, :for_content => false } %>
4
+ <%= render :partial => 'browser', :locals => { :asset_types => @asset_types, :for_content => false } %>
5
5
  </div>
6
6
 
7
7
  <% content_for :sub_content do %>
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beef-has_assets}
8
- s.version = "0.6.2"
8
+ s.version = "0.6.3"
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-10-27}
12
+ s.date = %q{2009-10-28}
13
13
  s.email = %q{steve@wearebeef.co.uk}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -74,8 +74,8 @@ Gem::Specification.new do |s|
74
74
  s.rubygems_version = %q{1.3.5}
75
75
  s.summary = %q{Rails Engine. Adds uploadable assets to a model and admin area for files}
76
76
  s.test_files = [
77
- "test/has_assets_test.rb",
78
- "test/test_helper.rb"
77
+ "test/test_helper.rb",
78
+ "test/has_assets_test.rb"
79
79
  ]
80
80
 
81
81
  if s.respond_to? :specification_version then
@@ -88,3 +88,4 @@ Gem::Specification.new do |s|
88
88
  else
89
89
  end
90
90
  end
91
+
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
3
  admin.resources :flickrs
4
- admin.resources :assets, :collection => { :by_content_type => :get, :descriptions => :get, :by_category => :get, :categories => :get, :category => :get }, :member => { :set_lead => :put, :rename_category => :post }
4
+ admin.resources :assets, :collection => { :by_content_type => :get, :descriptions => :get, :by_category => :get, :categories => :get, :category => :get, :content_type => :get }, :member => { :set_lead => :put, :rename_category => :post }
5
5
  end
6
6
  end
@@ -1,11 +1,10 @@
1
1
  var AssetBrowser = Class.create({
2
- initialize: function(grouping, folder, for_content, ajax) {
2
+ initialize: function(grouping, folder, for_content) {
3
3
  AssetBrowser.current_grouping = grouping;
4
4
  AssetBrowser.dl = $('asset-browser');
5
5
  AssetBrowser.setContentNodeForm('has-assets-form');
6
6
  AssetBrowser.dts = AssetBrowser.dl.select('dt');
7
7
  AssetBrowser.open_folder = folder;
8
- AssetBrowser.ajax = (ajax || false);
9
8
  AssetBrowser.for_content = (for_content || false);
10
9
 
11
10
  AssetBrowser.dts.each(function(dt) {
@@ -15,7 +14,7 @@ var AssetBrowser = Class.create({
15
14
  dt.onclick = function() {
16
15
  AssetBrowser.closeInfo();
17
16
 
18
- if(AssetBrowser.ajax && !this.dd.visible() && !dt.dd.down('ul li'))
17
+ if(!this.dd.visible() && !dt.dd.down('ul li'))
19
18
  AssetBrowser.loadFilesByFolder(dt.innerHTML, dt.dd.down('ul').id);
20
19
 
21
20
 
@@ -105,7 +104,7 @@ Object.extend(AssetBrowser, {
105
104
  },
106
105
 
107
106
  loadFilesByFolder: function(folder_name, folder_id){
108
- new Ajax.Request('/admin/assets/category', { method: 'get',
107
+ new Ajax.Request('/admin/assets/' + this.current_grouping.replace(/$by_/, ''), { method: 'get',
109
108
  asynchronous:true,
110
109
  parameters: { for_content: AssetBrowser.for_content, format: 'html', category: folder_name, authenticity_token: AJ.authenticity_token() },
111
110
  onSuccess: function(response){ $(folder_id).update(response.responseText); } } );
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.6.2
4
+ version: 0.6.3
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-10-27 00:00:00 +00:00
12
+ date: 2009-10-28 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -103,5 +103,5 @@ signing_key:
103
103
  specification_version: 3
104
104
  summary: Rails Engine. Adds uploadable assets to a model and admin area for files
105
105
  test_files:
106
- - test/has_assets_test.rb
107
106
  - test/test_helper.rb
107
+ - test/has_assets_test.rb