Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-10-21 14:23:20 +08:00
commit 49c77312da
9 changed files with 62 additions and 50 deletions

View File

@ -27,6 +27,7 @@ class ArticleHomepagesController < ApplicationController
end
def show
@user = User.find params[:user_id]
respond_to do |format|
format.html {render :layout => 'clear_base'}
end

View File

@ -96,9 +96,9 @@ class HomeworkCommonController < ApplicationController
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
if anonymous != @homework.anonymous_comment
if anonymous == 1
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 1.0 : 0.4
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 0.6 : 0.3
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
end
end

View File

@ -1063,9 +1063,9 @@ class UsersController < ApplicationController
homework_detail_manual = HomeworkDetailManual.new
if homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 1.0 : 0.4
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
end
if homework.publish_time > Date.today
homework_detail_manual.comment_status = 0
@ -3581,13 +3581,11 @@ class UsersController < ApplicationController
end
def homepage
if @user.base_homepage
@article = @user.base_homepage
respond_to do |format|
format.html {render :layout => 'clear_base'}
end
end
end
private

View File

@ -3623,8 +3623,9 @@ def course_syllabus_option user = User.current
end
def create_works_list homework
unless homework.course.nil?
students = homework.course.student
if !homework.course.nil? && !students.empty?
if !students.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
@ -3638,6 +3639,7 @@ def create_works_list homework
ActiveRecord::Base.connection.execute sql
end
end
end
# 获取项目动态更新时间
def get_forge_act_message(act, type)

View File

@ -1,50 +1,47 @@
<div class="homepageContentContainer" style="margin-top: 25px;">
<div class="homepageMainContent">
<div class="postRightContainer pr" style="padding: 25px 40px;">
<% if User.current && User.current == @article.user %>
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="top: -25px;">
<% if User.current == @user && @article == @user.base_homepage %>
<div class="homepagePostSetting" style="top: -25px;">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(l(:button_conf_base_homepage), user_homepages_path(:user_id=>@article.user_id), :class => 'postOptionLink' )%>
<%# if @article.id == @article.homepage.article_id %>
<%#= link_to(
l(:button_cancel_base_homepage),
{:controller => 'homepages',:action => 'cancel_homepage',:user_id=>@article.user_id,:id=>@article.homepage_id, :article_id => @article.id, :show => 1},
:method => :post,
:class => 'postOptionLink'
)%>
<%# else %>
<%#= link_to(
l(:button_set_base_homepage),
{:controller => 'homepages',:action => 'set_homepage',:user_id=>@article.user_id,:id=>@article.homepage_id, :article_id => @article.id, :show => 1},
:method => :post,
:class => 'postOptionLink'
) %>
<%# end %>
<%= link_to(l(:button_conf_base_homepage), user_homepages_path(:user_id=>@user.id), :class => 'postOptionLink' )%>
</li>
<!--<li>-->
<!--<%#= link_to(-->
<!--l(:button_edit),-->
<!--{:controller => 'article_homepages',:action => 'edit', :id => @article.id},-->
<!--:class => 'postOptionLink'-->
<!--) %>-->
<!--</li>-->
<!--<li>-->
<!--<%#= link_to(-->
<!--l(:button_delete),-->
<!--{:controller => 'article_homepages',:action => 'destroy', :id => @article.id},-->
<!--:method => :delete,-->
<!--:data => {:confirm => l(:text_are_you_sure)},-->
<!--:class => 'postOptionLink'-->
<!--) %>-->
<!--</li>-->
</ul>
</li>
</ul>
</div>
<% elsif !@article.nil? && @article != @user.base_homepage %>
<p class="sy_cgrey" style="position:absolute; height:20px; left: 1px; top: -22px;">
<span class="fl">
<%= link_to(@user.show_name, user_path(@user), :class => 'sy_cgrey') %>
&nbsp;&gt;&nbsp;
</span>
<% if @user.base_homepage %>
<span class="fl">
<%=link_to @user.base_homepage.title, homepage_user_path(@user.login), :class => 'sy_cgrey fl', :style => 'white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 300px;' %>
&nbsp;&gt;&nbsp;
</span>
<% else %>
<span class="fl">
<%=link_to '编辑主页', user_homepages_path(:user_id => @user.id), :class => 'sy_cgrey' %>
&nbsp;&gt;&nbsp;
</span>
<% end %>
<%=link_to @article.title, user_homepage_show_path(:user_id=> @article.user_id,:id=> @article), :class => 'sy_cgrey', :style => 'white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 300px;' %>
</p>
<% end %>
<% if @article.nil? %>
<% if User.current == @user && @user.homepage.article_homepages.empty? %>
<p class="nodata mt10" style="text-align: left;">您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id), :target => "_blank", :class => 'linkBlue' %></p>
<% elsif User.current == @user %>
<p class="nodata mt10 mb0" style="text-align: left;">您还没有设置个人主页,其他用户无法查看哦</p>
<% else %>
<p class="nodata mt10 mb0" style="text-align: left;">该用户还未设置个人主页</p>
<% end %>
<% else %>
<div class="cl"></div>
<div class="postThemeContainer">
<div class="postDetailPortrait">
@ -52,7 +49,7 @@
</div>
<div class="postThemeWrap">
<div class="postDetailTitle fl mt5">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;"><%= @article.title%></a>
<a href="javascript:void(0);" class="f14 linkGrey4 fb break_word" style="overflow:hidden;"><%= @article.title%></a>
</div>
<div class="cl"></div>
@ -64,6 +61,7 @@
<div class="break_word mt10" style="padding: 5px 5px 0 0" id="intro_content">
<%=@article.content.html_safe %>
</div>
<% end %>
</div>
</div>
</div>

