114 lines
4.3 KiB
Plaintext
114 lines
4.3 KiB
Plaintext
<%= content_for(:header_tags) do %>
|
|
<%= import_ke(enable_at: true, prettify: false) %>
|
|
<% end %>
|
|
|
|
<div class="resources mt10">
|
|
<div id="new_course_news">
|
|
<div class="homepagePostBrief c_grey">
|
|
<div>
|
|
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布通知,请先输入通知标题" value="<%= news.title%>" >
|
|
<p id="title_notice_span"></p>
|
|
</div>
|
|
<div id="news_editor" style="display: none;">
|
|
<div class="mt10">
|
|
<%= f.check_box :sticky, :value => edit_mode ? news.sticky : 0 %>
|
|
<%= label_tag 'news_sticky', l(:label_board_sticky) %>
|
|
<div class="cl"></div>
|
|
</div>
|
|
<div class="mt10">
|
|
<div id="news_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
|
<%= text_area :quote,:quote,:style => 'display:none' %>
|
|
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
|
|
|
<%= f.kindeditor :description, :editor_id => 'news_description_editor',
|
|
:owner_id => news.nil? ? 0: news.id,
|
|
:owner_type => OwnerTypeHelper::NEWS,
|
|
:width => '100%',
|
|
:height => 300,
|
|
:minHeight=>300,
|
|
:class => 'talk_text fl',
|
|
:input_html => { :id => 'news_content',
|
|
:class => 'talk_text fl',
|
|
:maxlength => 5000 },
|
|
at_id: news.id, at_type: news.class.to_s
|
|
%>
|
|
<div class="cl"></div>
|
|
<p id="description_notice_span"></p>
|
|
</div>
|
|
<div class="cl"></div>
|
|
<div class="mt10">
|
|
<div class="fl" id="news_attachments">
|
|
<%= render :partial => 'attachments/form_course', :locals => {:container => news, :isReply => false} %>
|
|
</div>
|
|
</div>
|
|
<div class="cl"></div>
|
|
<div class="mt5">
|
|
<%if !edit_mode %>
|
|
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_contest_news();">确定</a>
|
|
<span class="fr mr10 mt3">或</span>
|
|
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_news();">取消</a>
|
|
<% else %>
|
|
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_contest_news();">确定</a>
|
|
<span class="fr mr10 mt3">或</span>
|
|
<%= link_to "取消",news_path(news), :class => "fr mr10 mt3"%>
|
|
<% end %>
|
|
</div>
|
|
<div class="cl"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function regexcontestTitle()
|
|
{
|
|
var name = $("#news_title").val();
|
|
if(name.length ==0)
|
|
{
|
|
$("#title_notice_span").text("标题不能为空");
|
|
$("#title_notice_span").css('color','#ff0000');
|
|
$("#news_title").focus();
|
|
return false;
|
|
}
|
|
else if(name.length <= 60)
|
|
{
|
|
$("#title_notice_span").text("填写正确");
|
|
$("#title_notice_span").css('color','#008000');
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
$("#title_notice_span").text("标题超过60个字符");
|
|
$("#title_notice_span").css('color','#ff0000');
|
|
$("#news_title").focus();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function regexcontestDescription()
|
|
{
|
|
var name = news_description_editor.html();
|
|
if(news_description_editor.isEmpty())
|
|
{
|
|
$("#description_notice_span").text("描述不能为空");
|
|
$("#description_notice_span").css('color','#ff0000');
|
|
$("#description_notice_span").focus();
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
$("#description_notice_span").text("填写正确");
|
|
$("#description_notice_span").css('color','#008000');
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function submit_contest_news()
|
|
{
|
|
if(regexcontestTitle() && regexcontestDescription())
|
|
{
|
|
news_description_editor.sync();
|
|
$("#news-form").submit();
|
|
}
|
|
}
|
|
</script> |