diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 325517e4b..b88ecf775 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -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(/ /," ") 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(/ /," ") : 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(/ /," ")}.join(";") diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0790696cc..93c0c18cd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/layouts/base_course_community.html.erb b/app/views/layouts/base_course_community.html.erb index 9a4a509a3..8eed02482 100644 --- a/app/views/layouts/base_course_community.html.erb +++ b/app/views/layouts/base_course_community.html.erb @@ -82,13 +82,13 @@ <% end %> -
- -
+ + + + + + + <%# 更新访问数,刷新的时候更新访问次数 %> <% update_visiti_count @user %>
访问计数 <%= @user.visits.to_i %> (自2016年5月)
@@ -109,5 +109,16 @@ + + \ No newline at end of file diff --git a/app/views/layouts/base_project_community.html.erb b/app/views/layouts/base_project_community.html.erb index f1b2e20ba..e61bd67cf 100644 --- a/app/views/layouts/base_project_community.html.erb +++ b/app/views/layouts/base_project_community.html.erb @@ -92,5 +92,16 @@ + + \ No newline at end of file diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index a65bb8436..1e31674f4 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -143,7 +143,7 @@
  • 关注
    - <%= User.watched_by(@user).count %> + <%= User.watched_by(@user).count %>
  • @@ -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"); - } \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 2ef7c4a26..85ed34fc7 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -303,6 +303,7 @@ <% end %> <% end %> +<% if @can_edit_poll %>
    <% if @poll.polls_status == 2 %> <%=l(:button_submit) %> @@ -316,6 +317,7 @@ <%= format "%.2f", @percent %>%
    +<% end %> diff --git a/app/views/syllabuses/_delete_syllabus.html.erb b/app/views/syllabuses/_delete_syllabus.html.erb index a72a87c03..d0a143551 100644 --- a/app/views/syllabuses/_delete_syllabus.html.erb +++ b/app/views/syllabuses/_delete_syllabus.html.erb @@ -10,8 +10,8 @@
    <% if @syllabus.courses.not_deleted.empty? %> <%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%> - 关闭 + 取消 <% else %> - 关闭 + 取消 <% end %>
    \ No newline at end of file diff --git a/app/views/users/_anonymous_evaluation_list.html.erb b/app/views/users/_anonymous_evaluation_list.html.erb index e2c4fe83d..507bf00e3 100644 --- a/app/views/users/_anonymous_evaluation_list.html.erb +++ b/app/views/users/_anonymous_evaluation_list.html.erb @@ -19,7 +19,7 @@
  • - <%= 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"%>
  • diff --git a/app/views/users/_unapproval_applied_list.html.erb b/app/views/users/_unapproval_applied_list.html.erb index 5256b1082..362307d43 100644 --- a/app/views/users/_unapproval_applied_list.html.erb +++ b/app/views/users/_unapproval_applied_list.html.erb @@ -5,4 +5,16 @@
    <%= render :partial => 'users/new_user_message', :locals => { :message_alls => @message_alls } %> -
    \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index e8a3143e3..54eeffbd7 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -109,7 +109,8 @@ - <%= 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%> <% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %> <% end %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 0e3e3b508..edc94d6cc 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -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' %> 评论了通知:
  • -
  • +
  • <%= 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' %>
  • - <%= 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' %> 启动了作业匿评:
  • @@ -401,7 +401,7 @@
  • <% 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 %> <% end %> @@ -666,8 +668,7 @@ 系统提示 您成功创建了班级:
  • -
  • +
  • <%= link_to "班级名称:" + ma.course_message.name, course_path(ma.course_message), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> @@ -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' %> 将您移出了班级:
  • -
  • +
  • <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> diff --git a/app/views/users/_user_message_list.html.erb b/app/views/users/_user_message_list.html.erb index 4cf520ff6..1cea4f989 100644 --- a/app/views/users/_user_message_list.html.erb +++ b/app/views/users/_user_message_list.html.erb @@ -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() }); \ No newline at end of file diff --git a/app/views/users/course_community.html.erb b/app/views/users/course_community.html.erb index eb82a09ba..724bb730c 100644 --- a/app/views/users/course_community.html.erb +++ b/app/views/users/course_community.html.erb @@ -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 %>
    <%= render :partial => 'users/no_data' %> diff --git a/app/views/users/project_community.html.erb b/app/views/users/project_community.html.erb index e1c8735a3..64ce8ce9e 100644 --- a/app/views/users/project_community.html.erb +++ b/app/views/users/project_community.html.erb @@ -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 %>
    <%= render :partial => 'users/no_data' %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 069a1bfd3..9a6ec18d4 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -39,7 +39,7 @@
    <% 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 %>
    <%= render :partial => 'users/no_data' %> diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb index 0c0fa2310..20e515859 100644 --- a/app/views/users/show.js.erb +++ b/app/views/users/show.js.erb @@ -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 %> diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index 83358b049..016465391 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -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]}) %>"); diff --git a/config/locales/courses/zh.yml b/config/locales/courses/zh.yml index ac7e1b4a3..3cecad728 100644 --- a/config/locales/courses/zh.yml +++ b/config/locales/courses/zh.yml @@ -105,6 +105,7 @@ zh: label_user_name: "用户名称" #setting end - label_course_poll: 课程问卷 + label_course_poll: "课程问卷" + label_other_answer: "其他" - label_homework_committed: 你已经提交过作品,如果你想修改作品的话,可以在作品列表页面对作品信息进行修改。 \ No newline at end of file + label_homework_committed: "你已经提交过作品,如果你想修改作品的话,可以在作品列表页面对作品信息进行修改。" \ No newline at end of file diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 44268348b..6bacebe59 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -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); diff --git a/public/stylesheets/css/user.css b/public/stylesheets/css/user.css index 0743dc192..8957de38f 100644 --- a/public/stylesheets/css/user.css +++ b/public/stylesheets/css/user.css @@ -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;}