项目新闻添加编辑器:显示页面、列表页面新样式显示

This commit is contained in:
huang 2015-05-27 14:45:36 +08:00
parent e0ea57b213
commit 95f3d89afa
5 changed files with 31 additions and 20 deletions

View File

@ -53,13 +53,13 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor",
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
# :accesskey => accesskey(:edit),
# :class => "w583",
:width=>'87%',
:resizeType => 0,
:no_label => true %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor",
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
# :accesskey => accesskey(:edit),
# :class => "w583",
:width=>'87%',
:resizeType => 0,
:no_label => true %>
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>

View File

@ -1,26 +1,35 @@
<li class="ml45">
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<input type="text" name="news[title]" class="hwork_input_news" id="news_title" width="576px" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<p id="title_notice_span" class="ml55"></p>
</li>
<li class="ml45">
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" maxlength="6000"><%= is_new ? '' : @news.description %></textarea>
<p id="description_notice_span" class="ml55"></p>
<li class="mb10">
<% if is_new %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'project_news_description_editor' %>
<p id="description_notice_span" class="ml55"></p>
<% else %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%', :editor_id=>'project_news_description_editor', :owner_id => @news.id, :owner_type => OwnerTypeHelper::NEWS %>
<p id="description_notice_span" class="ml55"></p>
<% end %>
</li>
<div class="cl"></div>
<li class="ml45">
<label class="fl">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<li>
<label class="fl mt5">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
<div class="cl"></div>
</li>
<li class=" ml90" >
<li class="ml40" >
<% if is_new %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
<%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %>
<% end %>
<div class="cl"></div>
</li>

View File

@ -29,7 +29,7 @@
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%= news.description %><br /> </p>
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
<span class="f1"><%= l(:label_create_time) %> <%= format_time(news.created_on) %></span>
</div>

View File

@ -212,6 +212,7 @@ function regexTitle() {
}
function regexDescription() {
project_news_description_editor.sync();
var name = $("#news_description").val();
if (name.length == 0) {
$("#description_notice_span").text("描述不能为空");

View File

@ -330,6 +330,7 @@ a:hover.st_add{ color:#ff8e15;}
.hwork_new{ color:#4c4c4c;}
.c_red{ color:#F00;}
.hwork_input{ border:1px solid #64bdd9; height:22px; width:555px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input_news{ border:1px solid #64bdd9; height:22px; width:594px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:120px; background:#fff; margin-bottom:10px; padding:5px;}
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.hwork_new ul li{ }