From 31e1311fe6f32c1579dfd0b736ef7e6af306c8c8 Mon Sep 17 00:00:00 2001 From: Jez Caudle Date: Wed, 28 Jun 2023 15:01:01 +0100 Subject: [PATCH] Updated to Rails 7.0.5.1 --- Gemfile.lock | 147 +++++++++++++------------ app/assets/stylesheets/application.css | 25 +---- app/controllers/virtuals_controller.rb | 13 ++- app/views/devise/sessions/new.html.erb | 29 ++--- app/views/domains/index.html.erb | 4 +- app/views/domains/show.html.erb | 52 ++++++--- app/views/layouts/application.html.erb | 33 +++++- app/views/virtuals/_form.html.erb | 2 +- app/views/virtuals/edit.html.erb | 3 +- app/views/virtuals/new.html.erb | 4 +- 10 files changed, 171 insertions(+), 141 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 376b1d6..ff556cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 56f94f6..333a019 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -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; } diff --git a/app/controllers/virtuals_controller.rb b/app/controllers/virtuals_controller.rb index 749c3f1..f405588 100644 --- a/app/controllers/virtuals_controller.rb +++ b/app/controllers/virtuals_controller.rb @@ -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) diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 5ede964..811d9bf 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,26 +1,27 @@

Log in

-<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, autocomplete: "email" %> +
+ <%= 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| %> +
+ <%= f.label :email, class: "my-2" %> + <%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
-
- <%= f.label :password %>
- <%= f.password_field :password, autocomplete: "current-password" %> +
+ <%= f.label :password, class: "my-2" %> + <%= f.password_field :password, autocomplete: "current-password", class: "input" %>
<% if devise_mapping.rememberable? %> -
- <%= f.check_box :remember_me %> - <%= f.label :remember_me %> +
+ <%= f.check_box :remember_me, class: "checkbox mr-3" %> + <%= f.label :remember_me, class: "form-check-label" %>
<% end %> -
- <%= f.submit "Log in" %> +
+ <%= f.submit "Log in", class: "button" %>
-<% end %> - + <% end %> +
<%= render "devise/shared/links" %> diff --git a/app/views/domains/index.html.erb b/app/views/domains/index.html.erb index 3034de3..aa50cbb 100644 --- a/app/views/domains/index.html.erb +++ b/app/views/domains/index.html.erb @@ -1,4 +1,4 @@ -

Domains

+

Domains <%= link_to "Add new domain",new_domain_path %>

    @@ -8,4 +8,4 @@
-<%= link_to "New domain", new_domain_path %> + diff --git a/app/views/domains/show.html.erb b/app/views/domains/show.html.erb index 256ac47..0ec035e 100644 --- a/app/views/domains/show.html.erb +++ b/app/views/domains/show.html.erb @@ -1,22 +1,38 @@ -

<%= @domain.domain %>

+
+
+

<%= @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" %>

+
+
+

Credentials (<%= @domain.credentials.count %>)

+
    +
  • <%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %> + <% @domain.credentials.each do |credential| %> +
  • <%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> | <%= button_to "Destroy this credential", [@domain, credential], method: :delete %>
  • + <% end %> +
+ +
+ +

Virtuals (<%= @domain.virtuals.count %>)

+
    +
  • <%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %>
  • + <% @domain.virtuals.each do |virtual| %> +
  • <%= virtual.email%> >> <%= virtual.destination%> <%= link_to "Edit", edit_domain_virtual_path(@domain,virtual)%> | <%= button_to "Delete", [@domain, virtual], method: :delete %>
  • + <% end %> +
+ +
+
+ + +
+
+ +

+ +
-
- <%= link_to "Edit this domain", edit_domain_path(@domain) %> | <%= link_to "Back to domains", domains_path %> | <%= button_to "Destroy this domain", @domain, method: :delete %>
-

Credentials (<%= @domain.credentials.count %>)

-
    -
  • <%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %> -<% @domain.credentials.each do |credential| %> -
  • <%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> | - <%= button_to "Destroy this credential", [@domain, credential], method: :delete %>
  • -<% end %> -
-

Virtuals (<%= @domain.virtuals.count %>)

-
    -
  • <%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %>
  • -<% @domain.virtuals.each do |virtual| %> -
  • <%= virtual.email%> >> <%= virtual.destination%>
  • -<% end %> -
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8441b46..c5f46aa 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,14 +5,41 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> - + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> - + -

<%= notice %>

<%= alert %>

+ + +
+ <% if notice %>
<%= notice %>
<% end %> + <% if alert %>
<%= alert %>
<% end %> <%= yield %> +
+ +
+
+ RoR Version <%= Rails.version %> (<%=Rails.env%>) | Ruby <%= "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}" %> | OS <%= RUBY_PLATFORM %> +
+ diff --git a/app/views/virtuals/_form.html.erb b/app/views/virtuals/_form.html.erb index 0b80272..0af91b2 100644 --- a/app/views/virtuals/_form.html.erb +++ b/app/views/virtuals/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with(model: virtual) do |form| %> +<%= form_with(model: [@domain,virtual]) do |form| %> <% if virtual.errors.any? %>

<%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:

diff --git a/app/views/virtuals/edit.html.erb b/app/views/virtuals/edit.html.erb index 5d4083b..b5c543a 100644 --- a/app/views/virtuals/edit.html.erb +++ b/app/views/virtuals/edit.html.erb @@ -5,6 +5,5 @@
- <%= link_to "Show this virtual", @virtual %> | - <%= link_to "Back to virtuals", virtuals_path %> + <%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
diff --git a/app/views/virtuals/new.html.erb b/app/views/virtuals/new.html.erb index b37c8dd..1f96fc0 100644 --- a/app/views/virtuals/new.html.erb +++ b/app/views/virtuals/new.html.erb @@ -1,9 +1,9 @@ -

New virtual

+

New virtual for <%= @domain.domain %>

<%= render "form", virtual: @virtual %>
- <%= link_to "Back to virtuals", virtuals_path %> + <%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>