look at daily log.
This commit is contained in:
parent
85351ee7e3
commit
4eeb7c3ea8
|
@ -4,6 +4,8 @@ class ForumsController < ApplicationController
|
||||||
# GET /forums.json
|
# GET /forums.json
|
||||||
before_filter :authenticate_user_edit, :only => [:edit, :update]
|
before_filter :authenticate_user_edit, :only => [:edit, :update]
|
||||||
before_filter :authenticate_user_destroy, :only => [:destroy]
|
before_filter :authenticate_user_destroy, :only => [:destroy]
|
||||||
|
|
||||||
|
PageLimit = 20
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
|
@ -101,7 +103,43 @@ class ForumsController < ApplicationController
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
|
|
||||||
|
@ -121,4 +159,5 @@ end
|
||||||
def authenticate_user_destroy
|
def authenticate_user_destroy
|
||||||
find_forum
|
find_forum
|
||||||
render_403 unless @forum.destroyable_by? User.current
|
render_403 unless @forum.destroyable_by? User.current
|
||||||
end
|
end
|
||||||
|
end
|
|
@ -1331,6 +1331,8 @@ module ApplicationHelper
|
||||||
|
|
||||||
# Add by Tao
|
# Add by Tao
|
||||||
def url_to_avatar(source)
|
def url_to_avatar(source)
|
||||||
|
source = nil if source.kind_of?(String)
|
||||||
|
logger.error "======================================#{source.class}"
|
||||||
get_avatar(source)
|
get_avatar(source)
|
||||||
end
|
end
|
||||||
# Endof Tao's code
|
# Endof Tao's code
|
||||||
|
|
|
@ -51,6 +51,11 @@ module WelcomeHelper
|
||||||
nil
|
nil
|
||||||
end
|
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
|
def time_tag_welcome time
|
||||||
text = distance_of_time_in_words(Time.now, time)
|
text = distance_of_time_in_words(Time.now, time)
|
||||||
|
@ -99,7 +104,7 @@ module WelcomeHelper
|
||||||
# or
|
# or
|
||||||
searchStudent(project).count
|
searchStudent(project).count
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def sort_project_by_hot
|
def sort_project_by_hot
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Memo < ActiveRecord::Base
|
||||||
|
|
||||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
|
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
|
||||||
acts_as_attachable
|
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'],
|
# acts_as_searchable :column => ['subject', 'content'],
|
||||||
# #:include => { :forum => :p}
|
# #:include => { :forum => :p}
|
||||||
# #:project_key => "#{Forum.table_name}.project_id"
|
# #:project_key => "#{Forum.table_name}.project_id"
|
||||||
|
|
|
@ -9,7 +9,14 @@
|
||||||
<%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %>
|
<%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</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>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/forums", forums_path %> </a></td>
|
<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 style="width: 430px; color: #15bccf""><strong><%= l(:label_user_location) %> : </strong></td>
|
||||||
<td rowspan="2" width="250px">
|
<td rowspan="2" width="250px">
|
||||||
<div class="top-content-search">
|
<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 %>
|
<%= 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 %>
|
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<style type='text/css'>
|
<style type='text/css'>
|
||||||
|
|
||||||
.tools a:link{
|
.tools a:link{
|
||||||
color:#336601;
|
color: #116699;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
width:100px;
|
width:100px;
|
||||||
padding:3px 5px 0px 5px;
|
padding:3px 5px 0px 5px;
|
||||||
}
|
}
|
||||||
.tools a:visited{
|
.tools a:visited{
|
||||||
color:#336601;
|
color: #116699;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
padding:3px 5px 0px 5px;
|
padding:3px 5px 0px 5px;
|
||||||
width:100px;
|
width:100px;
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;"%>
|
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;"%>
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<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;">
|
<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);"%>发表
|
由<%= link_to topic.author, user_path(topic.author), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);"%>发表
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -17,6 +17,14 @@
|
||||||
|
|
||||||
RedmineApp::Application.routes.draw do
|
RedmineApp::Application.routes.draw do
|
||||||
resources :forums 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
|
resources :memos do
|
||||||
collection do
|
collection do
|
||||||
get "quote"
|
get "quote"
|
||||||
|
|
Loading…
Reference in New Issue