Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Set flash from rails if one exists#2091

Merged
robguthrie merged 4 commits intomasterfrom
rails-to-angular-flash
Apr 8, 2015
Merged

Set flash from rails if one exists#2091
robguthrie merged 4 commits intomasterfrom
rails-to-angular-flash

Conversation

@gdpelican
Copy link
Contributor

No description provided.

@robguthrie
Copy link
Member

FYI: there will be notice, alert and maybe other cases.

@gdpelican
Copy link
Contributor Author

Kay, I went ahead and cleaned up the way we do flash messages, which was decently bad and is now pretty good.

Defines four levels:

FlashService.success
FlashService.info
FlashService.warning
FlashService.error

Which accepts a translation value and translation options (or just a simple string to display, in the case of symbols or things already translated on the server side)

I also switched it to a $broadcast / $on system, which is more reliable I think and more consistent with the way we do things in the rest of the app.

@gdpelican
Copy link
Contributor Author

🔦!

@display = => @flash and (@modal == @modalIsVisible())
@dismiss = => @flash = null

FlashService.success window.Loomio.flash.success if window.Loomio.flash.success?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this init block should be moved to app.coffee in the future? Anyway this whole thing looks great. Thanks @gdpelican.

robguthrie added a commit that referenced this pull request Apr 8, 2015
@robguthrie robguthrie merged commit 1aa0718 into master Apr 8, 2015
@robguthrie robguthrie deleted the rails-to-angular-flash branch April 8, 2015 20:10
@gdpelican
Copy link
Contributor Author

Yeah! I tried putting it there, but had that code run before the
$scope.$on 'flashMessage' event had been defined, so it didn't catch it.
Wonder if there's a better place, or a way to switch up the order in which
things get loaded?

On Thu, Apr 9, 2015 at 4:10 AM, Robert Guthrie [email protected]
wrote:

Merged #2091 #2091.


Reply to this email directly or view it on GitHub
#2091 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments