mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
added registrar credit changing functionality
This commit is contained in:
parent
4982aba97c
commit
2ff049707d
18 changed files with 271 additions and 2 deletions
7
app/views/admin/accounts/_account.html.erb
Normal file
7
app/views/admin/accounts/_account.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<tr>
|
||||
<td><%= account.id %></td>
|
||||
<td><%= account.balance %></td>
|
||||
<td><%= account.currency %></td>
|
||||
<td><%= link_to account.registrar, admin_registrar_path(account.registrar) %></td>
|
||||
<td><%= link_to(t(:edit_balance), edit_admin_account_path(account), class: 'btn btn-primary btn-xs') %></td>
|
||||
</tr>
|
52
app/views/admin/accounts/_form.html.erb
Normal file
52
app/views/admin/accounts/_form.html.erb
Normal file
|
@ -0,0 +1,52 @@
|
|||
<%= form_for([:admin, @account], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f| %>
|
||||
<%= render 'form_errors', target: @account %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :id, nil, class: 'required' %>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<%= f.text_field :id, required: true, autofocus: true,
|
||||
class: 'form-control', disabled: true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :currency, nil, class: 'required' %>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<%= f.text_field :currency, required: true, class: 'form-control', disabled: true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :balance %>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<%= f.text_field(:balance, class: 'form-control') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-4 control-label">
|
||||
<%= f.label :description %>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<%= text_area_tag :description, params[:description], class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 text-right">
|
||||
<%= button_tag t('.save_btn'), class: 'btn btn-warning' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
34
app/views/admin/accounts/_search_form.haml
Normal file
34
app/views/admin/accounts/_search_form.haml
Normal file
|
@ -0,0 +1,34 @@
|
|||
.row
|
||||
.col-md-12
|
||||
= search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
|
||||
.row
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag :name
|
||||
= f.search_field :name, value: params[:q][:name], class: 'form-control', placeholder: t(:name)
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag :registrant
|
||||
= f.search_field :registrant, value: params[:q][:registrant], class: 'form-control', placeholder: t('.registrant_placeholder')
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:registrar_name)
|
||||
= select_tag '[q][registrar]', options_for_select(Registrar.all.map { |x| [x, x.name] }, selected: params[:q][:registrar]), { include_blank: true, class: 'form-control', placeholder: t('.registrant')}
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag :action
|
||||
= select_tag '[q][event]', options_for_select([['Update', 'update'], ['Destroy', 'destroy'], ['Create', 'create']], params[:q][:event]), { include_blank:true, multiple: false, placeholder: t(:choose), class: 'form-control js-combobox' }
|
||||
.row
|
||||
.col-md-3
|
||||
.col-md-3
|
||||
.col-md-3
|
||||
.form-group
|
||||
= label_tag t(:results_per_page)
|
||||
= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
|
||||
.col-md-3{style: 'padding-top: 25px;'}
|
||||
%button.btn.btn-primary
|
||||
|
||||
%span.glyphicon.glyphicon-search
|
||||
|
||||
= link_to(t('.reset_btn'), admin_domain_versions_path, class: 'btn btn-default')
|
||||
%hr
|
32
app/views/admin/accounts/_search_form.html.erb
Normal file
32
app/views/admin/accounts/_search_form.html.erb
Normal file
|
@ -0,0 +1,32 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= search_form_for @q, url: [:admin, :accounts], html: { style: 'margin-bottom: 0;' } do |f| %>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label t(:registrar_name) %>
|
||||
<%= f.select :registrar_id_in, Registrar.all.map { |x| [x, x.id] }, {}, class: 'form-control js-combobox', placeholder: t(:choose), multiple: true %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= label_tag t(:results_per_page) %>
|
||||
<%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 text-right" style="padding-top: 25px;">
|
||||
<button class="btn btn-default search">
|
||||
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
|
||||
</button>
|
||||
<%= button_tag t('.download_csv_btn'),
|
||||
formaction: admin_accounts_path(format: 'csv'),
|
||||
class: 'btn btn-default' %>
|
||||
<%= link_to(t('.reset_btn'), admin_accounts_path, class: 'btn btn-default') %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
5
app/views/admin/accounts/edit.html.erb
Normal file
5
app/views/admin/accounts/edit.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<h1>Editing Account</h1>
|
||||
|
||||
<%= render 'form', account: @account %>
|
||||
|
||||
<%= link_to 'Back', admin_accounts_path %>
|
38
app/views/admin/accounts/index.html.erb
Normal file
38
app/views/admin/accounts/index.html.erb
Normal file
|
@ -0,0 +1,38 @@
|
|||
<h1><%= t '.header' %></h1>
|
||||
<%= render 'search_form', search: @search %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-xs-2"><%= sort_link(@q, 'ID', t('.')) %></th>
|
||||
<th class="col-xs-2"><%= sort_link(@q, 'Balance') %></th>
|
||||
<th class="col-xs-2"><%= sort_link(@q, 'Currency') %></th>
|
||||
<th class="col-xs-2"><%= sort_link(@q, 'registrar_name', Registrar.model_name.human) %></th>
|
||||
<th class="col-xs-2">
|
||||
<%= t(:actions) %>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<%= render @accounts %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<%= paginate @accounts %>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<div class="pagination">
|
||||
<%= t(:result_count, count: @q.result.count) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
5
app/views/admin/accounts/new.html.erb
Normal file
5
app/views/admin/accounts/new.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<h1>New Admin Account</h1>
|
||||
|
||||
<%= render 'form', admin_account: @admin_account %>
|
||||
|
||||
<%= link_to 'Back', admin_accounts_path %>
|
4
app/views/admin/accounts/show.html.erb
Normal file
4
app/views/admin/accounts/show.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= link_to 'Edit', edit_admin_account_path(@account) %> |
|
||||
<%= link_to 'Back', admin_accounts_path %>
|
Loading…
Add table
Add a link
Reference in a new issue