diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 288b9ab..56f94f6 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,27 @@ *= require_tree . *= 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; +} diff --git a/app/controllers/credentials_controller.rb b/app/controllers/credentials_controller.rb index 700b7ba..fc3f963 100644 --- a/app/controllers/credentials_controller.rb +++ b/app/controllers/credentials_controller.rb @@ -1,6 +1,6 @@ class CredentialsController < ApplicationController before_action :set_credential, only: %i[ show edit update destroy ] - before_action :set_domain, only: %i[ new ] + before_action :set_domain, only: %i[ new create edit update destroy ] # GET /credentials or /credentials.json def index @@ -23,10 +23,11 @@ class CredentialsController < ApplicationController # POST /credentials or /credentials.json def create @credential = Credential.new(credential_params) + @credential.domain_id = @domain.id respond_to do |format| if @credential.save - format.html { redirect_to credential_url(@credential), notice: "Credential was successfully created." } + format.html { redirect_to domain_path(@domain), notice: "Credential was successfully created." } format.json { render :show, status: :created, location: @credential } else format.html { render :new, status: :unprocessable_entity } @@ -39,7 +40,7 @@ class CredentialsController < ApplicationController def update respond_to do |format| if @credential.update(credential_params) - format.html { redirect_to credential_url(@credential), notice: "Credential was successfully updated." } + format.html { redirect_to domain_path(@domain), notice: "Credential was successfully updated." } format.json { render :show, status: :ok, location: @credential } else format.html { render :edit, status: :unprocessable_entity } @@ -53,7 +54,7 @@ class CredentialsController < ApplicationController @credential.destroy respond_to do |format| - format.html { redirect_to credentials_url, notice: "Credential was successfully destroyed." } + format.html { redirect_to domain_path(@domain), notice: "Credential was successfully destroyed." } format.json { head :no_content } end end diff --git a/app/views/credentials/_form.html.erb b/app/views/credentials/_form.html.erb index c06258a..5a9f25d 100644 --- a/app/views/credentials/_form.html.erb +++ b/app/views/credentials/_form.html.erb @@ -12,7 +12,7 @@ <% end %>
- <%= form.label :email, style: "display: block" %> + <%= form.label :email, style: "display: inline" %> @<%=@domain.domain%> <%= form.text_field :email %>
diff --git a/app/views/credentials/edit.html.erb b/app/views/credentials/edit.html.erb index 2b8f560..1b38878 100644 --- a/app/views/credentials/edit.html.erb +++ b/app/views/credentials/edit.html.erb @@ -5,6 +5,6 @@
- <%= link_to "Show this credential", @credential %> | - <%= link_to "Back to credentials", credentials_path %> + <%#= link_to "Show this credential", @credential %> | + <%#= link_to "Back to credentials", credentials_path %>
diff --git a/app/views/domains/index.html.erb b/app/views/domains/index.html.erb index 5d5e685..3034de3 100644 --- a/app/views/domains/index.html.erb +++ b/app/views/domains/index.html.erb @@ -1,5 +1,3 @@ -

<%= notice %>

-

Domains

diff --git a/app/views/domains/show.html.erb b/app/views/domains/show.html.erb index 028b12a..256ac47 100644 --- a/app/views/domains/show.html.erb +++ b/app/views/domains/show.html.erb @@ -1,4 +1,3 @@ -

<%= notice %>

<%= @domain.domain %>

@@ -9,7 +8,8 @@ diff --git a/config/routes.rb b/config/routes.rb index 4c0b7eb..f8113a7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,5 +9,5 @@ Rails.application.routes.draw do # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Defines the root path route ("/") - root "home#index" + root "domains#index" end diff --git a/test/models/virtual_test.rb b/test/models/virtual_test.rb index 979e7c7..98f40f2 100644 --- a/test/models/virtual_test.rb +++ b/test/models/virtual_test.rb @@ -39,4 +39,14 @@ class VirtualTest < ActiveSupport::TestCase assert !@v.save end + test "domain id must be present" do + @v = Virtual.new + @v.email = "abuse@example.net" + @v.destination = "valid@email.com" + @v.domain_id = domains(:one).id + 1234 + assert !@v.save + end + + + end