Skip to content

Commit

Permalink
added variables for toolbar css, added buttons to modal window, added…
Browse files Browse the repository at this point in the history
… better css for switcher menu
  • Loading branch information
Angelo Dini committed Jan 24, 2013
1 parent a3f3fbc commit f02ce1c
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 130 deletions.
2 changes: 1 addition & 1 deletion cms/static/cms/css/plugins/cms.placeholders.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cms/static/cms/css/plugins/cms.toolbar.css

Large diffs are not rendered by default.

Binary file modified cms/static/cms/img/toolbar/sprite_toolbar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cms/static/cms/img/toolbar/sprite_toolbar.psd
Binary file not shown.
4 changes: 2 additions & 2 deletions cms/static/cms/js/plugins/cms.placeholders.js
Expand Up @@ -151,7 +151,7 @@
'items': '.cms_draggable',
'handle': '.cms_dragitem',
'listType': 'ul',
'opacity': 0.2,
'opacity': 0.4,
'tolerance': 'pointer',
'toleranceElement': '> div',
'cursor': 'move',
Expand All @@ -167,6 +167,7 @@
// getting restriction array
var bounds = [];
var plugin = $('#cms_plugin-' + that.getId(originalItem));

var bar = placeholder.parent().prevAll('.cms_placeholder-bar').first();
var type = plugin.data('settings').plugin_type;

Expand Down Expand Up @@ -437,7 +438,6 @@
plugin.insertAfter($('#cms_plugin-' + parent_id));
} else {
// if we dont find out, we need to figure out where it belongs and get the previous item
console.log(dragitem.parent().parent().next());
dragitem.parent().parent().next().prepend(plugin);
}

Expand Down
81 changes: 54 additions & 27 deletions cms/static/cms/js/plugins/cms.toolbar.js
Expand Up @@ -115,15 +115,39 @@ $(document).ready(function () {
});
});

// attach event to the sidebar
this.sideframe.bind('dblclick', function () {
that._hideSideframe();
// module events
this._eventsSidebar();
this._eventsDialog();
this._eventsModal();

// stopper events
$(document).bind('mouseup.cms', function (e) {
that._stopSideframeResize();
that._endModalMove(e);
that._endModalResize(e);
});
this.sideframe.find('.cms_sideframe-resize').bind('mousedown', function (e) {

// event for switching between edit and layout mode
this.menu.bind('click', function (e) {
($(this).hasClass('cms_placeholders-menu-alternate')) ? that._enableEditMode(300) : that._enableDragMode(300);
// reset dragholders
// TODO this is new placeholders
$('.cms_draggable').removeClass('cms_draggable-selected');
// attach active class to current element
var id = $(this).data('id');
$('#cms_draggable-' + id).addClass('cms_draggable-selected');
});
this.toolbar.find('.cms_toolbar-item_buttons li a').eq(0).bind('click', function (e) {
e.preventDefault();
that._startSideframeResize();
that._enableEditMode(300);
});
this.toolbar.find('.cms_toolbar-item_buttons li a').eq(1).bind('click', function (e) {
e.preventDefault();
that._enableDragMode(300);
});
},

_eventsDialog: function () {
// attach events to the dialogue window
this.dialogue.find('.cms_dialogue-confirm').bind('click', function (e) {
e.preventDefault();
Expand All @@ -137,6 +161,23 @@ $(document).ready(function () {
e.preventDefault();
that._hideDialogue();
});
},

_eventsSidebar: function () {
var that = this;

// attach event to the sidebar
this.sideframe.bind('dblclick', function () {
that._hideSideframe();
});
this.sideframe.find('.cms_sideframe-resize').bind('mousedown', function (e) {
e.preventDefault();
that._startSideframeResize();
});
},

_eventsModal: function () {
var that = this;

// attach events to window
this.modal.find('.cms_modal-close').bind('click', function (e) {
Expand All @@ -159,31 +200,13 @@ $(document).ready(function () {
e.preventDefault();
that._changeModalContent($(this));
});

// stopper events
$(document).bind('mouseup.cms', function (e) {
that._stopSideframeResize();
that._endModalMove(e);
that._endModalResize(e);
});

// event for switching between edit and layout mode
this.menu.bind('click', function (e) {
($(this).hasClass('cms_placeholders-menu-alternate')) ? that._enableEditMode(300) : that._enableDragMode(300);
// reset dragholders
// TODO this is new placeholders
$('.cms_draggable').removeClass('cms_draggable-selected');
// attach active class to current element
var id = $(this).data('id');
$('#cms_draggable-' + id).addClass('cms_draggable-selected');
});
this.toolbar.find('.cms_toolbar-item_buttons li a').eq(0).bind('click', function (e) {
this.modal.find('.cms_modal-cancel').bind('click', function (e) {
e.preventDefault();
that._enableEditMode(300);
that._hideModal(100);
});
this.toolbar.find('.cms_toolbar-item_buttons li a').eq(1).bind('click', function (e) {
this.modal.find('.cms_modal-save').bind('click', function (e) {
e.preventDefault();
that._enableDragMode(300);
that._saveModal();
});
},

Expand Down Expand Up @@ -592,6 +615,10 @@ $(document).ready(function () {
$(document).unbind('mousemove.cms');
},

_saveModal: function () {
this.modal.find('iframe').contents().find('form').submit();
},

_changeModalContent: function (el) {
if(el.hasClass('cms_modal-breadcrumb-last')) return false;

Expand Down

0 comments on commit f02ce1c

Please sign in to comment.