diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb
index 010729d12..9077a0120 100644
--- a/app/views/projects/_form.html.erb
+++ b/app/views/projects/_form.html.erb
@@ -37,7 +37,6 @@
<% end %>
<%= hidden_field_tag 'project[enabled_module_names][]', '' %>
-<%= javascript_tag 'observeProjectModules()' %>
<% end %>
@@ -87,3 +86,15 @@
});
<% end %>
<% end %>
+
+<%= javascript_tag do %>
+$(document).ready(function() {
+ $('#project_enabled_module_names_issue_tracking').on('change', function(){
+ if ($(this).attr('checked')){
+ $('#project_trackers, #project_issue_custom_fields').show();
+ } else {
+ $('#project_trackers, #project_issue_custom_fields').hide();
+ }
+ }).trigger('change');
+});
+<% end %>
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 057de3fc6..0ad0efc56 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -517,20 +517,6 @@ function observeSearchfield(fieldId, targetId, url) {
});
}
-function observeProjectModules() {
- var f = function() {
- /* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */
- if ($('#project_enabled_module_names_issue_tracking').attr('checked')) {
- $('#project_trackers').show();
- } else {
- $('#project_trackers').hide();
- }
- };
-
- $(window).load(f);
- $('#project_enabled_module_names_issue_tracking').change(f);
-}
-
function initMyPageSortable(list, url) {
$('#list-'+list).sortable({
connectWith: '.block-receiver',