Minor fixes: clean code (II)
parent
5f68c09533
commit
f62e0e2897
|
@ -16,11 +16,10 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# File: modules/user-settings/main.coffee
|
# File: modules/user-settings/notifications.coffee
|
||||||
###
|
###
|
||||||
|
|
||||||
taiga = @.taiga
|
taiga = @.taiga
|
||||||
|
|
||||||
mixOf = @.taiga.mixOf
|
mixOf = @.taiga.mixOf
|
||||||
bindOnce = @.taiga.bindOnce
|
bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
|
@ -74,13 +73,13 @@ class UserNotificationsController extends mixOf(taiga.Controller, taiga.PageMixi
|
||||||
|
|
||||||
module.controller("UserNotificationsController", UserNotificationsController)
|
module.controller("UserNotificationsController", UserNotificationsController)
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## User Notifications Directive
|
## User Notifications Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
UserNotificationsDirective = () ->
|
UserNotificationsDirective = () ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
|
@ -88,6 +87,7 @@ UserNotificationsDirective = () ->
|
||||||
|
|
||||||
module.directive("tgUserNotifications", UserNotificationsDirective)
|
module.directive("tgUserNotifications", UserNotificationsDirective)
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## User Notifications List Directive
|
## User Notifications List Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -124,11 +124,12 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
</div>
|
</div>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
""")
|
""")
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
render = ->
|
render = ->
|
||||||
$el.off()
|
$el.off()
|
||||||
$el.html(template({notifyPolicies: $scope.notifyPolicies}))
|
$el.html(template({notifyPolicies: $scope.notifyPolicies}))
|
||||||
|
|
||||||
$el.on "change", "input[type=radio]", (event) ->
|
$el.on "change", "input[type=radio]", (event) ->
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
policyIndex = target.parents(".policy-table-row").data('index')
|
policyIndex = target.parents(".policy-table-row").data('index')
|
||||||
|
@ -145,7 +146,6 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
|
|
||||||
bindOnce($scope, $attrs.ngModel, render)
|
bindOnce($scope, $attrs.ngModel, render)
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
Loading…
Reference in New Issue