From b22a3c026d6f57122aa064cdb0c42006801ee3c8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 16 Nov 2008 19:51:15 +0000 Subject: - Added missing file from #302054 --- modules/node/content_types.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/node/content_types.js (limited to 'modules') diff --git a/modules/node/content_types.js b/modules/node/content_types.js new file mode 100644 index 000000000..61ff33493 --- /dev/null +++ b/modules/node/content_types.js @@ -0,0 +1,24 @@ +Drupal.behaviors.contentTypes = { + attach: function() { + if ($('#edit-type').val() == $('#edit-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('#edit-type').val() == '') { + $('#edit-type-wrapper').hide(); + $('#edit-name').keyup(function() { + var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_'); + if (machine != '_' && machine != '') { + $('#edit-type').val(machine); + $('#node-type-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($(''+ Drupal.t('Edit') +'').click(function() { + $('#edit-type-wrapper').show(); + $('#node-type-name-suffix').hide(); + $('#edit-name').unbind('keyup'); + return false; + })).append(']'); + } + else { + $('#edit-type').val(machine); + $('#node-type-name-suffix').text(''); + } + }); + $('#edit-name').keyup(); + } + } +}; -- cgit v1.2.3