From ee2601b8de655359c7de3472cd8ce252ddcab119 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 9 Dec 2020 16:50:53 +0500 Subject: [PATCH] Add scaffold for a controller & view --- Gemfile | 1 + Gemfile.lock | 7 ++++++ .../registrar/bulk_renew_controller.rb | 9 ++++++++ .../bulk_change/_api_errors.html.erb | 9 ++++++++ .../bulk_change/_bulk_renew_form.html.erb | 22 +++++++++++++++++++ app/views/registrar/bulk_change/new.html.erb | 8 +++++++ config/locales/registrar/bulk_change.en.yml | 5 +++++ config/routes.rb | 2 ++ 8 files changed, 63 insertions(+) create mode 100644 app/controllers/registrar/bulk_renew_controller.rb create mode 100644 app/views/registrar/bulk_change/_api_errors.html.erb create mode 100644 app/views/registrar/bulk_change/_bulk_renew_form.html.erb diff --git a/Gemfile b/Gemfile index 9bbcba254..9aad8b7ae 100644 --- a/Gemfile +++ b/Gemfile @@ -80,6 +80,7 @@ gem 'directo', github: 'internetee/directo', branch: 'master' group :development, :test do + gem 'listen' gem 'pry', '0.10.1' gem 'puma' end diff --git a/Gemfile.lock b/Gemfile.lock index 2a0bb55b1..3c9da920e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -250,6 +250,9 @@ GEM kaminari-core (= 1.2.1) kaminari-core (1.2.1) libxml-ruby (3.2.0) + listen (3.3.3) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) logger (1.4.2) loofah (2.7.0) crass (~> 1.0.2) @@ -363,6 +366,9 @@ GEM activesupport (>= 5.2.1) i18n polyamorous (= 2.3.2) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) + ffi (~> 1.0) rbtree3 (0.6.0) regexp_parser (1.8.0) request_store (1.5.0) @@ -510,6 +516,7 @@ DEPENDENCIES jquery-ui-rails (= 5.0.5) kaminari lhv! + listen minitest (~> 5.14) money-rails nokogiri diff --git a/app/controllers/registrar/bulk_renew_controller.rb b/app/controllers/registrar/bulk_renew_controller.rb new file mode 100644 index 000000000..8818e416c --- /dev/null +++ b/app/controllers/registrar/bulk_renew_controller.rb @@ -0,0 +1,9 @@ +class Registrar + class BulkRenewController < DeppController + def index; end + + def new + authorize! :manage, :repp + end + end +end diff --git a/app/views/registrar/bulk_change/_api_errors.html.erb b/app/views/registrar/bulk_change/_api_errors.html.erb new file mode 100644 index 000000000..56bf8c404 --- /dev/null +++ b/app/views/registrar/bulk_change/_api_errors.html.erb @@ -0,0 +1,9 @@ +<% if @api_errors %> +
+ +
+<% end %> diff --git a/app/views/registrar/bulk_change/_bulk_renew_form.html.erb b/app/views/registrar/bulk_change/_bulk_renew_form.html.erb new file mode 100644 index 000000000..38134e707 --- /dev/null +++ b/app/views/registrar/bulk_change/_bulk_renew_form.html.erb @@ -0,0 +1,22 @@ +<%= form_tag registrar_new_registrar_bulk_renew_path, multipart: true, class: 'form-horizontal' do %> + <%= render 'api_errors' %> + + +
+
+ <%= label_tag 'expire_date', t('.expire_date') %> +
+
+ <%= text_field :expire_date, params[:expire_date], + class: 'form-control js-datepicker' %> +
+
+ +
+
+ +
+
+<% end %> diff --git a/app/views/registrar/bulk_change/new.html.erb b/app/views/registrar/bulk_change/new.html.erb index da85899ff..e61270b6d 100644 --- a/app/views/registrar/bulk_change/new.html.erb +++ b/app/views/registrar/bulk_change/new.html.erb @@ -19,6 +19,10 @@
  • <%= t '.bulk_transfer' %>
  • + +
  • + <%= t '.bulk_renew' %> +
  • @@ -34,4 +38,8 @@
    <%= render 'bulk_transfer_form' %>
    + +
    + <%= render 'bulk_renew_form' %> +
    diff --git a/config/locales/registrar/bulk_change.en.yml b/config/locales/registrar/bulk_change.en.yml index 7c1f11da9..d9f932a46 100644 --- a/config/locales/registrar/bulk_change.en.yml +++ b/config/locales/registrar/bulk_change.en.yml @@ -6,6 +6,7 @@ en: technical_contact: Technical contact nameserver: Nameserver bulk_transfer: Bulk transfer + bulk_renew: Bulk renew tech_contact_form: current_contact_id: Current contact ID @@ -29,3 +30,7 @@ en: submit_btn: Transfer help_btn: Toggle help help: Transfer domains in the csv file with correct transfer code to this registrar + + bulk_renew_form: + filter_btn: Filter + expire_date: Expire date diff --git a/config/routes.rb b/config/routes.rb index 0af3d95c9..2a6930d3f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -133,6 +133,8 @@ Rails.application.routes.draw do end resources :domain_transfers, only: %i[new create] resource :bulk_change, controller: :bulk_change, only: :new + # resource :bulk_renew, controller: :bulk_renew #, only: :index + post '/registrar/bulk_renew/new', to: 'bulk_renew#new', as: :new_registrar_bulk_renew resource :tech_contacts, only: :update resource :nameservers, only: :update resources :contacts, constraints: {:id => /[^\/]+(?=#{ ActionController::Renderers::RENDERERS.map{|e| "\\.#{e}\\z"}.join("|") })|[^\/]+/} do