search framework

This commit is contained in:
yanxd 2014-01-14 15:01:11 +08:00
parent 41fefd0b37
commit d34253bdfc
4 changed files with 14 additions and 4 deletions

View File

@ -5,9 +5,13 @@ class StoresController < ApplicationController
# menu_item :overview # menu_item :overview
# menu_item :roadmap, :only => :roadmap # menu_item :roadmap, :only => :roadmap
# menu_item :settings, :only => :settings # menu_item :settings, :only => :settings
# include ActsAsTaggableOn::TagsHelper # 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 def index
# @projects_attach = project_classification(0).take(LIMIT) # @projects_attach = project_classification(0).take(LIMIT)
# @courses_attach = project_classification(1).take(LIMIT) # @courses_attach = project_classification(1).take(LIMIT)

View File

@ -87,7 +87,7 @@
<tbody> <tbody>
<% k.each do |c1|%> <% k.each do |c1|%>
<tr class="<%= cycle 'odd', 'even' %>"> <tr class="<%= cycle 'odd', 'even' %>">
<td class="filename" style="width:62%;"><%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename} %> </td> <td class="filename" style="width:62%;"><%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %> </td>
<td style="width:19%;"><%= c1.downloads %> </td> <td style="width:19%;"><%= c1.downloads %> </td>
<td class="filename" style="width:19%;"><%= link_to_attachment c1, {:text => "下载"}%></td> <td class="filename" style="width:19%;"><%= link_to_attachment c1, {:text => "下载"}%></td>
</tr> </tr>

View File

@ -0,0 +1 @@
<%= @searched_attach.to_s %>

View File

@ -16,7 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do RedmineApp::Application.routes.draw do
resources :stores resources :stores do
collection do
match 'search', via: [:get, :post]
end
end
resources :forums do resources :forums do
collection do collection do
match 'search_forum', :via => [:get, :post] match 'search_forum', :via => [:get, :post]