]> source.dussan.org Git - redmine.git/commitdiff
Hide issue custom fields when disabling issue tracking on new project.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 5 Oct 2013 10:45:43 +0000 (10:45 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 5 Oct 2013 10:45:43 +0000 (10:45 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12200 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/projects/_form.html.erb
public/javascripts/application.js

index 010729d125f2dd40328515553e40ee315c952839..9077a0120ee01a078936775b4cae8a5045a70a9f 100644 (file)
@@ -37,7 +37,6 @@
     </label>
 <% end %>
 <%= hidden_field_tag 'project[enabled_module_names][]', '' %>
-<%= javascript_tag 'observeProjectModules()' %>
 </fieldset>
 <% end %>
 
     });
   <% 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 %>
index 057de3fc6cf000439b2728f04c7c5dc3a9c952ce..0ad0efc56eca918713f2adb4afeb59a158b82e0d 100644 (file)
@@ -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',