mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Let registrar users change registrar account
This commit is contained in:
parent
207c2a704c
commit
37249a24f7
8 changed files with 104 additions and 9 deletions
|
@ -2,16 +2,23 @@ class Registrar
|
|||
class AccountController < BaseController
|
||||
skip_authorization_check
|
||||
|
||||
helper_method :linked_users
|
||||
def show; end
|
||||
|
||||
def show
|
||||
@user = current_registrar_user
|
||||
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 linked_users
|
||||
current_registrar_user.linked_users
|
||||
def registrar_params
|
||||
params.require(:registrar).permit(:billing_email)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
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' %>
|
|
@ -3,7 +3,13 @@
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<%= render 'linked_users', linked_users: linked_users %>
|
||||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue