Merge branch 'cxt_course' into 'develop'

上线bug修复



See merge request !70
This commit is contained in:
陈晓婷 2016-12-17 10:35:56 +08:00
commit feca94ffc0
21 changed files with 81 additions and 90 deletions

View File

@ -42,7 +42,7 @@ class PollController < ApplicationController
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
else
@can_edit_poll = (!has_commit_poll?(@poll.id,User.current.id)) || User.current.admin?
@can_edit_poll = @poll.user != User.current && ((!has_commit_poll?(@poll.id,User.current.id)) || User.current.admin?)
@percent = get_percent(@poll,User.current)
@poll_questions = @poll.poll_questions
@left_nav_type = 7
@ -804,7 +804,7 @@ class PollController < ApplicationController
current_index = 1
poll_questions.each_with_index do |poll_question, i|
if poll_question.question_type == 1 || poll_question.question_type == 2
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ") if poll_vote.poll_answer}.join(";")
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| (poll_vote.vote_text.nil? ? poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ") : l(:label_other_answer) + " (" + poll_vote.vote_text.to_s + ") ") if poll_vote.poll_answer}.join(";")
current_index += 1
elsif poll_question.question_type == 3
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")}.join(";")

View File

@ -2128,12 +2128,6 @@ class UsersController < ApplicationController
when "course_journals"
container_type = 'Course'
act_type = 'JournalsForMessage'
when "user_journals"
container_type = 'Principal'
act_type = 'JournalsForMessage'
when "current_user"
container_type = 'Principal'
act_type = 'Principal'
when "all"
container_type = 'all'
act_type = 'all'
@ -2142,23 +2136,12 @@ class UsersController < ApplicationController
if container_type != '' && container_type != 'all'
if container_type == 'Course'
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end
else
if User.current != @user
blog_ids = "("+@user.blog.id.to_s+")"
else
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
end
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" +
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
if container_type != 'all' && User.current != @user
sql = "user_id = #{@user.id} and(" + sql + ")"
end
@ -2191,12 +2174,6 @@ class UsersController < ApplicationController
when "project_message"
container_type = 'Project'
act_type = 'Message'
when "user_journals"
container_type = 'Principal'
act_type = 'JournalsForMessage'
when "current_user"
container_type = 'Principal'
act_type = 'Principal'
when "all"
container_type = 'all'
act_type = 'all'
@ -2205,23 +2182,12 @@ class UsersController < ApplicationController
if container_type != '' && container_type != 'all'
if container_type == 'Project'
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}))"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end
else
if User.current != @user
blog_ids = "("+@user.blog.id.to_s+")"
else
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
end
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})"
if container_type != 'all' && User.current != @user
sql = "user_id = #{@user.id} and(" + sql + ")"
end

View File

@ -82,13 +82,13 @@
<% end %>
</ul>
</div>
<div class="user_leftnav ">
<ul class="users_accordion mb10">
<li id="user_10" class="user_icons_mes">
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
</li>
</ul>
</div>
<!--<div class="user_leftnav ">-->
<!--<ul class="users_accordion mb10">-->
<!--<li id="user_10" class="user_icons_mes">-->
<!--<%#= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
@ -109,5 +109,16 @@
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
<script>
function leftCourseslistChange(){
var target = $('#user_courses_li>li');
for(var i = 10; i < target.length; i++){
target.eq(i).slideToggle();
}
$('#hide_show_courseicon').toggleClass("user_icons_closeclass");
$('#hide_show_courseicon').toggleClass("user_icons_moreclass");
}
</script>
</body>
</html>

View File

@ -92,5 +92,16 @@
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
<script>
function leftProjectslistChange(){
var target = $('#user_projects_li>li');
for(var i = 10; i < target.length; i++){
target.eq(i).slideToggle();
}
$('#hide_show_projecticon').toggleClass("user_icons_closeclass");
$('#hide_show_projecticon').toggleClass("user_icons_moreclass");
}
</script>
</body>
</html>

View File

@ -143,7 +143,7 @@
<li>
<a href="<%= user_watchlist_user_path(@user) %>">
<strong>关注</strong><br />
<span class="sy_cgrey"><%= User.watched_by(@user).count %></span>
<span class="sy_cgrey" id="user_watchers_number"><%= User.watched_by(@user).count %></span>
</a>
</li>
<li>
@ -309,23 +309,6 @@
$("#projectMenu").mouseleave(function(){
$("#topnav_project_menu").hide();
});
function leftCourseslistChange(){
var target = $('#user_courses_li>li');
for(var i = 10; i < target.length; i++){
target.eq(i).slideToggle();
}
$('#hide_show_courseicon').toggleClass("user_icons_closeclass");
$('#hide_show_courseicon').toggleClass("user_icons_moreclass");
}
function leftProjectslistChange(){
var target = $('#user_projects_li>li');
for(var i = 10; i < target.length; i++){
target.eq(i).slideToggle();
}
$('#hide_show_projecticon').toggleClass("user_icons_closeclass");
$('#hide_show_projecticon').toggleClass("user_icons_moreclass");
}
</script>
</body>
</html>

