mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Make InfoDialog more flexible (can show information as well as errors)
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
angular.module("admin.utils").factory 'InfoDialog', ($rootScope, $compile, $injector, $templateCache, DialogDefaults) ->
|
||||
angular.module("admin.utils").factory 'InfoDialog', ($rootScope, $q, $compile, $templateCache, DialogDefaults) ->
|
||||
new class InfoDialog
|
||||
icon_classes: {
|
||||
error: 'icon-exclamation-sign'
|
||||
info: 'icon-info-sign'
|
||||
}
|
||||
|
||||
open: (type, message, templateUrl='admin/info_dialog.html', options={}) ->
|
||||
deferred = $q.defer()
|
||||
scope = $rootScope.$new()
|
||||
scope.message = message
|
||||
scope.dialog_class = type
|
||||
scope.icon_class = @icon_classes[type]
|
||||
scope.options = options
|
||||
template = $compile($templateCache.get(templateUrl))(scope)
|
||||
template.dialog(DialogDefaults)
|
||||
template.dialog('open')
|
||||
scope.close = ->
|
||||
deferred.resolve()
|
||||
template.dialog('close')
|
||||
null
|
||||
deferred.promise
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#info-dialog{ ng: { class: "dialog_class" } }
|
||||
.message.clearfix.margin-bottom-30
|
||||
.icon.text-center
|
||||
%i.icon-exclamation-sign
|
||||
%i{ ng: { class: "icon_class" } }
|
||||
.text
|
||||
{{ message }}
|
||||
.action-buttons.text-center
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
.icon {
|
||||
width: 20%;
|
||||
font-size: 2rem;
|
||||
font-size: 4rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.info {
|
||||
.message {
|
||||
.icon {
|
||||
color: #5498da;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user