Mercurial > zeropaste
changeset 181:500c09718fd7
Added fresh paste marker.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Fri, 01 Feb 2013 22:58:53 +0700 |
parents | dd5a154c17c7 |
children | 0bda7690529c |
files | app/controllers/pastes_controller.rb app/helpers/pastes_helper.rb |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb Fri Feb 01 22:57:49 2013 +0700 +++ b/app/controllers/pastes_controller.rb Fri Feb 01 22:58:53 2013 +0700 @@ -52,6 +52,7 @@ begin respond_to do |format| if @paste.save + @fresh = true format.html { redirect_to @paste, :notice => 'Paste was successfully created.' } format.json { render :json => @paste, :status => :created, :location => @paste } else
--- a/app/helpers/pastes_helper.rb Fri Feb 01 22:57:49 2013 +0700 +++ b/app/helpers/pastes_helper.rb Fri Feb 01 22:58:53 2013 +0700 @@ -2,7 +2,11 @@ def print_txt_create_result unless @paste.errors.any? url = paste_path @paste, :only_path => false - "#{url} (key: #{@paste.key})" + if @fresh + "#{url} (key: #{@paste.key})" + else + url + end else 'Failed' end