Skip to content

Commit

Permalink
SAK-31799 make favorites clickable on mobile (sakaiproject#3943)
Browse files Browse the repository at this point in the history
* SAK-31799 Allow favorite site links to be clickable on mobile devices
- Now that links are clickable, make the drag handle icon the actual drag handle for dragging
- Also reinstate the drag icon on mobile devices

* SAK-31799 Fix favorites dragging not working on some pages by ensuring that touch-punch is included for touch devices
  • Loading branch information
payten authored and adrianfish committed Feb 23, 2017
1 parent 8cf6f55 commit 6ac4ef3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
document.write('\x3Cscript src="${pageWebjarsPath}bootstrap/3.3.7/js/bootstrap.min.js$!{portalCDNQuery}">'+'\x3C/script>')
document.write('\x3Cscript src="${pageWebjarsPath}jquery-ui/1.11.3/jquery-ui.min.js$!{portalCDNQuery}">'+'\x3C/script>')
document.write('\x3Clink rel="stylesheet" href="${pageWebjarsPath}jquery-ui/1.11.3/jquery-ui.min.css$!{portalCDNQuery}"/>')
if (Modernizr.touch) {
document.write('\x3Cscript type="text/javascript" src="${pageWebjarsPath}jquery-ui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js$!{portalCDNQuery}">'+'\x3C/script>')
}
window.console && console.log('Portal scripts loaded JQ+MI+BS+UI');
} else {
if (typeof jQuery.migrateWarnings == 'undefined') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,25 +525,22 @@ $PBJQ(document).ready(function($){
var favoriteItem = itemsBySiteId[siteid].clone(false);

favoriteItem.addClass('organize-favorite-item').data('site-id', siteid);
var dragHandle = $PBJQ('<i class="fa fa-bars fav-drag-handle"></i>');
var dragHandle = $PBJQ('<a href="javascript:void(0);" class="fav-drag-handle"><i class="fa fa-bars"></i></a>');

// Hide the tool dropdown
$PBJQ('.toolMenus', favoriteItem).remove();

// Show a drag handle
favoriteItem.append(dragHandle);

// And disable the link to site so we don't accidentally hit it while
// dragging
$PBJQ(favoriteItem).find('.fav-title a').attr('href', null);

list.append(favoriteItem);

// Make sure the item is visible, just in case it was hidden on the other tab
favoriteItem.show();
});

list.sortable({
handle: ".fav-drag-handle",
stop: function () {
// Update our ordering based on the new selection
favoritesList = list.find('.organize-favorite-item').map(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,13 @@ ul.favoriteSiteList{
.fav-drag-handle{
display: inline-block;
position: relative;
right: -4px;
right: 2px;
padding: 0 6px;
color: $tool-border-color;
cursor: move; /* fallback if grab cursor is unsupported */
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;

@media #{$phone}{
display: none;
}
}
.fav-drag-handle:active{
cursor: grabbing;
Expand Down

0 comments on commit 6ac4ef3

Please sign in to comment.