Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:divio/django-cms into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Obrist committed Jun 1, 2011
2 parents cf964bc + ada9bfc commit a6cf36d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 33 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -81,6 +81,7 @@ Contributors (in alphabetical order):
* jordanjambazov
* Jorge Vargas (elpargo)
* kar1m
* Keryn Knight
* kochin
* Krzysztof Bandurski
* kunitoki
Expand Down
20 changes: 17 additions & 3 deletions cms/media/cms/css/plugins/cms.placeholders.css
Expand Up @@ -29,7 +29,7 @@
.cms_placeholder-subnav-title li:last-child a { -webkit-border-radius:0 0 4px 4px; -moz-border-radius:0 0 4px 4px; border-radius:0 0 4px 4px; }

/* #PLACEHOLDERS/loader# */
#cms_placeholder-dim { display:none; position:absolute; left:0; top:0; z-index:99997; background:#000; width:100%; height:100%; opacity:0.6; }
#cms_placeholder-dim { display:none; position:absolute; left:0; top:0; z-index:99997; background:#000; width:100%; height:100%; }
#cms_placeholder-content { display:none; position:absolute; left:0; top:43px; z-index:99998; width:100%; color:#fff;
background:#5a7fb0 url('../../images/toolbar/frame_shadow.gif') repeat-x left top; /* might need some ie fixing */
-webkit-box-shadow:#000 -5px 0px 5px; -moz-box-shadow:#000 -5px 0px 5px; box-shadow:#000 -5px 0px 5px; }
Expand All @@ -43,7 +43,7 @@
#cms_placeholder-overlay { display:none; position:absolute; left:0; top:0; z-index:9999;
min-height:15px; border:1px solid #5b80b2; }
.cms_placeholder-overlay_bg { position:relative; left:0; top:0; z-index:9999;
width:100%; height:100%; opacity:0.5; background:#5b80b2 !important; }
width:100%; height:100%; background:#5b80b2 !important; }

/* #PLACEHOLDERS/overlay/list# */
.cms_placeholder-options { list-style:none; padding:0; margin:0; position:absolute; right:0; top:0; z-index:10000;
Expand Down Expand Up @@ -71,4 +71,18 @@
.cms_placeholder-icon_more:hover { background-position:-70px -173px; }

#cms_placeholder-success { display:none; position:absolute; left:0; top:0; z-index:9999; min-height:15px; border:1px solid #59e140; }
.cms_placeholder-success_inner { width:100%; height:100%; opacity:0.5; background:#59e140; }
.cms_placeholder-success_inner { width:100%; height:100%; background:#59e140; }

/*##################################################|*/
/* #PLACEHOLDERS/IE# */
#cms_placeholder-dim {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter:alpha(opacity=60);
opacity:0.6;
}
.cms_placeholder-overlay_bg,
.cms_placeholder-success_inner {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter:alpha(opacity=50);
opacity:0.5;
}
5 changes: 4 additions & 1 deletion cms/media/cms/css/plugins/cms.toolbar.css
Expand Up @@ -104,4 +104,7 @@
.cms_toolbar-item_status { padding-top:8px !important; }
.cms_toolbar-item_status p { color:#5b80b2 !important; margin:0; padding:3px 10px !important; border:1px solid #ddd !important; background:#fff;
-webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; }
.cms_toolbar-item_status em { color:#000; }
.cms_toolbar-item_status em { color:#000; }

/*##################################################|*/
/* #TOOLBAR/IE# */
51 changes: 30 additions & 21 deletions cms/media/cms/js/plugins/cms.placeholders.js
Expand Up @@ -228,9 +228,12 @@ jQuery(document).ready(function ($) {
// bind load event to injected iframe
$('#cms_placeholder-iframe').load(function () {
// set new height and animate
var height = $('#cms_placeholder-iframe').contents().find('body').outerHeight(true);
$('#cms_placeholder-iframe').animate({ 'height': height }, 500);

// cause IE is so awesome, we need a timeout so that slow rendering bitch catches up
setTimeout(function () {
var height = $('#cms_placeholder-iframe').contents().find('body').outerHeight(true)+26;
$('#cms_placeholder-iframe').animate({ 'height': height }, 500);
}, 100);

// remove loader class
frame.removeClass('cms_placeholder-content_loader');

Expand Down Expand Up @@ -355,7 +358,8 @@ jQuery(document).ready(function ($) {
var current = plugin.attr('class').split('::')[5];

// lets remove current from array - puke
var idx = array.indexOf(current);
// cause ie is a fucking motherfucker it doesn't support indexOf so use jquerys crap instead
var idx = $.inArray(current, array);
array.splice(idx, 1);

// grab the element
Expand Down Expand Up @@ -447,14 +451,14 @@ jQuery(document).ready(function ($) {
var that = this;
var list = el.parent().find('.cms_placeholder-subnav');
list.show();

// add event to body to hide the list needs a timout for late trigger
setTimeout(function () {
$(window).bind('click', function () {
$(document).bind('click', function () {
that._hidePluginList.call(that, el);
});
}, 100);

el.addClass('cms_toolbar-btn-active').data('collapsed', false);
},

Expand All @@ -463,7 +467,7 @@ jQuery(document).ready(function ($) {
list.hide();

// remove the body event
$(window).unbind('click');
$(document).unbind('click');

el.removeClass('cms_toolbar-btn-active').data('collapsed', true);
},
Expand All @@ -480,12 +484,11 @@ jQuery(document).ready(function ($) {
this.frame.data('collapsed', false);
// set dynamic frame position
var offset = 43;
var pos = $(window).scrollTop();
var pos = $(document).scrollTop();
// frame should always have space on top
this.frame.css('top', pos+offset);
// make sure that toolbar is visible
// TODO: triggers IE error
//if(this.toolbar.data('collapsed')) CMS.Toolbar._showToolbar();
if(this.toolbar.data('collapsed')) CMS.Toolbar._showToolbar();
// listen to toolbar events
this.toolbar.bind('cms.toolbar.show cms.toolbar.hide', function (e) {
(e.handleObj.namespace === 'show.toolbar') ? that.frame.css('top', pos+offset) : that.frame.css('top', pos);
Expand Down Expand Up @@ -513,28 +516,34 @@ jQuery(document).ready(function ($) {
var that = this;
// clear timer when initiated within resize event
clearTimeout(this.timer);

/* cause IE's mother had sex with a sheep, we need to always usw window instead of document
* we need to substract 4 pixel from the frame cause IE's vater has a small dick
*/
var scrollbarWidth = ($.browser.msie) ? 4 : 0;

// attach resize event to window
$(window).bind('resize', function () {
$(document).bind('resize', function () {
that.dim.css({
'width': $(window).width(),
'height': $(window).height()
'width': $(document).width(),
'height': $(document).height()
});
that.frame.css('width', $(window).width());
that.frame.css('width', $(document).width());
// adjust after resizing
that.timer = setTimeout(function () {
that.dim.css({
'width': $(window).width(),
'height': $(document).height()
'width': $(document).width()-scrollbarWidth,
'height': $(document).height()-scrollbarWidth
});
that.frame.css('width', $(window).width());
that.frame.css('width', $(document).width()-scrollbarWidth);
}, 100);
});
// init dim resize
$(window).resize();
$(document).resize();
// change data information
this.dim.data('dimmed', true);
// show dim
this.dim.stop().fadeIn();
this.dim.css('opacity', 0.6).stop().fadeIn();
// add event to dim to hide
this.dim.bind('click', function () {
that.toggleFrame.call(that);
Expand All @@ -544,7 +553,7 @@ jQuery(document).ready(function ($) {

_hideDim: function () {
// unbind resize event
$(window).unbind('resize');
$(document).unbind('resize');
// change data information
this.dim.data('dimmed', false);
// hide dim
Expand Down
14 changes: 7 additions & 7 deletions cms/media/cms/js/plugins/cms.toolbar.js
Expand Up @@ -185,7 +185,7 @@ jQuery(document).ready(function ($) {
// add events
template.find('.cms_toolbar-btn').bind('click', function (e) {
e.preventDefault();
(obj.redirect) ? window.location = obj.redirect : $(this).parentsUntil('form').parent().submit();
(obj.redirect) ? document.location = obj.redirect : $(this).parentsUntil('form').parent().submit();
});
// append item
this._injectItem(template, obj.dir, obj.order);
Expand Down Expand Up @@ -214,13 +214,13 @@ jQuery(document).ready(function ($) {
if(btn.data('state')) {
btn.stop().animate({'backgroundPosition': '-40px -198px'}, function () {
// disable link
var url = that.removeUrl(window.location.href, obj.addParameter);
window.location = that.insertUrl(url, obj.removeParameter, "")
var url = that.removeUrl(document.location.href, obj.addParameter);
document.location = that.insertUrl(url, obj.removeParameter, "")
});
} else {
btn.stop().animate({'backgroundPosition': '0px -198px'}, function () {
// enable link
window.location = that.insertUrl(location.href, obj.addParameter, "");
document.location = that.insertUrl(location.href, obj.addParameter, "");
});
}
});
Expand Down Expand Up @@ -267,7 +267,7 @@ jQuery(document).ready(function ($) {
function show_list() {
// add event to body to hide the list needs a timout for late trigger
setTimeout(function () {
$(window).bind('click', hide_list);
$(document).bind('click', hide_list);
}, 100);

// show element and save data
Expand All @@ -276,7 +276,7 @@ jQuery(document).ready(function ($) {
}
function hide_list() {
// remove the body event
$(window).unbind('click');
$(document).unbind('click');

// show element and save data
container.hide();
Expand Down Expand Up @@ -318,7 +318,7 @@ jQuery(document).ready(function ($) {
// add events
template.find('.cms_toolbar-btn').bind('click', function (e) {
e.preventDefault();
(obj.redirect) ? window.location = obj.redirect : $(this).parentsUntil('form').parent().submit();
(obj.redirect) ? document.location = obj.redirect : $(this).parentsUntil('form').parent().submit();
});
// save order remove id and show element
template.data('order', obj.order)
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/tutorial.rst
Expand Up @@ -152,7 +152,7 @@ Now add a little magic to the :setting:`django:TEMPLATE_DIRS` section of the fil
TEMPLATE_DIRS = (
# The docs say it should be absolute path: PROJECT_PATH is precisely one.
# Life is wonderful!
os.path.join(PROJECT_PATH, "templates")
os.path.join(PROJECT_PATH, "templates"),
)

Add at least one template to :setting:`CMS_TEMPLATES`; for example::
Expand Down

0 comments on commit a6cf36d

Please sign in to comment.