From 478910a3aaa34bd5c67ebb6b269defdf93ccc09a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 17 Jul 2014 16:00:41 +0100 Subject: [PATCH 1/5] if a user does not have a first or last name use their email for their name in connected user data --- .../coffee/ide/online-users/OnlineUsersManager.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee b/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee index 05b8f55016..8abe1281a9 100644 --- a/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee +++ b/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee @@ -21,11 +21,16 @@ define [ # Don't store myself continue # Store data in the same format returned by clientTracking.clientUpdated + if user.first_name?.length == 0 and user.last_name.length == 0 + name = user.email + else + name = "#{user.first_name} #{user.last_name}" + @$scope.onlineUsers[user.client_id] = { id: user.client_id user_id: user.user_id email: user.email - name: "#{user.first_name} #{user.last_name}" + name: name doc_id: user.cursorData?.doc_id row: user.cursorData?.row column: user.cursorData?.column From 554fd7c7d0e8be0d0fb08cd019398c2a42145493 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 17 Jul 2014 16:03:53 +0100 Subject: [PATCH 2/5] change client connection timeout to 15 mins expire in redis --- .../Features/ConnectedUsers/ConnectedUsersManager.coffee | 2 +- .../coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee b/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee index 9c4fda7bf4..b3f18ec60f 100644 --- a/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee +++ b/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee @@ -11,7 +11,7 @@ ONE_HOUR_IN_S = 60 * 60 ONE_DAY_IN_S = ONE_HOUR_IN_S * 24 FOUR_DAYS_IN_S = ONE_DAY_IN_S * 4 -USER_TIMEOUT_IN_S = ONE_HOUR_IN_S +USER_TIMEOUT_IN_S = ONE_HOUR_IN_S / 4 buildProjectSetKey = (project_id)-> return "clients_in_project:#{project_id}" buildUserKey = (project_id, client_id)-> return "connected_user:#{project_id}:#{client_id}" diff --git a/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee b/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee index 605ea4fe04..bdba5cd2a6 100644 --- a/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee @@ -89,7 +89,7 @@ describe "ConnectedUsersManager", -> it "should add a ttl to the connected user so it stays clean", (done)-> @ConnectedUsersManager.markUserAsConnected @project_id, @client_id, @user, (err)=> - @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 60).should.equal true + @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 15).should.equal true done() describe "markUserAsDisconnected", -> @@ -160,6 +160,6 @@ describe "ConnectedUsersManager", -> it "should add the ttl on", (done)-> @ConnectedUsersManager.setUserCursorPosition @project_id, @client_id, @cursorData, (err)=> - @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 60).should.equal true + @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 15).should.equal true done() From c683eab9e2a22efa795163f8115f370a67957e18 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 17 Jul 2014 17:05:39 +0100 Subject: [PATCH 3/5] change the scribtex modal to be bootstrap3/angular, same content and same logic if it should be shown or not --- services/web/app/views/layout.jade | 14 ++++---------- services/web/app/views/scribtex-modal.jade | 8 ++++++++ services/web/public/coffee/main.coffee | 1 + .../web/public/coffee/main/scribtex-popup.coffee | 9 +++++++++ 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 services/web/app/views/scribtex-modal.jade create mode 100644 services/web/public/coffee/main/scribtex-popup.coffee diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 0b374dd0ab..2e59b6a48f 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -43,17 +43,11 @@ html(itemscope, itemtype='http://schema.org/Product') - if(typeof(suppressFooter) == "undefined") include layout/footer + + - if (typeof(lookingForScribtex) != "undefined" && lookingForScribtex) - .modal.hide#scribtexModal - .modal-header - h3 Looking for ScribTeX? - .modal-body - p ScribTeX has moved to https://scribtex.sharelatex.com. Please update your bookmarks. - p(style="text-align: center") You can find the page you were looking for here: - p(style="text-align: center") - a(href="https://scribtex.sharelatex.com#{scribtexPath}", style="font-size: 16px") https://scribtex.sharelatex.com#{scribtexPath} - .modal-footer - button(data-dismiss="modal").btn OK + span(ng-controller="ScribtexPopupController") + include scribtex-modal - if(typeof(suppressFooter) == "undefined") diff --git a/services/web/app/views/scribtex-modal.jade b/services/web/app/views/scribtex-modal.jade new file mode 100644 index 0000000000..1d4e2ce005 --- /dev/null +++ b/services/web/app/views/scribtex-modal.jade @@ -0,0 +1,8 @@ +script(type='text/ng-template', id='scribtexModalTemplate') + .modal-header + h3 Looking for ScribTeX? + .modal-body + p ScribTeX has moved to https://scribtex.sharelatex.com. Please update your bookmarks. + p(style="text-align: center") You can find the page you were looking for here: + p(style="text-align: center") + a(href="https://scribtex.sharelatex.com#{scribtexPath}", style="font-size: 16px") https://scribtex.sharelatex.com#{scribtexPath} \ No newline at end of file diff --git a/services/web/public/coffee/main.coffee b/services/web/public/coffee/main.coffee index 101f2dcab3..ed6b22404c 100644 --- a/services/web/public/coffee/main.coffee +++ b/services/web/public/coffee/main.coffee @@ -5,6 +5,7 @@ define [ "main/templates" "main/plans" "main/group-members" + "main/scribtex-popup" "directives/asyncForm" "directives/stopPropagation" "directives/focus" diff --git a/services/web/public/coffee/main/scribtex-popup.coffee b/services/web/public/coffee/main/scribtex-popup.coffee new file mode 100644 index 0000000000..d18993c0a0 --- /dev/null +++ b/services/web/public/coffee/main/scribtex-popup.coffee @@ -0,0 +1,9 @@ +define [ + "base" +], (App) -> + + App.controller 'ScribtexPopupController', ($scope, $modal) -> + + $modal.open { + templateUrl: "scribtexModalTemplate" + } From ca6e8a7d400fdef00e66e4b868f769d5a3587586 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 17 Jul 2014 17:34:09 +0100 Subject: [PATCH 4/5] basic sorting added to project list page --- services/web/app/views/project/list/project-list.jade | 8 ++++---- services/web/public/coffee/main/project-list.coffee | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/list/project-list.jade b/services/web/app/views/project/list/project-list.jade index 2f853e9d97..05489defb9 100644 --- a/services/web/app/views/project/list/project-list.jade +++ b/services/web/app/views/project/list/project-list.jade @@ -122,13 +122,13 @@ select-all, type="checkbox" ) - span.header Title + span.header(ng-click="changePredicate('name')") Title .col-md-2 - span.header Owner + span.header(ng-click="changePredicate('accessLevel')") Owner .col-md-4 - span.header Last Modified + span.header(ng-click="changePredicate('lastUpdated')") Last Modified li.project_entry.container-fluid( - ng-repeat="project in visibleProjects | orderBy:'lastUpdated':true", + ng-repeat="project in visibleProjects | orderBy:predicate:reverse", ng-controller="ProjectListItemController" ) .row diff --git a/services/web/public/coffee/main/project-list.coffee b/services/web/public/coffee/main/project-list.coffee index 3b8a379226..8035bc9054 100644 --- a/services/web/public/coffee/main/project-list.coffee +++ b/services/web/public/coffee/main/project-list.coffee @@ -57,6 +57,8 @@ define [ $scope.allSelected = false $scope.selectedProjects = [] $scope.filter = "all" + $scope.predicate = "lastUpdated" + $scope.reverse = false $scope.windowHeight = $window.innerHeight angular.element($window).bind "resize", () -> @@ -75,8 +77,10 @@ define [ project.tags ||= [] project.tags.push tag - $scope.$watch "searchText", (value) -> - $scope.updateVisibleProjects() + $scope.changePredicate = (newPredicate)-> + if $scope.predicate == newPredicate + $scope.reverse = !$scope.reverse + $scope.predicate = newPredicate $scope.clearSearchText = () -> $scope.searchText = "" From 57b461e0ffc3ec3ef877e3cee7611f85c992a62c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 18 Jul 2014 10:43:32 +0100 Subject: [PATCH 5/5] added little icons to the table for when you want to sort --- .../web/app/views/project/list/project-list.jade | 15 +++++++++------ .../web/public/coffee/main/project-list.coffee | 8 ++++++++ .../web/public/stylesheets/app/project-list.less | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/list/project-list.jade b/services/web/app/views/project/list/project-list.jade index 05489defb9..05fa427b22 100644 --- a/services/web/app/views/project/list/project-list.jade +++ b/services/web/app/views/project/list/project-list.jade @@ -117,16 +117,19 @@ ) li.container-fluid .row - .col-md-6 + .col-md-6(ng-click="changePredicate('name')") input.select-all( select-all, type="checkbox" ) - span.header(ng-click="changePredicate('name')") Title - .col-md-2 - span.header(ng-click="changePredicate('accessLevel')") Owner - .col-md-4 - span.header(ng-click="changePredicate('lastUpdated')") Last Modified + span.header Title + i.tablesort.fa(ng-class="getSortIconClass('name')") + .col-md-2(ng-click="changePredicate('accessLevel')") + span.header Owner + i.tablesort.fa(ng-class="getSortIconClass('accessLevel')") + .col-md-4(ng-click="changePredicate('lastUpdated')") + span.header Last Modified + i.tablesort.fa(ng-class="getSortIconClass('lastUpdated')") li.project_entry.container-fluid( ng-repeat="project in visibleProjects | orderBy:predicate:reverse", ng-controller="ProjectListItemController" diff --git a/services/web/public/coffee/main/project-list.coffee b/services/web/public/coffee/main/project-list.coffee index 8035bc9054..d64f2bbcde 100644 --- a/services/web/public/coffee/main/project-list.coffee +++ b/services/web/public/coffee/main/project-list.coffee @@ -82,6 +82,14 @@ define [ $scope.reverse = !$scope.reverse $scope.predicate = newPredicate + $scope.getSortIconClass = (column)-> + if column == $scope.predicate and $scope.reverse + return "fa-sort-down" + else if column == $scope.predicate and !$scope.reverse + return "fa-sort-up" + else + return "fa-sort" + $scope.clearSearchText = () -> $scope.searchText = "" $scope.$emit "search:clear" diff --git a/services/web/public/stylesheets/app/project-list.less b/services/web/public/stylesheets/app/project-list.less index e6456f0c00..6d49493825 100644 --- a/services/web/public/stylesheets/app/project-list.less +++ b/services/web/public/stylesheets/app/project-list.less @@ -148,6 +148,9 @@ ul.project-list { color: white; } } + i.tablesort { + padding-left: 8px; + } } #institution_auto_complete {