Merge pull request #1202 from internetee/improve-registrar-area-account-view

Improve registrar area account view
This commit is contained in:
Timo Võhmar 2019-06-07 13:48:48 +03:00 committed by GitHub
commit 7b7a87348b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 137 additions and 56 deletions

View file

@ -0,0 +1,24 @@
class Registrar
class AccountController < BaseController
skip_authorization_check
def show; end
def edit
@registrar = current_registrar_user.registrar
end
def update
@registrar = current_registrar_user.registrar
@registrar.update!(registrar_params)
redirect_to registrar_account_path, notice: t('.saved')
end
private
def registrar_params
params.require(:registrar).permit(:billing_email)
end
end
end

View file

@ -1,17 +0,0 @@
class Registrar
class ProfileController < BaseController
skip_authorization_check
helper_method :linked_users
def show
@user = current_registrar_user
end
private
def linked_users
current_registrar_user.linked_users
end
end
end

View file

@ -182,7 +182,7 @@ class Registrar
if can?(:show, :poll)
registrar_root_path
else
registrar_profile_path
registrar_account_path
end
end

View file

@ -24,7 +24,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to can?(:show, :poll) ? registrar_root_path : registrar_profile_path,
<%= link_to can?(:show, :poll) ? registrar_root_path : registrar_account_path,
class: 'navbar-brand' do %>
<%= t(:registrar_head_title) %>
<% if unstable_env.present? %>

View file

@ -0,0 +1,16 @@
<div class="panel panel-default">
<div class="panel-heading">
<%= t '.header' %>
</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt><%= Registrar.human_attribute_name :billing_email %></dt>
<dd><%= registrar.billing_email %></dd>
</dl>
</div>
<div class="panel-footer text-right">
<%= link_to t('.edit_btn'), edit_registrar_account_path, class: 'btn btn-default btn-sm' %>
</div>
</div>

View file

@ -0,0 +1,21 @@
<%= form_for @registrar, url: registrar_account_path, method: :patch, html: { class: 'form-horizontal' } do |f| %>
<%= render 'form_errors', target: @registrar %>
<div class="form-group">
<div class="col-sm-2 control-label">
<%= f.label :billing_email %>
</div>
<div class="col-sm-4">
<%= f.email_field :billing_email, autofocus: true, class: 'form-control' %>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-6 text-right">
<%= f.submit t('.submit_btn'), class: 'btn btn-success' %>
</div>
</div>
<% end %>

View file

@ -0,0 +1,10 @@
<ol class="breadcrumb">
<li><%= link_to t('registrar.account.show.header'), registrar_account_path %></li>
<li><%= t '.header' %></li>
</ol>
<div class="page-header">
<h1><%= t '.header' %></h1>
</div>
<%= render 'form' %>

View file

@ -0,0 +1,15 @@
<div class="page-header">
<h1><%= t '.header' %></h1>
</div>
<div class="row">
<div class="col-sm-5">
<%= render 'details', registrar: current_registrar_user.registrar %>
</div>
</div>
<div class="row">
<div class="col-sm-5">
<%= render 'linked_users', linked_users: current_registrar_user.linked_users %>
</div>
</div>

View file

@ -1,5 +1,4 @@
<% current_user_presenter = UserPresenter.new(user: current_registrar_user, view: self) %>
<%= link_to current_user_presenter.login_with_role, registrar_profile_path, id: 'registrar-profile-btn',
class: 'navbar-link' %>
<%= link_to current_user_presenter.login_with_role, registrar_account_path, class: 'navbar-link' %>
<span class="text-muted">|</span>
<%= link_to t('.sign_out'), destroy_registrar_user_session_path, method: :delete, class: 'navbar-link' %>

View file

@ -1,9 +0,0 @@
<div class="page-header">
<h1><%= t '.header' %></h1>
</div>
<div class="row">
<div class="col-sm-4">
<%= render 'linked_users', linked_users: linked_users %>
</div>
</div>