Skip to content

Commit

Permalink
General improvements, thx @johnbergvall @mikaelbrandt
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjonsson committed Aug 28, 2014
1 parent 41dcb1c commit f30f0e3
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion arlima.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: https://github.com/victorjonsson/Arlima
Description: Manage the order of posts on your front page, or any page you want. This is a plugin suitable for online newspapers that's in need of a fully customizable front page.
Author: VK (<a href="http://twitter.com/chredd">@chredd</a>, <a href="http://twitter.com/znoid">@znoid</a>, <a href="http://twitter.com/victor_jonsson">@victor_jonsson</a>, <a href="http://twitter.com/lefalque">@lefalque</a>)
Version: 3.0.beta.44
Version: 3.0.beta.45
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Expand Down
13 changes: 9 additions & 4 deletions classes/TemplateObjectCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,30 +430,35 @@ protected function generateStreamerData($has_streamer, &$data, $article)
$data['class'] .= ($has_streamer ? '' : ' no-streamer');
if ( $has_streamer ) {

$content = '';
$style_attr = '';
$streamer_classes = $data['options']['streamerType'];
$streamer_content = isset($data['options']['streamerContent']) ?
$data['options']['streamerContent'] : '';

switch ($data['options']['streamerType']) {
case 'extra' :
$content = 'EXTRA';
break;
case 'image' :
$content = '<img src="' . $data['options']['streamerContent'] . '" alt="Streamer" />';
if ($streamer_content)
$content = '<img src="' . $streamer_content . '" alt="Streamer" />';
break;
case 'text':
$content = $data['options']['streamerContent'];
$content = $streamer_content;
if( isset($data['options']['streamerColor']) ) {
$style_attr = ' style="background: #'.$data['options']['streamerColor'].'"';
$streamer_classes .= ' color-'.$data['options']['streamerColor'];
}
break;
default :
// Custom streamer
$content = $data['options']['streamerContent'];
$content = $streamer_content;
break;
}

$data['html_streamer'] = sprintf(
if ($content)
$data['html_streamer'] = sprintf(
'<div class="streamer %s"%s>%s</div>',
$streamer_classes,
$style_attr,
Expand Down
2 changes: 1 addition & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
or define('ARLIMA_COMPILE_LESS_IN_BROWSER', ARLIMA_DEV_MODE);

// Plugin version (only edit this via grunt!)
define('ARLIMA_FILE_VERSION', '3.0.beta.44' .(ARLIMA_DEV_MODE ? '__'.time():''));
define('ARLIMA_FILE_VERSION', '3.0.beta.45' .(ARLIMA_DEV_MODE ? '__'.time():''));

// Which type of tag to use for images in Arlima RSS feeds
defined('ARLIMA_RSS_IMG_TAG')
Expand Down
8 changes: 4 additions & 4 deletions js/arlima/arlima.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion js/arlima/dev/ArlimaArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,18 @@ var ArlimaArticle = (function($, window, ArlimaJS, ArlimaUtils) {
return this.canPreview(); // only an alias so far
};

/**
* @return {Boolean}
*/
ArlimaArticle.prototype.isDivider = function() {
return this.opt('sectionDivider');
}

/**
* @return {Boolean}
*/
ArlimaArticle.prototype.canBeChild = function() {
return !this.opt('sectionDivider');
return !this.isDivider();
};


Expand Down
15 changes: 15 additions & 0 deletions js/arlima/dev/ArlimaNestedSortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ function arlimaNestedSortable(list) {
else
maxDepth = 0;
},
_nextIsChild = function(ui) {
if (!next.length) _updateSharedVars(ui);
return next.length && next[0].arlimaArticle.isChild();
},
_itemDepth = function($item) {
var margin = $item.eq(0).css('margin-left');
return _pxToDepth( margin && -1 != margin.indexOf('px') ? margin.slice(0, -2) : 0 );
Expand Down Expand Up @@ -238,6 +242,11 @@ function arlimaNestedSortable(list) {
listContainerElem = ui.item.closest('.article-list').get(0),
itemIndex = ui.item.prevAll().length;

if ( ui.item[0].arlimaArticle.isDivider() && _nextIsChild(ui) ) {
$(this).sortable('cancel');
return false;
}

if( ui.item.hasClass('ui-draggable') ) {
// this item is taken care of in the recieve event
return;
Expand Down Expand Up @@ -334,6 +343,12 @@ function arlimaNestedSortable(list) {
(prev.length) ? prev.after( ui.placeholder ) : $articles.prepend( ui.placeholder );

_updateSharedVars(ui);

// Check if divider is inside a group, if so add
// red background to helper object
if ( ui.item[0].arlimaArticle.isDivider() ) {
ui.placeholder.css('background-color', _nextIsChild(ui) ? 'red' : '');
}

if( (prev.length && !prev[0].arlimaArticle.isChild() && !prev[0].arlimaArticle.canHaveChildren()) || !canBeChild ) {
depth = 0; // We cant go deeper if parent article for some reason don't accept children
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: @chredd, @znoid, @victor_jonsson, @lefalque, @aaslun
Tags: CMS, e-paper, e-magazine, magazine, newspaper, front page, wysiwyg
Requires at least: 3.8
Tested up to: 3.9.1
Stable tag: 3.0.beta.44
Stable tag: 3.0.beta.45
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down

0 comments on commit f30f0e3

Please sign in to comment.