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

This commit is contained in:
cxt 2016-12-22 17:13:25 +08:00
commit 5a27b84e97
7 changed files with 69 additions and 41 deletions

View File

@ -1,6 +1,7 @@
#encoding=utf-8
class ContestsController < ApplicationController
before_filter :find_contest, :only => [:show, :settings]
before_filter :find_contest, :only => [:show, :settings, :update]
before_filter :is_logged, :only => [:index, :new, :create]
layout "base_contests"
@ -39,6 +40,27 @@ class ContestsController < ApplicationController
end
end
def update
@contest.name = params[:contest][:name]
@contest.description = params[:contest][:description]
# @project.organization_id = params[:organization_id]
params[:contest][:is_public] == "on" ? @contest.is_public = 1 : @contest.is_public = 0
begin
if @contest.save
respond_to do |format|
format.html{redirect_to settings_contest_url(@contest)}
end
end
rescue Exception => e
@message = e.message
end
end
def settings
@roles = ["管理人员","开发者","报告人员"]
@members = @contest.member_principals.includes(:roles, :principal).all.sort
end
def join_contest
end
@ -117,8 +139,4 @@ class ContestsController < ApplicationController
redirect_to signin_path unless User.current.logged?
end
def settings
end
end

View File

@ -11,4 +11,5 @@ module OwnerTypeHelper
SYLLABUS = 10
ArticleHomepage = 11
PROJECT = 12
CONTEST = 13
end

View File

@ -7,15 +7,15 @@
<ul class="pro_newsetting_con mb15">
<li class="mb10">
<label class="label"><span class="c_red f12">*</span>&nbsp;竞赛名称&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="project[name]" id="contest_name" class="w625" onkeyup="regex_contest_name();" value="<%= @contest.name %>">
<input type="text" name="contest[name]" id="contest_name" class="w623" onkeyup="regex_contest_name();" value="<%= @contest.name %>">
<span class="c_red ml5 w690" id="contest_name_notice" style="padding-left:100px;display: none;">竞赛名称不能为空!</span>
</li>
<li class="clear mb10">
<label class="label fl">&nbsp;竞赛介绍&nbsp;&nbsp;:&nbsp;</label>
<label class="label fl mr3">&nbsp;竞赛介绍&nbsp;&nbsp;:&nbsp;</label>
<%= f.kindeditor :description, :editor_id => 'contest_setting_editor',
:owner_id => @project.nil? ? 0: @project.id,
:owner_type => OwnerTypeHelper::PROJECT,
:width => '85%',
:owner_id => @contest.nil? ? 0: @contest.id,
:owner_type => OwnerTypeHelper::CONTEST,
:width => '84%',
:height => 300,
:minHeight=> 300,
:class => 'fl ml5 w690',

View File

