From 568d89b6202c0ae1f377ff4290f6b7a5dc1cca7a Mon Sep 17 00:00:00 2001 From: rishabhptr Date: Tue, 26 Sep 2017 21:43:18 +0530 Subject: [PATCH] Changed physical_ticket to plural --- ...al_ticket_controller.rb => physical_tickets_controller.rb} | 2 +- app/controllers/payments_controller.rb | 2 +- ...al_ticket_controller.rb => physical_tickets_controller.rb} | 2 +- app/controllers/ticket_purchases_controller.rb | 2 +- .../{physical_ticket => physical_tickets}/index.html.haml | 0 app/views/admin/tickets/index.html.haml | 2 +- app/views/conferences/_conference_details.html.haml | 2 +- .../{physical_ticket => physical_tickets}/index.html.haml | 0 .../{physical_ticket => physical_tickets}/show.html.haml | 0 config/routes.rb | 4 ++-- spec/controllers/physical_ticket_controller_spec.rb | 2 +- spec/features/ticket_purchases_spec.rb | 2 +- 12 files changed, 10 insertions(+), 10 deletions(-) rename app/controllers/admin/{physical_ticket_controller.rb => physical_tickets_controller.rb} (88%) rename app/controllers/{physical_ticket_controller.rb => physical_tickets_controller.rb} (94%) rename app/views/admin/{physical_ticket => physical_tickets}/index.html.haml (100%) rename app/views/{physical_ticket => physical_tickets}/index.html.haml (100%) rename app/views/{physical_ticket => physical_tickets}/show.html.haml (100%) diff --git a/app/controllers/admin/physical_ticket_controller.rb b/app/controllers/admin/physical_tickets_controller.rb similarity index 88% rename from app/controllers/admin/physical_ticket_controller.rb rename to app/controllers/admin/physical_tickets_controller.rb index d43c5c33..0fb26ad8 100644 --- a/app/controllers/admin/physical_ticket_controller.rb +++ b/app/controllers/admin/physical_tickets_controller.rb @@ -1,5 +1,5 @@ module Admin - class PhysicalTicketController < Admin::BaseController + class PhysicalTicketsController < Admin::BaseController before_action :authenticate_user! load_resource :conference, find_by: :short_title load_and_authorize_resource diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index bee58f6c..8faebef7 100644 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -19,7 +19,7 @@ class PaymentsController < ApplicationController if @payment.purchase && @payment.save update_purchased_ticket_purchases - redirect_to conference_physical_ticket_index_path, + redirect_to conference_physical_tickets_path, notice: 'Thanks! Your ticket is booked successfully.' else @total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false) diff --git a/app/controllers/physical_ticket_controller.rb b/app/controllers/physical_tickets_controller.rb similarity index 94% rename from app/controllers/physical_ticket_controller.rb rename to app/controllers/physical_tickets_controller.rb index af02155c..2f6f18ec 100644 --- a/app/controllers/physical_ticket_controller.rb +++ b/app/controllers/physical_tickets_controller.rb @@ -1,4 +1,4 @@ -class PhysicalTicketController < ApplicationController +class PhysicalTicketsController < ApplicationController before_action :authenticate_user! load_resource :conference, find_by: :short_title load_and_authorize_resource find_by: :token diff --git a/app/controllers/ticket_purchases_controller.rb b/app/controllers/ticket_purchases_controller.rb index a53a3cf5..3eb8b68d 100644 --- a/app/controllers/ticket_purchases_controller.rb +++ b/app/controllers/ticket_purchases_controller.rb @@ -12,7 +12,7 @@ class TicketPurchasesController < ApplicationController redirect_to new_conference_payment_path, notice: 'Please pay here to get tickets.' elsif current_user.ticket_purchases.by_conference(@conference).paid.any? - redirect_to conference_physical_ticket_index_path, + redirect_to conference_physical_tickets_path, notice: 'You have free tickets for the conference.' else redirect_to conference_tickets_path(@conference.short_title), diff --git a/app/views/admin/physical_ticket/index.html.haml b/app/views/admin/physical_tickets/index.html.haml similarity index 100% rename from app/views/admin/physical_ticket/index.html.haml rename to app/views/admin/physical_tickets/index.html.haml diff --git a/app/views/admin/tickets/index.html.haml b/app/views/admin/tickets/index.html.haml index b8cdb505..42154ae7 100644 --- a/app/views/admin/tickets/index.html.haml +++ b/app/views/admin/tickets/index.html.haml @@ -40,4 +40,4 @@ .row .col-md-12 = link_to 'Add Ticket', new_admin_conference_ticket_path, class: 'btn btn-success pull-right' - = link_to 'Tickets Sold', admin_conference_physical_ticket_index_path, class: 'button btn btn-default btn-info pull-right' + = link_to 'Tickets Sold', admin_conference_physical_tickets_path, class: 'button btn btn-default btn-info pull-right' diff --git a/app/views/conferences/_conference_details.html.haml b/app/views/conferences/_conference_details.html.haml index ebf80ef6..84a87303 100644 --- a/app/views/conferences/_conference_details.html.haml +++ b/app/views/conferences/_conference_details.html.haml @@ -47,4 +47,4 @@ - else = link_to 'Unsubscribe', conference_subscriptions_path(conference.short_title), method: :delete, class: 'btn btn-default' - if current_user && current_user.physical_tickets.by_conference(conference).any? - = link_to "My Tickets", conference_physical_ticket_index_path(conference.short_title), class: 'btn btn-default' + = link_to "My Tickets", conference_physical_tickets_path(conference.short_title), class: 'btn btn-default' diff --git a/app/views/physical_ticket/index.html.haml b/app/views/physical_tickets/index.html.haml similarity index 100% rename from app/views/physical_ticket/index.html.haml rename to app/views/physical_tickets/index.html.haml diff --git a/app/views/physical_ticket/show.html.haml b/app/views/physical_tickets/show.html.haml similarity index 100% rename from app/views/physical_ticket/show.html.haml rename to app/views/physical_tickets/show.html.haml diff --git a/config/routes.rb b/config/routes.rb index 0d7e7aec..99f716e4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -122,7 +122,7 @@ Osem::Application.routes.draw do resources :targets, except: [:show] resources :campaigns, except: [:show] resources :emails, only: [:show, :update, :index] - resources :physical_ticket, only: [:index] + resources :physical_tickets, only: [:index] resources :roles, except: [:new, :create] do member do post :toggle_user @@ -184,7 +184,7 @@ Osem::Application.routes.draw do resources :tickets, only: [:index] resources :ticket_purchases, only: [:create, :destroy, :index] resources :payments, only: [:index, :new, :create] - resources :physical_ticket, only: [:index, :show] + resources :physical_tickets, only: [:index, :show] resource :subscriptions, only: [:create, :destroy] resource :schedule, only: [:show] do member do diff --git a/spec/controllers/physical_ticket_controller_spec.rb b/spec/controllers/physical_ticket_controller_spec.rb index 863e27af..476a1717 100644 --- a/spec/controllers/physical_ticket_controller_spec.rb +++ b/spec/controllers/physical_ticket_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe PhysicalTicketController do +describe PhysicalTicketsController do let(:conference) { create(:conference) } let(:user) { create(:user) } let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user) } diff --git a/spec/features/ticket_purchases_spec.rb b/spec/features/ticket_purchases_spec.rb index c76b84a6..9cace981 100644 --- a/spec/features/ticket_purchases_spec.rb +++ b/spec/features/ticket_purchases_spec.rb @@ -103,7 +103,7 @@ feature Registration do click_button 'Continue' - expect(current_path).to eq(conference_physical_ticket_index_path(conference.short_title)) + expect(current_path).to eq(conference_physical_tickets_path(conference.short_title)) purchase = TicketPurchase.where(user_id: participant.id, ticket_id: free_ticket.id).first expect(purchase.quantity).to eq(5) expect(purchase.paid).to be true