summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-11-16 19:51:15 +0000
committerDries Buytaert <dries@buytaert.net>2008-11-16 19:51:15 +0000
commitb22a3c026d6f57122aa064cdb0c42006801ee3c8 (patch)
treee9520fa17ecccc41304433dd73eaabfe31003e60 /modules
parentdc65b62aceddb0dc5f7b61bd1f1f3d46015a5969 (diff)
downloadbrdo-b22a3c026d6f57122aa064cdb0c42006801ee3c8.tar.gz
brdo-b22a3c026d6f57122aa064cdb0c42006801ee3c8.tar.bz2
- Added missing file from #302054
Diffstat (limited to 'modules')
-rw-r--r--modules/node/content_types.js24
1 files changed, 24 insertions, 0 deletions
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($('<a href="#">'+ Drupal.t('Edit') +'</a>').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();
+ }
+ }
+};