Skip to content

Commit

Permalink
Merge pull request #4185 from FinalAngel/feature/simple-structure
Browse files Browse the repository at this point in the history
Simple structure board rendering
  • Loading branch information
yakky committed Jun 29, 2015
2 parents 66555c2 + c930fc6 commit d4b68cf
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cms/static/cms/css/cms.base.css

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions cms/static/cms/js/modules/cms.structureboard.js
Expand Up @@ -295,10 +295,25 @@ $(document).ready(function () {
this.placeholders.show();

// attach event
$(window).bind('resize.sideframe', function () {
that._resizeBoard();
}).trigger('resize.sideframe');

if (CMS.config.simpleStructureBoard) {
var content = $('.cms_structure-content');
var areas = content.find('.cms_dragarea');
// set correct css attributes for the new mode
content.addClass('cms_structure-content-simple');
areas.addClass('cms_dragarea-simple');
// lets reorder placeholders
areas.each(function (index, item) {
if ($(item).hasClass('cms_dragarea-static')) {
content.append(item)
}
});
// now lets get the first instance and add some padding
areas.filter('.cms_dragarea-static').eq(0).css('margin-top', '50px');
} else {
$(window).bind('resize.sideframe', function () {
that._resizeBoard();
}).trigger('resize.sideframe');
}
},

_hideBoard: function () {
Expand Down
15 changes: 7 additions & 8 deletions cms/static/cms/sass/includes/_structureboard.scss
Expand Up @@ -24,6 +24,10 @@ display:none; position:absolute; top:0; right:0; width:100%; height:100%; z-inde
}
.cms_dragarea-static { background:$color-grey-70 url('../img/toolbar/pattern.png'); }

// subclasses for the simple structure borad without absolute positioning
.cms_structure-content-simple { padding:5%; }
.cms_dragarea-simple { position:static; }

//######################################################################################################################
// #DRAGBAR#
.cms_dragbar {
Expand Down Expand Up @@ -138,12 +142,7 @@ display:none; position:absolute; top:0; right:0; width:100%; height:100%; z-inde
// end of dragarea
}

// dragging state
body > .cms_draggable { list-style-type:none; white-space:nowrap;
@include border-radius(3px); padding:4px 5px 3px 5px; margin:0;
border-color:$color-grey-10; background:white; }

// hide elements when dragging
body > .cms_draggable .cms_switcher { display:none !important; }
body > .cms_draggable .cms_submenu { display:none !important; }
body > .cms_draggable .cms_draggables { display:none !important; }
.ui-sortable-helper.cms_draggable .cms_switcher { display:none !important; }
.ui-sortable-helper.cms_draggable .cms_submenu { display:none !important; }
.ui-sortable-helper.cms_draggable .cms_draggables { display:none !important; }
3 changes: 2 additions & 1 deletion cms/templates/cms/toolbar/toolbar_javascript.html
Expand Up @@ -62,7 +62,8 @@
},
'messages': '{% if messages %}{% for message in messages %}{{ message }}{% endfor %}{% endif %}',
'error': '{% if request.toolbar.login_form.errors or cms_toolbar_login_error %}{% blocktrans %}<strong>Login failed.</strong> Please check your credentials and try again.{% endblocktrans %}{% endif %}',
'publisher': '{% if not request.current_page.publisher_is_draft and request.current_page.publisher_draft.is_dirty and user.is_authenticated %}{% trans "This page has unpublished changes." %}{% endif %}'
'publisher': '{% if not request.current_page.publisher_is_draft and request.current_page.publisher_draft.is_dirty and user.is_authenticated %}{% trans "This page has unpublished changes." %}{% endif %}',
'simpleStructureBoard': {{ request.toolbar.simple_structure_mode|lower }}
};
CMS.settings = CMS.API.Helpers.getSettings();

Expand Down
1 change: 1 addition & 0 deletions cms/toolbar/toolbar.py
Expand Up @@ -59,6 +59,7 @@ def __init__(self, request):
self.clipboard = None
self.language = None
self.toolbar_language = None
self.simple_structure_mode = getattr(settings, 'CMS_TOOLBAR_SIMPLE_STRUCTURE_MODE', False)
self.show_toolbar = True
self.init_toolbar(request)

Expand Down
18 changes: 18 additions & 0 deletions docs/reference/configuration.rst
Expand Up @@ -947,3 +947,21 @@ This should be an integer preferably taken from the Page object e.g.
- X_FRAME_OPTIONS_SAMEORIGIN
- X_FRAME_OPTIONS_DENY


CMS_TOOLBAR_SIMPLE_STRUCTURE_MODE
=================================

default:
``False``

Enable or disable the absolute positioning within the structure board.

By default the absolute positioned board is activated. Setting this attribute
to ``False`` will prevent the absolute positioning and order the placeholders
beneath each other. Static placeholders have a visual gap in the simple mode.


Example::

CMS_TOOLBAR_SIMPLE_STRUCTURE_MODE = True

0 comments on commit d4b68cf

Please sign in to comment.