From 5af59c68712032ef387ccd4410eb4b8b04c27df9 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 24 Jul 2015 23:07:09 +0200 Subject: rename sidebar element and use css and js utility functions to core --- core/js/apps.js | 21 +++++++++++++++++++++ core/js/core.json | 1 + 2 files changed, 22 insertions(+) (limited to 'core/js') diff --git a/core/js/apps.js b/core/js/apps.js index 71170bbc23a..1606abf5971 100644 --- a/core/js/apps.js +++ b/core/js/apps.js @@ -20,6 +20,27 @@ } }; + /** + * Shows the #app-sidebar and add .with-app-sidebar to subsequent siblings + */ + exports.Apps.showAppSidebar = function() { + var $appSidebar = $('#app-sidebar'); + $appSidebar + .removeClass('disappear') + .find('~ .with-app-sidebar').removeClass('.with-app-sidebar'); + }; + + /** + * Shows the #app-sidebar and removes .with-app-sidebar from subsequent + * siblings + */ + exports.Apps.hideAppSidebar = function() { + var $appSidebar = $('#app-sidebar'); + $appSidebar + .addClass('disappear') + .find('~').addClass('.with-app-sidebar'); + }; + /** * Provides a way to slide down a target area through a button and slide it * up if the user clicks somewhere else. Used for the news app settings and diff --git a/core/js/core.json b/core/js/core.json index 0f052b798a9..1053debaa99 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -20,6 +20,7 @@ "oc-dialogs.js", "js.js", "l10n.js", + "apps.js", "share.js", "octemplate.js", "eventsource.js", -- cgit v1.2.3 From a81251454d81a5ea2532b66af42c835bc5566f00 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 28 Jul 2015 14:46:10 +0200 Subject: fix show/hide app sidebar functions --- core/js/apps.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/js/apps.js b/core/js/apps.js index 1606abf5971..5d9bbeb870a 100644 --- a/core/js/apps.js +++ b/core/js/apps.js @@ -27,7 +27,8 @@ var $appSidebar = $('#app-sidebar'); $appSidebar .removeClass('disappear') - .find('~ .with-app-sidebar').removeClass('.with-app-sidebar'); + .find('~').addClass('with-app-sidebar'); + }; /** @@ -38,7 +39,7 @@ var $appSidebar = $('#app-sidebar'); $appSidebar .addClass('disappear') - .find('~').addClass('.with-app-sidebar'); + .find('~ .with-app-sidebar').removeClass('with-app-sidebar'); }; /** -- cgit v1.2.3 From ae27f90efe554d3a8a069165fe14cfd50445855d Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 6 Aug 2015 11:45:12 +0200 Subject: Fix app-content scrollbar when app-sidebar is open --- core/css/apps.css | 6 +++--- core/css/mobile.css | 6 +----- core/js/apps.js | 10 ++++------ core/js/js.js | 4 ++-- 4 files changed, 10 insertions(+), 16 deletions(-) (limited to 'core/js') diff --git a/core/css/apps.css b/core/css/apps.css index 091bb2c22fc..5769120c5ed 100644 --- a/core/css/apps.css +++ b/core/css/apps.css @@ -430,7 +430,7 @@ right: 0; left: auto; bottom: 0; - width: 300px; + width: 27%; display: block; background: #eee; -webkit-transition: margin-right 300ms; @@ -443,8 +443,8 @@ z-index: 500; } -#app-sidebar ~ .with-app-sidebar { - width: 73%; +#app-content.with-app-sidebar { + margin-right: 27%; } #app-sidebar.disappear { diff --git a/core/css/mobile.css b/core/css/mobile.css index e38d9756d95..2256d821d73 100644 --- a/core/css/mobile.css +++ b/core/css/mobile.css @@ -103,11 +103,7 @@ z-index: 1000; } -#app-sidebar { - width: 250px; -} - -#app-sidebar ~ .with-app-sidebar { +#app-sidebar{ width: 100%; } diff --git a/core/js/apps.js b/core/js/apps.js index 5d9bbeb870a..d0d351f5147 100644 --- a/core/js/apps.js +++ b/core/js/apps.js @@ -25,9 +25,8 @@ */ exports.Apps.showAppSidebar = function() { var $appSidebar = $('#app-sidebar'); - $appSidebar - .removeClass('disappear') - .find('~').addClass('with-app-sidebar'); + $appSidebar.removeClass('disappear') + $('#app-content').addClass('with-app-sidebar'); }; @@ -37,9 +36,8 @@ */ exports.Apps.hideAppSidebar = function() { var $appSidebar = $('#app-sidebar'); - $appSidebar - .addClass('disappear') - .find('~ .with-app-sidebar').removeClass('with-app-sidebar'); + $appSidebar.addClass('disappear'); + $('#app-content').removeClass('with-app-sidebar'); }; /** diff --git a/core/js/js.js b/core/js/js.js index 45c9c90362f..72d4edd28dd 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1366,13 +1366,13 @@ function initCore() { // if there is a scrollbar … if($('#app-content').get(0).scrollHeight > $('#app-content').height()) { if($(window).width() > 768) { - controlsWidth = $('#content').width() - $('#app-navigation').width() - getScrollBarWidth(); + controlsWidth = $('#content').width() - $('#app-navigation').width() - $('#app-sidebar').width() - getScrollBarWidth(); } else { controlsWidth = $('#content').width() - getScrollBarWidth(); } } else { // if there is none if($(window).width() > 768) { - controlsWidth = $('#content').width() - $('#app-navigation').width(); + controlsWidth = $('#content').width() - $('#app-navigation').width() - $('#app-sidebar').width(); } else { controlsWidth = $('#content').width(); } -- cgit v1.2.3 From 604694630bddff28f0e8daf3868bb35abf910eab Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 6 Aug 2015 15:45:41 +0200 Subject: Set momentJS locale to en during unit test runs --- core/js/tests/specHelper.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/js') diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js index 29293e89bcb..dbe005ba2e9 100644 --- a/core/js/tests/specHelper.js +++ b/core/js/tests/specHelper.js @@ -121,6 +121,8 @@ window.isPhantom = /phantom/i.test(navigator.userAgent); OC.TestUtil = TestUtil; } + moment.locale('en'); + // reset plugins OC.Plugins._plugins = []; -- cgit v1.2.3