Mercurial > zeropaste
changeset 385:62fef621f39c
Move alerts to layout.
author | nanaya <me@myconan.net> |
---|---|
date | Sun, 07 Jun 2015 10:13:25 +0900 |
parents | 7ba798dee39d |
children | bf9e350f8a2b |
files | app/views/layouts/_alerts.html.erb app/views/layouts/application.html.erb app/views/pastes/new.html.erb |
diffstat | 3 files changed, 6 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/app/views/layouts/_alerts.html.erb Sun Jun 07 02:59:29 2015 +0900 +++ b/app/views/layouts/_alerts.html.erb Sun Jun 07 10:13:25 2015 +0900 @@ -1,13 +1,13 @@ -<% if params[:notice] %> +<% if notice %> <div class="alert alert-info"> <strong>Info:</strong> - <%= params[:notice] %> + <%= notice %> </div> <% end %> -<% if @paste && @paste.errors.any? %> +<% if alert %> <div class="alert alert-danger"> <strong>Error:</strong> - <%= @paste.errors.full_messages.to_sentence %> + <%= alert %> </div> <% end %>
--- a/app/views/layouts/application.html.erb Sun Jun 07 02:59:29 2015 +0900 +++ b/app/views/layouts/application.html.erb Sun Jun 07 10:13:25 2015 +0900 @@ -17,6 +17,8 @@ </header> <main> + <%= render "layouts/alerts" %> + <%= yield %> </main>
--- a/app/views/pastes/new.html.erb Sun Jun 07 02:59:29 2015 +0900 +++ b/app/views/pastes/new.html.erb Sun Jun 07 10:13:25 2015 +0900 @@ -1,17 +1,3 @@ <% provide :title, 'New Paste' %> -<% if notice %> - <div class="alert alert-info"> - <strong>Info:</strong> - <%= notice %> - </div> -<% end %> - -<% if alert %> - <div class="alert alert-danger"> - <strong>Error:</strong> - <%= alert %> - </div> -<% end %> - <%= render 'form' %>