diff --git a/application/views/header.php b/application/views/header.php
index efedc54..31e2c57 100644
--- a/application/views/header.php
+++ b/application/views/header.php
@@ -67,8 +67,8 @@
endif;
?>
-
- =_('Projects');?>
+
+ =_('Projects');?>
- =_('New project');?>
- =_('Show projects');?>
@@ -83,8 +83,8 @@
- -
- =_('Own projects')?>
+
-
+ =_('Own projects')?>
$projects = $this->project->getOwn();
@@ -96,14 +96,14 @@
?>
- -
- =_('Projects shared with me')?>
+
-
+ =_('Projects shared with me')?>
- -
- =_('Public projects')?>
+
-
+ =_('Public projects')?>
diff --git a/assets/js/scattport.js b/assets/js/scattport.js
index 113aef8..1ea041e 100644
--- a/assets/js/scattport.js
+++ b/assets/js/scattport.js
@@ -22,6 +22,81 @@ function deleteConfirm(url) {
}
}
+/**
+ * Sets a cookie.
+ *
+ * @param name
+ * @param value
+ * @param days
+ */
+function setCookie(name, value, days) {
+ var today = new Date();
+ var expire = new Date();
+
+ if (days == null || days == 0) {
+ days = 1;
+ }
+ expire.setTime(today.getTime() + 3600000 * 24 * days);
+ document.cookie = name + "=" + escape(value) + ";path=/;expires=" + expire.toGMTString();
+}
+
+/**
+ * Gets a cookie.
+ *
+ * @param name
+ * @returns
+ */
+function getCookie(name) {
+ var cookie = ' ' + document.cookie;
+ var index = cookie.indexOf(" " + name + "=");
+
+ if (index == -1) {
+ index = cookie.indexOf(";" + name + "=");
+ }
+ if (index == -1 || name == '') {
+ return '';
+ }
+
+ var index2 = cookie.indexOf(";", index + 1);
+
+ if (index2 == -1) {
+ index2 = cookie.length;
+ }
+ return unescape(cookie.substring(index + name.length + 2, index2));
+}
+
+/**
+ *
+ * @param cookieName
+ * @returns
+ */
+var CookieList = function(cookieName) {
+ var cookie = getCookie(cookieName);
+ // load the items or a new array if null
+ var items = cookie ? cookie.split(/,/) : new Array();
+
+ return {
+ "add": function(val) {
+ // add to the items
+ items.push(val);
+ // save the items to a cookie
+ setCookie(cookieName, items.join(','));
+ }, "remove": function(val) {
+ // remove the value from items
+ items.splice(items.indexOf(val), 1);
+ // save the items to a cookie
+ setCookie(cookieName, items.join(','));
+ }, "clear": function() {
+ items = null;
+ // clear the cookie
+ setCookie(cookieName, null, null);
+ }, "items": function() {
+ // get all the items
+ return items;
+ }
+ };
+};
+
/**
* Saves the changes done by in-place edit.
*
@@ -207,4 +282,27 @@ $(document).ready(function() {
window.location = url;
}
});
+
+ /*
+ * Toggleable navigation
+ */
+ var toggleList = new CookieList("toggled");
+ var toggled = toggleList.items();
+
+ for (var i = 0; i < toggled.length; i++) {
+ $('#' + toggled[i]).toggleClass('active').find('ul').hide();
+ }
+
+ $('.toggleable').find('a').click(function() {
+ var id = $(this).parent().attr('id');
+
+ // toggle
+ $(this).parent().toggleClass('active').find('ul').toggle();
+
+ if ($(this).next().css('display') == 'none') {
+ toggleList.add(id);
+ } else {
+ toggleList.remove(id);
+ }
+ });
});