diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 269: Remove useless features from sidebar widget

Message ID 20111021004614.12801.35911.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki Oct. 21, 2011, 12:46 a.m. UTC
------------------------------------------------------------
revno: 269
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: lava-server
timestamp: Fri 2011-10-21 01:32:19 +0200
message:
  Remove useless features from sidebar widget
  
  Useless == no longer used
modified:
  lava_server/htdocs/js/jquery.lava.sidebar.js


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_server/htdocs/js/jquery.lava.sidebar.js'
--- lava_server/htdocs/js/jquery.lava.sidebar.js	2011-09-22 11:43:08 +0000
+++ lava_server/htdocs/js/jquery.lava.sidebar.js	2011-10-20 23:32:19 +0000
@@ -10,20 +10,12 @@ 
 
   $.widget("lava.sidebar", {
     options: {
-      // hidden by default (unless pinned)
-      hidden: true, 
-      // not pinned by default
-      pinned: false,  
-      pinnedCookieName: "lava-sidebar-pinned",
-      pinnedCookiePath: "/",
+      hidden: false, 
       extraControls: [],
       onShow: null,
       onHide: null,
       onDestroy: null,
-      onPin: null,
-      onUnpin: null,
     },
-    _pin_button: null,
     _close_button: null,
     _controls: null,
     controls: function() {
@@ -37,8 +29,6 @@ 
         // If the sidebar was empty then just hide it
         this.element.hide();
       } else {
-        // Load cookie to check for pin status
-        this._load_pin_option();
         // Initialize basic stuff:
         // 1) css class
         // 2) click handler
@@ -56,18 +46,6 @@ 
             "class": "lava-sidebar-controls"
           })
           .prependTo(this.element);
-        // Initialize pin button
-        self._pin_button = $("<span/>", {
-            title: "Pin/unpin the sidebar"
-          })
-        .button({
-            text: false,
-            icons: { primary: this.options.pinned ? 'ui-icon-pin-s' : 'ui-icon-pin-w'}
-          })
-          .click(function(event) {
-            self.element.sidebar("option", "pinned", !self.options.pinned);
-          })
-          .appendTo(self._controls);
         // Initialize close button
         self._close_button = $("<span/>", {
             title: "Collapse the sidebar"
@@ -89,7 +67,7 @@ 
     },
     _init: function() {
       /* Initializer */
-      if (this.options.pinned == false && this.options.hidden == true) {
+      if (this.options.hidden == true) {
         this.hide();
       } else {
         this.show();
@@ -122,40 +100,6 @@ 
         this.options.onHide();
       }
     },
-    pin: function() {
-      /* Pin the sidebar so that it is shown by default */
-      this._set_pinned(true);
-    },
-    unpin: function() {
-      /* Unpin the sidebar */
-      this._set_pinned(false);
-    },
-    _set_pinned: function(pin_state) {
-      this.options.pinned = (pin_state == true);
-      this._pin_button.button("option", "icons", { primary: this.options.pinned ? 'ui-icon-pin-s' : 'ui-icon-pin-w'});
-      this._save_pin_option();
-      if (this.options.pinned == true && this.options.onPin) {
-        this.options.onPin();
-      }
-      if (this.options.pinned == false && this.options.onUnpin) {
-        this.options.onUnpin();
-      }
-    },
-    _load_pin_option: function() {
-      this.options.pinned = $.cookie(
-        this.options.pinnedCookieName, {
-          path: this.optionsPinnedCookiePath,
-          expires: 365
-        }) == "pinned";
-    },
-    _save_pin_option: function() {
-      $.cookie(
-        this.options.pinnedCookieName,
-        this.options.pinned ? "pinned" : "", {
-          path: this.options.pinnedCookiePath,
-          expires: 365
-        });
-    },
     _setOption: function(key, value) {
       /* jQueryUI widget method for implementing option setter */
       $.Widget.prototype._setOption.apply(this, arguments);
@@ -166,9 +110,6 @@ 
           this.show();
         }
       }
-      if (key == "pinned") {
-        this._set_pinned(value);
-      }
     }
   });
 })(jQuery);