优化排序显示,修改搜索页面显示
This commit is contained in:
parent
7283131688
commit
68145ef5f7
|
@ -23,8 +23,8 @@ class ProjectsController < ApplicationController
|
||||||
menu_item l(:label_sort_by_active), :only => :index
|
menu_item l(:label_sort_by_active), :only => :index
|
||||||
menu_item l(:label_sort_by_influence), :only => :index
|
menu_item l(:label_sort_by_influence), :only => :index
|
||||||
|
|
||||||
before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ]
|
before_filter :find_project, :except => [ :index, :search, :list, :new, :create, :copy ]
|
||||||
before_filter :authorize, :except => [:watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback, :project_respond]
|
before_filter :authorize, :except => [:watcherlist, :index, :search, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback, :project_respond]
|
||||||
before_filter :authorize_global, :only => [:new, :create]
|
before_filter :authorize_global, :only => [:new, :create]
|
||||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
|
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
|
||||||
#by young
|
#by young
|
||||||
|
@ -89,7 +89,7 @@ class ProjectsController < ApplicationController
|
||||||
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
||||||
|
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
@projects = Project.visible
|
@projects_status = ProjectStatus.visible
|
||||||
# @projects.each do |project|
|
# @projects.each do |project|
|
||||||
# @admin = project.users_by_role[Role.find(3)]
|
# @admin = project.users_by_role[Role.find(3)]
|
||||||
# unless @admin.nil?
|
# unless @admin.nil?
|
||||||
|
@ -102,8 +102,8 @@ class ProjectsController < ApplicationController
|
||||||
# @projects.each do |project|
|
# @projects.each do |project|
|
||||||
# ProjectStatus.create(:changesets_count => project.changesets.count, :project_id => project.id, :watchers_count => project.watcher_users.count)
|
# ProjectStatus.create(:changesets_count => project.changesets.count, :project_id => project.id, :watchers_count => project.watcher_users.count)
|
||||||
# end
|
# end
|
||||||
@projects = Project.visible.like(params[:name]) if params[:name].present?
|
#@projects_status = Project.visible.like(params[:name]) if params[:name].present?
|
||||||
@project_count = @projects.count
|
@project_count = @projects_status.count
|
||||||
@project_pages = Paginator.new @project_count, @limit, params['page']
|
@project_pages = Paginator.new @project_count, @limit, params['page']
|
||||||
|
|
||||||
@offset ||= @project_pages.reverse_offset
|
@offset ||= @project_pages.reverse_offset
|
||||||
|
@ -114,13 +114,13 @@ class ProjectsController < ApplicationController
|
||||||
when '0'
|
when '0'
|
||||||
@offset ||= @project_pages.reverse_offset
|
@offset ||= @project_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@projects = @projects.offset(@offset).limit(@limit).all.reverse
|
@projects_status = @projects_status.offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @project_count % @limit
|
limit = @project_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@projects = @projects.offset(@offset).limit(limit).all.reverse
|
@projects_status = @projects_status.offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 0
|
@s_type = 0
|
||||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||||
|
@ -128,13 +128,13 @@ class ProjectsController < ApplicationController
|
||||||
when '1'
|
when '1'
|
||||||
@offset ||= @project_pages.reverse_offset
|
@offset ||= @project_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@projects = @projects.includes(:project_status).reorder('project_statuses.changesets_count').offset(@offset).limit(@limit).all.reverse
|
@projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @project_count % @limit
|
limit = @project_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@projects = @projects.includes(:project_status).reorder('project_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
|
@projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
|
|
||||||
|
@ -142,31 +142,35 @@ class ProjectsController < ApplicationController
|
||||||
when '2'
|
when '2'
|
||||||
@offset ||= @project_pages.reverse_offset
|
@offset ||= @project_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@projects = @projects.includes(:project_status).reorder('project_statuses.watchers_count').offset(@offset).limit(@limit).all.reverse
|
@projects_status = @projects_status.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @project_count % @limit
|
limit = @project_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@projects = @projects.includes(:project_status).reorder('project_statuses.watchers_count').offset(@offset).limit(limit).all.reverse
|
@projects_status = @projects_status.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 2
|
@s_type = 2
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@offset ||= @project_pages.reverse_offset
|
@offset ||= @project_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@projects = @projects.includes(:project_status).reorder('project_statuses.changesets_count').offset(@offset).limit(@limit).all.reverse
|
@projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @project_count % @limit
|
limit = @project_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@projects = @projects.includes(:project_status).reorder('project_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
|
@projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||||
# @projects = @projects[@offset, @limit]
|
# @projects = @projects[@offset, @limit]
|
||||||
|
end
|
||||||
|
|
||||||
|
@projects = []
|
||||||
|
@projects_status.each do |obj|
|
||||||
|
@projects << Project.find_by_id("#{obj.project_id}")
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -188,6 +192,35 @@ class ProjectsController < ApplicationController
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def search
|
||||||
|
|
||||||
|
@projects = Project.visible
|
||||||
|
@projects = @projects.visible.like(params[:name]) if params[:name].present?
|
||||||
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
|
@project_count = @projects.visible.count
|
||||||
|
@project_pages = Paginator.new @project_count, @limit, params['page']
|
||||||
|
@offset ||= @project_pages.offset
|
||||||
|
@projects = @projects.visible.offset(@offset).limit(@limit).all
|
||||||
|
respond_to do |format|
|
||||||
|
format.html {
|
||||||
|
render :layout => 'base'
|
||||||
|
scope = Project
|
||||||
|
unless params[:closed]
|
||||||
|
scope = scope.active
|
||||||
|
end
|
||||||
|
}
|
||||||
|
format.api {
|
||||||
|
# @offset, @limit = api_offset_and_limit
|
||||||
|
# @project_count = Project.visible.count
|
||||||
|
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
||||||
|
}
|
||||||
|
format.atom {
|
||||||
|
projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||||
|
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def feedback
|
def feedback
|
||||||
@jours = @project.journals_for_messages.reverse
|
@jours = @project.journals_for_messages.reverse
|
||||||
|
|
|
@ -25,7 +25,7 @@ class UsersController < ApplicationController
|
||||||
#Ended by young
|
#Ended by young
|
||||||
|
|
||||||
|
|
||||||
before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:edit,:update]
|
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:edit,:update]
|
||||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership,
|
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership,
|
||||||
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
|
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||||
|
@ -138,7 +138,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
def index
|
def index
|
||||||
sort_init 'login', 'asc'
|
sort_init 'login', 'asc'
|
||||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||||
|
|
||||||
|
@ -155,8 +155,8 @@ class UsersController < ApplicationController
|
||||||
}
|
}
|
||||||
# @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
|
# @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
|
||||||
|
|
||||||
scope = User.logged.status(@status)
|
scope = UserStatus.visible
|
||||||
scope = scope.like(params[:name]) if params[:name].present?
|
|
||||||
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
|
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
|
||||||
# scope.each do |user|
|
# scope.each do |user|
|
||||||
# UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
|
# UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
|
||||||
|
@ -171,13 +171,13 @@ class UsersController < ApplicationController
|
||||||
when '0'
|
when '0'
|
||||||
@offset ||= @user_pages.reverse_offset
|
@offset ||= @user_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@users = scope.offset(@offset).limit(@limit).all.reverse
|
@users_statuses = scope.offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @user_count % @limit
|
limit = @user_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@users = scope.offset(@offset).limit(limit).all.reverse
|
@users_statuses = scope.offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 0
|
@s_type = 0
|
||||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||||
|
@ -185,13 +185,13 @@ class UsersController < ApplicationController
|
||||||
when '1'
|
when '1'
|
||||||
@offset ||= @user_pages.reverse_offset
|
@offset ||= @user_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(@limit).all.reverse
|
@users_statuses = scope.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @user_count % @limit
|
limit = @user_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
|
@users_statuses = scope.reorder('changesets_count').offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
|
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
|
||||||
|
@ -199,13 +199,13 @@ class UsersController < ApplicationController
|
||||||
when '2'
|
when '2'
|
||||||
@offset ||= @user_pages.reverse_offset
|
@offset ||= @user_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@users = scope.includes(:user_status).reorder('user_statuses.watchers_count').offset(@offset).limit(@limit).all.reverse
|
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @user_count % @limit
|
limit = @user_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@users = scope.includes(:user_status).reorder('user_statuses.watchers_count').offset(@offset).limit(limit).all.reverse
|
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 2
|
@s_type = 2
|
||||||
#@users = @users[@offset, @limit]
|
#@users = @users[@offset, @limit]
|
||||||
|
@ -214,18 +214,25 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
@offset ||= @user_pages.reverse_offset
|
@offset ||= @user_pages.reverse_offset
|
||||||
unless @offset == 0
|
unless @offset == 0
|
||||||
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(@limit).all.reverse
|
@users_statuses = scope.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse
|
||||||
else
|
else
|
||||||
limit = @user_count % @limit
|
limit = @user_count % @limit
|
||||||
if limit == 0
|
if limit == 0
|
||||||
limit = @limit
|
limit = @limit
|
||||||
end
|
end
|
||||||
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
|
@users_statuses = scope.reorder('changesets_count').offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||||
# @projects = @projects[@offset, @limit]
|
# @projects = @projects[@offset, @limit]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@users = []
|
||||||
|
@users_statuses.each do |obj|
|
||||||
|
@users << User.find_by_id("#{obj.user_id}")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
@groups = Group.all.sort
|
@groups = Group.all.sort
|
||||||
|
@ -234,6 +241,47 @@ class UsersController < ApplicationController
|
||||||
format.api
|
format.api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def search
|
||||||
|
sort_init 'login', 'asc'
|
||||||
|
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||||
|
|
||||||
|
case params[:format]
|
||||||
|
when 'xml', 'json'
|
||||||
|
@offset, @limit = api_offset_and_limit({:limit => 15})
|
||||||
|
else
|
||||||
|
@limit = 15#per_page_option
|
||||||
|
end
|
||||||
|
|
||||||
|
@status = params[:status] || 1
|
||||||
|
has = {
|
||||||
|
"show_changesets" => true
|
||||||
|
}
|
||||||
|
scope = User.logged.status(@status)
|
||||||
|
scope = scope.like(params[:name]) if params[:name].present?
|
||||||
|
@user_count = scope.count
|
||||||
|
@user_pages = Paginator.new @user_count, @limit, params['page']
|
||||||
|
@user_base_tag = params[:id]?'base_users':'base'
|
||||||
|
@offset ||= @user_pages.reverse_offset
|
||||||
|
unless @offset == 0
|
||||||
|
@users = scope.offset(@offset).limit(@limit).all.reverse
|
||||||
|
else
|
||||||
|
limit = @user_count % @limit
|
||||||
|
if limit == 0
|
||||||
|
limit = @limit
|
||||||
|
end
|
||||||
|
@users = scope.offset(@offset).limit(limit).all.reverse
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html {
|
||||||
|
@groups = Group.all.sort
|
||||||
|
render :layout => @user_base_tag
|
||||||
|
}
|
||||||
|
format.api
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
### modified by fq
|
### modified by fq
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -6,7 +6,7 @@ class ProjectStatus < ActiveRecord::Base
|
||||||
validates_presence_of :project_id
|
validates_presence_of :project_id
|
||||||
validates_uniqueness_of :project_id
|
validates_uniqueness_of :project_id
|
||||||
|
|
||||||
|
scope :visible, lambda {|*args| nil }
|
||||||
# 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配
|
# 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配
|
||||||
# 负责这个表的聂同学 是在新建用户时就新建了该表的记录
|
# 负责这个表的聂同学 是在新建用户时就新建了该表的记录
|
||||||
# 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点
|
# 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点
|
||||||
|
|
|
@ -6,7 +6,7 @@ class UserStatus < ActiveRecord::Base
|
||||||
validates_presence_of :user_id
|
validates_presence_of :user_id
|
||||||
validates_uniqueness_of :user_id
|
validates_uniqueness_of :user_id
|
||||||
|
|
||||||
|
scope :visible, lambda {|*args| nil }
|
||||||
# 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配
|
# 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配
|
||||||
# 负责这个表的聂同学 是在新建用户时就新建了该表的记录
|
# 负责这个表的聂同学 是在新建用户时就新建了该表的记录
|
||||||
# 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点
|
# 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_tag(projects_path, :method => :get) do %>
|
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
|
||||||
<div class="project-search-block">
|
<div class="project-search-block">
|
||||||
<table width="100%" valign="center">
|
<table width="100%" valign="center">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<% content_for :header_tags do %>
|
||||||
|
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
|
||||||
|
<div class="project-search-block">
|
||||||
|
<table width="100%" valign="center">
|
||||||
|
<tr>
|
||||||
|
<td width="16%"><span style="margin-left:0px"><%= l(:label_project_plural)%></span></td>
|
||||||
|
<td valign="center"><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
|
||||||
|
|
||||||
|
<td align="right">
|
||||||
|
<div class="project-search">
|
||||||
|
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||||
|
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
|
||||||
|
</div></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<%end%>
|
||||||
|
|
||||||
|
<!-- <div class="pagination_list">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_sort_by_time), projects_path(:project_sort_type => '0'),:class=>"test_new" %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_sort_by_active), projects_path(:project_sort_type => '1'),:class=>"test_new" %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_sort_by_influence), projects_path(:project_sort_type => '2'),:class=>"test_new" %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
|
||||||
|
<div id="projects-index">
|
||||||
|
<%= render_project_hierarchy(@projects)%>
|
||||||
|
</div>
|
||||||
|
<!-- <p class="pagination"><%= pagination_links_full @project_pages%></p> -->
|
||||||
|
<div class="pagination">
|
||||||
|
<ul>
|
||||||
|
<%= pagination_links_full @project_pages %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<p style="text-align:right;">
|
||||||
|
<span class="my-project"><%= l(:label_my_projects) %></span>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% other_formats_links do |f| %>
|
||||||
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% content_for :sidebar do %>
|
||||||
|
<%= form_tag({}, :method => :get) do %>
|
||||||
|
<h3><%= l(:label_project_plural) %></h3>
|
||||||
|
<label for="closed"><%= check_box_tag 'closed', 1, params[:closed] %> <%= l(:label_show_closed_projects) %></label>
|
||||||
|
<p>
|
||||||
|
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% html_title(l(:label_project_plural)) -%>
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<h3><%= l(:label_user_plural)%></h3>
|
<h3><%= l(:label_user_plural)%></h3>
|
||||||
|
|
||||||
<%= form_tag(users_path, :method => :get) do %>
|
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
<%= l(:label_filter_plural) %>
|
<%= l(:label_filter_plural) %>
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
<div class="project-search-block">
|
<div class="project-search-block">
|
||||||
<span><%= l(:label_user_plural)%></span>
|
<span><%= l(:label_user_plural)%></span>
|
||||||
|
|
||||||
<%= form_tag(users_path, :method => :get) do %>
|
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
|
||||||
<!-- <fieldset>
|
<!-- <fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
<%= l(:label_filter_plural) %>
|
<%= l(:label_filter_plural) %>
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
<% if User.current.admin? %>
|
||||||
|
<div class="contextual">
|
||||||
|
<%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3><%= l(:label_user_plural)%></h3>
|
||||||
|
|
||||||
|
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
<%= l(:label_filter_plural) %>
|
||||||
|
</legend>
|
||||||
|
<label for='status'><%= l(:field_status) %>:</label>
|
||||||
|
<%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||||
|
|
||||||
|
<% if @groups.present? %>
|
||||||
|
<label for='group_id'><%= l(:label_group) %>:</label>
|
||||||
|
<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<label for='name'><%= l(:label_user) %>:</label>
|
||||||
|
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||||
|
<%= submit_tag l(:label_search), :class => "small", :name => nil %><!--Modified by young-->
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<%= sort_header_tag('login', :caption => l(:field_login)) %>
|
||||||
|
<%= sort_header_tag('firstname', :caption => l(:field_firstname)) %>
|
||||||
|
<%= sort_header_tag('lastname', :caption => l(:field_lastname)) %>
|
||||||
|
<%= sort_header_tag('mail', :caption => l(:field_mail)) %>
|
||||||
|
|
||||||
|
<%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
|
||||||
|
<%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
|
||||||
|
<%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% for user in @users -%>
|
||||||
|
<tr class="<%= user.css_classes %> <%= cycle("odd", "even") %>">
|
||||||
|
<td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %></td>
|
||||||
|
<td class="firstname"><%= h(user.firstname) %></td>
|
||||||
|
<td class="lastname"><%= h(user.lastname) %></td>
|
||||||
|
<td class="email"><%= mail_to(h(user.mail)) %></td>
|
||||||
|
<td align="center"><%= checked_image user.admin? %></td>
|
||||||
|
<td class="created_on" align="center"><%= format_time(user.created_on) %></td>
|
||||||
|
<td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
|
||||||
|
<td class="buttons"> <%= change_status_link(user) %>
|
||||||
|
<%= delete_link user_path(user, :back_url => users_path(params)) unless User.current == user %> </td>
|
||||||
|
</tr>
|
||||||
|
<% end -%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<ul>
|
||||||
|
<%= pagination_links_full @user_pages, @user_count %>
|
||||||
|
<ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_user_plural)) -%>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
<!-- <div class="contextual">
|
||||||
|
<%= link_to l(:label_user_new), new_user_path, :class => 'icon icon-add' %>
|
||||||
|
</div> -->
|
||||||
|
<div class="project-search-block">
|
||||||
|
<span><%= l(:label_user_plural)%></span>
|
||||||
|
|
||||||
|
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
|
||||||
|
<!-- <fieldset>
|
||||||
|
<legend>
|
||||||
|
<%= l(:label_filter_plural) %>
|
||||||
|
</legend> -->
|
||||||
|
<div class="project-search">
|
||||||
|
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||||
|
<%= submit_tag l(:label_search), :class => "small", :name => nil %><!--Modified by young-->
|
||||||
|
<!-- </fieldset> -->
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div class="pagination" style="border-bottom: 1px solid rgb(223,223,223); width: 95%; margin-left: 2%; margin-top: 0px">
|
||||||
|
<ul style="margin-right:0px">
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_sort_by_time), users_path(:user_sort_type => '0') %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_sort_by_active), users_path(:user_sort_type => '1') %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_sort_by_influence), users_path(:user_sort_type => '2') %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<% for user in @users -%>
|
||||||
|
<% unless user.id == 1%>
|
||||||
|
<div class="well">
|
||||||
|
|
||||||
|
<%= content_tag "p", "#{format_date(user.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %>
|
||||||
|
<%= image_tag "/images/time_member.png", :class => "img_member_time"%>
|
||||||
|
<!-- <%= get_avatar?(user) ? (link_to image_tag(avatar_image(user), :class => 'avatar'), user_path(user), :class => "avatar") : (link_to image_tag("/images/12_50.png", :class => 'avatar'), user_path(user), :class => "avatar") %> -->
|
||||||
|
<div>
|
||||||
|
<%= link_to image_tag(url_to_avatar(user), :class => 'avatar'), user_path(user) %>
|
||||||
|
<%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 20px;margin-left:66px">
|
||||||
|
<%= l(:label_has_fans,:count=>user.watcher_users.count)%>
|
||||||
|
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="user-bottom">
|
||||||
|
<% unless user.memberships.empty? %>
|
||||||
|
<%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %>
|
||||||
|
<% for member in user.memberships %>
|
||||||
|
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%= user.changesets.count == 0 ? '' : ",#{l(:label_total_commit, :total_commit => user.changesets.count)}" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<ul>
|
||||||
|
<%= pagination_links_full @user_pages, @user_count %>
|
||||||
|
<ul>
|
||||||
|
</div>
|
||||||
|
<% html_title(l(:label_user_plural)) -%>
|
||||||
|
<% end -%>
|
|
@ -31,8 +31,10 @@ RedmineApp::Application.routes.draw do
|
||||||
#added by baiyu
|
#added by baiyu
|
||||||
match 'git_usage/ch_usage', :controller => 'git_usage', :action => 'ch_usage', :via => :get, :as => 'ch_usage'
|
match 'git_usage/ch_usage', :controller => 'git_usage', :action => 'ch_usage', :via => :get, :as => 'ch_usage'
|
||||||
match 'git_usage/en_usage', :controller => 'git_usage', :action => 'en_usage', :via => :get, :as => 'en_usage'
|
match 'git_usage/en_usage', :controller => 'git_usage', :action => 'en_usage', :via => :get, :as => 'en_usage'
|
||||||
|
#added by nie
|
||||||
|
match '/projects/search', :controller => 'projects', :action => 'search', :via => [:get, :post], :as => 'search'
|
||||||
|
match '/users/search', :controller => 'users', :action => 'search', :via => [:get, :post], :as => 'search'
|
||||||
|
#end
|
||||||
match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
|
match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
|
||||||
match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
|
match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
|
||||||
match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
|
match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
|
||||||
|
|
Loading…
Reference in New Issue