From 3adc746352d18b6b511073454657b991c45ba0b6 Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 31 Jan 2013 14:57:06 +0000 Subject: [PATCH] Tab layout; password mismatch; activity counters; --- client/assets/css/style.css | 36 +++++++++++++++++++++++++---- client/assets/dev/view.js | 46 ++++++++++++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/client/assets/css/style.css b/client/assets/css/style.css index f6a8240..c46870f 100644 --- a/client/assets/css/style.css +++ b/client/assets/css/style.css @@ -287,9 +287,9 @@ html, body { height:100%; } background-color: #eee; } -#kiwi.theme_relaxed #toolbar .panellist .alert_highlight { background: #990000; } -#kiwi.theme_relaxed #toolbar .panellist .alert_activity { background: #009900; } -#kiwi.theme_relaxed #toolbar .panellist .alert_action { } +#kiwi.theme_relaxed #toolbar .panellist .alert_highlight { /*background: #990000;*/ } +#kiwi.theme_relaxed #toolbar .panellist .alert_activity { font-weight:normal; } +#kiwi.theme_relaxed #toolbar .panellist .alert_action { font-weight:normal; } #kiwi.theme_relaxed #toolbar .panellist .active { padding-right:23px; } #kiwi.theme_relaxed #toolbar .panellist li .part { @@ -300,7 +300,21 @@ html, body { height:100%; } #kiwi.theme_relaxed #toolbar .panellist li.server span { background:url(../img/server_tab.png) no-repeat; padding-left:23px; } /* Tab texts are within a span */ -#kiwi.theme_relaxed #toolbar .panellist li span { line-height:20px; vertical-align:middle; display:block; } +#kiwi.theme_relaxed #toolbar .panellist li span { line-height:20px; vertical-align:middle; } + +#kiwi.theme_relaxed #toolbar .panellist li.active .activity { display:none; } +#kiwi.theme_relaxed #toolbar .panellist li .activity.zero { visibility:hidden; } +#kiwi.theme_relaxed #toolbar .panellist li .activity { + padding: 1px 3px; margin-left:1em; + border-radius: 4px; + background: #3F9532; color:#000; /*color: #ff5300;*/ + text-align: center; font-size: 10px; + display:inline-block; + width:2em; +} +#kiwi.theme_relaxed #toolbar .panellist li.alert_highlight .activity { + color: #fff; background: #a60400; +} #kiwi.theme_relaxed #status_message { background: #FEEFB3; color: #9F6000; @@ -533,7 +547,19 @@ html, body { height:100%; } #kiwi.theme_relaxed .server_select .kiwi_logo img { } - +#kiwi.theme_relaxed.chanlist_treeview #panels { left:200px; } +#kiwi.theme_relaxed.chanlist_treeview #toolbar { position:static; } +#kiwi.theme_relaxed.chanlist_treeview #toolbar .app_tools { float:none; } +#kiwi.theme_relaxed.chanlist_treeview #toolbar > div { margin-left:200px; } +#kiwi.theme_relaxed.chanlist_treeview #toolbar #tabs { position:absolute; left:0px; bottom:0px; top:0px; margin:0; width:200px; background:#1B1B1B; overflow-y:auto; } +#kiwi.theme_relaxed.chanlist_treeview #tabs ul li { display:block; float:none; } +#kiwi.theme_relaxed.chanlist_treeview #tabs ul li .activity { float:right; } +#kiwi.theme_relaxed.chanlist_treeview #tabs ul li.active { + margin-right:0; + border-right-width:0; + border-bottom-right-radius:0; + border-top-right-radius:0; +} diff --git a/client/assets/dev/view.js b/client/assets/dev/view.js index 201ba9c..41325c6 100644 --- a/client/assets/dev/view.js +++ b/client/assets/dev/view.js @@ -117,6 +117,8 @@ _kiwi.view.ServerSelect = function () { }, initialize: function () { + var that = this; + this.$el = $($('#tmpl_server_select').html()); // Remove the 'more' link if the server has disabled server changing @@ -138,6 +140,12 @@ _kiwi.view.ServerSelect = function () { this.setStatus('Nickname already taken'); this.show('nick_change'); } + + if (data.error == 'password_mismatch') { + this.setStatus('Incorrect Password'); + this.show('nick_change'); + that.$el.find('.password').select(); + } }, this); }, @@ -386,9 +394,11 @@ _kiwi.view.Panel = Backbone.View.extend({ // Activity/alerts based on the type of new message if (msg.type.match(/^action /)) { this.alert('action'); + } else if (is_highlight) { _kiwi.app.view.alertWindow('* People are talking!'); this.alert('highlight'); + } else { // If this is the active panel, send an alert out if (this.model.isActive()) { @@ -397,6 +407,20 @@ _kiwi.view.Panel = Backbone.View.extend({ this.alert('activity'); } + // Update the activity counters + (function () { + // Only inrement the counters if we're not the active panel + if (this.model.isActive()) return; + + var $act = this.model.tab.find('.activity'); + $act.text((parseInt($act.text(), 10) || 0) + 1); + if ($act.text() === '0') { + $act.addClass('zero'); + } else { + $act.removeClass('zero'); + } + }).apply(this); + this.scrollToBottom(); // Make sure our DOM isn't getting too large (Acts as scrollback) @@ -431,6 +455,7 @@ _kiwi.view.Panel = Backbone.View.extend({ media_message.open(); }, + // Cursor hovers over a message msgEnter: function (event) { var nick_class; @@ -447,6 +472,7 @@ _kiwi.view.Panel = Backbone.View.extend({ $('.'+nick_class).addClass('global_nick_highlight'); }, + // Cursor leaves message msgLeave: function (event) { var nick_class; @@ -481,10 +507,13 @@ _kiwi.view.Panel = Backbone.View.extend({ } _kiwi.app.view.doLayout(); + + // Remove any alerts and activity counters for this panel this.alert('none'); + this.model.tab.find('.activity').text('0').addClass('zero'); this.trigger('active', this.model); - _kiwi.app.panels.trigger('active', this.model); + _kiwi.app.panels.trigger('active', this.model, _kiwi.app.panels.active); this.scrollToBottom(true); }, @@ -615,7 +644,7 @@ _kiwi.view.Tabs = Backbone.View.extend({ panelAdded: function (panel) { // Add a tab to the panel - panel.tab = $('
  • ' + (panel.get('title') || panel.get('name')) + '
  • '); + panel.tab = $('
  • ' + (panel.get('title') || panel.get('name')) + '
  • '); if (panel.isServer()) { panel.tab.addClass('server'); @@ -634,7 +663,7 @@ _kiwi.view.Tabs = Backbone.View.extend({ _kiwi.app.view.doLayout(); }, - panelActive: function (panel) { + panelActive: function (panel, previously_active_panel) { // Remove any existing tabs or part images $('.part', this.$el).remove(); this.tabs_applets.children().removeClass('active'); @@ -1105,6 +1134,11 @@ _kiwi.view.Application = Backbone.View.extend({ el_memberlists.css(css_heights); el_resize_handle.css(css_heights); + // If we have channel tabs on the side, adjust the height + if (el_kiwi.hasClass('chanlist_treeview')) { + $('#kiwi #tabs').css(css_heights); + } + // Determine if we have a narrow window (mobile/tablet/or even small desktop window) if (el_kiwi.outerWidth() < 400) { el_kiwi.addClass('narrow'); @@ -1127,6 +1161,12 @@ _kiwi.view.Application = Backbone.View.extend({ }, + toggleLayout: function () { + this.$el.toggleClass('chanlist_treeview'); + this.doLayout(); + }, + + alertWindow: function (title) { if (!this.alertWindowTimer) { this.alertWindowTimer = new (function () { -- 2.25.1