summaryrefslogtreecommitdiff
path: root/assets/js/src
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-09-05 12:03:20 -0400
committerFrederic Guillot <fred@kanboard.net>2015-09-05 12:03:20 -0400
commit512840fe1dca3ddc686360107ae1369e82696502 (patch)
tree5e983be9f84be97e50d72bbc0a946d52f251e2f8 /assets/js/src
parentbac18d80f8ff8fce9d167671273e80a492f4c3c5 (diff)
Improve pull-request about swimlane description
Diffstat (limited to 'assets/js/src')
-rw-r--r--assets/js/src/Swimlane.js136
1 files changed, 69 insertions, 67 deletions
diff --git a/assets/js/src/Swimlane.js b/assets/js/src/Swimlane.js
index ce18dbfa..0edb4821 100644
--- a/assets/js/src/Swimlane.js
+++ b/assets/js/src/Swimlane.js
@@ -1,67 +1,69 @@
-function Swimlane() {
-}
-
-Swimlane.prototype.getStorageKey = function() {
- return "hidden_swimlanes_" + $("#board").data("project-id");
-};
-
-Swimlane.prototype.expand = function(swimlaneId) {
- var swimlaneIds = this.getAllCollapsed();
- var index = swimlaneIds.indexOf(swimlaneId);
-
- if (index > -1) {
- swimlaneIds.splice(index, 1);
- }
-
- localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
-
- $('.swimlane-row-' + swimlaneId).css('display', 'table-row');
- $('.show-icon-swimlane-' + swimlaneId).css('display', 'none');
- $('.hide-icon-swimlane-' + swimlaneId).css('display', 'inline');
-};
-
-Swimlane.prototype.collapse = function(swimlaneId) {
- var swimlaneIds = this.getAllCollapsed();
-
- if (swimlaneIds.indexOf(swimlaneId) < 0) {
- swimlaneIds.push(swimlaneId);
- localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
- }
-
- $('.swimlane-row-' + swimlaneId).css('display', 'none');
- $('.show-icon-swimlane-' + swimlaneId).css('display', 'inline');
- $('.hide-icon-swimlane-' + swimlaneId).css('display', 'none');
-};
-
-Swimlane.prototype.isCollapsed = function(swimlaneId) {
- return this.getAllCollapsed().indexOf(swimlaneId) > -1;
-};
-
-Swimlane.prototype.getAllCollapsed = function() {
- return JSON.parse(localStorage.getItem(this.getStorageKey())) || [];
-};
-
-Swimlane.prototype.refresh = function() {
- var swimlaneIds = this.getAllCollapsed();
-
- for (var i = 0; i < swimlaneIds.length; i++) {
- this.collapse(swimlaneIds[i]);
- }
-};
-
-Swimlane.prototype.listen = function() {
- var self = this;
-
- $(document).on('click', ".board-swimlane-toggle", function(e) {
- e.preventDefault();
-
- var swimlaneId = $(this).data('swimlane-id');
-
- if (self.isCollapsed(swimlaneId)) {
- self.expand(swimlaneId);
- }
- else {
- self.collapse(swimlaneId);
- }
- });
-};
+function Swimlane() {
+}
+
+Swimlane.prototype.getStorageKey = function() {
+ return "hidden_swimlanes_" + $("#board").data("project-id");
+};
+
+Swimlane.prototype.expand = function(swimlaneId) {
+ var swimlaneIds = this.getAllCollapsed();
+ var index = swimlaneIds.indexOf(swimlaneId);
+
+ if (index > -1) {
+ swimlaneIds.splice(index, 1);
+ }
+
+ localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
+
+ $('.swimlane-row-' + swimlaneId).css('display', 'table-row');
+ $('.show-icon-swimlane-' + swimlaneId).css('display', 'none');
+ $('.hide-icon-swimlane-' + swimlaneId).css('display', 'inline');
+ $('.swimlane-task-count-' + swimlaneId).css('display', 'inline');
+};
+
+Swimlane.prototype.collapse = function(swimlaneId) {
+ var swimlaneIds = this.getAllCollapsed();
+
+ if (swimlaneIds.indexOf(swimlaneId) < 0) {
+ swimlaneIds.push(swimlaneId);
+ localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
+ }
+
+ $('.swimlane-row-' + swimlaneId).css('display', 'none');
+ $('.show-icon-swimlane-' + swimlaneId).css('display', 'inline');
+ $('.hide-icon-swimlane-' + swimlaneId).css('display', 'none');
+ $('.swimlane-task-count-' + swimlaneId).css('display', 'none');
+};
+
+Swimlane.prototype.isCollapsed = function(swimlaneId) {
+ return this.getAllCollapsed().indexOf(swimlaneId) > -1;
+};
+
+Swimlane.prototype.getAllCollapsed = function() {
+ return JSON.parse(localStorage.getItem(this.getStorageKey())) || [];
+};
+
+Swimlane.prototype.refresh = function() {
+ var swimlaneIds = this.getAllCollapsed();
+
+ for (var i = 0; i < swimlaneIds.length; i++) {
+ this.collapse(swimlaneIds[i]);
+ }
+};
+
+Swimlane.prototype.listen = function() {
+ var self = this;
+
+ $(document).on('click', ".board-swimlane-toggle", function(e) {
+ e.preventDefault();
+
+ var swimlaneId = $(this).data('swimlane-id');
+
+ if (self.isCollapsed(swimlaneId)) {
+ self.expand(swimlaneId);
+ }
+ else {
+ self.collapse(swimlaneId);
+ }
+ });
+};