diff --git a/CHANGELOG.md b/CHANGELOG.md index 5882de1a..6b4cdade 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,8 @@ Changelog for Redmine DMSF New columns in the main DMSF view; columns are configurable from the plugin settings * Bug: #663 - Locked documnts on My page -* Bug: #662 - Broken paging on the Add approver form +* Bug: #662 - Broken paging on the Add approver form +* Bug: #652 - Missing date picker when creating new file * Bug: #651 - Incomplete copy of a file to another project * New: #641 - Documents export * New: #635 - Edit approval workflow steps diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index 460775c6..c18b7ff9 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -32,6 +32,7 @@ require 'redmine_dmsf/patches/project_tabs_extended' require 'redmine_dmsf/patches/user_preference_patch' require 'redmine_dmsf/patches/user_patch' require 'redmine_dmsf/patches/issue_patch' +require 'redmine_dmsf/patches/application_helper_patch' # Load up classes that make up our WebDAV solution ontop of DAV4Rack require 'redmine_dmsf/webdav/base_resource' diff --git a/lib/redmine_dmsf/patches/application_helper_patch.rb b/lib/redmine_dmsf/patches/application_helper_patch.rb new file mode 100644 index 00000000..e2dde201 --- /dev/null +++ b/lib/redmine_dmsf/patches/application_helper_patch.rb @@ -0,0 +1,55 @@ +# encoding: utf-8 +# +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2011-17 Karel Pičman +# +# 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. + +require_dependency 'application_helper' + +module RedmineDmsf + module Patches + module ApplicationHelperPatch + def self.included(base) + base.send(:include, InstanceMethods) + base.class_eval do + unloadable + + alias_method_chain :calendar_for, :square_brackets + end + end + + module InstanceMethods + + # If the field_id contains square brackets, jQuery is unable to find the tag by it's ID and therefore the Date + # picker is missing when a DMSF custom filed has got the date format. + def calendar_for_with_square_brackets(field_id) + field_id.gsub! '[', '\\\\\\[' + field_id.gsub! ']', '\\\\\\]' + calendar_for_without_square_brackets field_id + end + + end + end + end +end + +# Apply the patch +Rails.configuration.to_prepare do + unless ApplicationHelper.included_modules.include?(RedmineDmsf::Patches::ApplicationHelperPatch) + ApplicationHelper.send(:include, RedmineDmsf::Patches::ApplicationHelperPatch) + end +end \ No newline at end of file diff --git a/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb b/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb index 55766e78..f90bc612 100644 --- a/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb +++ b/lib/redmine_dmsf/patches/custom_fields_helper_patch.rb @@ -4,7 +4,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-17 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -26,7 +26,6 @@ module RedmineDmsf module Patches module CustomFieldsHelperPatch def self.included(base) - base.extend(ClassMethods) base.send(:include, InstanceMethods) base.class_eval do unloadable @@ -36,9 +35,6 @@ module RedmineDmsf end end - module ClassMethods - end - module InstanceMethods def render_custom_fields_tabs_with_render_custom_tab(types)