Skip to content

Commit

Permalink
Handle view commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlpp committed Sep 28, 2015
1 parent 8f3cddc commit b74ff2e
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 4,382 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = function(grunt) {
// Upload
'resources/assets/bower_components/dropzone/dist/dropzone.js',
// Image crop
'resources/assets/bower_components/imgareaselect/jquery.imgareaselect.dev.js',
//'resources/assets/bower_components/imgareaselect/jquery.imgareaselect.dev.js',
// Sharp
'resources/assets/js/sharp.form.js',
'resources/assets/js/sharp.date.js',
Expand Down
42 changes: 42 additions & 0 deletions resources/assets/js/sharp.commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,48 @@ function handleCommandReturn_ALERT(data) {
sweetAlert(data.title, data.message, data.level);
}

function handleCommandReturn_VIEW(data) {
showPageOverlay();

var $body = $("body");

var $cmdViewPanel = $("#command_view_panel");
if(!$cmdViewPanel.length) {
$cmdViewPanel = $('<div id="command_view_panel"/>');
$body.append($cmdViewPanel);
}

$cmdViewPanel.html(data.html);

$cmdViewPanel.animate({
left:'2vw'
});

var $overlay = $(".sharp-page-overlay");

var handler = function(event) {

// If keydown event, only handle ESC
if(event.type == "keydown" && event.which != 27) {
return true;
}

// Hide panel
$cmdViewPanel.animate({
left:'110vw'
}, 'fast');

// Unbind event
$overlay.unbind("click", handler);
$body.unbind("keydown", handler);

hidePageOverlay();
};

$overlay.bind("click", handler);
$body.bind("keydown", handler);
}

function handleCommandReturn_RELOAD() {
window.location.reload();
}
Expand Down
5 changes: 4 additions & 1 deletion resources/assets/js/sharp.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,19 @@ function deactivate($source, jsonData) {
}

var $pageOverlay = null;
var $body = $("body");
function showPageOverlay() {
if(!$pageOverlay) {
$pageOverlay = $("<div>").addClass("sharp-page-overlay hidden");
$("body").append($pageOverlay);
$body.append($pageOverlay);
}
$pageOverlay.removeClass("hidden");
$body.css("overflow", "hidden");
}

function hidePageOverlay() {
if($pageOverlay) {
$pageOverlay.addClass("hidden");
}
$body.css("overflow", "auto");
}
12 changes: 12 additions & 0 deletions resources/assets/less/listview.less
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,16 @@ body.sharp-list {
opacity: 1;
background-color: lighten(@sharp-contexbar-bg, 35%) !important;
}
}

#command_view_panel {
background: #fff;
height:100vh;
width:98vw;
position: fixed;
left:110vw;
top:0;
z-index:9999;
box-shadow: 0 0 10px #333;
overflow: auto;
}
2 changes: 1 addition & 1 deletion resources/assets/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ body.sharp-auth {
right: 0;
top: 0;
bottom: 0;
z-index: 9999;
z-index: 9998;
position: fixed;
}

Expand Down
Loading

0 comments on commit b74ff2e

Please sign in to comment.