diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index b8e37bee7..634210d78 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -5,9 +5,13 @@ class StoresController < ApplicationController # menu_item :overview # menu_item :roadmap, :only => :roadmap # menu_item :settings, :only => :settings - # include ActsAsTaggableOn::TagsHelper - LIMIT = 20 unless const_defined?(:LIMIT) + + def search + @searched_attach = Attachment.all[0..20] + end + + LIMIT = 12 unless const_defined?(:LIMIT) def index # @projects_attach = project_classification(0).take(LIMIT) # @courses_attach = project_classification(1).take(LIMIT) diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 9ff68ec3f..c32231859 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -87,7 +87,7 @@ <% k.each do |c1|%> - <%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename} %> + <%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %> <%= c1.downloads %> <%= link_to_attachment c1, {:text => "下载"}%> diff --git a/app/views/stores/search.html.erb b/app/views/stores/search.html.erb new file mode 100644 index 000000000..989e6b4f2 --- /dev/null +++ b/app/views/stores/search.html.erb @@ -0,0 +1 @@ +<%= @searched_attach.to_s %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ea02406b8..78f334b47 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,7 +16,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. RedmineApp::Application.routes.draw do - resources :stores + resources :stores do + collection do + match 'search', via: [:get, :post] + end + end + resources :forums do collection do match 'search_forum', :via => [:get, :post]