Revert "Reworking flash messages hooray"

This reverts commit c9d0091cd9.
This commit is contained in:
Rohan Mitchell
2014-06-06 16:59:47 +10:00
parent c9d0091cd9
commit be644bdcc3
14 changed files with 26 additions and 36 deletions

View File

@@ -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()

View File

@@ -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

View File

@@ -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 @

View File

@@ -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: ->

View File

@@ -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

View File

@@ -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