Prevent datepickers to raise an error from erb file if they don't exist on the current page

This commit is contained in:
Hugo 2019-04-14 23:20:54 +02:00
parent 9ab93501e5
commit 6c53e0ef6d

View File

@ -131,7 +131,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
o << "</span>"
o << "<script>"
o << "//<![CDATA[\n"
o << " $(function() { $('#StartDateInput input').addClass('date').datepickerFallback(datepickerOptions); });\n"
o << " if(typeof datepickerOptions !== 'undefined'){\n"
o << " $(function() { $('#StartDateInput input').addClass('date').datepickerFallback(datepickerOptions); });\n"
o << " }\n"
o << "//]]>\n"
o << "</script>"
end
@ -145,7 +147,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
o << "</span>"
o << "<script>"
o << "//<![CDATA[\n"
o << " $(function() { $('#DueDateInput input').addClass('date').datepickerFallback(datepickerOptions); });\n"
o << " if(typeof datepickerOptions !== 'undefined'){\n"
o << " $(function() { $('#DueDateInput input').addClass('date').datepickerFallback(datepickerOptions); });\n"
o << " }\n"
o << "//]]>\n"
o << "</script>"
end