mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Save and read filtering options from local storage.
This commit is contained in:
parent
3bdd5a4a2e
commit
884a89893d
1 changed files with 15 additions and 3 deletions
|
@ -2,7 +2,7 @@ define [
|
|||
"base"
|
||||
], (App) ->
|
||||
|
||||
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp, event_tracking, $timeout) ->
|
||||
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp, event_tracking, $timeout, localStorage) ->
|
||||
$scope.projects = window.data.projects
|
||||
$scope.tags = window.data.tags
|
||||
$scope.notifications = window.data.notifications
|
||||
|
@ -18,6 +18,8 @@ define [
|
|||
recalculateProjectListHeight()
|
||||
, 10
|
||||
|
||||
storedUIOpts = JSON.parse(localStorage("project_list"))
|
||||
|
||||
recalculateProjectListHeight = () ->
|
||||
topOffset = $(".project-list-card")?.offset()?.top
|
||||
bottomOffset = $("footer").outerHeight() + 25
|
||||
|
@ -52,6 +54,13 @@ define [
|
|||
project.tags ||= []
|
||||
project.tags.push tag
|
||||
|
||||
markTagAsSelected = (id) ->
|
||||
for tag in $scope.tags
|
||||
if tag._id == id
|
||||
tag.selected = true
|
||||
else
|
||||
tag.selected = false
|
||||
|
||||
$scope.changePredicate = (newPredicate)->
|
||||
if $scope.predicate == newPredicate
|
||||
$scope.reverse = !$scope.reverse
|
||||
|
@ -126,6 +135,11 @@ define [
|
|||
else
|
||||
# We don't want hidden selections
|
||||
project.selected = false
|
||||
|
||||
localStorage("project_list", JSON.stringify({
|
||||
filter: $scope.filter,
|
||||
selectedTagId: selectedTag?._id
|
||||
}))
|
||||
$scope.updateSelectedProjects()
|
||||
|
||||
$scope.getSelectedTag = () ->
|
||||
|
@ -424,8 +438,6 @@ define [
|
|||
path = "/project/#{selected_project_ids[0]}/download/zip"
|
||||
|
||||
window.location = path
|
||||
|
||||
$scope.updateVisibleProjects()
|
||||
|
||||
App.controller "ProjectListItemController", ($scope) ->
|
||||
$scope.ownerName = () ->
|
||||
|
|
Loading…
Reference in a new issue