Merge branch 'yutao' into szzh

Conflicts:
	app/controllers/users_controller.rb
dev_cxt2
sw 10 years ago
commit a7666af597

@ -25,6 +25,7 @@ class MyController < ApplicationController
helper :issues
helper :users
helper :custom_fields
helper :user_score
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
'issuesreportedbyme' => :label_reported_issues,
@ -88,6 +89,23 @@ class MyController < ApplicationController
end
end
def clear_user_avatar_temp
@user = User.current
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
File.delete(diskfile1) if File.exist?(diskfile1)
end
def save_user_avatar
@user = User.current
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
begin
FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1
ensure
File.delete(diskfile1) if File.exist?(diskfile1)
end
end
# Edit user's account
def account
@user = User.current
@ -119,6 +137,8 @@ class MyController < ApplicationController
@se.identity = params[:identity].to_i if params[:identity]
@se.technical_title = params[:technical_title] if params[:technical_title]
@se.student_id = params[:no] if params[:no]
@se.brief_introduction = params[:brief_introduction]
@se.description = params[:description]
if @user.save && @se.save
# 头像保存
@ -137,6 +157,7 @@ class MyController < ApplicationController
File.delete(diskfile1) if File.exist?(diskfile1)
end
render :layout=>'base_users_new'
end
# Destroys user's account
@ -159,6 +180,7 @@ class MyController < ApplicationController
# Manage user's password
def password
@act='password'
@user = User.current
unless @user.change_password_allowed?
flash.now[:error] = l(:notice_can_t_change_password)
@ -178,12 +200,14 @@ class MyController < ApplicationController
flash.now[:error] = l(:notice_account_wrong_password)
end
end
render :template => 'my/account',:layout=>'base_users_new'
rescue Exception => e
if e.message == 'wrong password'
flash.now[:error] = l(:notice_account_wrong_password)
else
flash.now[:error] = e.message
end
render :template => 'my/account',:layout=>'base_users_new'
end
# Create a new feeds key

File diff suppressed because it is too large Load Diff

@ -16,12 +16,15 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WatchersController < ApplicationController
before_filter :require_login#, :find_watchables, :only => [:watch, :unwatch]
helper :users
def watch
s = WatchesService.new
watchables = s.watch params.merge(:current_user_id => User.current.id)
respond_to do |format|
format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} }
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} }
end
rescue Exception => e
if e.message == "404"
@ -37,7 +40,7 @@ class WatchersController < ApplicationController
watchables = s.unwatch params.merge(:current_user_id => User.current.id)
respond_to do |format|
format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} }
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'delete'} }
end
rescue Exception => e
if e.message == "404"

@ -13,11 +13,12 @@ class WordsController < ApplicationController
end
refer_user_id = params[:new_form][:reference_user_id].to_i
@user.add_jour(User.current, message, refer_user_id)
list = @user.add_jour(User.current, message, refer_user_id)
unless refer_user_id == 0 || refer_user_id == User.current.id
User.find(refer_user_id).add_jour(User.current, message, refer_user_id)
list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id)
end
@user.count_new_jour
@jour = list.last
# @user.count_new_jour
# if a_message.size > 5
# @message = a_message[-5, 5]
# else
@ -26,8 +27,8 @@ class WordsController < ApplicationController
# @message_count = a_message.count
end
end
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
@jour = paginateHelper @jours,10
# @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
# @jour = paginateHelper @jours,10
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}

@ -42,4 +42,30 @@ module ActivitiesHelper
end
sorted_events
end
def get_container_type(activity)
#问卷
if activity.act_type == 'Poll'
return ['Course',activity.act.polls_group_id]
end
#注册
if activity.act_type == 'Principal'
return ['Principal',activity.act.id]
end
#留言
if activity.act_type == 'JournalsForMessage'
return [activity.act.jour_type,activity.act.jour_id]
end
# HomeworkCommon Issue Journal Message News
if activity.act.respond_to?('course') && activity.act.course
return ['Course',activity.act.course.id]
end
if activity.act.respond_to?('project') && activity.act.project
return ['Project',activity.act.project.id]
end
# Contest Contestnotification
return ['Unknow',0]
end
end

