mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 20:48:22 +02:00
parent
1dcf7bcd62
commit
f269796382
4 changed files with 31 additions and 2 deletions
|
@ -6,7 +6,7 @@ module Concerns::Domain::Deletable
|
||||||
end
|
end
|
||||||
|
|
||||||
def discard
|
def discard
|
||||||
self.statuses << DomainStatus::DELETE_CANDIDATE
|
statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,17 @@ class DomainPresenter
|
||||||
@view = view
|
@view = view
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name_with_status
|
||||||
|
html = domain.name
|
||||||
|
|
||||||
|
if domain.discarded?
|
||||||
|
label = view.content_tag(:span, 'deleteCandidate', class: 'label label-warning')
|
||||||
|
html += " #{label}"
|
||||||
|
end
|
||||||
|
|
||||||
|
html.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
def expire_time
|
def expire_time
|
||||||
view.l(domain.expire_time)
|
view.l(domain.expire_time)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
<% domain = DomainPresenter.new(domain: @domain, view: self) %>
|
||||||
|
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li><%= link_to t('admin.domains.index.header'), admin_domains_path %></li>
|
<li><%= link_to t('admin.domains.index.header'), admin_domains_path %></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -5,7 +7,7 @@
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<h1><%= @domain %></h1>
|
<h1><%= domain.name_with_status %></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4 text-right">
|
<div class="col-sm-4 text-right">
|
||||||
|
|
16
test/integration/admin/domains/details_test.rb
Normal file
16
test/integration/admin/domains/details_test.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class AdminAreaDomainDetailsTest < ActionDispatch::IntegrationTest
|
||||||
|
def setup
|
||||||
|
login_as users(:admin)
|
||||||
|
@domain = domains(:shop)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_discarded_domain_has_corresponding_label
|
||||||
|
visit admin_domain_url(@domain)
|
||||||
|
assert_no_css 'span.label.label-warning', text: 'deleteCandidate'
|
||||||
|
@domain.discard
|
||||||
|
visit admin_domain_url(@domain)
|
||||||
|
assert_css 'span.label.label-warning', text: 'deleteCandidate'
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue