Loading modules/features/phase2_profile/phase2_profile.module +1 −0 Changes for modules/features/phase2_profile/phase2_profile.module: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ include_once('phase2_profile.theme.inc'); function phase2_profile_form_node_form_alter(&$form, &$form_state) { if ($form['type']['#value'] == 'profile') { $form['title']['#attributes']['readonly'] = TRUE; $form['title']['#attributes']['class'][] = 'disabled'; $form['title']['#description'] = t('This is set by entering the First and Last name or Organization name. It will be filled in automatically, and used as the display name throughout the site.'); } } modules/features/phase2_profile/theme/phase2_profile-node-form.css +1 −1 Changes for modules/features/phase2_profile/theme/phase2_profile-node-form.css: 1 added line, 1 removed line. Original line number Diff line number Diff line /* Make the profile title field look disabled */ .node-form .form-item-title input { .node-form .form-item-title input.disabled { background-color: #EEE; border: 1px solid #DDD; } No newline at end of file modules/features/phase2_profile/theme/phase2_profile.js +37 −6 Changes for modules/features/phase2_profile/theme/phase2_profile.js: 37 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -14,17 +14,48 @@ Drupal.behaviors.phase2_profile_name = { lastname: $('#edit-field-profile-last-name-und-0-value', context).addClass('display-name-source'), orgname: $('#edit-field-profile-organization-und-0-value', context).addClass('display-name-source'), } for (key in sources) { sources[key].bind('keyup.displayName change.displayName', function () { var content = ''; // This makes Organization name take precedence over First+Last name //content = (sources['orgname'].val()) ? sources['orgname'].val() : sources['firstname'].val() + ' ' + sources['lastname'].val(); var setContent = function () { var content = ''; content = (sources['orgname'].val()) ? sources['orgname'].val() : sources['firstname'].val() + ' ' + sources['lastname'].val(); // This makes First+Last name take precedence over Organization name content = (sources['firstname'].val() || sources['lastname'].val()) ? sources['firstname'].val() + ' ' + sources['lastname'].val() : sources['orgname'].val(); if ($('#edit-title').hasClass('disabled') && !$('#edit-title').hasClass('custom')){ $('#edit-title').val(content); }); } }; for (key in sources) { sources[key].bind('keyup.displayName change.displayName', setContent); } //make it possible to directly edit the title var edit = $('<a href="javascript:" title="Enable Full Name for direct editing.">Edit</a>'); var reset = $('<a href="javascript:" title="Reset to generated value." class="element-hidden" >Reset</a>'); $('#edit-title').after(edit); $(edit).after(reset); $(edit).after('<span class="seperator"> </span>'); var text = ''; edit.toggle(function(e){ $(this).text('Disable'); $('#edit-title').attr('readonly', '').removeClass('disabled'); text = $('#edit-title').val(); $(reset).addClass('element-hidden'); }, function(e){ $(this).text('Edit'); $('#edit-title').attr('readonly', 'true').addClass('disabled'); if($('#edit-title').val() != text) { $('#edit-title').addClass('custom'); $(reset).removeClass('element-hidden'); } }); reset.click(function(){ $('#edit-title').removeClass('custom'); setContent(); }); $("#edit-field-profile-staff-und", context).click(function (){ if (($("#edit-field-profile-staff-und:checked", context).length) && $(".staff-information.collapsed", context).length) { Loading Loading
modules/features/phase2_profile/phase2_profile.module +1 −0 Changes for modules/features/phase2_profile/phase2_profile.module: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ include_once('phase2_profile.theme.inc'); function phase2_profile_form_node_form_alter(&$form, &$form_state) { if ($form['type']['#value'] == 'profile') { $form['title']['#attributes']['readonly'] = TRUE; $form['title']['#attributes']['class'][] = 'disabled'; $form['title']['#description'] = t('This is set by entering the First and Last name or Organization name. It will be filled in automatically, and used as the display name throughout the site.'); } }
modules/features/phase2_profile/theme/phase2_profile-node-form.css +1 −1 Changes for modules/features/phase2_profile/theme/phase2_profile-node-form.css: 1 added line, 1 removed line. Original line number Diff line number Diff line /* Make the profile title field look disabled */ .node-form .form-item-title input { .node-form .form-item-title input.disabled { background-color: #EEE; border: 1px solid #DDD; } No newline at end of file
modules/features/phase2_profile/theme/phase2_profile.js +37 −6 Changes for modules/features/phase2_profile/theme/phase2_profile.js: 37 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -14,17 +14,48 @@ Drupal.behaviors.phase2_profile_name = { lastname: $('#edit-field-profile-last-name-und-0-value', context).addClass('display-name-source'), orgname: $('#edit-field-profile-organization-und-0-value', context).addClass('display-name-source'), } for (key in sources) { sources[key].bind('keyup.displayName change.displayName', function () { var content = ''; // This makes Organization name take precedence over First+Last name //content = (sources['orgname'].val()) ? sources['orgname'].val() : sources['firstname'].val() + ' ' + sources['lastname'].val(); var setContent = function () { var content = ''; content = (sources['orgname'].val()) ? sources['orgname'].val() : sources['firstname'].val() + ' ' + sources['lastname'].val(); // This makes First+Last name take precedence over Organization name content = (sources['firstname'].val() || sources['lastname'].val()) ? sources['firstname'].val() + ' ' + sources['lastname'].val() : sources['orgname'].val(); if ($('#edit-title').hasClass('disabled') && !$('#edit-title').hasClass('custom')){ $('#edit-title').val(content); }); } }; for (key in sources) { sources[key].bind('keyup.displayName change.displayName', setContent); } //make it possible to directly edit the title var edit = $('<a href="javascript:" title="Enable Full Name for direct editing.">Edit</a>'); var reset = $('<a href="javascript:" title="Reset to generated value." class="element-hidden" >Reset</a>'); $('#edit-title').after(edit); $(edit).after(reset); $(edit).after('<span class="seperator"> </span>'); var text = ''; edit.toggle(function(e){ $(this).text('Disable'); $('#edit-title').attr('readonly', '').removeClass('disabled'); text = $('#edit-title').val(); $(reset).addClass('element-hidden'); }, function(e){ $(this).text('Edit'); $('#edit-title').attr('readonly', 'true').addClass('disabled'); if($('#edit-title').val() != text) { $('#edit-title').addClass('custom'); $(reset).removeClass('element-hidden'); } }); reset.click(function(){ $('#edit-title').removeClass('custom'); setContent(); }); $("#edit-field-profile-staff-und", context).click(function (){ if (($("#edit-field-profile-staff-und:checked", context).length) && $(".staff-information.collapsed", context).length) { Loading