#1008 Comment
This commit is contained in:
parent
fc6f8ccde4
commit
3e8594a832
32
app/helpers/dmsf_files_helper.rb
Normal file
32
app/helpers/dmsf_files_helper.rb
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
#
|
||||||
|
# Redmine plugin for Document Management System "Features"
|
||||||
|
#
|
||||||
|
# Copyright © 2011-19 Karel Pičman <karel.picman@kontron.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
module DmsfFilesHelper
|
||||||
|
|
||||||
|
def clean_wiki_text(text)
|
||||||
|
# If there is <p> tag, the text is moved one column to the right by Redmin's CSS. A new line causes double new line.
|
||||||
|
text.gsub! '<p>', ''
|
||||||
|
text.gsub! '</p>', ''
|
||||||
|
text.gsub! "\n\n", '<br/>'
|
||||||
|
text.gsub "\n\t", '<br/>'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
@ -112,12 +112,7 @@
|
|||||||
<% if revision.description.present? %>
|
<% if revision.description.present? %>
|
||||||
<div class="status attribute">
|
<div class="status attribute">
|
||||||
<%= content_tag :div, l(:label_description), :class => 'label' %>
|
<%= content_tag :div, l(:label_description), :class => 'label' %>
|
||||||
<% text = textilizable(revision.description) %>
|
<% text = clean_wiki_text(textilizable(revision.description)) %>
|
||||||
<%# If there is <p> tag, the text is moved one column to the right by Redmin's CSS. A new line causes double new line. %>
|
|
||||||
<% text.gsub! '<p>', '' %>
|
|
||||||
<% text.gsub! '</p>', '' %>
|
|
||||||
<% text.gsub! "\n\n", '<br/>' %>
|
|
||||||
<% text.gsub! "\n\t", '<br/>' %>
|
|
||||||
<%= content_tag :div, text.html_safe, :class => 'value wiki' %>
|
<%= content_tag :div, text.html_safe, :class => 'value wiki' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -146,10 +141,7 @@
|
|||||||
<% if revision.comment.present? %>
|
<% if revision.comment.present? %>
|
||||||
<div class="status attribute">
|
<div class="status attribute">
|
||||||
<%= content_tag :div, l(:label_comment), :class => 'label' %>
|
<%= content_tag :div, l(:label_comment), :class => 'label' %>
|
||||||
<% text = textilizable(revision.comment) %>
|
<% text = clean_wiki_text(textilizable(revision.comment)) %>
|
||||||
<% if text =~ /^<p>(.*)<\/p>$/ %>
|
|
||||||
<% text = $1 %>
|
|
||||||
<% end %>
|
|
||||||
<%= content_tag :div, text.html_safe, :class => 'value wiki' %>
|
<%= content_tag :div, text.html_safe, :class => 'value wiki' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user