From 02ba0f21e65675aca79c9fef9eac382658c73d57 Mon Sep 17 00:00:00 2001 From: Zin Moe Date: Thu, 18 Jun 2020 18:02:02 +0630 Subject: [PATCH] modify expire page --- app/controllers/renew_license_controller.rb | 5 +- app/models/license.rb | 4 ++ app/views/renew_license/expire.html.erb | 51 ++++++++++++------- .../shared/_license_expire_warning.html.erb | 6 ++- config/routes.rb | 2 +- 5 files changed, 46 insertions(+), 22 deletions(-) diff --git a/app/controllers/renew_license_controller.rb b/app/controllers/renew_license_controller.rb index 7ef245fe..04b0b3bc 100644 --- a/app/controllers/renew_license_controller.rb +++ b/app/controllers/renew_license_controller.rb @@ -10,8 +10,7 @@ class RenewLicenseController < ApplicationController def renew status, message = current_license.verify_license - - redirect_to expire_url(message: message, status: status) + render json: {message: message, status: status} end -end \ No newline at end of file +end diff --git a/app/models/license.rb b/app/models/license.rb index edbe5947..a9f8d356 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -170,6 +170,10 @@ class License else delete_license_file + + stauts = 0 + message = "*** Your license has been expired. ***" + return status, message end rescue SocketError => e diff --git a/app/views/renew_license/expire.html.erb b/app/views/renew_license/expire.html.erb index d29c5923..62a9d925 100644 --- a/app/views/renew_license/expire.html.erb +++ b/app/views/renew_license/expire.html.erb @@ -2,10 +2,14 @@ <% date_count = (renewable_date.to_date - Date.today).to_i %> <% day = pluralize( date_count, 'day' )%> -<% if @license_status == 0 +<% if @license_status == 0 text = 'Your license has been expired.' elsif @license_status == 2 - text = "Your license will expire in #{day}." + if date_count == 0 + text = "Your license will expire in tomorrow." + else + text = "Your license will expire in #{day}." + end end %>