mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 12:38:25 +02:00
parent
1dcf7bcd62
commit
f269796382
4 changed files with 31 additions and 2 deletions
|
@ -6,7 +6,7 @@ module Concerns::Domain::Deletable
|
|||
end
|
||||
|
||||
def discard
|
||||
self.statuses << DomainStatus::DELETE_CANDIDATE
|
||||
statuses << DomainStatus::DELETE_CANDIDATE
|
||||
save
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,17 @@ class DomainPresenter
|
|||
@view = view
|
||||
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
|
||||
view.l(domain.expire_time)
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<% domain = DomainPresenter.new(domain: @domain, view: self) %>
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li><%= link_to t('admin.domains.index.header'), admin_domains_path %></li>
|
||||
</ol>
|
||||
|
@ -5,7 +7,7 @@
|
|||
<div class="page-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h1><%= @domain %></h1>
|
||||
<h1><%= domain.name_with_status %></h1>
|
||||
</div>
|
||||
|
||||
<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