Timestamp toggling
authorDarren <darren@Darrens-MacBook-Pro.local>
Sun, 24 Mar 2013 19:53:17 +0000 (19:53 +0000)
committerDarren <darren@Darrens-MacBook-Pro.local>
Sun, 24 Mar 2013 19:53:17 +0000 (19:53 +0000)
client/assets/css/style.css
client/assets/dev/app.js
client/assets/dev/applet_settings.js
client/assets/dev/index.html.tmpl
client/assets/dev/view.js

index e6f4154f390785692b2ae77c921ccef1b70d2269..492e0de63eb8cdfc96d19624f935f56b470a65a3 100644 (file)
@@ -337,7 +337,7 @@ html, body { height:100%; }
 #kiwi.theme_relaxed .messages a { text-decoration:none; }
 
 #kiwi.theme_relaxed .messages .msg { border-bottom: 1px solid #DEDEDE; padding: 1px; font-family:arial; font-size:0.9em; }
-#kiwi.theme_relaxed .messages .msg .time { width:6em; float:left; color:#777; display:none; }
+#kiwi.theme_relaxed .messages .msg .time { width:5em; float:left; color:#777; padding:5px; display:none; }
 #kiwi.theme_relaxed .messages .msg .nick { width:11em; float:left; font-size:12px; font-family:Arial; text-align:right; padding: 5px; overflow:hidden; }
 #kiwi.theme_relaxed .messages .msg .text { display:block; margin-left:12em; border-left: 1px solid #DEDEDE; white-space:pre-wrap; word-wrap:break-word; font-family:arial; padding:5px; }
 
@@ -364,6 +364,9 @@ html, body { height:100%; }
     padding:0.5em; margin-top:1em; margin-bottom:1em; margin-right:2em;
 }
 
+#kiwi.theme_relaxed.timestamps .messages .msg .time { display:block; }
+#kiwi.theme_relaxed.timestamps .messages .msg .text { margin-left:17em; }
+
 #kiwi.theme_relaxed .messages .msg.global_nick_highlight,
 #kiwi.theme_relaxed .messages .msg.highlight { background:#D9D9D9; }
 
index 9187b5bd870c748cdd9a9ca42c7a35d3a5471474..046eb3fbd123ab6283a0f4d42ba50fe35c00cdad 100644 (file)
@@ -15,7 +15,7 @@ _kiwi.applets = {};
  * and data (think: plugins)\r
  */\r
 _kiwi.global = {\r
-       settings: undefined,\r
+       settings: undefined, // Instance of _kiwi.model.DataStore\r
        plugins: undefined,\r
        utils: undefined, // TODO: Re-usable methods\r
        user: undefined, // TODO: Limited user methods\r
index 93a222f762684ea6d4d82b80735d7c554f637599..78d235a00c8a78284c0e3fa148a62567b4a03a23 100644 (file)
             } else {\r
                 this.$el.find('.setting-show_joins_parts').attr('checked', false);\r
             }\r
+\r
+            if (typeof settings.get('show_timestamps') === 'undefined' || !settings.get('show_timestamps')) {\r
+                this.$el.find('.setting-show_timestamps').attr('checked', false);\r
+            } else {\r
+                this.$el.find('.setting-show_timestamps').attr('checked', true);\r
+            }\r
         },\r
 \r
 \r
@@ -51,6 +57,7 @@
             settings.set('channel_list_style', $('.setting-channel_list_style', this.$el).val());\r
             settings.set('scrollback', $('.setting-scrollback', this.$el).val());\r
             settings.set('show_joins_parts', $('.setting-show_joins_parts', this.$el).is(':checked'));\r
+            settings.set('show_timestamps', $('.setting-show_timestamps', this.$el).is(':checked'));\r
 \r
             settings.save();\r
 \r
index 16a7dcdc16fe7d8200fe864cd75cd87947e8ed63..fe98e62e48d242b559580529ef7359e3ac12deef 100644 (file)
                     <td class="setting"><input type="checkbox" class="setting-show_joins_parts" /></td>\r
                 </tr>\r
 \r
+                <tr>\r
+                    <td class="label">Show timestamps</td>\r
+                    <td class="setting"><input type="checkbox" class="setting-show_timestamps" /></td>\r
+                </tr>\r
+\r
                 <tr class="save">\r
                     <td colspan="2"><button class="save">Save</button>​​​​​​​​​</td>\r
                 </tr>\r
index fa43cabe5bc7f62572355ac98db4a250bcd87d2b..d6d3ebb30ac9e47785b7532a825e8f5dd25a28d9 100644 (file)
@@ -1085,6 +1085,9 @@ _kiwi.view.Application = Backbone.View.extend({
         _kiwi.global.settings.on('change:channel_list_style', this.setTabLayout, this);\r
         this.setTabLayout(_kiwi.global.settings.get('channel_list_style'));\r
 \r
+        _kiwi.global.settings.on('change:show_timestamps', this.displayTimestamps, this);\r
+        this.displayTimestamps(_kiwi.global.settings.get('show_timestamps'));\r
+\r
         this.doLayout();\r
 \r
         $(document).keydown(this.setKeyFocus);\r
@@ -1134,6 +1137,20 @@ _kiwi.view.Application = Backbone.View.extend({
     },\r
 \r
 \r
+    displayTimestamps: function (show_timestamps) {\r
+        // If called by the settings callback, get the correct new_value\r
+        if (show_timestamps === _kiwi.global.settings) {\r
+            show_timestamps = arguments[1];\r
+        }\r
+        \r
+        if (show_timestamps) {\r
+            this.$el.addClass('timestamps');\r
+        } else {\r
+            this.$el.removeClass('timestamps');\r
+        }\r
+    },\r
+\r
+\r
     // Globally shift focus to the command input box on a keypress\r
     setKeyFocus: function (ev) {\r
         // If we're copying text, don't shift focus\r