Commit 56b23945 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Make drag and drop work for touch devices for edit content page."

parents fb79d8cc 02ee612f
......@@ -25,15 +25,7 @@
// Whether the browser is IE - needed for some hacks
ViewManager.isOldIE = $.browser.msie && $.browser.version < 9.0;
ViewManager.contentEditorWidth = 145;
ViewManager.isMobile = config['handheld_device'] || (navigator.userAgent.match(/iPhone/i))
|| (navigator.userAgent.match(/iPod/i))
|| (navigator.userAgent.match(/iPad/i))
|| (navigator.platform.toLowerCase().indexOf("win") !== -1 && navigator.userAgent.toLowerCase().indexOf("touch") !== -1)
|| (navigator.platform.toLowerCase().indexOf("win") !== -1 && navigator.userAgent.indexOf("ARM") !== -1);
// Whether the brower is iPhone, IPad, IPod, Windows 8 Tablet or using Windows RT
if (ViewManager.isMobile) {
ViewManager.contentEditorWidth = 175;
}
//Public Methods
////////////////
ViewManager.addCSSRules = function() {
......@@ -93,49 +85,6 @@
viewThemeSelect = $('#viewtheme-select');
viewsLoading = $('#views-loading');
if (ViewManager.isMobile) {
// Unhide the radio button if the browser is iPhone, IPad or IPod
$('#editcontent-sidebar').addClass('withradio');
$('#page').addClass('withradio');
$('#content-editor input.blocktype-radio').each(function() {
$(this).show();
});
$('#accordion a.nonjs').each(function() {
$(this).hide();
});
$('#accordion div.withjs').each(function() {
$(this).show();
});
$('#accordion *').css('zoom', '1');
$('#main-column-container .tabswrap ul li a').css('float', 'left'); // fix li elements not floating left by floating anchors
}
else {
// Hide 'new block here' buttons
$('#bottom-pane div.add-button').each(function() {
$(this).remove();
});
// Hide controls in each block instance that are not needed
$('#bottom-pane input.movebutton').each(function() {
$(this).remove();
});
// Hide radio buttons for moving block types into place
$('#content-editor input.blocktype-radio').each(function() {
$(this).hide();
});
// Remove the a href links that are needed for when js is turned off
$('#accordion a.nonjs').each(function() {
$(this).hide();
});
// Display the divs that are needed when js is turned on
$('#accordion div.withjs').each(function() {
$(this).show();
});
}
$('#accordion').accordion({
icons: false,
heightStyle: 'content',
......@@ -157,23 +106,6 @@
$(category).html(data.data);
makeNewBlocksDraggable();
showColumnBackgroundsOnSort();
// Unhide the radio button if the browser is iPhone, IPad or IPod
if (ViewManager.isMobile) {
// Unhide the radio button if the browser is iPhone, IPad or IPod
$('#editcontent-sidebar').addClass('withradio');
$('#page').addClass('withradio');
$('#content-editor input.blocktype-radio').each(function() {
$(this).show();
});
$('#accordion a.nonjs').each(function() {
$(this).hide();
});
$('#accordion div.withjs').each(function() {
$(this).show();
});
$('#accordion *').css('zoom', '1');
$('#main-column-container .tabswrap ul li a').css('float', 'left'); // fix li elements not floating left by floating anchors
}
checkEditAreaHeight();
});
return false;
......@@ -230,6 +162,7 @@
$(viewsLoading).remove();
$(bottomPane).show();
} // init
function checkEditAreaHeight() {
......@@ -420,7 +353,8 @@
});
$(this).find('.blocktypelink').off('mouseup keydown'); // remove old event handlers
$(this).find('.blocktypelink').on('mouseup keydown', function(e) {
$(this).find('.blocktypelink').on('click keydown', function(e) {
// Add a block when click left button or press 'Space bar' or 'Enter' key
if (isHit(e) && $('#addblock').is(':hidden')) {
startAddBlock($(this));
......@@ -877,19 +811,6 @@
});
}
}
// Unhide the radio button if the browser is iPhone, IPad or IPod
else if (ViewManager.isMobile && self.topPane) {
forEach(getElementsByTagAndClassName('input', 'blocktype-radio', 'top-pane'), function(i) {
setNodeAttribute(i, 'style', 'display:inline');
});
// Hide radio buttons for moving block types into place
$('#top-pane input.blocktype-radio').each(function() {
$(this).hide();
});
}
else {
parentNode = bottomPane;
}
$('input.addcolumn', parentNode).each(function() {
$(this).click(function(event) {
......@@ -1505,4 +1426,3 @@ function updateBlockConfigWidth(configblock, width) {
setStyle(configblock, style);
}
{foreach from=$categories key=name item=category}
<div id="block-category-{$category.name}" class="block-category-title collapsed">
<div class="withjs" style="display: none" title="{$category.description}">{$category.title}</div>
<a class="nonjs" href="{$WWWROOT}view/blocks.php?id={$viewid}&c={$category.name}&new=1" title="{$category.description}">{$category.title}</a>
<div class="withjs" title="{$category.description}">{$category.title}</div>
</div>
{if $selectedcategory == $category.name}
<div id="{$category.name}">
......
<div class="blockinstance cb{if $configure} configure{elseif $retractable} retractable{/if}" id="blockinstance_{$id}{if $configure}_configure{/if}">
<div class="blockinstance-controls">
{foreach from=$movecontrols item=item}
<input type="image" src="{theme_url filename='images/btn_move`$item.dir`.png'}" class="movebutton" name="action_moveblockinstance_id_{$id}_row_{$row}_column_{$item.column}_order_{$item.order}" alt="{$item.arrow}" title="{$item.title}">
{/foreach}
<input type="image" src="{theme_url filename=images/btn_move.png}" class="keyboardmovebutton nojs-hidden-inline" name="action_moveblockinstance_id_{$id}" alt="{$strmovetitletext}">
{if $retractable && !$configure}
<img src="{theme_url filename=images/retractable.png}" alt="{str tag='retractable' section='view'}" title="{str tag='retractable' section='view'}" class="retractablebtn">
......@@ -17,8 +14,3 @@
{$content|safe}
</div>
</div>
{if !$javascript && !$configure}
<div class="add-button">
<input type="submit" class="submit newblockhere" name="action_addblocktype_row_{$row}_column_{$column}_order_{$order+1}" value="{str tag='addnewblockhere' section='view'}">
</div>
{/if}
......@@ -23,11 +23,6 @@
<div class="column-header-empty"></div>
{/if}
<div class="column-content">
{if !$javascript}
<div class="add-button">
<input type="submit" class="submit newblockhere" name="action_addblocktype_row_{$row}_column_{$column}_order_1" value="{str tag='addnewblockhere' section='view'}">
</div>
{/if}
{$blockcontent|safe}
</div>
</div>
......@@ -139,7 +139,7 @@ if ($viewtheme && !isset($allowedthemes[$viewtheme])) {
exit;
}
$javascript = array('views', 'tinymce', 'paginator', 'expandable', 'js/jquery/jquery-ui/js/jquery-ui-1.10.2.min.js', 'tablerenderer', 'artefact/file/js/filebrowser.js', 'lib/pieforms/static/core/pieforms.js','js/jquery/modernizr.custom.js');
$javascript = array('views', 'tinymce', 'paginator', 'expandable', 'js/jquery/jquery-ui/js/jquery-ui-1.10.2.min.js', 'js/jquery/jquery-ui/js/jquery-ui.touch-punch.min.js', 'tablerenderer', 'artefact/file/js/filebrowser.js', 'lib/pieforms/static/core/pieforms.js','js/jquery/modernizr.custom.js');
$blocktype_js = $view->get_all_blocktype_javascript();
$javascript = array_merge($javascript, $blocktype_js['jsfiles']);
$inlinejs = "addLoadEvent( function() {\n" . join("\n", $blocktype_js['initjs']) . "\n});";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment