|
|
|
@ -71,7 +71,7 @@ module UsersHelper
|
|
|
|
|
def user_settings_tabs
|
|
|
|
|
tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
|
|
|
|
|
{:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
if Group.all.any?
|
|
|
|
|
tabs.insert 1, {:name => 'groups', :partial => 'users/groups', :label => :label_group_plural}
|
|
|
|
|
end
|
|
|
|
@ -83,7 +83,7 @@ module UsersHelper
|
|
|
|
|
def get_users_by_tag(tag_name)
|
|
|
|
|
User.tagged_with(tag_name).order('updated_on desc')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# added by fq
|
|
|
|
|
# <div class="pagination" >
|
|
|
|
|
# <ul>
|
|
|
|
@ -91,7 +91,7 @@ module UsersHelper
|
|
|
|
|
# <li><%= link_to("只看自己", {:controller => 'users', :action => 'show', :type => 1}) %></li>
|
|
|
|
|
# <li><%= link_to("所有反馈", {:controller => 'users', :action => 'show', :type => 2}) %></li>
|
|
|
|
|
# </ul></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: 待删
|
|
|
|
|
# def show_activity(state)
|
|
|
|
|
# content = ''.html_safe
|
|
|
|
@ -114,19 +114,19 @@ module UsersHelper
|
|
|
|
|
# end
|
|
|
|
|
# content_tag('div', content, :class => "pagination")
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#TODO: 待删
|
|
|
|
|
def watch_projects(state)
|
|
|
|
|
content = ''.html_safe
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', l(:label_project_take), :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1}))
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', l(:label_has_watched_project), :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', l(:label_project_take), :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1}))
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', l(:label_has_watched_project), :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
end
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
end
|
|
|
|
@ -134,59 +134,59 @@ module UsersHelper
|
|
|
|
|
def user_course(state)
|
|
|
|
|
content = ''.html_safe
|
|
|
|
|
if @user != User.current
|
|
|
|
|
if @user.user_extensions.identity == 0
|
|
|
|
|
if @user.user_extensions.identity == 0
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', '他执教的课程', :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', '他发布的作业', :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', '他执教的课程', :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', '他发布的作业', :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', '他的课程', :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', '他的作业', :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', '他的课程', :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', '他的作业', :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if @user.user_extensions.identity == 0
|
|
|
|
|
if @user.user_extensions.identity == 0
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', l(:label_teaching_course), :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to(l(:label_release_homework), {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', l(:label_release_homework), :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_teaching_course), {:controller => 'users', :action => 'user_courses'}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', l(:label_teaching_course), :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to(l(:label_release_homework), {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', l(:label_release_homework), :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_teaching_course), {:controller => 'users', :action => 'user_courses'}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', l(:label_my_course), :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', '我的作业', :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 0
|
|
|
|
|
s = content_tag('span', l(:label_my_course), :class => "current-page")
|
|
|
|
|
content << content_tag('li', s)
|
|
|
|
|
content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
when 1
|
|
|
|
|
s = content_tag('span', '我的作业', :class => "current-page")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0}))
|
|
|
|
|
content << content_tag('li', s, :class => "current-page")
|
|
|
|
|
content_tag('div', content, :class => "pagination")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -196,42 +196,42 @@ module UsersHelper
|
|
|
|
|
def sort_user(state, project_type)
|
|
|
|
|
content = ''.html_safe
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ), :class=>"selected") )
|
|
|
|
|
when 1
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ), :class=>"selected") )
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
|
|
|
|
|
when 2
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ), :class=>"selected") )
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
|
|
|
|
|
when 0
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ), :class=>"selected") )
|
|
|
|
|
when 1
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ), :class=>"selected") )
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
|
|
|
|
|
when 2
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) )))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ), :class=>"selected") )
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) )))
|
|
|
|
|
end
|
|
|
|
|
content = content_tag('ul', content)
|
|
|
|
|
content_tag('div', content, :class => "tabs")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def sort_user_enterprise(state, project_type)
|
|
|
|
|
content = ''.html_safe
|
|
|
|
|
case state
|
|
|
|
|
when 0
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
|
|
|
|
when 1
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
|
|
|
|
|
when 2
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
|
|
|
|
|
when 0
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
|
|
|
|
when 1
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
|
|
|
|
|
when 2
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
|
|
|
|
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
|
|
|
|
|
end
|
|
|
|
|
content = content_tag('ul', content)
|
|
|
|
|
content_tag('div', content, :class => "tabs_enterprise")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def gender_avatar_uri user
|
|
|
|
|
img_uri = '/images/sidebar/female.png'
|
|
|
|
@ -256,7 +256,7 @@ module UsersHelper
|
|
|
|
|
# people_ids += (members_to_user_ids(tmp)) unless tmp.nil?
|
|
|
|
|
# end
|
|
|
|
|
# people_ids.include?(login_user.id) or (login_user == user) or login_user.admin?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -290,7 +290,7 @@ module UsersHelper
|
|
|
|
|
membership.collect { |e|
|
|
|
|
|
memberships.push(e)
|
|
|
|
|
}
|
|
|
|
|
## 判断课程是否过期 [需封装]
|
|
|
|
|
## 判断课程是否过期 [需封装]
|
|
|
|
|
memberships_doing = []
|
|
|
|
|
memberships_done = []
|
|
|
|
|
memberships.map { |e|
|
|
|
|
@ -546,7 +546,7 @@ module UsersHelper
|
|
|
|
|
type = []
|
|
|
|
|
user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
|
|
|
|
|
option = []
|
|
|
|
|
option << course.name
|
|
|
|
|
option << course.name+"("+course.time.to_s+course.term+")"
|
|
|
|
|
option << course.id
|
|
|
|
|
type << option
|
|
|
|
|
end
|
|
|
|
|