fix MR comments

This commit is contained in:
Bilal
2020-09-09 15:00:26 +03:00
parent 545d12f427
commit 057bdfe882
3 changed files with 8 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
class AccountLocksController < ApplicationController class Admin::AccountLocksController < Admin::ApplicationController
before_action :set_account before_action :set_account
def create def create
@@ -16,8 +16,8 @@ class AccountLocksController < ApplicationController
private private
def set_account def set_account
if params[:id].present? if params[:account_id].present?
@account = Account.find(params[:id]) @account = Account.find_by(slug: params[:account_id])
else else
failure_redirect failure_redirect
end end

View File

@@ -31,9 +31,9 @@
<%= link_to fa_icon("pencil", text: "Edit"), edit_admin_account_path(account), class: "dropdown-item" %> <%= link_to fa_icon("pencil", text: "Edit"), edit_admin_account_path(account), class: "dropdown-item" %>
<%= link_to fa_icon("arrow-right", text: "Account Managers"), account_auths_path({ account_id: account.id}), class: "dropdown-item" %> <%= link_to fa_icon("arrow-right", text: "Account Managers"), account_auths_path({ account_id: account.id}), class: "dropdown-item" %>
<% if account.locked? %> <% if account.locked? %>
<%= link_to fa_icon("unlock", text: "Unlock Account"), [:account, :lock, id: account.id], method: :delete, class: "dropdown-item" %> <%= link_to fa_icon("unlock", text: "Unlock Account"), [:admin, account, :lock], method: :delete, class: "dropdown-item" %>
<% else %> <% else %>
<%= link_to fa_icon("lock", text: "Lock Account"), [:account, :lock, id: account.id], method: :post, class: "dropdown-item" %> <%= link_to fa_icon("lock", text: "Lock Account"), [:admin, account, :lock], method: :post, class: "dropdown-item" %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@@ -30,7 +30,9 @@ Rails.application.routes.draw do
namespace :admin do namespace :admin do
mount Sidekiq::Web => '/background_queue', as: :background_queue mount Sidekiq::Web => '/background_queue', as: :background_queue
resources :accounts, only: [:index, :new, :create, :edit, :update, :show] resources :accounts, only: [:index, :new, :create, :edit, :update, :show] do
resource :account_lock, path: :lock, as: :lock, only: [:create, :destroy]
end
resources :users, only: [:index, :new, :create, :edit, :update, :destroy] do resources :users, only: [:index, :new, :create, :edit, :update, :destroy] do
resource :masquerade, only: :create resource :masquerade, only: :create
end end
@@ -49,7 +51,6 @@ Rails.application.routes.draw do
resource :account_session, only: [:update] resource :account_session, only: [:update]
resource :session, only: [:destroy] resource :session, only: [:destroy]
resource :account, only: [:new, :create, :update] do resource :account, only: [:new, :create, :update] do
resource :account_locks, path: :lock, as: :lock, only: [:create, :destroy]
get 'locked' => 'locked_accounts#index' get 'locked' => 'locked_accounts#index'
end end
resources :account_auths, only: [:index, :create, :update, :destroy] resources :account_auths, only: [:index, :create, :update, :destroy]