@ -303,4 +303,237 @@ module UsersHelper
end
end
end
def get_watcher_users(obj)
count = User.watched_by(obj.id).count
if count == 0
return [0,[]]
end
list = User.watched_by(obj.id).order("#{Watcher.table_name}.id desc").limit(10).all
return [count,list];
end
def get_fans_users(obj)
count = obj.watcher_users.count
if count == 0
return [0,[]]
end
list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all
return [count,list];
end
def get_visitor_users(obj)
query = Visitor.where("master_id=?",obj.id)
count = query.count
if count == 0
return [0,[]]
end
list = query.order("updated_on desc").limit(10).all
return [count,list];
end
def get_create_course_count(user)
return Course.where("tea_id = ?",user.id).count()
end
def get_join_course_count(user)
return user.coursememberships.count() - get_create_course_count(user)
end
def get_homework_commons_count(user)
return HomeworkCommon.where("user_id = ?",user.id).count()
end
def get_projectandcourse_attachment_count(user)
return Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count()
end
def get_create_project_count(user)
return Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count()
end
def get_join_project_count(user)
return user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user)
end
def get_create_issue_count(user)
return Issue.where("author_id = ?",user.id).count()
end
def get_resolve_issue_count(user)
return Issue.where("assigned_to_id = ? and status_id=3",user.id).count()
end
def get_anonymous_evaluation_count(user)
return StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count()
end
# def query_activities(query,type)
# query_rec_count = 8
# # query = query.where("act_type='JournalsForMessage'")
# #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll'])
# list = query.order("id desc").limit(query_rec_count).all
#
# result = [];
# for item in list
# container = get_activity_container(item,type)
# if( activity_is_show(item,container) )
# result << { :item=>item,:e=>container }
# end
# end
# return [lastid,result]
# end
# def get_activity_container activity,type
# e = nil;
# if type == 'Project'
# if activity.act_type == 'Poll'
# # 项目没有问卷
# # e = Project.find_by_id(activity.act.polls_group_id)
# else
# e = activity.act.project if activity.act.respond_to?('project')
# end
# end
# if type == 'Course'
# if activity.act_type == 'Poll'
# e = Course.find_by_id(activity.act.polls_group_id)
# else
# e = activity.act.course if activity.act.respond_to?('course')
# end
# end
#
# return e;
# end
def query_activities(query)
list = query.limit(8).all
result = [];
for item in list
container = get_activity_container(item)
result << { :item=>item,:e=>container }
end
return result
end
def get_activity_container activity
return activity.activity_container
# if type == 'Project'
# return activity.act.project if activity.act.respond_to?('project')
# end
# if type == 'Course'
# if activity.act_type == 'Poll'
# return Course.find_by_id(activity.act.polls_group_id)
# end
# return activity.act.course if activity.act.respond_to?('course')
# end
# return nil;
end
# def activity_is_show(activity,e)
# if(!e)
# return false
# end
#
# if activity.user_id == User.current.id
# return true
# end
# if( e.visible? )
# return true
# end
# return false
# end
def get_activity_act_showname_htmlclear(activity)
str = get_activity_act_showname(activity)
str = str.gsub(/<.*>/,'')
str = str.lstrip.rstrip
if str == ''
str = 'RE:'
end
return str.html_safe
end
def get_activity_act_showname(activity)
case activity.act_type
when "HomeworkCommon"
return activity.act.name
when "Issue"
return activity.act.subject
when "Journal"
return details_to_strings(activity.act.details,true).to_s
when "JournalsForMessage"
return activity.act.notes
when "Message"
return activity.act.subject
when "News"
return activity.act.title
when "Poll"
return activity.act.polls_name
when "Contest"
return ''
when "Contestnotification"
return ''
when "Principal"
return ''
else
return activity.act_type
end
end
def get_activity_act_createtime(activity)
case activity.act_type
when "HomeworkCommon"
return activity.act.created_at
when "Poll"
return activity.act.created_at
else
return activity.act.created_on
end
end
def get_activity_container_url e
if !e.visible?
return "javascript:;"
end
if e.class.to_s == 'Course'
return url_for(:controller => 'courses', :action=>"show", :id=>e.id, :host=>Setting.host_course)
end
return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name)
end
def get_activity_url(activity,e)
if !e.visible?
return "javascript:;"
end
case activity.act_type
# when "Contest"
# when "Contestnotification"
# when "Principal"
when "HomeworkCommon"
return homework_common_index_path( :course=>e.id )
when "Issue"
return issue_path(activity.act.id)
when "Journal"
return issue_path( activity.act.journalized_id )
when "JournalsForMessage"
return e.class.to_s == 'Course' ? course_feedback_path(e) : project_feedback_path(e)
when "Message"
return e.class.to_s == 'Course' ? course_boards_path(e) : project_boards_path(e)
when "News"
return news_path(activity.act)
#return e.class.to_s == 'Course' ? course_news_index_path(e) : project_news_index_path(e)
when "Poll"
return poll_index_path( :polls_group_id=>activity.act.polls_group_id, :polls_type=>e.class.to_s )
else
return 'javascript:;'
end
end
def get_activity_opt(activity,e)
case activity.act_type
when "HomeworkCommon"
return '创建了作业'
when "News"
return e.class.to_s == 'Course' ? '发布了通知' : '添加了新闻'
when "Issue"
return '发表了问题'
when "Journal"
return '回复了问题'
when "JournalsForMessage"
return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈'
#return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : ''
when "Message"
return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子'
when "Poll"
return '发布了问卷'
else
return '有了新动态'
end
end
end

