Mercurial > defr > drupal > scald > dnd
changeset 21:69db20fdbac2
Cleanup and refactoring.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Tue, 10 Mar 2009 13:46:49 -0500 |
parents | 89fe0aca43d4 |
children | 40b5dd396feb |
files | dnd-library.tpl.php dnd.admin.inc dnd.info dnd.install dnd.module dnd_test/dnd-editor-item.tpl.php dnd_test/dnd-library-header.tpl.php dnd_test/dnd-library-item.tpl.php dnd_test/dnd-library-preview.tpl.php dnd_test/dnd_test.css dnd_test/dnd_test.info dnd_test/dnd_test.module dnd_test/img-backup/page-1-large.jpg dnd_test/img-backup/page-1-small.jpg dnd_test/img-backup/page-2-large.jpg dnd_test/img-backup/page-2-small.jpg dnd_test/img/item-1-L.jpg dnd_test/img/item-1-M.jpg dnd_test/img/item-1-S.jpg dnd_test/img/item-1-thumb.jpg dnd_test/img/item-2-L.jpg dnd_test/img/item-2-M.jpg dnd_test/img/item-2-S.jpg dnd_test/img/item-2-thumb.jpg dnd_test/img/item-3-L.jpg dnd_test/img/item-3-M.jpg dnd_test/img/item-3-S.jpg dnd_test/img/item-3-thumb.jpg js/bt/.jquery.bt.js.swp js/dnd-library.js |
diffstat | 7 files changed, 52 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/dnd.module Sun Mar 08 20:29:57 2009 -0500 +++ b/dnd.module Tue Mar 10 13:46:49 2009 -0500 @@ -56,8 +56,7 @@ /** * Settings array: - * What should it take, if anything? Probably a source... - * maybe editor specific configuration shit? + * What should it take, if anything? Probably a source * maybe editor specific configuration shit? * * - source for library json/ajax shit * - target selector @@ -74,7 +73,7 @@ * configuration options * callback should be smart about attachment and detachment */ -function dnd_process_textarea($element, $form_state) { +function dnd_process_textarea($element, $edit, $form_state, $form) { if ($element['#dnd-enabled']) { // BeautyTips @@ -112,7 +111,7 @@ 'dndEnabledLibraries' => array($element['#id'] => $settings), ), 'setting'); - $element['#prefix'] = theme('dnd_library', $element, $settings); + $element['#suffix'] = theme('dnd_library', $element, $settings) . $element['#suffix']; } return $element; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dnd_test/dnd-library-header.tpl.php Tue Mar 10 13:46:49 2009 -0500 @@ -0,0 +1,9 @@ +<h3><?php print t('Test library: Page @page', array('@page' => $page)); ?></h3> + +<div class="view-filters"> + <form method="get" action="/" id="test-form"> + <div><label for="test-form-page">Page:</label> <input type="text" id="test-form-page" name="test-form-page" /></div> + <div><input type="submit" id="test-form-submit" value="Switch page" /></div> + </form> +</div> +
--- a/dnd_test/dnd-library-preview.tpl.php Sun Mar 08 20:29:57 2009 -0500 +++ b/dnd_test/dnd-library-preview.tpl.php Tue Mar 10 13:46:49 2009 -0500 @@ -1,17 +1,20 @@ -<div class="editor-preview" id="<?php print $id; ?>"> +<div class="dnd-editor-preview" id="<?php print $id; ?>"> <h2 class="title"> <?php print $title; ?> </h2> - <div class="image"> + + <div class="media-meta"> + <div class="description"> + <?php print $description; ?> + </div> + <div class="attribution"> + <span class="author"><?php print $author; ?></span> | + <span class="date"><?php print $date; ?></span> + </div> + </div> + + <div class="media-preview"> <?php print $image; ?> </div> - <div class="description"> - <?php print $description; ?> - </div> - - <div class="meta"> - <div class="author"><?php print $author; ?></div> - <div class="date"><?php print $date; ?></div> - </div> </div>
--- a/dnd_test/dnd_test.css Sun Mar 08 20:29:57 2009 -0500 +++ b/dnd_test/dnd_test.css Tue Mar 10 13:46:49 2009 -0500 @@ -132,3 +132,23 @@ .dnd-library-wrapper .editor-item.dnd-child-inserted { background-color: #ccc; } +.dnd-editor-preview h2.title { + font-size: 1em; + font-weight: bold; + margin-bottom: 0.5em; +} +.dnd-editor-preview .media-preview { + float: left; + width: 125px; +} + +.dnd-editor-preview .media-meta { + float: left; + width: 225px; + margin-right: 20px; +} + +.dnd-editor-preview .attribution { + font-size: .875em; + margin-bottom: .5em; +}
--- a/dnd_test/dnd_test.module Sun Mar 08 20:29:57 2009 -0500 +++ b/dnd_test/dnd_test.module Tue Mar 10 13:46:49 2009 -0500 @@ -118,9 +118,9 @@ template_preprocess_dnd_library_item($variables); $variables['id'] = 'dnd-preview-'. $variables['i']; - $variables['image'] = '<img src="http://'. $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/item-'. $variables['img_num'] .'-M.jpg" class="drop" width="300" height="225" />'; + $variables['image'] = '<img src="http://'. $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'dnd_test') .'/img/item-'. $variables['img_num'] .'-S.jpg" class="drop" width="125" height="94" />'; - $variables['description'] = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'; + $variables['description'] = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; }
--- a/js/dnd-library.js Sun Mar 08 20:29:57 2009 -0500 +++ b/js/dnd-library.js Tue Mar 10 13:46:49 2009 -0500 @@ -40,7 +40,7 @@ $('.editor-item', context).each(function () { $(this).bt(Drupal.settings.dndLibraryPreviews[this.id], { 'trigger': 'none', - 'width': 300, + 'width': 375, 'spikeLength': 7, 'spikeGirth': 9, 'corner-radius' : 3, @@ -75,13 +75,13 @@ return false; }); - $('.view-filters form', $this).submit(function() { + $('.view-filters input[type=submit]', $this).click(function() { $(this).ajaxSubmit({ - // @TODO add URL from settings and target more specifically... + 'url' : Drupal.settings.basePath + Drupal.settings.dndEnabledLibraries[$editor.get(0).id].url, 'dataType': 'json', 'success': function(responsetext, statustext) { - drupal.behaviors.dndlibrary.responsetext.call($this.get(0), responsetext, $editor); - drupal.behaviors.dndlibrary(); + Drupal.behaviors.dndLibrary.refreshLibrary.call($this.get(0), responsetext, $editor); + Drupal.behaviors.dndLibrary(); } }); return false;