summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-16 13:00:35 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-16 13:00:35 +0200
commit1fb0d5412c7a4a3b888098e492342699d05fe55e (patch)
tree436bab2e329cf0e3ff2080a4227338c131f85b57 /core
parent43d6650d194105dac30b11fb2ba4a3b3c7805650 (diff)
parent6fd084243b65a556d4775209ba3916145ef5912a (diff)
downloadnextcloud-server-1fb0d5412c7a4a3b888098e492342699d05fe55e.tar.gz
nextcloud-server-1fb0d5412c7a4a3b888098e492342699d05fe55e.zip
Merge pull request #6260 from owncloud/jan-navigation-filesidebar
Files app navigation sidebar
Diffstat (limited to 'core')
-rw-r--r--core/css/apps.css3
-rw-r--r--core/js/js.js113
-rw-r--r--core/templates/layout.user.php2
3 files changed, 117 insertions, 1 deletions
diff --git a/core/css/apps.css b/core/css/apps.css
index a0bb262854d..377878467c0 100644
--- a/core/css/apps.css
+++ b/core/css/apps.css
@@ -178,6 +178,9 @@
bottom: 0;
border-top: 1px solid #ccc;
}
+#app-settings.opened #app-settings-content {
+ display: block;
+}
#app-settings-header {
background-color: #eee;
}
diff --git a/core/js/js.js b/core/js/js.js
index 27bc3c651e3..38b97590430 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1319,6 +1319,114 @@ OC.Util = {
};
/**
+ * Utility class for the history API,
+ * includes fallback to using the URL hash when
+ * the browser doesn't support the history API.
+ */
+OC.Util.History = {
+ _handlers: [],
+
+ /**
+ * Push the current URL parameters to the history stack
+ * and change the visible URL.
+ * Note: this includes a workaround for IE8/IE9 that uses
+ * the hash part instead of the search part.
+ *
+ * @param params to append to the URL, can be either a string
+ * or a map
+ */
+ pushState: function(params) {
+ var strParams;
+ if (typeof(params) === 'string') {
+ strParams = params;
+ }
+ else {
+ strParams = OC.buildQueryString(params);
+ }
+ if (window.history.pushState) {
+ var url = location.pathname + '?' + strParams;
+ window.history.pushState(params, '', url);
+ }
+ // use URL hash for IE8
+ else {
+ window.location.hash = '?' + strParams;
+ // inhibit next onhashchange that just added itself
+ // to the event queue
+ this._cancelPop = true;
+ }
+ },
+
+ /**
+ * Add a popstate handler
+ *
+ * @param handler function
+ */
+ addOnPopStateHandler: function(handler) {
+ this._handlers.push(handler);
+ },
+
+ /**
+ * Parse a query string from the hash part of the URL.
+ * (workaround for IE8 / IE9)
+ */
+ _parseHashQuery: function() {
+ var hash = window.location.hash,
+ pos = hash.indexOf('?');
+ if (pos >= 0) {
+ return hash.substr(pos + 1);
+ }
+ return '';
+ },
+
+ _decodeQuery: function(query) {
+ return query.replace(/\+/g, ' ');
+ },
+
+ /**
+ * Parse the query/search part of the URL.
+ * Also try and parse it from the URL hash (for IE8)
+ *
+ * @return map of parameters
+ */
+ parseUrlQuery: function() {
+ var query = this._parseHashQuery(),
+ params;
+ // try and parse from URL hash first
+ if (query) {
+ params = OC.parseQueryString(this._decodeQuery(query));
+ }
+ // else read from query attributes
+ if (!params) {
+ params = OC.parseQueryString(this._decodeQuery(location.search));
+ }
+ return params || {};
+ },
+
+ _onPopState: function(e) {
+ if (this._cancelPop) {
+ this._cancelPop = false;
+ return;
+ }
+ var params;
+ if (!this._handlers.length) {
+ return;
+ }
+ params = (e && e.state) || this.parseUrlQuery() || {};
+ for (var i = 0; i < this._handlers.length; i++) {
+ this._handlers[i](params);
+ }
+ }
+};
+
+// fallback to hashchange when no history support
+if (window.history.pushState) {
+ window.onpopstate = _.bind(OC.Util.History._onPopState, OC.Util.History);
+}
+else {
+ $(window).on('hashchange', _.bind(OC.Util.History._onPopState, OC.Util.History));
+}
+
+/**
* Get a variable by name
* @param {string} name
* @return {*}
@@ -1368,6 +1476,11 @@ OC.set=function(name, value) {
})();
/**
+ * Namespace for apps
+ */
+window.OCA = {};
+
+/**
* select a range in an input field
* @link http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area
* @param {type} start
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index a217446ca73..b0ae8637acc 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -123,7 +123,7 @@
</div></nav>
<div id="content-wrapper">
- <div id="content">
+ <div id="content" class="app-<?php p($_['appid']) ?>">
<?php print_unescaped($_['content']); ?>
</div>
</div>