# HG changeset patch # User Edho Arief # Date 1361597494 -32400 # Node ID d4682cea8e589e44aa1654f2590105a6f5bbf73e # Parent b4b7a29b70f617bfff143e9d3f2af8189cb68697 Fun with alerts. diff -r b4b7a29b70f6 -r d4682cea8e58 app/assets/stylesheets/alert.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/assets/stylesheets/alert.css Sat Feb 23 14:31:34 2013 +0900 @@ -0,0 +1,5 @@ +.alert { + border-radius: 0 0 4px 4px; + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; +} diff -r b4b7a29b70f6 -r d4682cea8e58 app/controllers/pastes_controller.rb --- a/app/controllers/pastes_controller.rb Sat Feb 23 14:01:22 2013 +0900 +++ b/app/controllers/pastes_controller.rb Sat Feb 23 14:31:34 2013 +0900 @@ -82,6 +82,7 @@ flash[:notice] = "Paste ##{params[:id]} deleted" redirect_to root_path else + flash[:error] = 'Incorrect deletion key' render :action => :show end end diff -r b4b7a29b70f6 -r d4682cea8e58 app/views/pastes/new.html.erb --- a/app/views/pastes/new.html.erb Sat Feb 23 14:01:22 2013 +0900 +++ b/app/views/pastes/new.html.erb Sat Feb 23 14:31:34 2013 +0900 @@ -1,4 +1,11 @@ <% provide :title, 'New Paste' %> + +<% if flash[:notice] %> +
+ <%= flash[:notice] %> +
+<% end %> + diff -r b4b7a29b70f6 -r d4682cea8e58 app/views/pastes/show.html.erb --- a/app/views/pastes/show.html.erb Sat Feb 23 14:01:22 2013 +0900 +++ b/app/views/pastes/show.html.erb Sat Feb 23 14:31:34 2013 +0900 @@ -1,4 +1,11 @@ <% provide :title, "Paste ##{@paste.id}" %> + +<% if flash[:error] %> +
+ <%= flash[:error] %> +
+<% end %> + @@ -38,7 +45,7 @@
<%= form_for @paste, :method => :delete do |f| %> - <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key' %> + <%= f.text_field :key, :value => nil, :placeholder => 'Deletion key', :autofocus => !flash[:error].blank? %> <%= f.submit 'Delete this paste', :class => 'btn btn-danger' %> <% end %>
diff -r b4b7a29b70f6 -r d4682cea8e58 config/initializers/session_store.rb --- a/config/initializers/session_store.rb Sat Feb 23 14:01:22 2013 +0900 +++ b/config/initializers/session_store.rb Sat Feb 23 14:31:34 2013 +0900 @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -Zeropaste::Application.config.session_store :disabled +Zeropaste::Application.config.session_store ActionDispatch::Session::CacheStore # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information