Skip to content
This repository was archived by the owner on Apr 30, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/admin/assets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def index
@template_name = 'index'
if [email protected]?
render :partial => 'admin/assets/search_results.html.haml', :layout => false
elsif params[:repaginate].present?
render :partial => 'admin/assets/actions.html.haml', :locals => { :assets => @assets }, :layout => false
else
render :partial => 'admin/assets/asset_table.html.haml', :locals => { :assets => @assets }, :layout => false
end
Expand Down
4 changes: 4 additions & 0 deletions app/views/admin/assets/_actions.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#actions
= pagination_for @assets, :depaginate => false, :filter => params[:filter]
%ul
%li= link_to((image('plus', :alt => '') + ' ' + t('paperclipped.new_asset')), new_admin_asset_path)
25 changes: 9 additions & 16 deletions app/views/admin/assets/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
- form_tag(admin_assets_path,:id => 'filesearchform', :method => 'get') do
%input{ :type => "search", :id => "search", :name => "search" , :value => params[:search] }
= submit_tag t("paperclipped.search")
= observe_field 'search', :frequency => 1, :update => 'actions', :url => { :controller => 'assets', :action=> 'index', :repaginate => '1' }, :method => 'get', :with => "'search=' + escape(value)"
= observe_field 'search', :frequency => 1, :update => 'assets_table', :url => { :controller => 'assets', :action=> 'index' }, :method => 'get', :with => "'search=' + escape(value)"

== #{t('paperclipped.types_to_find')}:
%span
= link_to t("paperclipped.images"), "#"
%span
= link_to t("paperclipped.others"), "#"
%span
= link_to t("paperclipped.audio"), "#"
%span
= link_to t("paperclipped.movies"), "#"
- ['images', 'others', 'audio', 'movies'].each do |filter|
%span
- options = (params[:filter].present? and params[:filter][filter.singularize].present? and params[:filter][filter.singularize] == '1') ? {:class => :pressed} : nil
= link_to t("paperclipped.#{filter}"), "#", options

#type_boxes{ :style => "display: none" }
= check_box_tag 'filter[audio]', '1', false, :id => 'audio-check'
= check_box_tag 'filter[image]', '1', false, :id => 'images-check'
= check_box_tag 'filter[other]', '1', false, :id => 'others-check'
= check_box_tag 'filter[movie]', '1', false, :id => 'movies-check'
- ['images', 'others', 'audio', 'movies'].each do |filter|
= check_box_tag "filter[#{filter.singularize}]", '1', (params[:filter].present? and params[:filter][filter.singularize].present? and params[:filter][filter.singularize] == '1'), :id => "#{filter}-check"

- if false #current_user.admin? # turned off for now, this might be too dangerous to reveal
.regenerator
= link_to t('paperclipped.regenerate_all_thumbnails') , refresh_admin_assets_path, :confirm => 'Beware that this will take a while and consume considerable resources on your server. Are you sure you want to continue?'
Expand All @@ -32,7 +28,4 @@
= render :partial => 'assets_container'

- render_region :bottom do |bottom|
#actions
= pagination_for @assets, :depaginate => false
%ul
%li= link_to((image('plus', :alt => '') + ' ' + t('paperclipped.new_asset')), new_admin_asset_path)
= render :partial => 'actions'
7 changes: 7 additions & 0 deletions public/javascripts/admin/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ Asset.FileTypes = Behavior.create({
method: 'get',
onComplete: 'assets_table'
});
new Ajax.Updater('actions', search_form.action, {
asynchronous: true,
evalScripts: true,
parameters: Form.serialize(search_form) + "&repaginate=1",
method: 'get',
onComplete: 'actions'
});
}
});

Expand Down