Mercurial > zeropaste
changeset 39:a930c717654c
Add Clear button to the form.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Thu, 04 Oct 2012 02:08:11 +0700 |
parents | 91d3749cbff8 |
children | a81fb558f954 |
files | app/assets/javascripts/application.js app/assets/javascripts/pastes.js app/views/pastes/_form.html.erb |
diffstat | 3 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/app/assets/javascripts/application.js Thu Oct 04 01:57:13 2012 +0700 +++ b/app/assets/javascripts/application.js Thu Oct 04 02:08:11 2012 +0700 @@ -10,4 +10,6 @@ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD // GO AFTER THE REQUIRES BELOW. // +//= require jquery +//= require jquery_ujs //= require_tree .
--- a/app/assets/javascripts/pastes.js Thu Oct 04 01:57:13 2012 +0700 +++ b/app/assets/javascripts/pastes.js Thu Oct 04 02:08:11 2012 +0700 @@ -1,2 +1,10 @@ // Place all the behaviors and hooks related to the matching controller here. // All this logic will automatically be available in application.js. + +$(document).ready(function() { + $('#reset_paste').click(function() { + $('#paste_paste').val(''); + $('#paste_paste').focus(); + return false; + }); +})
--- a/app/views/pastes/_form.html.erb Thu Oct 04 01:57:13 2012 +0700 +++ b/app/views/pastes/_form.html.erb Thu Oct 04 02:08:11 2012 +0700 @@ -16,5 +16,6 @@ </div> <div class="form-actions"> <%= f.submit :class => 'btn btn-primary' %> + <%= link_to 'Clear', root_path, :class => 'btn', :id => 'reset_paste' %> </div> <% end %>