Missing date picker when creating new file #652

This commit is contained in:
Karel Picman 2017-02-14 13:49:53 +01:00
parent 59e360b9fd
commit 54a3805cca
4 changed files with 59 additions and 6 deletions

View File

@ -23,7 +23,8 @@ Changelog for Redmine DMSF
New columns in the main DMSF view; columns are configurable from the plugin settings New columns in the main DMSF view; columns are configurable from the plugin settings
* Bug: #663 - Locked documnts on My page * 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 * Bug: #651 - Incomplete copy of a file to another project
* New: #641 - Documents export * New: #641 - Documents export
* New: #635 - Edit approval workflow steps * New: #635 - Edit approval workflow steps

View File

@ -32,6 +32,7 @@ require 'redmine_dmsf/patches/project_tabs_extended'
require 'redmine_dmsf/patches/user_preference_patch' require 'redmine_dmsf/patches/user_preference_patch'
require 'redmine_dmsf/patches/user_patch' require 'redmine_dmsf/patches/user_patch'
require 'redmine_dmsf/patches/issue_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 # Load up classes that make up our WebDAV solution ontop of DAV4Rack
require 'redmine_dmsf/webdav/base_resource' require 'redmine_dmsf/webdav/base_resource'

View File

@ -0,0 +1,55 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-17 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.
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

View File

@ -4,7 +4,7 @@
# #
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com> # Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -26,7 +26,6 @@ module RedmineDmsf
module Patches module Patches
module CustomFieldsHelperPatch module CustomFieldsHelperPatch
def self.included(base) def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods) base.send(:include, InstanceMethods)
base.class_eval do base.class_eval do
unloadable unloadable
@ -36,9 +35,6 @@ module RedmineDmsf
end end
end end
module ClassMethods
end
module InstanceMethods module InstanceMethods
def render_custom_fields_tabs_with_render_custom_tab(types) def render_custom_fields_tabs_with_render_custom_tab(types)