mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Merge pull request #1202 from internetee/improve-registrar-area-account-view
Improve registrar area account view
This commit is contained in:
commit
7b7a87348b
18 changed files with 137 additions and 56 deletions
24
app/controllers/registrar/account_controller.rb
Normal file
24
app/controllers/registrar/account_controller.rb
Normal 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
|
|
@ -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
|
|
@ -182,7 +182,7 @@ class Registrar
|
|||
if can?(:show, :poll)
|
||||
registrar_root_path
|
||||
else
|
||||
registrar_profile_path
|
||||
registrar_account_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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? %>
|
||||
|
|
16
app/views/registrar/account/_details.html.erb
Normal file
16
app/views/registrar/account/_details.html.erb
Normal 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>
|
21
app/views/registrar/account/_form.html.erb
Normal file
21
app/views/registrar/account/_form.html.erb
Normal 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 %>
|
10
app/views/registrar/account/edit.html.erb
Normal file
10
app/views/registrar/account/edit.html.erb
Normal 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' %>
|
15
app/views/registrar/account/show.html.erb
Normal file
15
app/views/registrar/account/show.html.erb
Normal 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>
|
|
@ -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' %>
|
||||
|
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue