Commit 4ddb2cb5 authored by Nigel McNie's avatar Nigel McNie
Browse files

Added a hook for loading javascript only CSS rules, and a CSS file for this.

Moved some rules around for this - namely, the 'cursor: move' rules for dragging stuff.

Make sure that the blocktypes are draggable when you switch tabs.
parent 6a1e6293
......@@ -46,6 +46,7 @@ function ViewManager() {
// Make the block types draggable
self.makeBlockTypesDraggable();
// Make the top pane a dropzone for cancelling adding block types
var count = 0;
new Droppable('top-pane', {
'onhover': function() {
......@@ -56,6 +57,9 @@ function ViewManager() {
}
}
});
// Add CSS rules
self.addCSSRules();
}
/**
......@@ -197,6 +201,7 @@ function ViewManager() {
addElementClass(i.parentNode, 'current');
sendjsonrequest('viewrework.json.php', {'view': $('viewid').value, 'action': 'blocktype_list', 'category': queryString['category']}, 'POST', function(data) {
$('blocktype-list').innerHTML = data.data;
self.makeBlockTypesDraggable();
});
e.stop();
});
......@@ -392,9 +397,9 @@ function ViewManager() {
// meaning revert ends up with a horrid flash when the element is
// moved back into place
makePositioned(i);
var clone = DIV();
var clone = DIV({'class': 'blocktype-clone'});
setStyle(clone, {
'outline': '3px dotted #ccc;',
//'outline': '3px dotted #ccc;',
'position': 'absolute'
});
setElementPosition(clone, getElementPosition(i, 'top-pane'));
......@@ -734,6 +739,18 @@ function ViewManager() {
return {'column': column, 'order': order};
}
/**
* Adds CSS rules that should apply for the javascript only version
*/
this.addCSSRules = function() {
var styleNode = createDOM('link', {
'rel' : 'stylesheet',
'type': 'text/css',
'href': 'views-js.css'
});
appendChildNodes(getFirstElementByTagAndClassName('head'), styleNode);
}
// Whether it is a blocktype that is being added, rather than a
// blockinstance being moved
......
/**
* CSS rules that only apply to the JS version of the views interface
*/
.blocktype, .blocktype-clone {
cursor: move;
}
.blockinstance-header h4 {
cursor: move;
}
......@@ -139,7 +139,6 @@
margin: 0;
padding: .25em;
border-bottom: 2px solid #cc9;
cursor: move;
background-color: #ffd;
}
......
Markdown is supported
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