diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-11-22 11:54:40 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-11-22 11:54:40 +0000 |
commit | b366ea6acb3ad87e9d091026b5ca19cd377cecc4 (patch) | |
tree | 7718e81e48760c3dc73d1cc5a255a8c65aea9660 /modules | |
parent | b547567e8591d92b66c1cd19cfae0d72d450be96 (diff) | |
download | brdo-b366ea6acb3ad87e9d091026b5ca19cd377cecc4.tar.gz brdo-b366ea6acb3ad87e9d091026b5ca19cd377cecc4.tar.bz2 |
- Patch #337660 by dmitrig01: usability improvement - show a preview for the Powered By Drupal block.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/system/system.js | 12 | ||||
-rw-r--r-- | modules/system/system.module | 8 |
2 files changed, 19 insertions, 1 deletions
diff --git a/modules/system/system.js b/modules/system/system.js index 8df6d5dd3..514dfb40a 100644 --- a/modules/system/system.js +++ b/modules/system/system.js @@ -120,3 +120,15 @@ Drupal.behaviors.dateTime = { $('select.date-format', context).trigger('change'); } }; + +/** + * Show the powered by Drupal image preview + */ +Drupal.behaviors.poweredByPreview = { + attach: function(context) { + $('#edit-color, #edit-size').change(function() { + var path = Drupal.settings.basePath + 'misc/' + $('#edit-color').val() + '-' + $('#edit-size').val() + '.png'; + $('img.powered-by-preview').attr('src', path); + }); + } +};
\ No newline at end of file diff --git a/modules/system/system.module b/modules/system/system.module index 1bab8e266..cfc10fe68 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -822,6 +822,7 @@ function system_user_timezone(&$edit, &$form) { * Generate a block with a promotional link to Drupal.org. */ function system_block($op = 'list', $delta = '', $edit = NULL) { + $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; switch ($op) { case 'list': $blocks['powered-by'] = array( @@ -832,6 +833,7 @@ function system_block($op = 'list', $delta = '', $edit = NULL) { ); return $blocks; case 'configure': + drupal_add_js(drupal_get_path('module', 'system') .'/system.js'); // Compile a list of fields to show $form['wrapper']['color'] = array( '#type' => 'select', @@ -845,13 +847,17 @@ function system_block($op = 'list', $delta = '', $edit = NULL) { '#default_value' => variable_get('drupal_badge_size', '80x15'), '#options' => array('80x15' => t('Small'), '88x31' => t('Medium'), '135x42' => t('Large')), ); + $form['wrapper']['preview'] = array( + '#type' => 'item', + '#title' => 'Preview', + '#markup' => theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system'), array('class' => 'powered-by-preview'), FALSE), + ); return $form; case 'save': variable_set('drupal_badge_color', $edit['color']); variable_set('drupal_badge_size', $edit['size']); break; case 'view': - $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; $block['subject'] = NULL; // Don't display a title $block['content'] = theme('system_powered_by', $image_path); return $block; |