Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-38923 theme bootstrapbase: theme clean: enable docking

  • Loading branch information...
commit 056b54ff6390cd61db3e2ac47045ee1ddf0d5218 1 parent ba05f57
@bmbrands bmbrands authored samhemelryk committed
View
4 theme/bootstrapbase/config.php
@@ -35,7 +35,7 @@
$THEME->parents = array();
$THEME->sheets = array('moodle');
$THEME->supportscssoptimisation = false;
-
+$THEME->enable_dock = false;
$THEME->editor_sheets = array('editor');
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
@@ -154,7 +154,7 @@
$THEME->javascripts = array(
);
$THEME->javascripts_footer = array(
- 'moodlebootstrap',
+ 'moodlebootstrap', 'dockmod'
);
if (core_useragent::is_ie() && !core_useragent::check_ie_version('9.0')) {
View
85 theme/bootstrapbase/javascript/dockmod.js
@@ -0,0 +1,85 @@
+function customise_dock_for_theme() {
+ var dock = M.core_dock;
+ dock.on('dock:itemschanged', theme_dockmod_handle_spans);
+ dock.on('dock:panelgenerated', theme_dockmod_blockstyle);
+}
+
+//Add the "block" class to docked blocks. This prevents having to restyle
+//all docked blocks and simply use standard block styling
+function theme_dockmod_blockstyle() {
+ Y.all('.dockeditempanel_content').each(function(dockblock){
+ dockblock.addClass('block');
+ });
+}
+
+//On docking and undocking the bootstrap spans have to change to
+//dock properly
+function theme_dockmod_handle_spans() {
+
+ var prepopulatedblockregions = 0;
+ var postpopulatedblockregions = 0;
+
+ var blockspre = 0;
+ var blockspost = 0;
+
+ var maincontent = Y.one('#region-main');
+ var regionpre = Y.one('#block-region-side-pre');
+ var regionpost = Y.one('#block-region-side-post');
+ var ltr = Y.one('body.dir-ltr');
+ var mainwrapper = Y.one('#region-bs-main-and-pre');
+ if (!ltr) {
+ var mainwrapper = Y.one('#region-bs-main-and-post');
+ }
+
+ var body = Y.one('body');
+
+ if (Y.all('.block.dock_on_load').size()>0) {
+ // Do not resize during initial load
+ return;
+ }
+
+ if (body.hasClass('blocks-moving')) {
+ // open up blocks during blocks positioning
+ return;
+ }
+
+
+ if (body.hasClass('two-column')) {
+
+ var prehasblocks = (regionpre.all('.block').size() > 0);
+ if (prehasblocks) {
+ regionpre.addClass('span3');
+ maincontent.removeClass('span12');
+ maincontent.addClass('span9');
+ } else {
+ regionpre.removeClass('span3');
+ maincontent.removeClass('span9');
+ maincontent.addClass('span12');
+ }
+ } else {
+
+ var prehasblocks = (regionpre.all('.block').size() > 0);
+ if (prehasblocks) {
+ regionpre.addClass('span4');
+ maincontent.removeClass('span12');
+ maincontent.addClass('span8');
+ } else {
+ regionpre.removeClass('span4');
+ maincontent.removeClass('span8');
+ maincontent.addClass('span12');
+ }
+
+ var posthasblocks = (regionpost.all('.block').size() > 0);
+ if (posthasblocks) {
+ regionpost.addClass('span3');
+ mainwrapper.removeClass('span12');
+ mainwrapper.addClass('span9');
+ } else {
+ mainwrapper.removeClass('span9');
+ mainwrapper.addClass('span12');
+ regionpost.removeClass('span3');
+ }
+ }
+ return;
+
+}
View
1  theme/bootstrapbase/less/moodle.less
@@ -56,6 +56,7 @@ body {
@import "moodle/tables";
@import "moodle/buttons";
@import "moodle/grade";
+@import "moodle/dock";
// Anything below this line is considered expendable,
// so it doesn't matter if it doesn't show up in ie < 9
View
157 theme/bootstrapbase/less/moodle/dock.less
@@ -0,0 +1,157 @@
+.dockbutton {
+ .btn;
+ display: list-item;
+ padding: 0;
+}
+
+body.has_dock {
+ margin-left: 20px;
+ div#dock {
+ display: inline;
+ }
+}
+
+#dock {
+ width: 36px;
+ position: fixed;
+ top: 68px;
+ left: 0px;
+ height: 90%;
+ background-color: transparent;
+ border-right: 0 none;
+ .nothingdocked {
+ visibility: hidden;
+ display: none;
+ }
+ .dockeditem .firstdockitem {
+ margin-top: 1em;
+ }
+ .dockedtitle {
+ .dockbutton;
+ cursor: pointer;
+ margin: 2px;
+ h2 {
+ font-family: @sansFontFamily;
+ font-size: 1em;
+ line-height: 100%;
+ text-align: center;
+ font-weight: bold;
+ }
+
+ .filterrotate {
+ margin-left: 8px;
+ }
+ }
+ .dockeditempanel_hd h2 {
+ .nav-header;
+ font-size: 1.1em;
+ }
+ .controls {
+ position: absolute;
+ bottom: 1em;
+ text-align: center;
+ width: 100%;
+ img {
+ cursor: pointer;
+ }
+ }
+}
+
+#dockeditempanel {
+ min-width: 200px;
+ position: relative;
+ z-index: 12000;
+ left: 100%;
+ padding-left: 5px;
+ .dockeditempanel_content {
+ z-index: 12050;
+ background-color: @wellBackground;
+ width: 220px;
+ box-shadow: 2px 4px 4px 2px #CCCCCC;
+ }
+ .dockeditempanel_bd {
+ overflow: auto;
+ width: auto;
+ .block_navigation .block_tree li {
+ overflow: visible;
+ }
+ }
+ .dockeditempanel_hd {
+ h2 {
+ padding: 10px;
+ margin: 0;
+ border-bottom: 1px solid @white;
+ }
+ .commands {
+ width: 60px;
+ float: right;
+ position: absolute;
+ right: 0px;
+ display: block;
+ text-align: right;
+ top: 6px;
+ }
+ .commands > a,
+ .commands > span {
+ margin-left: 3px;
+ cursor: pointer;
+ }
+ a.editing_move,
+ a.editing_edit,
+ a.editing_roles,
+ a.editing_delete,
+ a.editing_hide {
+ display: none;
+ }
+ .commands img,
+ .commands input {
+ vertical-align: middle;
+ margin-right: 1px;
+ }
+ .commands .hidepanemicon img {
+ cursor: pointer;
+ }
+ }
+
+}
+
+#dockeditempanel.dockitempanel_hidden {
+ display: none;
+}
+
+.dir-rtl {
+ #dockeditempanel {
+ right: 100%;
+ .dockeditempanel_hd .commands {
+ text-align: left;
+ }
+ }
+ #dock {
+ left: auto;
+ right: 0%;
+ .dockedtitle {
+ border-bottom: 1px solid #DDD;
+ border-top: 1px solid #EEE;
+ cursor: pointer;
+ }
+ }
+ .dockeditempanel_hd {
+ h2 {
+ padding: 10px;
+ margin: 0;
+ border-bottom: 1px solid @white;
+ }
+ .commands {
+ float: left;
+ right: auto;
+ left: 0px;
+ text-align: left;
+ top: 6px;
+ }
+ }
+}
+
+body.dir-rtl.has_dock {
+ margin-left: 0px;
+ margin-right: 20px;
+}
View
2  theme/bootstrapbase/style/moodle.css
1 addition, 1 deletion not shown
View
2  theme/clean/config.php
@@ -41,7 +41,7 @@
$THEME->sheets = array('custom');
$THEME->supportscssoptimisation = false;
$THEME->yuicssmodules = array();
-
+$THEME->enable_dock = true;
$THEME->editor_sheets = array();
$THEME->rendererfactory = 'theme_overridden_renderer_factory';

0 comments on commit 056b54f

Please sign in to comment.
Something went wrong with that request. Please try again.