From c3c251b7d6394da4fb76c5bc00c3bfdc266eadf0 Mon Sep 17 00:00:00 2001 From: Benjamin Reed Date: Sun, 24 Jan 2016 15:12:39 -0500 Subject: [PATCH] fix seamail detail to be more like an IM window --- lib/seamail/Controller.js | 25 +++++++++++++++++++++- lib/seamail/seamail.html | 44 ++++++++++++++++---------------------- lib/seamail/user-list.html | 27 ++++++++++++++--------- scss/cruisemonkey.scss | 19 ++++++++++++++++ 4 files changed, 78 insertions(+), 37 deletions(-) diff --git a/lib/seamail/Controller.js b/lib/seamail/Controller.js index f86685bb..bed76662 100644 --- a/lib/seamail/Controller.js +++ b/lib/seamail/Controller.js @@ -5,6 +5,7 @@ require('../util/array-monkeypatch'); require('../images/Cache'); + var hashFunc = require('string-hash/index'); var autocompleteTemplate = require('ngtemplate!html!./autocomplete-template.html'); var seamailTemplate = require('ngtemplate!html!./seamail.html'); @@ -87,13 +88,18 @@ $scope.userList = { closed: true }; + + if ($scope.listView === undefined) { + $scope.listView = false; + } + $scope.toggle = function(ev) { ev.preventDefault(); ev.stopPropagation(); $scope.userList.closed = !$scope.userList.closed; }; }) - .controller('CMSeamailCtrl', function($interval, $ionicPopup, $log, $q, $scope, $stateParams, SettingsService, Twitarr, UserService) { + .controller('CMSeamailCtrl', function($interval, $ionicPopover, $ionicPopup, $ionicScrollDelegate, $log, $q, $scope, $stateParams, SettingsService, Twitarr, UserService) { $log.info('CMSeamailCtrl Initializing.'); $scope.userListTemplate = userListTemplate; @@ -126,6 +132,15 @@ } }; + var popover = $ionicPopover.fromTemplate('', { + scope: $scope + }); + popover.scope.listView = true; + + $scope.openUserList = function(ev) { + popover.show(ev); + }; + $scope.doRefresh = function() { if (!UserService.loggedIn()) { $log.info('CMSeamailCtrl.doRefresh(): not logged in'); @@ -138,7 +153,15 @@ $scope.user = UserService.get(); return Twitarr.getSeamailMessages($stateParams.id).then(function(res) { if (res.seamail && res.seamail.messages) { + for (var i=0, len=res.seamail.messages.length, message; i < len; i++) { + message = res.seamail.messages[i]; + message.hash = hashFunc(message.author + message.text + message.timestamp); + } + res.seamail.messages = res.seamail.messages.reverse(); $scope.seamail = res.seamail; + //$log.debug('seamail=' + angular.toJson($scope.seamail)); + $scope.$broadcast('scroll.refreshComplete'); + $ionicScrollDelegate.$getByHandle('seamail').scrollBottom(); } return res; }).finally(function() { diff --git a/lib/seamail/seamail.html b/lib/seamail/seamail.html index 49709207..f9735267 100644 --- a/lib/seamail/seamail.html +++ b/lib/seamail/seamail.html @@ -1,31 +1,23 @@ - - + + + + + - - -
-
- -
-
- -
-
+ + +
{{message.author_display_name}} @{{message.author}}
+

+
{{message.timestamp.fromNow()}}
- - - - -
-
- - -
{{message.author_display_name}} @{{message.author}}
-

-
{{message.timestamp.fromNow()}}
-
-
-
+
+ + + + +
\ No newline at end of file diff --git a/lib/seamail/user-list.html b/lib/seamail/user-list.html index eae8aa30..19de60ee 100644 --- a/lib/seamail/user-list.html +++ b/lib/seamail/user-list.html @@ -1,17 +1,24 @@ -
-
- - Show Users - + +
+
+ + {{seamail.users.length}} Users + +
-
-
-
- - Hide Users +
+
+ + Hide Users + +
+ + {{user.username}}
+
+
{{user.username}} diff --git a/scss/cruisemonkey.scss b/scss/cruisemonkey.scss index 9f1effe8..2cf3257b 100644 --- a/scss/cruisemonkey.scss +++ b/scss/cruisemonkey.scss @@ -195,6 +195,9 @@ ion-tabs { .cm-icon-music-note { @extend .ion-music-note; } +.cm-icon-people { + @extend .ion-android-people; +} .cm-icon-plus { @extend .ion-plus; } @@ -283,6 +286,9 @@ ion-tabs { .cm-icon-music-note { @extend .ion-ios-musical-notes; } + .cm-icon-people { + @extend .ion-ios-people; + } .cm-icon-plus { @extend .ion-ios-plus-empty; } @@ -798,6 +804,9 @@ ion-popover-view.fit ion-content { white-space: nowrap; vertical-align: middle; } + &.list-view .user { + display: block; + } } .title { font-family: $headings-font-family; @@ -821,6 +830,16 @@ ion-popover-view.fit ion-content { max-width: 50px; padding: 0; } + + .bar { + &.bar-light { + @include bar-style(white, $cmBackgroundAlternate, $cmForeground); + &.bar-footer { + background-image: none; + border-top: 1px solid $cmBackgroundAlternate; + } + } + } } .searchable {