View File

@ -303,6 +303,7 @@
<% end %>
<% end %>
<% if @can_edit_poll %>
<div class="ur_buttons" style="width: 77px;">
<% if @poll.polls_status == 2 %>
<a href="javascript:void(0)" class="BlueCirBtn" onclick="commit_poll();"><%=l(:button_submit) %></a>
@ -316,6 +317,7 @@
<span id="percent"><%= format "%.2f", @percent %></span>%
</strong>
</div>
<% end %>
</div>
<!--问卷内容end-->
</div>

View File

@ -10,8 +10,8 @@
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.not_deleted.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a>
<% else %>
<a href='javascript:void(0);' class='Blue-btn' style="margin-left: 50px;" onclick='hideModal()'>关闭</a>
<a href='javascript:void(0);' class='Blue-btn' style="margin-left: 50px;" onclick='hideModal()'>取消</a>
<% end %>
</div>

View File

@ -19,7 +19,7 @@
</th>
<th>
<li class="homepageTabProjectName ml5">
<%= link_to ae.course.try(:name),"", :target => "_blank", :class => "homepageTabTitle ml5", :target => "_blank"%>
<%= link_to ae.course.try(:name),course_path(ae.course), :class => "homepageTabTitle ml5", :target => "_blank"%>
<li>
</th>
<th>

View File

@ -5,4 +5,16 @@
</div>
<div class="resources">
<%= render :partial => 'users/new_user_message', :locals => { :message_alls => @message_alls } %>
</div>
</div>
<script>
$(function(){
$(".messageInformationContents").each(function(){
var parentWidth = $(this).parent().width();
var eq0Width = $(this).parent().children().eq(0).width();
var eq1Width = $(this).parent().children().eq(1).width();
var classWidth = parentWidth - eq0Width - eq1Width - 20;
$(this).css("max-width",classWidth + "px");
});
});
</script>

View File

@ -109,7 +109,8 @@
<!--
<div id="show_more_activities" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %></div>
-->
<%= link_to "点击展开更多", user_activities_path(@user.id,:type => type,:page => page), :id => "show_more_activities", :remote => "true", :class => "loadMore mt10 f_grey"%>
<%= link_to "点击展开更多", action == "project_community" ? user_project_community_path(@user.id, :type => type, :page => page) : (action == "course_community" ? user_course_community_path(@user.id, :type => type,:page => page) : user_activities_path(@user.id,:type => type,:page => page)),
:id => "show_more_activities", :remote => "true", :class => "loadMore mt10 f_grey" %>
<% end%>
<!--

View File

@ -29,7 +29,8 @@
<!-- 匿评成绩申诉 -->
<% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %>
<ul class="homepageNewsList fl">
<% applied_user = User.find(ma.applied_user_id) %>
<div class="longMessageWidth">
<% applied_user = User.find(ma.applied_user_id) %>
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(applied_user), :width => "30", :height => "30"), user_path(applied_user), :target => '_blank' %>
</li>
@ -37,11 +38,12 @@
<%=link_to applied_user.show_name, user_path(applied_user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">申诉匿评成绩:</span>
</li>
<li class="homepageNewsContent fl">
<li class="messageInformationContents fl">
<% homework = ma.applied.student_works_score.student_work.homework_common %>
<%= link_to homework.name, student_work_index_path(:homework => homework.id, :show_work_id => ma.applied.student_works_score.student_work_id, :tab => 2), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %>
</li>
</ul>
<% end %>

View File

@ -38,7 +38,7 @@
<%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">评论了通知:</span>
</li>
<li class="messageinformationcontents">
<li class="messageInformationContents">
<%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" ,
:target => '_blank',
@ -177,7 +177,7 @@
<%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
<%= link_to ma.course_message.user.show_name + "老师",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">启动了作业匿评:</span>
</li>
@ -401,7 +401,7 @@
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<% if ma.course_message.reviewer_role == 3 %>
<%= link_to image_tag(url_to_avatar(""), "javascript:void(0);", :width => "30", :height => "30"), :target => '_blank' %>
<%= link_to image_tag(url_to_avatar(""), :width => "30", :height => "30"),"javascript:void(0);", :target => '_blank' %>
<% else %>
<%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %>
<% end %>
@ -628,6 +628,7 @@
<!-- 匿评申诉 -->
<% if ma.course_message_type == "StudentWorksScoresAppeal" && ma.course_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30"), "javascript:void(0);", :target => '_blank' %>
</li>
@ -648,11 +649,12 @@
<% end %>
</span>
</li>
<li class="homepageNewsContent fl">
<li class="messageInformationContents">
<%= link_to ma.course_message.student_works_score.student_work.homework_common.name, student_work_index_path(:homework => ma.course_message.student_works_score.student_work.homework_common_id, :show_work_id => ma.course_message.student_works_score.student_work_id, :tab => 2),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!-- 创建课程消息 -->
@ -666,8 +668,7 @@
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="homepageNewsType fl">您成功创建了班级:</span>
</li>
<li class="messageInformationContents
">
<li class="messageInformationContents">
<%= link_to "班级名称:" + ma.course_message.name, course_path(ma.course_message),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
@ -819,7 +820,7 @@
<%=link_to User.find(ma.course_message_id).show_name, user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">将您移出了班级:</span>
</li>
<li class="messageinformationcontents">
<li class="messageInformationContents">
<%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->

View File

@ -16,9 +16,8 @@
var parentWidth = $(this).parent().width();
var eq0Width = $(this).parent().children().eq(0).width();
var eq1Width = $(this).parent().children().eq(1).width();
var classWidth = parentWidth - eq0Width - eq1Width;
var classWidth = parentWidth - eq0Width - eq1Width - 20;
$(this).css("max-width",classWidth + "px");
});
//$(".messageInformationContents").width()
});
</script>

