mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Create views for bounced emails
This commit is contained in:
parent
0f3b033f79
commit
188cca0c06
9 changed files with 169 additions and 0 deletions
60
app/controllers/admin/bounced_mail_addresses_controller.rb
Normal file
60
app/controllers/admin/bounced_mail_addresses_controller.rb
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
module Admin
|
||||||
|
class BouncedMailAddressesController < BaseController
|
||||||
|
before_action :set_bounced_mail_address, only: %i[show edit update destroy]
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
# GET /bounced_mail_addresses
|
||||||
|
def index
|
||||||
|
@bounced_mail_addresses = BouncedMailAddress.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /bounced_mail_addresses/1
|
||||||
|
def show; end
|
||||||
|
|
||||||
|
# GET /bounced_mail_addresses/new
|
||||||
|
def new
|
||||||
|
@bounced_mail_address = BouncedMailAddress.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /bounced_mail_addresses/1/edit
|
||||||
|
def edit; end
|
||||||
|
|
||||||
|
# POST /bounced_mail_addresses
|
||||||
|
def create
|
||||||
|
@bounced_mail_address = BouncedMailAddress.new(bounced_mail_address_params)
|
||||||
|
|
||||||
|
if @bounced_mail_address.save
|
||||||
|
redirect_to(admin_bounced_mail_addresses_url, notice: 'Bounced mail address was successfully created.')
|
||||||
|
else
|
||||||
|
render(:new)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /bounced_mail_addresses/1
|
||||||
|
def update
|
||||||
|
if @bounced_mail_address.update(bounced_mail_address_params)
|
||||||
|
redirect_to(@bounced_mail_address, notice: 'Bounced mail address was successfully updated.')
|
||||||
|
else
|
||||||
|
render(:edit)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /bounced_mail_addresses/1
|
||||||
|
def destroy
|
||||||
|
@bounced_mail_address.destroy
|
||||||
|
redirect_to(admin_bounced_mail_addresses_url, notice: 'Bounced mail address was successfully destroyed.')
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_bounced_mail_address
|
||||||
|
@bounced_mail_address = BouncedMailAddress.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a trusted parameter "white list" through.
|
||||||
|
def bounced_mail_address_params
|
||||||
|
params.require(:bounced_mail_address).permit(:email, :bounce_reason, :incidents, :response_json)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -109,6 +109,7 @@ class Ability
|
||||||
can :destroy, :pending
|
can :destroy, :pending
|
||||||
can :create, :zonefile
|
can :create, :zonefile
|
||||||
can :access, :settings_menu
|
can :access, :settings_menu
|
||||||
|
can :manage, BouncedMailAddress
|
||||||
end
|
end
|
||||||
|
|
||||||
def static_registrant
|
def static_registrant
|
||||||
|
|
2
app/models/bounced_mail_address.rb
Normal file
2
app/models/bounced_mail_address.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
class BouncedMailAddress < ApplicationRecord
|
||||||
|
end
|
37
app/views/admin/bounced_mail_addresses/_form.html.erb
Normal file
37
app/views/admin/bounced_mail_addresses/_form.html.erb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<%= form_for([:admin, @bounced_mail_address], html: { class: 'form-horizontal' }) do |form| %>
|
||||||
|
<% if @bounced_mail_address.errors.any? %>
|
||||||
|
<div id="error_explanation">
|
||||||
|
<h2><%= pluralize(bounced_mail_address.errors.count, "error") %> prohibited this bounced_mail_address from being saved:</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% @bounced_mail_address.errors.full_messages.each do |message| %>
|
||||||
|
<li><%= message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :email %>
|
||||||
|
<%= form.text_field :email %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :bounce_reason %>
|
||||||
|
<%= form.text_field :bounce_reason %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :incidents %>
|
||||||
|
<%= form.number_field :incidents %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :response_json %>
|
||||||
|
<%= form.text_field :response_json %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= form.submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
6
app/views/admin/bounced_mail_addresses/edit.html.erb
Normal file
6
app/views/admin/bounced_mail_addresses/edit.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<h1>Editing Bounced Mail Address</h1>
|
||||||
|
|
||||||
|
<%= render 'form', bounced_mail_address: @bounced_mail_address %>
|
||||||
|
|
||||||
|
<%= link_to 'Show', admin_bounced_mail_address_path(@bounced_mail_address)%> |
|
||||||
|
<%= link_to 'Back', admin_bounced_mail_addresses_path %>
|
33
app/views/admin/bounced_mail_addresses/index.html.erb
Normal file
33
app/views/admin/bounced_mail_addresses/index.html.erb
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<h1>Bounced Mail Addresses</h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Bounce reason</th>
|
||||||
|
<th>Incidents</th>
|
||||||
|
<th>Response json</th>
|
||||||
|
<th colspan="3"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @bounced_mail_addresses.each do |mail_addr| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= mail_addr.email %></td>
|
||||||
|
<td><%= mail_addr.bounce_reason %></td>
|
||||||
|
<td><%= mail_addr.incidents %></td>
|
||||||
|
<td><%= mail_addr.response_json %></td>
|
||||||
|
<td><%= link_to 'Show', admin_bounced_mail_address_path(mail_addr) %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_admin_bounced_mail_address_path(mail_addr) %></td>
|
||||||
|
<td><%= link_to 'Destroy', admin_bounced_mail_address_path(mail_addr), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<%= link_to 'New Bounced Mail Address', new_admin_bounced_mail_address_path %>
|
5
app/views/admin/bounced_mail_addresses/new.html.erb
Normal file
5
app/views/admin/bounced_mail_addresses/new.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<h1>New Bounced Mail Address</h1>
|
||||||
|
|
||||||
|
<%= render 'form', bounced_mail_address: @bounced_mail_address %>
|
||||||
|
|
||||||
|
<%= link_to 'Back', admin_bounced_mail_addresses_path %>
|
24
app/views/admin/bounced_mail_addresses/show.html.erb
Normal file
24
app/views/admin/bounced_mail_addresses/show.html.erb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Email:</strong>
|
||||||
|
<%= @bounced_mail_address.email %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Bounce reason:</strong>
|
||||||
|
<%= @bounced_mail_address.bounce_reason %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Incidents:</strong>
|
||||||
|
<%= @bounced_mail_address.incidents %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Response json:</strong>
|
||||||
|
<%= @bounced_mail_address.response_json %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<%= link_to 'Edit', edit_admin_bounced_mail_address_path(@bounced_mail_address) %> |
|
||||||
|
<%= link_to 'Back', admin_bounced_mail_addresses_path %>
|
|
@ -298,6 +298,7 @@ Rails.application.routes.draw do
|
||||||
resources :delayed_jobs
|
resources :delayed_jobs
|
||||||
resources :epp_logs
|
resources :epp_logs
|
||||||
resources :repp_logs
|
resources :repp_logs
|
||||||
|
resources :bounced_mail_addresses
|
||||||
|
|
||||||
authenticate :admin_user do
|
authenticate :admin_user do
|
||||||
mount Que::Web, at: 'que'
|
mount Que::Web, at: 'que'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue