No wiki editor for revision's description if HTTP text format is on
This commit is contained in:
parent
9aeac6e2fe
commit
e12684e45c
@ -87,6 +87,7 @@ class DmsfFilesController < ApplicationController
|
||||
@file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project)
|
||||
@revision_count = @file.dmsf_file_revisions.visible.all.size
|
||||
@revision_pages = Paginator.new @revision_count, params['per_page'] ? params['per_page'].to_i : 25, params['page']
|
||||
@wiki = Setting.text_formatting != 'HTML'
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
||||
@ -42,8 +42,8 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<%= f.text_area :description, rows: 6, class: 'wiki-edit' %>
|
||||
<p>
|
||||
<%= f.text_area :description, rows: 6, class: wiki ? 'wiki-edit' : 'dmsf-description' %>
|
||||
</p>
|
||||
<div class="clear">
|
||||
<div class="splitcontentright">
|
||||
@ -84,8 +84,8 @@
|
||||
locals: { multiple: false, container: nil, description: false, awf: false } %>
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
<%= f.text_area :comment, rows: 2, label: l(:label_comment), class: 'wiki-edit' %>
|
||||
<p>
|
||||
<%= f.text_area :comment, rows: 2, label: l(:label_comment), class: wiki ? 'wiki-edit' : 'dmsf-description' %>
|
||||
</p>
|
||||
<div class="form-actions">
|
||||
<%= f.submit l(:button_create), class: 'button-positive' %>
|
||||
@ -95,4 +95,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= wikitoolbar_for 'dmsf_file_revision_description' %>
|
||||
<% if wiki %>
|
||||
<%= wikitoolbar_for 'dmsf_file_revision_description' %>
|
||||
<% end %>
|
||||
|
||||
@ -55,9 +55,9 @@
|
||||
<%= render partial: '/dmsf/path', locals: { folder: @file.dmsf_folder, filename: @file.title, title: nil } %>
|
||||
|
||||
<% if @file_manipulation_allowed && !@file.locked_for_user? %>
|
||||
<%= error_messages_for('file') %>
|
||||
<%= error_messages_for('revision') %>
|
||||
<%= render(partial: 'file_new_revision') %>
|
||||
<%= error_messages_for 'file' %>
|
||||
<%= error_messages_for 'revision' %>
|
||||
<%= render partial: 'file_new_revision', locals: { wiki: @wiki } %>
|
||||
<% end %>
|
||||
|
||||
<div class="dmsf-id-box">
|
||||
|
||||
@ -132,6 +132,10 @@ div[id*="revision_access_"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dmsf-description {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Command icons */
|
||||
.icon-link { background-image: url(../../../images/link.png); }
|
||||
.icon-approvalworkflows { background-image: url(../../../images/ticket_go.png); }
|
||||
|
||||
@ -25,7 +25,7 @@ module RedmineDmsf
|
||||
class DmsfViewListener < Redmine::Hook::ViewListener
|
||||
|
||||
def view_layouts_base_html_head(context={})
|
||||
return unless /^(Dmsf|Projects|Issues|Queries)/.match?(context[:controller].class.name)
|
||||
return unless /^(Dmsf|Projects|Issues|Queries|EasyCrmCases)/.match?(context[:controller].class.name)
|
||||
meta = "\n".html_safe + stylesheet_link_tag('redmine_dmsf.css', plugin: :redmine_dmsf) +
|
||||
"\n".html_safe + stylesheet_link_tag('select2.min.css', plugin: :redmine_dmsf) +
|
||||
"\n".html_safe + javascript_include_tag('select2.min.js', plugin: :redmine_dmsf, defer: true) +
|
||||
|
||||
@ -36,6 +36,22 @@ class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_show_formatting_html
|
||||
Setting.text_formatting = 'HTML'
|
||||
get :show, params: { id: @file1.id }
|
||||
assert_response :success
|
||||
assert_include 'dmsf-description', response.body, 'dmsf-description class not found'
|
||||
assert_not_include 'wiki-edit', response.body, 'wiki-edit class found'
|
||||
end
|
||||
|
||||
def test_show_formatting_textile
|
||||
Setting.text_formatting = 'Textile'
|
||||
get :show, params: { id: @file1.id }
|
||||
assert_response :success
|
||||
assert_not_include 'dmsf-description', response.body, 'dmsf-description class found'
|
||||
assert_include 'wiki-edit', response.body, 'wiki-edit class not found'
|
||||
end
|
||||
|
||||
def test_show_file_forbidden
|
||||
# Missing permissions
|
||||
@role_manager.remove_permission! :view_dmsf_files
|
||||
|
||||
@ -88,6 +88,7 @@ module RedmineDmsf
|
||||
Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] = 'WEBDAV_READ_WRITE'
|
||||
Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = nil
|
||||
Setting.plugin_redmine_dmsf['dmsf_storage_directory'] = File.join(%w(files dmsf))
|
||||
Setting.text_formatting = 'Textile'
|
||||
FileUtils.cp_r File.join(File.expand_path('../fixtures/files', __FILE__), '.'), DmsfFile.storage_path
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user