View File

@ -31,7 +31,7 @@
<%# end %>
<% if @user_activities_count > 0 %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type,
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %>
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "course_community" } %>
<% else %>
<div class="mb10">
<%= render :partial => 'users/no_data' %>

View File

@ -29,7 +29,7 @@
<%# end %>
<% if @user_activities_count > 0 %>
<%= render :partial => 'users/user_activities', :locals => { :user_activities => @user_activities, :page => 0, :type => @type,
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %>
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "project_community" } %>
<% else %>
<div class="mb10">
<%= render :partial => 'users/no_data' %>

View File

@ -39,7 +39,7 @@
</div>
<!--显示个人主页-->
<% if @user_activities_count > 0 %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} %>
<% else %>
<div class="mb10">
<%= render :partial => 'users/no_data' %>

View File

@ -1,5 +1,5 @@
<% if is_current_user %>
$("#user_homepage_message_list").html("<%= escape_javascript( render :partial => 'users/user_message_list') %>");
<% else %>
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} )%>");
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} )%>");
<% end %>

View File

@ -14,6 +14,8 @@
$("#fans_user_number_div").html('<%= escape_javascript ( link_to User.find(params[:target_id]).watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>params[:target_id]},:class=>"homepageImageNumber", :id => "user_fans_number") %>');
$("#fans_span").html('<%= count %>');
$("#watch_span").html('<%= count %>');
$("#user_watchers_number").html('<%= User.watched_by(User.current).count %>');
$("#user_fans_number").html('<%= User.current.watcher_users.count %>');
//在其他用户的粉丝、关注页面
<% else %>
$("#users_list").html("<%= escape_javascript (render :partial => 'users/user_fans_item', :locals => {:list => list,:target=>User.find(params[:target_id]),:action_name=>action_name,:page=>params[:page]}) %>");

View File

@ -105,6 +105,7 @@ zh:
label_user_name: "用户名称"
#setting end
label_course_poll: 课程问卷
label_course_poll: "课程问卷"
label_other_answer: "其他"
label_homework_committed: 你已经提交过作品,如果你想修改作品的话,可以在作品列表页面对作品信息进行修改。
label_homework_committed: "你已经提交过作品,如果你想修改作品的话,可以在作品列表页面对作品信息进行修改。"

View File

@ -565,7 +565,7 @@ a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
left: 0;
content: '';
width: 24px;
height: 50px;
height: 40px;
margin: 4px 8px;
background-repeat: no-repeat;
background-image:url(/images/user/icons_user_leftnav.png);

View File

@ -113,7 +113,7 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
.users_accordion > li:target > a span,
.users_accordion > li > a.active span {margin-left:10px;color: #333;background: #dbdbdb;}
/* Images */
.users_accordion > li > a:before {position: absolute;top: 0;left: 0;content: '';width: 24px;height: 50px;margin: 4px 8px;background-repeat: no-repeat;background-image:url(/images/user/icons_user_leftnav.png);background-position: 5px 15px;}
.users_accordion > li > a:before {position: absolute;top: 0;left: 0;content: '';width: 24px;height: 40px;margin: 4px 8px;background-repeat: no-repeat;background-image:url(/images/user/icons_user_leftnav.png);background-position: 5px 15px;}
.users_accordion li.user_icons_course > a:before { background-position: 5px 15px; }
.users_accordion li.user_icons_course:hover > a:before,
.users_accordion li.user_icons_course:target > a:before,
@ -168,7 +168,7 @@ a.user_navmorebox .user_icons_closeclass{display:block;position: absolute;top:5p
.user_navmore_txt li a.user_navmore_li {font-size:12px;color:#888; display:block; width:75px;height:24px;line-height:24px; }
.user_navmore_txt li a.user_navmore_add{ width:10px;color:#888; padding:0 5px; }
.user_navmore_txt li:hover,.user_navmore_txt li a:hover{background-color:#f0f0f0;}
/* 新版个人主页 */
#messageTabList li { float:left; padding:10px 15px; text-align:center; }
.homepageTabTitle { max-width:330px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}