Added basic Registrant portal

This commit is contained in:
Priit Tark 2015-05-13 13:02:08 +03:00
parent 90633160c0
commit fdcad95683
28 changed files with 810 additions and 26 deletions

View file

@ -0,0 +1,46 @@
- content_for :actions do
-# = link_to(t(:new), new_registrant_domain_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:domains)
.row
.col-md-12{style: 'margin-bottom: -15px;'}
= form_tag info_registrant_domains_path, class: 'form-horizontal', method: :get do
.col-md-11
.form-group
= text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off', autofocus: true
.col-md-1.text-right.text-center-xs
.form-group
%button.btn.btn-default
 
%span.glyphicon.glyphicon-search
 
%hr
- if @response
.table-responsive
%table.table.table-hover.table-condensed
%thead
%tr
%th{class: 'col-xs-3'}= t(:name)
%th{class: 'col-xs-6'}= t(:valid)
%th{class: 'col-xs-3'}= t(:actions)
%tbody
- @response['domains'].each do |x|
%tr
%td= link_to(x['name'], info_registrant_domains_path(domain_name: x['name']))
%td
= Time.zone.parse(x['valid_from']).try(:to_date)
\-
= Time.zone.parse(x['valid_to']).try(:to_date)
%td
= link_to(t(:view), info_registrant_domains_path(domain_name: x['name']),
class: 'btn btn-primary btn-xs')
-# = link_to(t(:edit), edit_registrant_domains_path(domain_name: x['name']),
-# class: 'btn btn-primary btn-xs')
-# = link_to(t(:renew), renew_registrant_domains_path(domain_name: x['name']),
-# class: 'btn btn-default btn-xs')
-# = link_to(t(:delete), delete_registrant_domains_path(domain_name: x['name']),
-# class: 'btn btn-default btn-xs')
= paginate @paginatable_array

View file

@ -0,0 +1,26 @@
- content_for :actions do
-# = link_to(t(:edit), edit_registrar_domains_path(domain_name: params[:domain_name]),
-# class: 'btn btn-default')
-# = link_to(t(:renew), renew_registrar_domains_path(domain_name: params[:domain_name]),
-# class: 'btn btn-default')
-# = link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
-# class: 'btn btn-default')
= render 'shared/title', name: truncate(@data.css('name').text)
.row
.col-sm-12
- if @data.css('result').first['code'] == '1000'
.row
.col-md-12= render 'registrar/domains/partials/general'
.row
.col-md-12= render 'registrar/domains/partials/contacts'
.row
.col-md-12= render 'registrar/domains/partials/statuses'
.row
.col-md-12= render 'registrar/domains/partials/nameservers'
.row
.col-md-12= render 'registrar/domains/partials/dnskeys'
- else
.row
.col-sm-6
%h1= t(:not_found)

View file

@ -0,0 +1,21 @@
.row
.form-signin.col-md-6.center-block.text-center
%h2.form-signin-heading.text-center= t(:log_in)
%hr
= form_for @depp_user, url: registrant_sessions_path, html: {class: 'form-signin'} do |f|
= render 'registrar/shared/errors', object: f.object
- error_class = f.object.errors.any? ? 'has-error' : ''
%div{class: error_class}
= f.text_field :tag, class: 'form-control', placeholder: t(:username), required: true
= f.password_field :password, class: 'form-control', placeholder: t(:password), required: true
%button.btn.btn-lg.btn-primary.btn-block{:type => 'submit'}= t(:log_in)
%hr
= link_to '/regisrant/login/mid' do
= image_tag 'mid.gif'
-# = link_to '/registrant/login/id' do
-# = image_tag 'id_card.gif'

View file

@ -0,0 +1,40 @@
.row
.form-signin.col-md-4.center-block.text-center
%h2.form-signin-heading.text-center= t(:log_in_with_mid)
%hr
= form_for @user, url: registrant_mid_path, auto_html5_validation: false,
html: {class: 'form-signin'} do |f|
= f.text_field :phone, class: 'form-control',
placeholder: t(:phone_no), autocomplete: 'off', required: true
%button.btn.btn-lg.btn-primary.btn-block.js-login{:type => 'submit'}= t(:log_in)
- if ['development', 'alpha'].include?(Rails.env)
%div.text-center
00007, 60000007, 00000766
:coffee
$('.js-login').attr('disabled', false)
status_interval = null
mid_status = () ->
status_interval = setInterval((->
$.post('/registrant/login/mid_status').fail((data) ->
clearInterval(status_interval)
flash_alert(data.responseJSON.message)
$('.js-login').attr('disabled', false)
)
), 1000)
$('.js-login').on 'click', (e) ->
e.preventDefault();
$(this).attr('disabled', true)
$.post($('form').attr('action'), $('form').serialize()).done((data) ->
if data.message
flash_notice(data.message)
mid_status()
).fail((data) ->
flash_alert(data.responseJSON.message)
$('.js-login').attr('disabled', false)
)