Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
Conflicts: app/controllers/memos_controller.rb
This commit is contained in:
commit
a6b4ec64e2
|
@ -33,7 +33,7 @@ class BoardsController < ApplicationController
|
|||
#modify by nwb
|
||||
@flag = params[:flag] || false
|
||||
if @project
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? && !User.current.allowed_to?(:view_messages, @project)
|
||||
render_403
|
||||
else
|
||||
@boards = @project.boards.includes(:last_message => :author).all
|
||||
|
|
|
@ -15,6 +15,7 @@ class ContestantWorksController < ApplicationController
|
|||
|
||||
def new
|
||||
#更新消息
|
||||
if @contestwork.work_status == 1
|
||||
noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
|
||||
noEvaluation.update_all(:viewed => true)
|
||||
|
||||
|
@ -23,6 +24,9 @@ class ContestantWorksController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.html{ render :layout => "base_contests"}
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
|
@ -175,11 +175,11 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
case params[:agree]
|
||||
when 'Y'
|
||||
if ContestMember.where(:user_id => apply_user.id).first.nil?
|
||||
if ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first.nil?
|
||||
member = ContestMember.new(:user_id => apply_user.id)
|
||||
Contest.find(applied_contest.contest_id).contest_members << member
|
||||
else
|
||||
member = ContestMember.where(:user_id => apply_user.id).first
|
||||
member = ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first
|
||||
end
|
||||
|
||||
contest_member_roles = member.contest_member_roles
|
||||
|
|
|
@ -273,7 +273,7 @@ class NewsController < ApplicationController
|
|||
elsif @news.contest_id
|
||||
@contest = Contest.find(@news.contest_id)
|
||||
if @contest
|
||||
@left_nav_type = 4
|
||||
@left_nav_type = 5
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_contests'}
|
||||
|
|
|
@ -70,7 +70,7 @@ class WorksController < ApplicationController
|
|||
homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
homework.work_status = homework.publish_time > Date.today ? 0 : 1
|
||||
homework.work_status = homework.publish_time > Date.today ? 0 : (homework.end_time < Date.today ? 2 : 1)
|
||||
|
||||
work_detail_manual = WorkDetailManual.new
|
||||
|
||||
|
|
|
@ -103,8 +103,10 @@ class Message < ActiveRecord::Base
|
|||
:if => lambda {|message, user|
|
||||
if message.project
|
||||
user.allowed_to?(:edit_messages, message.project)
|
||||
else
|
||||
elsif message.course
|
||||
user.allowed_to?(:edit_messages, message.course)
|
||||
elsif message.contest
|
||||
user.admin_of_contest?(message.contest)
|
||||
end
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<div class="homepageLeft-new" id="forum_right_bar">
|
||||
<div class="wenba-rightbar">
|
||||
<div class="wenba-rightbar-top clearfix">
|
||||
<h3 class="fl ml10">推荐问吧</h3>
|
||||
<h3 class="fl ml10">推荐贴吧</h3>
|
||||
</div>
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
</div>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<% unless memo.nil? %>
|
||||
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
|
||||
<select class="languageBox">
|
||||
<option value="Chinese" selected="selected">中文</option>
|
||||
<option value="English">英文</option>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<% if hidden_unproject_infos && !memo.nil? %>
|
||||
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
|
||||
<li class="fl"><a href="<%= forums_path %>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<% memo = Memo.where(:id => 1168).first %>
|
||||
<% unless memo.nil? %>
|
||||
<li class="navHomepageMenu fl mr20">
|
||||
<%= link_to "贴吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
|
||||
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li ><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="" >帮助中心<span>|</span></a></li>
|
||||
<% end %>
|
||||
<li ><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="" > 贴吧交流</a></li>
|
||||
<li ><a href="<%= forums_path %>" target="_blank" class="" > 问吧交流</a></li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<p>Copyright 2007~2016, All Rights Reserved 湘ICP备09019772</p>
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank">贴吧交流</a></li>
|
||||
<li class="fl"><a href="<%= forums_path %>" class="f_grey mw20" target="_blank">问吧交流</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -410,7 +410,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="fl">帮助中心</a></li>
|
||||
<% end %>
|
||||
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="fl"> 贴吧交流</a></li>
|
||||
<li><a href="<%= forums_path %>" target="_blank" class="fl"> 问吧交流</a></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<p>Copyright 2007~2016 All Rights Reserved<br>湘ICP备09019772</p>
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">问吧交流</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -32,14 +32,14 @@
|
|||
l(:button_edit),
|
||||
{:action => 'edit', :id => @news},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current == @news.author || User.current.admin_of_contest?(@contest) %>
|
||||
) if User.current == @news.author || User.current.admin_of_contest?(@contest) || User.current.admin? %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
news_path(@news),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current == @news.author || User.current.admin_of_contest?(@contest) %>
|
||||
) if User.current == @news.author || User.current.admin_of_contest?(@contest) || User.current.admin? %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div>
|
||||
<p class="fl sy_p_grey">
|
||||
更新时间:<%= format_date(contest.updated_at) %>
|
||||
创建者:<%= contest.user.show_name %>
|
||||
创建者:<%= link_to contest.user.show_name, user_path(contest.user) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -45,14 +45,14 @@
|
|||
l(:button_edit),
|
||||
{controller:'news', :action => 'edit', :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) %>
|
||||
) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) || User.current.admin? %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
news_path(activity),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) %>
|
||||
) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) || User.current.admin? %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<span class="homepageNewsType fl">发布了竞赛题:</span>
|
||||
</li>
|
||||
<li class="messageInformationContents">
|
||||
<% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? %>
|
||||
<% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 %>
|
||||
<%= link_to ma.contest_message.name, new_contestant_work_path(:work => ma.contest_message.id),
|
||||
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||
:target => '_blank',
|
||||
|
|
|
@ -2135,7 +2135,7 @@ zh:
|
|||
label_recruitment_information: 招聘信息
|
||||
label_surpport_group: 帮助中心
|
||||
#label_forums: 论坛反馈
|
||||
label_forums: 贴吧交流
|
||||
label_forums: 问吧交流
|
||||
label_language: 语言
|
||||
label_license: 湘ICP备09019772
|
||||
label_org_name: 组织名称:
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
namespace :contest_work_evaluation do
|
||||
desc "start and end evaluation"
|
||||
def get_assigned_contestant_works(judges, n, index, num)
|
||||
judges[(index % num) .. ((index + n - 1) % num)]
|
||||
judges = judges + judges
|
||||
first_index = (index * n) % num
|
||||
last_index = (index * n + n - 1) % num < first_index ? ((index * n + n - 1) % num) + num : (index * n + n - 1) % num
|
||||
judges[first_index .. last_index]
|
||||
end
|
||||
# 获取竞赛的评委人员
|
||||
def contest_judges contest
|
||||
|
|
Loading…
Reference in New Issue