Wiki edit fields css

This commit is contained in:
Karel.Picman 2021-12-15 13:55:41 +01:00
parent 44ac90f114
commit 5298fd5d70
11 changed files with 15 additions and 34 deletions

View File

@ -35,7 +35,6 @@ class DmsfController < ApplicationController
before_action :find_folder_by_title, only: [:show]
before_action :get_query, only: [:expand_folder, :show, :trash, :empty_trash, :index]
before_action :get_project_roles, only: [:new, :edit, :create, :save]
before_action :text_formating, only: [:show, :edit, :edit_root]
accept_api_auth :show, :create, :save, :delete
@ -709,8 +708,4 @@ class DmsfController < ApplicationController
members: { project_id: @project.id }).distinct
end
def text_formating
@wiki = Setting.text_formatting != 'HTML'
end
end

View File

@ -83,7 +83,6 @@ 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 {

View File

@ -29,7 +29,6 @@ class DmsfUploadController < ApplicationController
before_action :authorize_global, only: [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
before_action :find_folder, except: [:upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
before_action :permissions, except: [:upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
before_action :wiki, only: [:multi_upload, :upload_files]
helper :all
helper :dmsf_workflows
@ -145,8 +144,4 @@ class DmsfUploadController < ApplicationController
render_403
end
def wiki
@wiki = Setting.text_formatting != 'HTML'
end
end

View File

@ -22,14 +22,8 @@
<% if @project %>
<div class="dmsf-header">
<% if @wiki %>
<div class="wiki">
<div class="wiki dmsf-description">
<%= textilizable @folder ? @folder.description : @project.dmsf_description %>
</div>
<% else %>
<div class="dmsf-description">
<%= h @folder ? @folder.description : @project.dmsf_description %>
</div>
<% end %>
</div>
<% end %>

View File

@ -81,7 +81,7 @@
<%= f.text_field :title, required: true %>
</p>
<p>
<%= f.text_area :description, rows: 8, class: @wiki ? 'wiki-edit' : 'dmsf-description' %>
<%= f.text_area :description, rows: 8, class: 'wiki-edit dmsf-description' %>
</p>
<p>
<% dir = @folder.inherited_permissions_from %>
@ -140,6 +140,6 @@
</div>
<% end %>
<% if @wiki %>
<% if Setting.text_formatting != 'HTML' %>
<%= wikitoolbar_for 'dmsf_folder_description' %>
<% end %>

View File

@ -45,8 +45,7 @@
<%= labelled_form_for(@project, url: { action: 'save_root', id: @project }, html: { method: :post }) do |f| %>
<div class="box tabular">
<p>
<%= f.text_area :dmsf_description, rows: 8, class: @wiki ? 'wiki-edit' : 'dmsf-description',
label: l(:field_description) %>
<%= f.text_area :dmsf_description, rows: 8, class: 'wiki-edit dmsf-description', label: l(:field_description) %>
</p>
<div class="form-actions">
<%= f.submit l(:submit_save), class: 'button-positive' %>
@ -54,6 +53,6 @@
</div>
<% end %>
<% if @wiki %>
<% if Setting.text_formatting != 'HTML' %>
<%= wikitoolbar_for 'project_dmsf_description' %>
<% end %>

View File

@ -44,7 +44,7 @@
</div>
</div>
<p>
<%= f.text_area :description, rows: 6, class: wiki ? 'wiki-edit' : 'dmsf-description' %>
<%= f.text_area :description, rows: 6, class: 'wiki-edit dmsf-description' %>
</p>
<div class="clear">
<div class="splitcontentright">
@ -86,7 +86,7 @@
</p>
</div>
<p>
<%= f.text_area :comment, rows: 2, label: l(:label_comment), class: wiki ? 'wiki-edit' : 'dmsf-description' %>
<%= f.text_area :comment, rows: 2, label: l(:label_comment), class: 'wiki-edit dmsf-description' %>
</p>
<div class="form-actions">
<%= f.submit l(:button_create), class: 'button-positive' %>
@ -96,7 +96,7 @@
</div>
</div>
<% if wiki %>
<% if Setting.text_formatting != 'HTML' %>
<%= wikitoolbar_for 'dmsf_file_revision_description' %>
<%= wikitoolbar_for 'dmsf_file_revision_comment' %>
<% end %>

View File

@ -61,7 +61,7 @@
<% if @file_manipulation_allowed && !@file.locked_for_user? %>
<%= error_messages_for 'file' %>
<%= error_messages_for 'revision' %>
<%= render partial: 'file_new_revision', locals: { wiki: @wiki } %>
<%= render partial: 'file_new_revision' %>
<% end %>
<div class="dmsf-id-box">

View File

@ -46,7 +46,7 @@
<p>
<%= label_tag "commited_files[#{i}][description]", l(:label_description) %>
<%= text_area_tag "commited_files[#{i}][description]", upload.description, rows: 6,
class: wiki ? 'wiki-edit' : 'dmsf-description' %>
class: 'wiki-edit dmsf-description' %>
</p>
<div class="clear">
<div class="splitcontentright">
@ -93,12 +93,11 @@
</div>
<p>
<%= label_tag "commited_files[#{i}][comment]", l(:label_comment) %>
<%= text_area_tag "commited_files[#{i}][comment]", upload.comment, rows: 2,
class: wiki ? 'wiki-edit' : 'dmsf-description' %>
<%= text_area_tag "commited_files[#{i}][comment]", upload.comment, rows: 2, class: 'wiki-edit dmsf-description' %>
</p>
</div>
<% if wiki %>
<% if Setting.text_formatting != 'HTML' %>
<%= wikitoolbar_for "commited_files_#{i}_description" %>
<%= wikitoolbar_for "commited_files_#{i}_comment" %>
<% end %>

View File

@ -41,7 +41,7 @@
<% if upload.locked %>
<%= render partial: 'upload_file_locked', locals: { upload: upload, i: i } %>
<% else %>
<%= render partial: 'upload_file', locals: { upload: upload, i: i, wiki: @wiki } %>
<%= render partial: 'upload_file', locals: { upload: upload, i: i } %>
<% end %>
<% end %>
<div class="form-actions">

View File

@ -41,14 +41,14 @@ class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
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'
assert_include 'wiki-edit', response.body, 'wiki-edit class not 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 'dmsf-description', response.body, 'dmsf-description class not found'
assert_include 'wiki-edit', response.body, 'wiki-edit class not found'
end