Updated to Rails 7.0.5.1

This commit is contained in:
Jez Caudle 2023-06-28 15:01:01 +01:00
parent b1009ec4de
commit 31e1311fe6
10 changed files with 171 additions and 141 deletions

View File

@ -1,79 +1,79 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.5)
actionpack (= 7.0.5)
activesupport (= 7.0.5)
actioncable (7.0.5.1)
actionpack (= 7.0.5.1)
activesupport (= 7.0.5.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.5)
actionpack (= 7.0.5)
activejob (= 7.0.5)
activerecord (= 7.0.5)
activestorage (= 7.0.5)
activesupport (= 7.0.5)
actionmailbox (7.0.5.1)
actionpack (= 7.0.5.1)
activejob (= 7.0.5.1)
activerecord (= 7.0.5.1)
activestorage (= 7.0.5.1)
activesupport (= 7.0.5.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.5)
actionpack (= 7.0.5)
actionview (= 7.0.5)
activejob (= 7.0.5)
activesupport (= 7.0.5)
actionmailer (7.0.5.1)
actionpack (= 7.0.5.1)
actionview (= 7.0.5.1)
activejob (= 7.0.5.1)
activesupport (= 7.0.5.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.5)
actionview (= 7.0.5)
activesupport (= 7.0.5)
actionpack (7.0.5.1)
actionview (= 7.0.5.1)
activesupport (= 7.0.5.1)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.5)
actionpack (= 7.0.5)
activerecord (= 7.0.5)
activestorage (= 7.0.5)
activesupport (= 7.0.5)
actiontext (7.0.5.1)
actionpack (= 7.0.5.1)
activerecord (= 7.0.5.1)
activestorage (= 7.0.5.1)
activesupport (= 7.0.5.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.5)
activesupport (= 7.0.5)
actionview (7.0.5.1)
activesupport (= 7.0.5.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.5)
activesupport (= 7.0.5)
activejob (7.0.5.1)
activesupport (= 7.0.5.1)
globalid (>= 0.3.6)
activemodel (7.0.5)
activesupport (= 7.0.5)
activerecord (7.0.5)
activemodel (= 7.0.5)
activesupport (= 7.0.5)
activestorage (7.0.5)
actionpack (= 7.0.5)
activejob (= 7.0.5)
activerecord (= 7.0.5)
activesupport (= 7.0.5)
activemodel (7.0.5.1)
activesupport (= 7.0.5.1)
activerecord (7.0.5.1)
activemodel (= 7.0.5.1)
activesupport (= 7.0.5.1)
activestorage (7.0.5.1)
actionpack (= 7.0.5.1)
activejob (= 7.0.5.1)
activerecord (= 7.0.5.1)
activesupport (= 7.0.5.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.5)
activesupport (7.0.5.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
bcrypt (3.1.18)
bcrypt (3.1.19)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
capybara (3.39.0)
capybara (3.39.2)
addressable
matrix
mini_mime (>= 0.1.3)
@ -97,20 +97,20 @@ GEM
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.13.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
importmap-rails (1.1.6)
importmap-rails (1.2.1)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.6.0)
irb (1.6.4)
irb (1.7.0)
reline (>= 0.3.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
loofah (2.20.0)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
@ -121,8 +121,8 @@ GEM
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
minitest (5.18.0)
msgpack (1.7.0)
minitest (5.18.1)
msgpack (1.7.1)
mysql2 (0.5.5)
net-imap (0.3.6)
date
@ -134,53 +134,54 @@ GEM
net-smtp (0.3.3)
net-protocol
nio4r (2.5.9)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
nokogiri (1.15.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
orm_adapter (0.5.0)
public_suffix (5.0.1)
puma (5.6.5)
puma (5.6.6)
nio4r (~> 2.0)
racc (1.6.2)
racc (1.7.1)
rack (2.2.7)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.5)
actioncable (= 7.0.5)
actionmailbox (= 7.0.5)
actionmailer (= 7.0.5)
actionpack (= 7.0.5)
actiontext (= 7.0.5)
actionview (= 7.0.5)
activejob (= 7.0.5)
activemodel (= 7.0.5)
activerecord (= 7.0.5)
activestorage (= 7.0.5)
activesupport (= 7.0.5)
rails (7.0.5.1)
actioncable (= 7.0.5.1)
actionmailbox (= 7.0.5.1)
actionmailer (= 7.0.5.1)
actionpack (= 7.0.5.1)
actiontext (= 7.0.5.1)
actionview (= 7.0.5.1)
activejob (= 7.0.5.1)
activemodel (= 7.0.5.1)
activerecord (= 7.0.5.1)
activestorage (= 7.0.5.1)
activesupport (= 7.0.5.1)
bundler (>= 1.15.0)
railties (= 7.0.5)
railties (= 7.0.5.1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.5)
actionpack (= 7.0.5)
activesupport (= 7.0.5)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.5.1)
actionpack (= 7.0.5.1)
activesupport (= 7.0.5.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
regexp_parser (2.8.0)
reline (0.3.3)
regexp_parser (2.8.1)
reline (0.3.5)
io-console (~> 0.5)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rubyzip (2.3.2)
selenium-webdriver (4.9.1)
selenium-webdriver (4.10.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
@ -193,8 +194,8 @@ GEM
sprockets (>= 3.0.0)
stimulus-rails (1.2.1)
railties (>= 6.0.0)
thor (1.2.1)
timeout (0.3.2)
thor (1.2.2)
timeout (0.4.0)
turbo-rails (1.4.0)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)

View File

@ -14,26 +14,7 @@
*= require_self
*/
html {
box-sizing: border-box;
font-size: 16px;
}
*, *:before, *:after {
box-sizing: inherit;
}
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
margin: 0;
padding: 0;
font-weight: normal;
}
ol, ul {
list-style: none;
}
img {
max-width: 100%;
height: auto;
body, nav, main, footer {
padding: 1rem;
margin: 1rem;
}

View File

@ -1,6 +1,6 @@
class VirtualsController < ApplicationController
before_action :set_virtual, only: %i[ show edit update destroy ]
before_action :set_domain, only: %i[ new create edit update destroy ]
# GET /virtuals or /virtuals.json
def index
@virtuals = Virtual.all
@ -22,10 +22,11 @@ class VirtualsController < ApplicationController
# POST /virtuals or /virtuals.json
def create
@virtual = Virtual.new(virtual_params)
@virtual.domain_id = @domain.id
respond_to do |format|
if @virtual.save
format.html { redirect_to virtual_url(@virtual), notice: "Virtual was successfully created." }
format.html { redirect_to domain_url(@domain), notice: "Virtual was successfully created." }
format.json { render :show, status: :created, location: @virtual }
else
format.html { render :new, status: :unprocessable_entity }
@ -38,7 +39,7 @@ class VirtualsController < ApplicationController
def update
respond_to do |format|
if @virtual.update(virtual_params)
format.html { redirect_to virtual_url(@virtual), notice: "Virtual was successfully updated." }
format.html { redirect_to domain_url(@domain), notice: "Virtual was successfully updated." }
format.json { render :show, status: :ok, location: @virtual }
else
format.html { render :edit, status: :unprocessable_entity }
@ -52,7 +53,7 @@ class VirtualsController < ApplicationController
@virtual.destroy
respond_to do |format|
format.html { redirect_to virtuals_url, notice: "Virtual was successfully destroyed." }
format.html { redirect_to domain_url(@domain), notice: "Virtual was successfully destroyed." }
format.json { head :no_content }
end
end
@ -63,6 +64,10 @@ class VirtualsController < ApplicationController
@virtual = Virtual.find(params[:id])
end
def set_domain
@domain = Domain.find(params[:domain_id])
end
# Only allow a list of trusted parameters through.
def virtual_params
params.require(:virtual).permit(:email, :destination)

View File

@ -1,26 +1,27 @@
<h2>Log in</h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<div class="black asap m-l3">
<%= form_for(resource, as: resource_name, url: session_path(resource_name), class: "p-10 border shadow br-b-8 md-w-50pc mx-auto") do |f| %>
<div class="flex flex-column">
<%= f.label :email, class: "my-2" %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
</div>
<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password" %>
<div class="flex flex-column mt-3">
<%= f.label :password, class: "my-2" %>
<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
<div class="flex flex-items-center mt-4">
<%= f.check_box :remember_me, class: "checkbox mr-3" %>
<%= f.label :remember_me, class: "form-check-label" %>
</div>
<% end %>
<div class="actions">
<%= f.submit "Log in" %>
<div class="mt-4">
<%= f.submit "Log in", class: "button" %>
</div>
<% end %>
<% end %>
</div>
<%= render "devise/shared/links" %>

View File

@ -1,4 +1,4 @@
<h1>Domains</h1>
<h1>Domains <%= link_to "Add new domain",new_domain_path %> </h1>
<div id="domains">
<ul>
@ -8,4 +8,4 @@
</ul>
</div>
<%= link_to "New domain", new_domain_path %>

View File

@ -1,22 +1,38 @@
<h1><%= @domain.domain %></h1>
<div class="w-100pc br-8 bg-white-lighter border-blue m-3">
<div class="p-5 br-t-8 bg-gray-darkest">
<h2 class="white fs-m1 fw-400"><%= @domain.domain %> <%= link_to "Edit", edit_domain_path(@domain), class: "inline-block br-3 bw-0 px-3 py-2 fs-s2 bg-blue-darker white pointer hover-opacity-80" %> <%= button_to "Delete", @domain, method: :delete, class: "inline-block button bg-red white focus-red" %></h2>
</div>
<div class="p-5">
<h2>Credentials (<%= @domain.credentials.count %>)</h2>
<ul>
<li><%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %>
<% @domain.credentials.each do |credential| %>
<li><%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> | <%= button_to "Destroy this credential", [@domain, credential], method: :delete %> </li>
<% end %>
</ul>
<hr/>
<h2>Virtuals (<%= @domain.virtuals.count %>)</h2>
<ul>
<li><%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %></li>
<% @domain.virtuals.each do |virtual| %>
<li><%= virtual.email%> >> <%= virtual.destination%> <%= link_to "Edit", edit_domain_virtual_path(@domain,virtual)%> | <%= button_to "Delete", [@domain, virtual], method: :delete %></li>
<% end %>
</ul>
</div>
<div class="flex justify-between p-5 br-b-8 border-t bc-gray-light">
<button class="inline-block br-3 bw-0 px-3 py-2 fs-s2 bg-blue-darker white pointer hover-opacity-80">Read
More</button>
<button class="inline-block br-3 bw-0 px-3 py-2 fs-s2 bg-gray-lighter black pointer hover-opacity-80">Cancel</button>
</div>
</div>
<h1></h1>
<div>
<div>
<%= link_to "Edit this domain", edit_domain_path(@domain) %> | <%= link_to "Back to domains", domains_path %> | <%= button_to "Destroy this domain", @domain, method: :delete %>
</div>
<h2>Credentials (<%= @domain.credentials.count %>)</h2>
<ul>
<li><%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %>
<% @domain.credentials.each do |credential| %>
<li><%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> |
<%= button_to "Destroy this credential", [@domain, credential], method: :delete %> </li>
<% end %>
</ul>
<h2>Virtuals (<%= @domain.virtuals.count %>)</h2>
<ul>
<li><%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %></li>
<% @domain.virtuals.each do |virtual| %>
<li><%= virtual.email%> >> <%= virtual.destination%></li>
<% end %>
</ul>

View File

@ -5,14 +5,41 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<link rel="stylesheet" href="https://minimalistcss.github.io/dist/minimalist.min.css">
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
</head>
</head>
<body>
<p class="notice"><%= notice %></p><p class="alert"><%= alert %></p>
<nav class="flex flex-column md-flex-row bg-gray-lighter px-4">
<div class="flex justify-between">
<a data-toggle="toggle-nav" data-target="#nav-items" href="#"
class="flex items-center ml-auto md-hidden opacity-70">
<div class="m-3 br-4 border-gray-darkest p-1">
<div class="border-t border-gray-darkest my-1 px-3"></div>
<div class="border-t border-gray-darkest my-1"></div>
<div class="border-t border-gray-darkest my-1"></div>
</div>
</a>
</div>
<div id="nav-items" class="hidden flex sm-w-100pc flex-column md-flex md-flex-row md-justify-start items-center">
<%= link_to "Home", root_path, class: "inline-block fs-s1 mx-3 py-3 gray-darkest no-underline hover-underline" %>
<% if user_signed_in? %><%= button_to "Log out", destroy_user_session_path, method: :delete, class: "button bg-red white focus-red" %><% end %>
</div>
</nav>
<main>
<% if notice %><div class="bg-green-lightest green-darkest px-5 py-3 br-3 border-l bw-6 bc-green"><%= notice %></div><% end %>
<% if alert %><div class="bg-red-lightest red-darkest px-5 py-3 br-3 border-l bw-6 bc-red"><%= alert %></div><% end %>
<%= yield %>
</main>
<footer>
<hr/>
RoR Version <%= Rails.version %> (<%=Rails.env%>) | Ruby <%= "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}" %> | OS <%= RUBY_PLATFORM %>
</footer>
</body>
</html>

View File

@ -1,4 +1,4 @@
<%= form_with(model: virtual) do |form| %>
<%= form_with(model: [@domain,virtual]) do |form| %>
<% if virtual.errors.any? %>
<div style="color: red">
<h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2>

View File

@ -5,6 +5,5 @@
<br>
<div>
<%= link_to "Show this virtual", @virtual %> |
<%= link_to "Back to virtuals", virtuals_path %>
<%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
</div>

View File

@ -1,9 +1,9 @@
<h1>New virtual</h1>
<h1>New virtual for <%= @domain.domain %></h1>
<%= render "form", virtual: @virtual %>
<br>
<div>
<%= link_to "Back to virtuals", virtuals_path %>
<%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
</div>