look at daily log.
This commit is contained in:
parent
85351ee7e3
commit
4eeb7c3ea8
|
@ -5,6 +5,8 @@ class ForumsController < ApplicationController
|
|||
before_filter :authenticate_user_edit, :only => [:edit, :update]
|
||||
before_filter :authenticate_user_destroy, :only => [:destroy]
|
||||
|
||||
PageLimit = 20
|
||||
|
||||
def index
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@forums_all = Forum.all
|
||||
|
@ -101,7 +103,43 @@ class ForumsController < ApplicationController
|
|||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def search_forum
|
||||
# @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'")
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@forums_all = Forum.where("name LIKE '%#{params[:name]}%'")
|
||||
@forums_count = @forums_all.count
|
||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||
|
||||
|
||||
@offset ||= @forums_pages.offset
|
||||
@forums = @forums_all.offset(@offset).limit(@limit).all
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render 'index'
|
||||
}
|
||||
format.json { render json: @forums }
|
||||
end
|
||||
end
|
||||
|
||||
def search_memo
|
||||
limit = PageLimit
|
||||
@memo = Memo.new
|
||||
@offset, @limit = api_offset_and_limit({:limit => limit})
|
||||
@forum = Forum.find(params[:id])
|
||||
@memos_all = @forum.topics.where("subject LIKE '%#{params[:name]}%'")
|
||||
@topic_count = @memos_all.count
|
||||
@topic_pages = Paginator.new @topic_count, @limit, params['page']
|
||||
|
||||
@offset ||= @topic_pages.offset
|
||||
@memos = @memos_all.offset(@offset).limit(@limit).all
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render 'show', :layout => 'base_forums'
|
||||
}
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
@ -122,3 +160,4 @@ end
|
|||
find_forum
|
||||
render_403 unless @forum.destroyable_by? User.current
|
||||
end
|
||||
end
|
|
@ -1331,6 +1331,8 @@ module ApplicationHelper
|
|||
|
||||
# Add by Tao
|
||||
def url_to_avatar(source)
|
||||
source = nil if source.kind_of?(String)
|
||||
logger.error "======================================#{source.class}"
|
||||
get_avatar(source)
|
||||
end
|
||||
# Endof Tao's code
|
||||
|
|
|
@ -51,6 +51,11 @@ module WelcomeHelper
|
|||
nil
|
||||
end
|
||||
|
||||
def topic_last_time topic
|
||||
return topic.event_datetime unless topic.methods.to_s =~ %r[last_reply]
|
||||
topic.last_reply.event_datetime
|
||||
end
|
||||
|
||||
|
||||
def time_tag_welcome time
|
||||
text = distance_of_time_in_words(Time.now, time)
|
||||
|
|
|
@ -11,7 +11,7 @@ class Memo < ActiveRecord::Base
|
|||
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
|
||||
acts_as_attachable
|
||||
belongs_to :last_reply_id, :class_name => 'Memo', :foreign_key => 'last_reply_id'
|
||||
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id'
|
||||
# acts_as_searchable :column => ['subject', 'content'],
|
||||
# #:include => { :forum => :p}
|
||||
# #:project_key => "#{Forum.table_name}.project_id"
|
||||
|
|
|
@ -9,7 +9,14 @@
|
|||
<%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td rowspan="2" ><!-- 搜索 --></td>
|
||||
<td rowspan="2" width="250px" >
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'forums', :action => "search_forum", :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/forums", forums_path %> </a></td>
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
<td style="width: 430px; color: #15bccf""><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
|
||||
<%= form_tag(:controller => 'forums', :action => "search_memo", :id => params[:id], :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= hidden_field_tag 'forum_id', params[:id] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<style type='text/css'>
|
||||
|
||||
.tools a:link{
|
||||
color:#336601;
|
||||
color: #116699;
|
||||
text-decoration:none;
|
||||
width:100px;
|
||||
padding:3px 5px 0px 5px;
|
||||
}
|
||||
.tools a:visited{
|
||||
color:#336601;
|
||||
color: #116699;
|
||||
text-decoration:none;
|
||||
padding:3px 5px 0px 5px;
|
||||
width:100px;
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;"%>
|
||||
</span>
|
||||
<br>
|
||||
<span style="margin-left: 20px; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;"><%= time_tag_welcome topic.event_datetime %>前</span>
|
||||
<span style="margin-left: 20px; color: rgb(172, 174, 177); white-space: nowrap; font-size: 9pt !important;;"><%=l(:field_updated_on)%><%=time_tag_welcome(topic_last_time topic)%>前</span>
|
||||
<span style="margin-left: 5px; color: rgb(172, 174, 177) !important; white-space: nowrap;">
|
||||
由<%= link_to topic.author, user_path(topic.author), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);"%>发表
|
||||
</span>
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
|
||||
RedmineApp::Application.routes.draw do
|
||||
resources :forums do
|
||||
collection do
|
||||
get 'search_forum'
|
||||
post 'search_forum'
|
||||
end
|
||||
member do
|
||||
get 'search_memo'
|
||||
post 'search_memo'
|
||||
end
|
||||
resources :memos do
|
||||
collection do
|
||||
get "quote"
|
||||
|
|
Loading…
Reference in New Issue