mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Add badges to locked domains
This commit is contained in:
parent
7ce092dff2
commit
faeeb55bc7
8 changed files with 80 additions and 7 deletions
|
@ -0,0 +1,37 @@
|
|||
module Api
|
||||
module V1
|
||||
module Registrant
|
||||
class RegistryLocksController < BaseController
|
||||
before_action :set_domain
|
||||
|
||||
def create
|
||||
if @domain.apply_registry_lock
|
||||
render json: @domain
|
||||
else
|
||||
render json: { errors: [{ base: 'Domain cannot be locked' }] },
|
||||
status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if @domain.remove_registry_lock
|
||||
render json: @domain
|
||||
else
|
||||
render json: { errors: [{ base: 'Domain cannot be unlocked' }] },
|
||||
status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_domain
|
||||
@domain = Domain.find_by(uuid: params[:domain_uuid])
|
||||
|
||||
return if @domain
|
||||
render json: { errors: [{ base: ['Domain not found'] }] },
|
||||
status: :not_found and return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,6 +14,11 @@ class DomainPresenter
|
|||
html += " #{label}"
|
||||
end
|
||||
|
||||
if domain.locked_by_registrant?
|
||||
label = view.content_tag(:span, 'registryLock', class: 'label label-danger')
|
||||
html += " #{label}"
|
||||
end
|
||||
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<% domain = DomainPresenter.new(domain: @domain, view: self) %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-5">
|
||||
<div class="col-sm-8">
|
||||
<h1 class="text-center-xs">
|
||||
Edit: <%= domain.name %>
|
||||
Edit: <%= domain.name_with_status %>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-sm-7 text-right">
|
||||
<div class="col-sm-4 text-right">
|
||||
<div class="btn-group">
|
||||
<%= link_to t('.back_btn'), [:admin, @domain], class: 'btn btn-default' %>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="col-sm-4 text-right">
|
||||
<%= link_to t('.edit_btn'), edit_admin_domain_path(@domain), class: 'btn btn-primary' %>
|
||||
<%= link_to t('.history_btn'), admin_domain_domain_versions_path(@domain),
|
||||
class: 'btn btn-primary' %>
|
||||
class: 'btn btn-primary' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue