mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-14 23:47:48 +00:00
Revert "Reworking flash messages hooray"
This reverts commit c9d0091cd9.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
Darkswarm.directive "ofnFlash", (flash, $timeout, RailsFlashLoader)->
|
||||
# Mappings between flash types (left) and Foundation classes
|
||||
Darkswarm.directive "ofnFlash", (flash, $timeout)->
|
||||
typePairings =
|
||||
info: "info"
|
||||
info: "standard"
|
||||
error: "alert"
|
||||
success: "success"
|
||||
scope: {}
|
||||
restrict: 'E'
|
||||
restrict: 'AE'
|
||||
templateUrl: "flash.html"
|
||||
controller: ($scope)->
|
||||
$scope.closeAlert = (index)->
|
||||
@@ -22,4 +21,3 @@ Darkswarm.directive "ofnFlash", (flash, $timeout, RailsFlashLoader)->
|
||||
$scope.flashes.shift()
|
||||
|
||||
flash.subscribe(show)
|
||||
RailsFlashLoader.initFlash()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Darkswarm.factory 'Flash', (flash)->
|
||||
new class Flash
|
||||
loadFlash: (rails_flash)->
|
||||
for type, message of rails_flash
|
||||
switch type
|
||||
when "notice"
|
||||
flash.info = message
|
||||
else
|
||||
flash[type] = message
|
||||
@@ -6,7 +6,11 @@ Darkswarm.factory "OfnMap", (enterprisesForMap, MapModal)->
|
||||
# Adding methods to each enterprise
|
||||
extend: (enterprise)->
|
||||
new class MapMarker
|
||||
icon: "/test.opng"
|
||||
constructor: ->
|
||||
@[k] = v for k, v of enterprise
|
||||
|
||||
reveal: =>
|
||||
|
||||
console.log @
|
||||
MapModal.open @
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Darkswarm.factory 'Order', ($resource, order, $http, Navigation, storage, CurrentHub, RailsFlashLoader)->
|
||||
Darkswarm.factory 'Order', ($resource, order, $http, flash, Navigation, storage, CurrentHub)->
|
||||
new class Order
|
||||
errors: {}
|
||||
secrets: {}
|
||||
@@ -24,8 +24,8 @@ Darkswarm.factory 'Order', ($resource, order, $http, Navigation, storage, Curren
|
||||
Navigation.go data.path
|
||||
.error (response, status)=>
|
||||
@errors = response.errors
|
||||
RailsFlashLoader.loadFlash(response.flash)
|
||||
|
||||
flash.error = response.flash?.error
|
||||
flash.success = response.flash?.notice
|
||||
|
||||
# Rails wants our Spree::Address data to be provided with _attributes
|
||||
preprocess: ->
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
Darkswarm.factory 'RailsFlashLoader', (flash, railsFlash)->
|
||||
new class RailsFlashLoader
|
||||
initFlash: ->
|
||||
@loadFlash railsFlash
|
||||
loadFlash: (rails_flash)->
|
||||
for type, message of rails_flash
|
||||
flash[type] = message
|
||||
@@ -2,8 +2,7 @@
|
||||
.small-12.columns.producer-hero
|
||||
%h3.producer-name
|
||||
%i.ofn-i_036-producers
|
||||
{{ enterprise.name }}
|
||||
{{ enterprise.id }}
|
||||
{{ producer.name }}
|
||||
%img.producer-hero-img{"ng-src" => "{{enterprise.promo_image}}"}
|
||||
|
||||
.row
|
||||
|
||||
Reference in New Issue
Block a user