Skip to content

Commit

Permalink
added thumbnail preview to entry edit pages
Browse files Browse the repository at this point in the history
  • Loading branch information
fawx committed Jun 11, 2011
1 parent 7686f1a commit 5dfcba0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions assets/image_index_preview.publish.css
Expand Up @@ -22,3 +22,5 @@ td.upload img {
.selecting td.upload img, .selected td.upload img {
border-color: #ABE;
}

.upload a { float: none; max-width: 100%; }
7 changes: 4 additions & 3 deletions assets/image_index_preview.publish.js
Expand Up @@ -2,15 +2,16 @@
(function($) {

/**
* This plugin adds image preview to the publish index.
* This plugin adds image preview to the publish pages.
*
* @author: Nils Hörrmann, post@nilshoerrmann.de
* @source: http://github.com/nilshoerrmann/image_index_preview
*/
$(document).ready(function() {
$('table td[class*="upload"]').addClass('upload').find('a').each(function() {
$('table td[class*="upload"], fieldset div[class*="upload"]').addClass('upload').find('a').each(function() {
var link = $(this),
href = link.attr('href'),
size = (Symphony.Context.get('env')['page'] == 'index' ? '40/40' : '0/150')
file = href.replace(Symphony.Context.get('root') + '/workspace/', '');

// Append preview
Expand All @@ -22,7 +23,7 @@

// Add image
$('<img />', {
src: Symphony.Context.get('root') + '/image/2/40/40/5/' + file
src: Symphony.Context.get('root') + '/image/2/' + size + '/5/' + file
}).prependTo(link);
}
}
Expand Down
4 changes: 2 additions & 2 deletions extension.driver.php
Expand Up @@ -35,10 +35,10 @@ public function __appendAssets($context) {
$callback = Symphony::Engine()->getPageCallback();

// Append styles for publish area
if($callback['driver'] == 'publish' && $callback['context']['page'] == 'index') {
if($callback['driver'] == 'publish' && (($callback['context']['page'] == 'index') || ($callback['context']['page'] == 'edit'))) {
Administration::instance()->Page->addScriptToHead(URL . '/extensions/image_index_preview/assets/image_index_preview.publish.js', 100, false);
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/image_index_preview/assets/image_index_preview.publish.css', 'screen', 101, false);
}
}

}
}

0 comments on commit 5dfcba0

Please sign in to comment.