From 50a84f49a6bc96a0106279ec9125bcc67b6f908b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Thu, 23 Apr 2020 14:51:54 +0200 Subject: [PATCH] Easy submit buttons --- app/views/dmsf/edit.html.erb | 28 +++++++++---------- .../hooks/views/base_view_hooks.rb | 2 -- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index e9acefa6..0d5676dc 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -22,29 +22,29 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -<% html_title(l(:dmsf)) %> +<% html_title l(:dmsf) %>
<% if !@folder.new_record? && User.current.allowed_to?(:folder_manipulation, @project) && !@folder.system %> <% if @folder.locked? %> - <%= link_to_if(@folder.unlockable? && (!@folder.locked_for_user? || @force_file_unlock_allowed), l(:button_unlock), + <%= link_to_if @folder.unlockable? && (!@folder.locked_for_user? || @force_file_unlock_allowed), l(:button_unlock), unlock_dmsf_path(id: @project, folder_id: @folder), - title: l(:title_unlock_file), class: 'icon icon-unlock') %> + title: l(:title_unlock_file), class: 'icon icon-unlock' %> <% else %> - <%= link_to(l(:button_lock), lock_dmsf_path(id: @project, folder_id: @folder), - title: l(:title_lock_file), class: 'icon icon-lock') %> + <%= link_to l(:button_lock), lock_dmsf_path(id: @project, folder_id: @folder), + title: l(:title_lock_file), class: 'icon icon-lock' %> <% end %> <% unless @folder.locked? %> <% if @folder.notification %> - <%= link_to(l(:label_notifications_off), + <%= link_to l(:label_notifications_off), notify_deactivate_dmsf_path(id: @project, folder_id: @folder), title: l(:title_notifications_active_deactivate), - class: 'icon icon-email') %> + class: 'icon icon-email' %> <% else %> - <%= link_to(l(:label_notifications_on), + <%= link_to l(:label_notifications_on), notify_activate_dmsf_path(id: @project, folder_id: @folder), title: l(:title_notifications_not_active_activate), - class: 'icon icon-email-add') %> + class: 'icon icon-email-add' %> <% end %> <% end %> <% unless @folder.locked? %> @@ -61,12 +61,12 @@ <%= labelled_form_for(@folder, url: { action: create ? 'create' : 'save', id: @project, folder_id: @folder, parent_id: @parent}, - html: { method: :post}) do |f| %> - <%= error_messages_for(@folder) %> + html: { method: :post }) do |f| %> + <%= error_messages_for @folder %> <%= f.hidden_field :redirect_to_folder_id, value: @redirect_to_folder_id %>

- <%= f.text_field(:title, required: true) %> + <%= f.text_field :title, required: true %>

<%= f.text_area :description, rows: 8, class: 'wiki-edit' %> @@ -120,11 +120,11 @@

<% values = @folder ? @folder.custom_field_values : (@parent ? @parent.custom_field_values : DmsfFolder.new.custom_field_values) %> <% values.each do |value| %> -

<%= custom_field_tag_with_label(:dmsf_folder, value) %>

+

<%= custom_field_tag_with_label :dmsf_folder, value %>

<% end %>
- <%= submit_tag(create ? l(:button_create) : l(:submit_save), class: 'button-positive') %> + <%= submit_tag create ? l(:button_create) : l(:submit_save), class: 'button-positive' %>
<% end %> diff --git a/lib/redmine_dmsf/hooks/views/base_view_hooks.rb b/lib/redmine_dmsf/hooks/views/base_view_hooks.rb index 0535e8fa..3ecfb43a 100644 --- a/lib/redmine_dmsf/hooks/views/base_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/base_view_hooks.rb @@ -32,9 +32,7 @@ module RedmineDmsf "\n".html_safe + javascript_include_tag('select2.min.js', plugin: :redmine_dmsf, defer: true) + "\n".html_safe + javascript_include_tag('redmine_dmsf.js', plugin: :redmine_dmsf, defer: true) + "\n".html_safe + javascript_include_tag('attachments_dmsf.js', plugin: :redmine_dmsf, defer: true) - # TODO: Why it's not included by EasyExtensions? if defined?(EasyExtensions) - meta << "\n".html_safe + javascript_include_tag('jquery-2.2.4-ui-1.11.0-ujs-5.2.3', 'application') meta << "\n".html_safe + javascript_include_tag('context_menu', 'application') end meta