View File

@ -16,7 +16,7 @@
<ul class="list-file pr" onmouseover='$("#message_setting_<%= activity.id%>").show();' onmouseout='$("#message_setting_<%= activity.id%>").hide();'>
<li><span class="item_list fl"></span>
<% if activity.homepage.article_id and activity.id == activity.homepage.article_id %>
<%= link_to activity.title.to_s.html_safe, homepage_user_path(activity.user_id), :class=> "list-title fl", :target => '_blank' %>
<%= link_to activity.title.to_s.html_safe, homepage_user_path(activity.user.login), :class=> "list-title fl", :target => '_blank' %>
<span class="red_homework_btn_cir ml5">主页</span>
<% else %>
<%= link_to activity.title.to_s.html_safe, user_homepage_show_path(:user_id=>activity.user_id,:id=>activity), :class=> "list-title fl", :target => '_blank' %>

View File

@ -2,14 +2,14 @@
<% if User.current.logged?%>
<% if User.current == target%>
<li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%= link_to("编辑基本资料", my_account_path, :class => "user_editinfo") %></li>
<li style="width: 118px; float: left;"><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo" %></li>
<li style="width: 118px; float: left;"><%= link_to '个人主页', homepage_user_path(@user.login), :class => "user_editinfo", :target => '_blank' %></li>
<li class="cl"></li>
<% else%>
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
<% if target.base_homepage.nil? %>
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
<% else %>
<%=link_to "主页", homepage_user_path(@user), :class => 'user_editinfo', :target => '_blank' %>
<%=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
<% end %>
</li>
<li style="width: 118px; float: left;">

View File

@ -182,7 +182,7 @@
<li style="height:auto;">
<% if @user.homepage && !@user.homepage.article_homepages.empty? %>
<% if @user.base_homepage %>
<%=link_to '查看', homepage_user_path(@user), :class => 'linkBlue',:target => '_blank' %>
<%=link_to '查看', homepage_user_path(@user.login), :class => 'linkBlue',:target => '_blank' %>
<% else %>
<%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %>
<% end %>

View File

@ -0,0 +1,13 @@
class UpdateGroupHomeworkScoreRule < ActiveRecord::Migration
def up
homeworks = HomeworkCommon.where("homework_type = 3 and anonymous_comment = 1")
homeworks.each do |homework|
if homework.homework_detail_manual
homework.homework_detail_manual.update_column("ta_proportion", 1.0)
end
end
end
def down
end
end