welcome footer

判断成员列表的查看
This commit is contained in:
yanxd 2014-05-19 16:12:06 +08:00
parent e78a309842
commit a76620a741
6 changed files with 38 additions and 91 deletions

View File

@ -15,9 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectsController < ApplicationController
# if @project.project_type == 1
# layout 'base_projects'# by young
layout :select_project_layout
menu_item :overview
menu_item :roadmap, :only => :roadmap
menu_item :settings, :only => :settings
@ -32,18 +31,7 @@ class ProjectsController < ApplicationController
menu_item :feedback, :only => :feedback
menu_item l(:label_course_file), :only => :index
menu_item l(:label_course_news), :only => :index
# end
# layout 'base_courses'# by young
# menu_item :overview
# menu_item l(:label_homework), :only => :homework
# menu_item :files, :only => :files
#
# layout 'base_courses'
# menu_item l(:label_homework), :only => homework
# menu_item l(:label_course_file), :only => files
# menu_item l(:label_settings), :only => settings
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
@ -52,11 +40,11 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen]
before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
#by young
# before_filter :member, :file, :statistics, :watcherlist
# modified by fq
before_filter :file, :statistics, :watcherlist
#
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
@ -89,27 +77,6 @@ class ProjectsController < ApplicationController
### added by william
include ActsAsTaggableOn::TagsHelper
# Lists visible projects
# def index
# respond_to do |format|
# format.html {
# scope = Project
# unless params[:closed]
# scope = scope.active
# end
# @projects = scope.visible.order('lft').all
# }
# 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 enterprise_course
session[:enterprise_college] = 2
respond_to do |format|
@ -384,36 +351,6 @@ class ProjectsController < ApplicationController
end
#gcmend
# def search
# #modified by nie
# project_type = params[:project_type].to_i
# projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
# @projects = projects_all.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
# added by fq
def new_join
@ -861,22 +798,7 @@ class ProjectsController < ApplicationController
memberlist
end
# def news
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# end
def file
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# @course_tag = params[:course]
# if @course_tag == '1'
# render :layout => 'base_courses'
# end
# User.current
end
def statistics
@ -999,12 +921,8 @@ class ProjectsController < ApplicationController
# end
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
# TODO:#finishcourse and #restartcourse 没有设置权限也就是说任何人的调用都会关闭or重启课程。
# 最好通过用户与项目的权限解决这种事情。还没写
def finishcourse
#course_prefs = Course.find_by_extra(@project.identifier)
# setup_time = Time.parse(course_prefs.setup_time)
# end_time = Time.parse(course_prefs.endup_time)
yesterday = Date.today.prev_day.to_time
@course_prefs.endup_time = yesterday
@ -1016,7 +934,6 @@ class ProjectsController < ApplicationController
end
def restartcourse
#course_prefs = Course.find_by_extra(@project.identifier)
day = Time.parse("3000-01-01")
@course_prefs.endup_time = day
@ -1030,6 +947,14 @@ class ProjectsController < ApplicationController
end
private
def memberAccess
# 是课程,则判断当前用户是否参加了课程
return 0 if @project.project_type == Project::ProjectType_project
currentUser = User.current
render_403 unless currentUser.member_of?(@project)
end
def toggleCourse
@course_prefs = Course.find_by_extra(@project.identifier)
unless (@course_prefs.teacher == User.current || User.current.admin?)

View File

@ -0,0 +1,6 @@
<div class="clearfix"></div>
<div class="linkother">
<a href="http://forge.trustie.net" class="link_other_item">项目托管平台</a>
<a href="http://course.trustie.net" class="link_other_item">课程实践平台</a>
<a href="http://contest.trustie.net" class="link_other_item">竞赛托管平台</a>
</div>

View File

@ -256,7 +256,7 @@
</div>
<div class="clearfix"></div>
<%= render partial: 'link_to_another' %>

View File

@ -109,7 +109,7 @@
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
(<%= "#{studentCount(project)}人" %><%#= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
@ -267,4 +267,5 @@
</tr>
</table>
</div>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -149,3 +149,4 @@
</table>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -3,6 +3,20 @@
*/
/************************** 某部分开始 *****************************/
/************************** 某部分结束 *****************************/
/************************** 页脚 footer 开始 *****************************/
.linkother{
width: 460px;
margin: 70px auto -35px ;
}
.link_other_item{
width: 150px;
text-align: center;
display: inline-block;
font-size: 14px;
}
/************************** 页脚 footer 结束 *****************************/
.top_bar{
height: auto;
}