Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yachtcaptain23 committed Jul 1, 2019
1 parent 92e4a7b commit 4713068
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions app/controllers/admin/publishers/referrals_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class Admin::Publishers::ReferralsController < Admin::PublishersController
def show
@publisher = Publisher.find(params[:id] || params[:publisher_id])
@navigation_view = Views::Admin::NavigationView.new(publisher).as_json.merge({ navbarSelection: "Referrals" }).to_json
@navigation_view = Views::Admin::NavigationView.new(@publisher).as_json.merge({ navbarSelection: "Referrals" }).to_json
end
end
4 changes: 3 additions & 1 deletion app/controllers/publishers/promo_registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class Publishers::PromoRegistrationsController < PublishersController
def for_referral_code
promo_registration = current_publisher.promo_registrations.find_by(referral_code: params[:referral_code])
promo_registration = current_publisher.admin? ?
PromoRegistration.find_by(referral_code: params[:referral_code]) :
current_publisher.promo_registrations.find_by(referral_code: params[:referral_code])
render :unauthorized and return if promo_registration.nil?
render json: promo_registration.stats_by_date.to_json
end
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/views/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default {
admin: {
promo_registrations: {
show: {
path: "/admin/promo_registrations/for_referral_code?referral_code={referral_code}&publisher_id={publisher_id}"
path: "/publishers/{publisher_id}/promo_registrations/for_referral_code?referral_code={referral_code}"
}
}
},
Expand Down
2 changes: 0 additions & 2 deletions app/views/admin/publishers/referrals/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

- if @publisher.promo_registrations.present?
= hidden_field_tag 'all-channels-referral-stats-starting-month', @publisher.promo_registrations.has_stats.order(created_at: :asc).first.created_at.strftime("%Y-%m-%d")
= hidden_field_tag 'referrals-hidden-tags', @publisher.promo_registrations.has_stats.pluck(:referral_code).to_json
= hidden_field_tag 'publisher_id', @publisher.id
.row
Expand Down
5 changes: 0 additions & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@
get :duplicates
end
end
resources :promo_registrations, only: [] do
collection do
get :for_referral_code
end
end
resources :faq_categories, except: [:show]
resources :faqs, except: [:show]
resources :payout_reports, only: %i(index show create) do
Expand Down

0 comments on commit 4713068

Please sign in to comment.