From 518e52aac056e17dbf8cd1aa7eaf40f5ca88b590 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Fri, 14 Dec 2007 22:04:13 +0000 Subject: [PATCH] ActionItem140: made the infra for the advanced search --- app/controllers/public/category_controller.rb | 8 ++++---- app/controllers/public/search_controller.rb | 4 ++++ app/views/category/_product_category.rhtml | 13 ++++++++++++- app/views/profile_editor/change_image.rhtml | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/controllers/public/category_controller.rb b/app/controllers/public/category_controller.rb index ab01362..802a926 100644 --- a/app/controllers/public/category_controller.rb +++ b/app/controllers/public/category_controller.rb @@ -2,12 +2,11 @@ class CategoryController < ApplicationController before_filter :load_default_enviroment - #FIXME This is not necessary because the application controller define the envrioment # as the default holder - + design :holder => 'environment' - + def load_default_enviroment @environment = Environment.default end @@ -26,11 +25,12 @@ class CategoryController < ApplicationController send(@category.class.name.underscore.to_sym) # TODO: load articles, documents, etc so the view can list them. end - + protected def product_category @products = @category.all_products @enterprises = Enterprise.find(:all, :conditions => ['products.id in (?)', @products.map(&:id)], :include => :products) + @users = Profile.find(:all, :conditions => ['consumptions.product_category_id = (?)',@category.id], :include => :consumptions) end def category diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 7407133..603f292 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -51,4 +51,8 @@ class SearchController < ApplicationController @tagged = @tag.taggings.map(&:taggable) end + def advanced_search + + end + end diff --git a/app/views/category/_product_category.rhtml b/app/views/category/_product_category.rhtml index 8c6ee8d..01dc200 100644 --- a/app/views/category/_product_category.rhtml +++ b/app/views/category/_product_category.rhtml @@ -1,9 +1,11 @@ -<%= link_to(_('I consume this'), {:profile => current_user.login, :controller => 'consumed_products', :action => 'new', 'consumption[product_category_id]' => @category.id }, :method => :post) %> +<%= link_to(_('I consume this'), {:profile => current_user.login, :controller => 'consumed_products', :action => 'new', 'consumption[product_category_id]' => @category.id }, :method => :post) if logged_in? %> +

<%= _('Products under this category:') %>

+ +

<%= _('Users that consumes products in this category:') %>

+ +<% @users.each do |u| %> +

+ <%= image_tag u.image.public_filename(:thumb) if u.image %>
+ <%= link_to_homepage(u.name, u.identifier) %> +

+<% end %> diff --git a/app/views/profile_editor/change_image.rhtml b/app/views/profile_editor/change_image.rhtml index cbcb5ea..71a63a9 100644 --- a/app/views/profile_editor/change_image.rhtml +++ b/app/views/profile_editor/change_image.rhtml @@ -1,4 +1,4 @@ -<% form_for :image, @image, :html => { :multipart => true }, :url => { :action => 'edit_image_preview'} do |f| %> +<% form_for :image, @image, :html => { :multipart => true }, :url => { :action => 'change_image'} do |f| %> <%= display_form_field(_('Image'), f.file_field( :uploaded_data ) ) %> <%= display_submit_tag(_('Upload')) %> <%= link_to _('Cancel'), :action => 'index' %> -- libgit2 0.21.2