Skip to content

Commit

Permalink
Creating drop down list for category_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoshairy committed Sep 11, 2013
1 parent b5857c9 commit d656b1f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
23 changes: 23 additions & 0 deletions app/controllers/rails_admin/main_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,29 @@ def get_collection(is_edit, model_config, scope, pagination)

end
end


if params.has_key?(:category_cache)
if params[:category_cache] != "All"
search_query = Hash.new
search_query[:o] = "is"
search_query[:v] = params[:category_cache]
query_hash = Hash.new
query_hash["94742"] = search_query
if params[:f] != nil
params[:f][:category_cache] = query_hash
else
params[:f] = Hash.new
params[:f][:category_cache] = query_hash
end
else
if params[:f] != nil
params[:f].delete(:category_cache)
end

end
end

puts query_hash
puts params
if params.has_key?(:f)
Expand Down
16 changes: 13 additions & 3 deletions app/views/rails_admin/main/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,35 @@

.well
%span#filters_box

-if @abstract_model.to_param.to_s.eql? "flag"
="Object Type: "
%select{:name => 'object_type'}
-items.each do |c|
%option{:value=>c, selected: params[:object_type] == c}
=h c
<br/>
<br/><br/>
="Reason: "
%select{:name => 'reason'}
-reasons.each do |c|
%option{:value=>c, selected: params[:reason] == c}
=h c
<br/>
<br/><br/>
="Status: "
%select{:name => 'status'}
-status.each do |c|
%option{:value=>c, selected: params[:status] == c}
=h c
<br/>
<br/><br/>
-if @abstract_model.to_param.to_s.eql? "item"
="Category: "
%select{:name => 'category_cache'}
-Tag.first_level_categorization_nodes.each do |c|
%option{:value=>c.tagname, selected: params[:category_cache] == c.tagname}
=h c.tagname
<br/><br/>


%hr.filters_box{:style => "display:#{@ordered_filters.empty? ? 'none' : 'block'}"}
%input.input-small{:name => "query", :type => "search", :value => query, :placeholder => t("admin.misc.filter")}
%button.btn.btn-primary{:type => "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
Expand Down

0 comments on commit d656b1f

Please sign in to comment.