@ -2,9 +2,20 @@ class Activity < ActiveRecord::Base
attr_accessible :act_id, :act_type, :user_id
belongs_to :act, :polymorphic => true
belongs_to :user
belongs_to :activity_container, polymorphic: true
validates :act_id, presence: true
validates :act_type, presence: true
validates :user_id, presence: true
include Trustie::Cache::ClearCourseEvent
before_create :set_container_type_val
#helper :activities
include ActivitiesHelper
def set_container_type_val
container_type,container_id =get_container_type(self)
self.activity_container_type = container_type
self.activity_container_id = container_id
end
end

@ -0,0 +1,3 @@
class Visitor < ActiveRecord::Base
belongs_to :user
end

@ -1,4 +1,8 @@
<% if @source_type=='User' %>
var imgSpan = $("img[nhname='avatar_image']");
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% else %>
var imgSpan = jQuery('#avatar_image');
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% end %>

@ -1,8 +1,8 @@
<% if @save_flag %>
$('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>");
$('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>");
var html = "<%= escape_javascript( render( :partial => 'users/course_form', :locals => {:item => @course_prefs} ) )%>";
$('#nh_course_<%=@course.id%>').replaceWith(html);
// alert("关闭成功");
<% else %>
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>

@ -1,7 +1,8 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
showModal('ajax-modal', '540px');
$('#ajax-modal').css('height','330px');
$('#ajax-modal').siblings().remove();
//$('#ajax-modal').siblings().remove();
$('#ajax-modal').siblings().hide();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='javascript:' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");

@ -0,0 +1,13 @@
<div id="Footer">
<ul class="copyright" style="text-align:center;">
<li><%= @organizer.description.html_safe %></li>
</ul>
<div class="cl"></div>
<ul class="footlogo">
<% @companies && @companies.each do |company| %>
<li class="fl" style="margin:0 8px;">
<a href="<%= company.url %>" target="_blank" title="<%=company.name%>"><img src="<%= url_to_avatar(company) %>" width="100" height="30" alt="<%=company.name%>" /></a>
</li>
<% end %>
</ul>
</div>

@ -0,0 +1,76 @@
<div id="Header" >
<div class="logo fl" >
<%=link_to image_tag("/images/logo.png",weight:"35px", height: "30px")%>
</div>
<div id="TopNav" class="fl">
<%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
</div>
<div id="TopUser" class="fr">
<div id="menu">
<ul class="menu">
<% if User.current.logged? %>
<li>
<%=link_to_user(User.current)%><!--<a href="javascript:void(0);" class="parent">用户名称</a>-->
<ul>
<% hidden_non_project = Setting.find_by_name("hidden_non_project")
visiable = hidden_non_project && hidden_non_project.value == "0"%>
<% if @show_course == 1 && !visiable %>
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% hasCourse=true %>
<% end %>
<% end %>
<% if hasCourse %>
<li>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
<ul>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
<% end %>
<% end %>
</ul>
</li>
<% end %>
<% end -%>
<% end %>
<% if User.current.projects.count>0 %>
<li>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
<ul>
<% User.current.projects.each do |project| %>
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
<% end %>
</ul>
</li>
<% end %>
<!--<li><a href="javascript:void(0);" class="parent">我的课程</a>-->
<!--<ul>-->
<!--<li><a href="javascript:void(0);">新建课程</a></li>-->
<!--<li><a href="javascript:void(0);">我的课程0我的课程我的课程01我的课程011</a></li>-->
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
<!--</ul>&lt;!&ndash;-level3 end-&ndash;&gt;-->
<!--</li>&lt;!&ndash;-level2 end-&ndash;&gt;-->
<!--<li><a href="javascript:void(0);" class="parent">我的项目</a>-->
<!--<ul>-->
<!--<li><a href="javascript:void(0);">新建项目</a></li>-->
<!--<li><a href="javascript:void(0);">我的项目01</a></li>-->
<!--<li><a href="javascript:void(0);">我的项目0</a></li>-->
<!--<li><a href="javascript:void(0);">我的项目02</a></li>-->
<!--</ul>&lt;!&ndash;-level3 end-&ndash;&gt;-->
<!--</li>&lt;!&ndash;-level2 end-&ndash;&gt;-->
<!--<li><a href="javascript:void(0);">我的主页</a></li>-->
</ul>
</li><!---level1 end--->
<!--<li ><a href="javascript:void(0);">退出</a></li>-->
<% end %>
</ul>
<%= render_menu :account_menu -%>
</div>
</div>
</div>
<div class="cl"></div>

@ -0,0 +1,12 @@
<% fans_count,fans_list = get_fans_users(user) %>
<div id="fans_nav_list" class="leftbox mt10" style="display:<%= fans_count==0 ? 'none' : 'block' %>">
<h4 class="fl">粉丝</h4><a href="<%=url_for(:controller => 'users', :action => 'user_fanslist', :id=>user.id)%>" data-count="<%= fans_count %>" style="display:<%= fans_count>10 ? 'block' : 'block' %>" class="more fr mr10">更多</a>
<div class="cl"></div>
<div class="mt5">
<% for fans in fans_list %>
<%= link_to image_tag(url_to_avatar(fans), :style => "width:38px;height:38px;"), user_path(fans), :class => "pic_members", :title => "#{fans.name}" %>
<% end %>
<div class="cl"></div>
</div>
</div><!--leftbox end-->

@ -0,0 +1,8 @@
<% if(User.current.logged? && User.current!=target)%>
<%if(target.watched_by?(User.current))%>
<a id="user_watch_id" href="<%= watch_path(:object_type=>
'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消</a>
<% else %>
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">关注</a>
<% end %>
<% end %>

@ -0,0 +1,11 @@
<% watcher_count,watcher_list = get_watcher_users(user) %>
<div id="watcher_nav_list" class="leftbox mt10" style="display:<%= watcher_count==0 ? 'none' : 'block' %>">
<h4 class="fl">关注</h4><a href="<%=url_for(:controller => 'users', :action => 'user_watchlist', :id=>user.id)%>" data-count="<%= watcher_count %>" style="display:<%= watcher_count>10 ? 'block' : 'block' %>" class="more fr mr10">更多</a>
<div class="cl"></div>
<div class="mt5">
<% for watcher in watcher_list %>
<%= link_to image_tag(url_to_avatar(watcher), :style => "width:38px;height:38px;"), user_path(watcher), :class => "pic_members", :title => "#{watcher.name}" %>
<% end %>
<div class="cl"></div>
</div>
</div><!--leftbox end-->

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
$("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src'));
$('#ajax-modal').html($("#nh_tx_dialog_html").html());
showModal('ajax-modal','460px');
$('#ajax-modal').siblings().hide();
$('#ajax-modal').parent().removeClass("alert_praise");
//$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("alert_box");

@ -0,0 +1,2 @@
$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:216px;height:216px;",:alt=>"头像") %>');
hideModal();

@ -1,7 +1,8 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>');
showModal('ajax-modal', '540px');
$('#ajax-modal').css('height','260px');
$('#ajax-modal').siblings().remove();
//$('#ajax-modal').siblings().remove();
$('#ajax-modal').siblings().hide();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");

@ -1,74 +1,46 @@
<div class="content_frame">
<ul class="user_course_sort">
<% for membership in memberships %>
<li>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50">
<%= image_tag(url_to_avatar(membership.course), :class => 'avatar') %>
</td>
<td>
<table width="580" border="0">
<tr>
<td colspan="2" valign="top">
<span>
<%= link_to_course(membership.course) %>
</span>
<span style="float: right">
<%= render :partial => 'courses/set_course_time', :locals => {:course => membership.course} %>
<% if (User.current == @user && (!@user.allowed_to?(:as_teacher,membership.course)))%>
<%= join_in_course(membership.course, User.current) %>
<% end %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= l(:label_x_base_courses_member, :count => membership.course.members.count) %>
(<%= "#{membership.course.members.count}" %>)
&nbsp;&nbsp;
<%= l(:label_homework) %>
(
<span class="">
<%= link_to (membership.course.homework_commons.count), homework_common_index_path(:course => membership.course.id) %>
</span>
)
&nbsp;&nbsp;
<%= l(:label_course_news) %>
(
<span style="color: #ed8924">
<%= link_to (membership.course.news.count), {:controller => 'news', :action => 'index', :course_id => membership.course.id} %>
</span>)
</span>
</td>
</tr>
<tr>
<td colspan="2" width="580" style="word-break:break-all;word-wrap: break-word;">
<p class="font_description">
<%= textilizable membership.course.short_description %>
</p>
</td>
</tr>
<tr>
<td>
<% @course = Course.find_by_extra(membership.course.extra) %>
<% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %>
<span class="font-lighter" style="float: left">
<%= l(:label_main_teacher) %>
: <%= link_to(@course.teacher.realname, user_path(@course.teacher)) %>
</span>
<span style="float: right; padding-left: 8px">
<%= l(:label_course_term) %>
: <%= @course.time %><%= get_course_term_locales @course %>
</span>
<% end %>
</td>
</tr>
</table>
</td>
</tr>
</table>
</li>
<% can_edit_flag = User.current.allowed_to?(:as_teacher,item) || User.current.admin? %>
<% course_end_flag = course_endTime_timeout?(item) %>
<div class="courses_list line" id="nh_course_<%=item.id%>">
<div class="courses_list_pic fl">
<a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>item.id, :host=>Setting.host_course) %>" title="<%= item.name %>">
<%= image_tag(url_to_avatar(item), :style => 'width:64px;height:64px;') %>
</a>
</div>
<div class="courses_list_info fl ml10">
<a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>item.id, :host=>Setting.host_course) %>" title="<%= item.name %>" class="courses_list_title f14 fb <%=course_end_flag ? 'c_dark' : 'c_blue02'%> fl"><%= item.name %></a>
<% if(can_edit_flag) %>
<% if(course_end_flag) %>
<a href="<%=restartcourse_course_path(item)%>" class="pic_eye_grey fl ml5" title="重开课程" data-confirm="确定要重开课程?" data-method="post" data-remote="true"></a>
<% else %>
<a href="<%=finishcourse_course_path(item, format: :js)%>" class="pic_eye_blue fl ml5" title="关闭课程" data-confirm="确定要关闭课程?" data-method="post" data-remote="true"></a>
<% end %>
<% end %>
</ul>
</div>
<%= call_hook :view_account_left_bottom, :user => @user %>
<div class="cl"></div>
<div class="courses_list_table">
<table><tbody>
<tr>
<td class="td_w60 ">主讲老师:</td>
<td class="td_w70 ">
<a href="<%= user_path(item.teacher) %>" title="<%= item.teacher.show_name %>"><%= item.teacher.show_name %></a>
</td>
<td class="td_w60 ">课程作业:</td>
<td class="td_w110 "><a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>"><%= item.homework_commons.count %></a></td>
</tr>
<tr>
<td>学生人数:</td>
<td><a href="<%= url_for(:controller => 'courses', :action=>"member", :id=>item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %></a></td>
<td>开课学期:</td>
<td><%= item.time %><%= get_course_term_locales item %></td>
</tr>
</tbody></table>
</div>
</div>
<% if(course_end_flag) %>
<span class="grey_n_btn fr mt20">课程结束</span>
<% elsif(can_edit_flag) %>
<a href="<%=url_for(:controller => 'homework_common', :action => 'new',:course=>item.id, :host=>Setting.host_course)%>" class="blue_n_btn fr mt20">发布作业</a>
<% else %>
<a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>" class="blue_n_btn fr mt20">提交作品</a>
<% end %>
<div class="cl"></div>
</div>

@ -4,7 +4,7 @@
<div class="inf_user_image">
<table style="border-bottom: solid 1px #80a6d2;" width="100%">
<tr>
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@user), :class => 'avatar2') %></td>
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@user), :class => 'avatar2',:style=>'max-width:150px;max-height:150px;') %></td>
<td width="35%">
<table>
<tr class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><td><%= h @user.name %></td></tr>

