Signed-off-by: alan <547533434@qq.com>

This commit is contained in:
alan 2015-05-18 14:53:01 +08:00
parent 372bf71ca5
commit 34893db465
3 changed files with 53 additions and 5 deletions

View File

@ -24,7 +24,7 @@ gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
gem "rmagick", ">= 2.0.0"
#gem "rmagick", ">= 2.0.0"
group :development do
gem 'grape-swagger'

View File

@ -1,3 +1,16 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<style>
.comment{
position: relative;
width: 330px;
padding: 10px;
}
.comment .ke-toolbar{
position: absolute;
bottom: -18px;
}
</style>
<%= error_messages_for 'message' %>
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
@ -35,15 +48,50 @@
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name="content"]', {
resizeType : 1,
allowPreviewEmoticons : false,
allowImageUpload : false,
width:"100%",
items : [
'emoticons']
});
});
</script>
<% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %>
<%= text_area :quote,:quote,:style => 'display:none' %>
<div class="content">
<% if replying%>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %>
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
:width => '89%',
:height => 300,
:input_html => { :id => "message_content#{f.object.id}",
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 }%>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
:owner_id => @message.nil? ? 0: @message.id,
:owner_type => OwnerTypeHelper::MESSAGE,
:width => '90%',
:height => 300,
:class => 'talk_text fl',
:input_html => { :id => "message_content#{f.object.id}",
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 }%>
<% end %>
</div>
<div class="cl"></div>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p>
</li>

View File

@ -112,11 +112,11 @@
<% end %>
<% replies_all = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").offset(2).
reorder("#{Message.table_name}.id asc").offset(2).
all %>
<% replies_show = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").limit(2).
reorder("#{Message.table_name}.id asc").limit(2).
all %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>