Custom filters spinner
parent
23d272503c
commit
fafb81e9c5
|
@ -449,7 +449,7 @@ module.directive("tgIssues", ["$log", "$tgLocation", IssuesDirective])
|
||||||
## Issues Filters Directive
|
## Issues Filters Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
|
IssuesFiltersDirective = ($log, $location, $rs, $confirm, $loading) ->
|
||||||
template = _.template("""
|
template = _.template("""
|
||||||
<% _.each(filters, function(f) { %>
|
<% _.each(filters, function(f) { %>
|
||||||
<% if (!f.selected) { %>
|
<% if (!f.selected) { %>
|
||||||
|
@ -468,7 +468,9 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
|
||||||
</a>
|
</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
<input class="hidden my-filter-name" type="text" placeholder="filter name" />
|
<span class="new">
|
||||||
|
<input class="hidden my-filter-name" type="text" placeholder="filter name" />
|
||||||
|
</span>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
templateSelected = _.template("""
|
templateSelected = _.template("""
|
||||||
|
@ -646,13 +648,17 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
|
||||||
$el.find('.my-filter-name').show()
|
$el.find('.my-filter-name').show()
|
||||||
$el.find('.my-filter-name').focus()
|
$el.find('.my-filter-name').focus()
|
||||||
|
|
||||||
$el.on "keyup", ".my-filter-name", (event) ->
|
$el.on "keyup", ".new .my-filter-name", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
if event.keyCode == 13
|
if event.keyCode == 13
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
newFilter = target.val()
|
newFilter = target.val()
|
||||||
$ctrl.saveCurrentFiltersTo(newFilter).then ->
|
$loading.start($el.find(".new"))
|
||||||
$ctrl.loadMyFilters().then (filters) ->
|
promise = $ctrl.saveCurrentFiltersTo(newFilter)
|
||||||
|
promise.then ->
|
||||||
|
loadPromise = $ctrl.loadMyFilters()
|
||||||
|
loadPromise.then (filters) ->
|
||||||
|
$loading.finish($el.find(".new"))
|
||||||
$scope.filters.myFilters = filters
|
$scope.filters.myFilters = filters
|
||||||
|
|
||||||
currentfilterstype = $el.find("h2 a.subfilter span.title").prop('data-type')
|
currentfilterstype = $el.find("h2 a.subfilter span.title").prop('data-type')
|
||||||
|
@ -661,6 +667,16 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
|
||||||
|
|
||||||
$el.find('.my-filter-name').hide()
|
$el.find('.my-filter-name').hide()
|
||||||
$el.find('.save-filters').show()
|
$el.find('.save-filters').show()
|
||||||
|
|
||||||
|
loadPromise.then null, ->
|
||||||
|
$loading.finish($el.find(".new"))
|
||||||
|
$confirm.notify("error", "Error loading custom filters")
|
||||||
|
|
||||||
|
promise.then null, ->
|
||||||
|
$loading.finish($el.find(".new"))
|
||||||
|
$el.find(".my-filter-name").val(newFilter).focus().select()
|
||||||
|
$confirm.notify("error", "Filter not saved")
|
||||||
|
|
||||||
else if event.keyCode == 27
|
else if event.keyCode == 27
|
||||||
$el.find('.my-filter-name').val('')
|
$el.find('.my-filter-name').val('')
|
||||||
$el.find('.my-filter-name').hide()
|
$el.find('.my-filter-name').hide()
|
||||||
|
@ -668,7 +684,7 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgIssuesFilters", ["$log", "$tgLocation", "$tgResources", "$tgConfirm",
|
module.directive("tgIssuesFilters", ["$log", "$tgLocation", "$tgResources", "$tgConfirm", "$tgLoading",
|
||||||
IssuesFiltersDirective])
|
IssuesFiltersDirective])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,30 @@
|
||||||
right: .7rem;
|
right: .7rem;
|
||||||
top: .7rem;
|
top: .7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.filters-inner {
|
.filters-inner {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@include transition (all .1s ease-in);
|
@include transition (all .1s ease-in);
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
background: $grayer;
|
||||||
|
border: 1px solid #b8b8b8;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
.icon-spinner {
|
||||||
|
float: none;
|
||||||
|
color: $whitish;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
@include animation (loading .5s linear);
|
||||||
|
@include animation (spin 1s linear infinite);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.filters-applied {
|
.filters-applied {
|
||||||
|
|
Loading…
Reference in New Issue