@ -1,34 +1,36 @@
<div class="pro_new_setting_conbox fl " style="width:100%; border:none;">
<a href="javascript:void(0);" class="fl sy_btn_green mb10 ml15">添加成员</a>
<a href="javascript:void(0);" class="fl sy_btn_green mb10 ml15" onclick="add_contest_member();">添加成员</a>
<div class="cl"></div>
<div class=" sy_new_tchbox clear" style="margin-left:10px; margin-right:10px">
<div class="hw_search_box mb10">
<input class=" sy_new_search" placeholder="支持姓名、邮箱、登录名搜索" type="text">
</div>
<div class="clear mb10">
<ul class="pro_new_idlist fl">
<li class=" clear " ><input type="checkbox" class="mr5 fl" ><span class="fl pro_new_idname mt3">shashashashashashasshashashashashashshashashashashashshashashashashashshashashashashashhasha</span></li>
<li class=" clear "><input type="checkbox" class="mr5 fl" ><span class="fl mt3">shashashashashashashasha</span></li>
<li class=" clear "><input type="checkbox" class="mr5 fl" ><span class="fl mt3">shashashashashashashasha</span></li>
<li class=" clear "><input type="checkbox" class="mr5 fl" ><span class="fl mt3">shashashashashashashasha</span></li>
<div class=" sy_new_tchbox clear undis" style="margin-left:10px; margin-right:10px" id="add_contest_member">
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@contest), :remote => true, :method => :post}) do |f| %>
<div class="hw_search_box mb10">
<input class=" sy_new_search" placeholder="支持姓名、邮箱、登录名搜索" type="text">
</div>
<div class="clear mb10">
<ul class="pro_new_idlist fl">
<li class=" clear " ><input type="checkbox" class="mr5 fl" ><span class="fl pro_new_idname mt3">shashashashashashasshashashashashashshashashashashashshashashashashashshashashashashashhasha</span></li>
<li class=" clear "><input type="checkbox" class="mr5 fl" ><span class="fl mt3">shashashashashashashasha</span></li>
<li class=" clear "><input type="checkbox" class="mr5 fl" ><span class="fl mt3">shashashashashashashasha</span></li>
<li class=" clear "><input type="checkbox" class="mr5 fl" ><span class="fl mt3">shashashashashashashasha</span></li>
</ul>
<ul class="fl pro_new_idbox">
<li class="clear ">
<input type="checkbox" class="mt2 fl" >
<p class="fl ml5"> 管理员</p>
</li>
<li class="clear ">
<input type="checkbox" class="mt2 fl" >
<p class="fl ml5"> 评委</p>
</li>
<li class="clear ">
<input type="checkbox" class="mt2 fl" >
<p class="fl ml5"> 参赛者</p>
</li>
</ul>
</div>
<a href="javascript:void(0);" class="fr sy_btn_grey ">取消</a><a href="javascript:void(0);" class="fr sy_btn_blue mr5">保存</a>
</ul>
<ul class="fl pro_new_idbox">
<li class="clear ">
<input type="checkbox" class="mt2 fl" >
<p class="fl ml5"> 管理员</p>
</li>
<li class="clear ">
<input type="checkbox" class="mt2 fl" >
<p class="fl ml5"> 评委</p>
</li>
<li class="clear ">
<input type="checkbox" class="mt2 fl" >
<p class="fl ml5"> 参赛者</p>
</li>
</ul>
</div>
<a href="javascript:void(0);" class="fr sy_btn_grey ">取消</a><a href="javascript:void(0);" class="fr sy_btn_blue mr5">保存</a>
<% end %>
</div>
<div class=" clear ml10 mr10" >
@ -79,4 +81,10 @@
</tbody>
</table>
</div>
</div>
</div>
<script>
function add_contest_member(){
$("#add_contest_member").show();
}
</script>

View File

@ -26,8 +26,7 @@
<div class="sy_class_infobox">
<p class="sy_cgrey mb10">
<%= link_to @contest.user.try(:show_name), user_path(@contest.user), :class => "sy_cgrey" %>&nbsp;&gt;&nbsp;
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>&nbsp;&gt;&nbsp;
<%= link_to "配置", settings_contest_path(@contest), :class => "sy_cgrey" %>
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>
</p>
<% if is_contest_manager?(User.current.id, @contest.id) %>
<%= render :partial => "contests/mamager_setting" %>

View File

@ -151,6 +151,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.ml358{ margin-left:358px;}
.mr-5 {margin-right:-5px;}
.mr2{ margin-right:2px;}
.mr3{ margin-right:3px;}
.mr5{ margin-right:5px;}
.mr8{ margin-right:8px;}
.mr10{ margin-right:10px;}

View File

@ -35,5 +35,6 @@ p.pro_new_grey{ line-height: 1.9; }
.game-setting-h3{ width: 100%; height: 40px; line-height: 40px; font-size: 14px; color: #666; font-weight: normal; background: #fff; border-bottom: 10px solid #eaebec;}
.w695{width: 695px; }
.w625{width: 625px; }
.w623{width: 623px; }
.sy_new_table tbody tr th{ height:40px; line-height:40px; border-bottom:1px solid #e5e5e5; color:#888;}