Keyrelays index

This commit is contained in:
Martin Lensment 2014-12-22 16:53:30 +02:00
parent f8ef86dcd5
commit 71df97f553
8 changed files with 58 additions and 4 deletions

View file

@ -1,5 +1,10 @@
class Admin::KeyrelaysController < AdminController class Admin::KeyrelaysController < AdminController
load_and_authorize_resource load_and_authorize_resource
def index
@q = Keyrelay.includes(:requester, :accepter).search(params[:q])
@keyrelays = @q.result.page(params[:page])
end
def show; end def show; end
end end

View file

@ -10,7 +10,7 @@ class ApplicationController < ActionController::Base
end end
def after_sign_in_path_for(_resource) def after_sign_in_path_for(_resource)
return session[:user_return_to].to_s if session[:user_return_to] return session[:user_return_to].to_s if session[:user_return_to] && session[:user_return_to] != login_path
admin_root_path admin_root_path
end end
end end

View file

@ -12,8 +12,6 @@ module Epp::KeyrelayHelper
render '/epp/shared/success' render '/epp/shared/success'
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
private private
@ -46,6 +44,9 @@ module Epp::KeyrelayHelper
epp_errors.empty? epp_errors.empty?
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def find_domain_for_keyrelay def find_domain_for_keyrelay
domain_name = parsed_frame.css('name').text.strip.downcase domain_name = parsed_frame.css('name').text.strip.downcase
domain = Epp::EppDomain.find_by(name: domain_name) domain = Epp::EppDomain.find_by(name: domain_name)

View file

@ -19,7 +19,7 @@ class Keyrelay < ActiveRecord::Base
end end
def expiry def expiry
if expiry_relative if expiry_relative.present?
pa_date + ISO8601::Duration.new(expiry_relative).to_seconds pa_date + ISO8601::Duration.new(expiry_relative).to_seconds
elsif expiry_absolute elsif expiry_absolute
expiry_absolute expiry_absolute

View file

@ -0,0 +1,44 @@
.row
.col-sm-12
%h2.text-center-xs= t('keyrelays')
%hr
.row
.col-md-12
= search_form_for [:admin, @q], html: { class: 'form-horizontal' } do |f|
.col-md-11
.form-group
= f.search_field :domain_name_cont, class: 'form-control', placeholder: t('domain_name')
.col-md-1.text-right.text-center-xs
.form-group
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-4'}
= sort_link(@q, 'pa_date', t('uploaded_at'))
%th{class: 'col-xs-3'}
= t('expiry')
%th{class: 'col-xs-2'}
= sort_link(@q, 'requester_name', t('requester'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'accepter_name', t('accepter'))
%th{class: 'col-xs-1'}
= t('status')
%tbody
- @keyrelays.each do |x|
%tr
%td= link_to(x.pa_date, [:admin, x])
%td= x.expiry
%td= link_to(x.requester, [:admin, x.requester])
%td= link_to(x.accepter, [:admin, x.accepter])
%td= x.status
.row
.col-md-12
= paginate @keyrelays

View file

@ -26,6 +26,7 @@
%li= link_to t('domains'), admin_domains_path %li= link_to t('domains'), admin_domains_path
%li= link_to t('contacts'), admin_contacts_path %li= link_to t('contacts'), admin_contacts_path
%li= link_to t('registrars'), admin_registrars_path %li= link_to t('registrars'), admin_registrars_path
%li= link_to t('keyrelays'), admin_keyrelays_path
- if can?(:access, :settings_menu) - if can?(:access, :settings_menu)
%li.dropdown %li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}

View file

@ -455,3 +455,4 @@ en:
accepter: 'Accepter' accepter: 'Accepter'
keyrelay_details: 'Keyrelay details' keyrelay_details: 'Keyrelay details'
unknown_expiry_absolute_pattern: 'Expiry absolute must be compatible to ISO 8601' unknown_expiry_absolute_pattern: 'Expiry absolute must be compatible to ISO 8601'
domain_name: 'Domain name'

View file

@ -13,6 +13,7 @@ Rails.application.routes.draw do
resources :zonefile_settings resources :zonefile_settings
resources :keyrelays
resources :domains resources :domains
resources :settings resources :settings
resources :registrars do resources :registrars do
@ -35,6 +36,7 @@ Rails.application.routes.draw do
resource :dashboard resource :dashboard
root 'domains#index' root 'domains#index'
end end