实训编辑功能完善
This commit is contained in:
parent
8655e91d48
commit
e95c686ea1
|
@ -97,8 +97,14 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
@shixun.attributes = params[:shixun]
|
||||
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
|
||||
if @shixun.save
|
||||
redirect_to settings_shixun_url(@shixun)
|
||||
else
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<div class="panel-form task-setting-tab">
|
||||
<ul>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>名称:</label>
|
||||
<input type="text" class="panel-form-width-690 panel-form-height-30 fl" placeholder="Helloworld:Java入门实训项目" value="<%= @shixun.name %>"/>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">预备知识:</label>
|
||||
<textarea class="panel-form-width-690 panel-form-height-150 fl"><%= @shixun.description %></textarea>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">默认分支:</label>
|
||||
<select class="panel-form-height-30 fl mt5">
|
||||
<option>master</option>
|
||||
</select>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">公开:</label>
|
||||
<input type="checkbox" class="fl mt15 mr10" />
|
||||
<span class="fl">(选中为公开项目,不选中为私有项目;私有项目仅自己可见。)</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<a href="#" class="task-btn task-btn-green fr mr10">保存</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,58 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
<div class="panel-form task-setting-tab">
|
||||
<ul>
|
||||
<%= labelled_form_for @shixun do |f| %>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>名称:</label>
|
||||
<input type="text" id="shixun_name" name="shixun[name]" class="panel-form-width-690 panel-form-height-30 fl" placeholder="Helloworld:Java入门实训项目" value="<%= @shixun.name %>"/>
|
||||
<span class="c_red ml5 w690" id="project_name_notice" style="padding-left:100px;display: none;">实训名称不能为空!</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">预备知识:</label>
|
||||
<%= f.kindeditor :description, :editor_id => 'shixun_setting_editor',
|
||||
:owner_id => @shixun.nil? ? 0: @shixun.id,
|
||||
:owner_type => OwnerTypeHelper::PROJECT,
|
||||
:width => '85%',
|
||||
:height => 300,
|
||||
:minHeight=> 300,
|
||||
:class => 'fl ml5 w690',
|
||||
:input_html => { :id => 'project_description',
|
||||
:class => 'courses_text fl',
|
||||
:maxlength => 5000 }
|
||||
%>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">公开:</label>
|
||||
<input type="checkbox" <%= @shixun.is_public ? "checked" : ""%> class="fl mt15 mr10" name="shixun[is_public]" />
|
||||
<span class="fl">(选中为公开实训,不选中为私有实训;私有实训仅自己可见。)</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-green fr mr10" onclick="submit_edit_shixun(<%= @shixun.id %>);" >保存</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function regex_shixun_name() {
|
||||
var name = $.trim($("#shixun_name").val());
|
||||
if (name.length == 0) {
|
||||
$("#project_name_notice").show();
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$("#project_name_notice").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//配置-信息提交
|
||||
function submit_edit_shixun(id) {
|
||||
shixun_setting_editor.sync();
|
||||
if (regex_shixun_name()) {
|
||||
$("#edit_shixun_" + id).submit();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -14,7 +14,7 @@
|
|||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="tab_con_1" class="" >
|
||||
<%= render :partial=>"shixuns/settings_edit" %>
|
||||
<%= render :partial=> "shixuns/settings_edit" %>
|
||||
</div>
|
||||
<div id="tab_con_2" class="undis" >
|
||||
<%= render :partial=>"shixuns/settings_repository" %>
|
||||
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
<div class="pro_new_setting_conbox fl ml10">
|
||||
<div class="<%= show_memu == 'edit_project' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_01">
|
||||
<%= render :partial=>"shixuns/settings_edit" %>
|
||||
<%= render :partial=> "shixuns/settings_edit" %>
|
||||
</div><!--tbc_01 end-->
|
||||
<div class="<%= show_memu == 'manage_repository' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_06">
|
||||
<%= render :partial=>"shixuns/settings_repository" %>
|
||||
|
|
Loading…
Reference in New Issue