@ -0,0 +1,50 @@
<div class="courses_list line" id="fans_item_<%=item.id%>">
<div class="courses_list_pic fl">
<a href="javascirpt:void();">
<%= image_tag(url_to_avatar(item), :style=>"width:64px;height:64px;",:alt=>"头像") %>
</a>
</div>
<div class="courses_list_info fl ml10">
<a href="<%= user_path(item) %>" title="<%= item.show_name %>" class="courses_list_title f14 fb c_blue02 fl"><%= item.show_name %></a>
<div class="cl"></div>
<div class="courses_list_table ">
<% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %>
<p class="fans_sign" title="<%= item.user_extensions.brief_introduction %>">个性签名:<%= item.user_extensions.brief_introduction %></p>
<% end %>
<table><tbody><tr>
<td class="td_w60 ">加入时间:</td>
<td class="td_w110 "><%= format_date(item.created_on) %></td>
<% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.user_extensions.school.name %>">
<a href="<%= url_for(:controller=>'welcome',:action => 'course', :school_id => item.user_extensions.school.id,:host=>Setting.host_course) %>"><%= item.user_extensions.school.name %></a>
</li>
</td>
<% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.user_extensions.occupation %>">
<%= item.user_extensions.occupation %>
</li>
</td>
<% elsif item.user_extensions.identity == 2 %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.show_name %>">
<%= item.show_name %>
</li>
</td>
<% end %>
</tr></tbody></table>
</div>
</div>
<% if(User.current.logged? && User.current != item )%>
<%if(item.watched_by?(User.current))%>
<a href="<%= watch_path(:object_type=>'user',:object_id=>item.id,:target_id=>target.id) %>" class="grey_n_btn fr mt20" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
<% else %>
<a href="<%= watch_path(:object_type=>'user',:object_id=>item.id,:target_id=>target.id) %>" class="blue_n_btn fr mt20" data-method="post" data-remote="true" title="添加关注">添加关注</a>
<% end %>
<% end %>
<div class="cl"></div>
</div>

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save