1
0
Fork 0

Add Users::RegistrationPolicy#update?

This commit is contained in:
Alex Kotov 2019-02-02 04:55:44 +05:00
parent d91def8c34
commit f7e1c85791
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class Users::RegistrationPolicy < ApplicationPolicy
def update?
!account&.user.nil?
end
end

View File

@ -6,10 +6,12 @@
"#{:active if tab == :profile}" %>
<% end %>
<%= link_to translate(:credentials, scope: %i[nav_tabs settings]),
edit_user_registration_path,
class: 'list-group-item list-group-item-action ' \
"#{:active if tab == :credentials}" %>
<% if policy(%i[users registration]).edit? %>
<%= link_to translate(:credentials, scope: %i[nav_tabs settings]),
edit_user_registration_path,
class: 'list-group-item list-group-item-action ' \
"#{:active if tab == :credentials}" %>
<% end %>
<% if policy(%i[settings account_telegram_contact]).index? %>
<%= link_to translate(:telegram_contacts, scope: %i[nav_tabs settings]),

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Users::RegistrationPolicy do
pending "add some examples to (or delete) #{__FILE__}"
end