diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 333a019..bce4afb 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -18,3 +18,50 @@ body, nav, main, footer { padding: 1rem; margin: 1rem; } + +menu { + display: flex; + list-style: none; + padding: 1rem; + background-color: #daeafa; + border-radius:1rem; +} + +menu > li { + padding:0 1rem; + flex-grow: 1; +} + +.domain-header h2 { + display: flex; +} + +.domain-header a { + font-size: 9pt; +} + +.domain-header button { + margin:0 0 0 10px; + +} + +.email-list li { + display: flex; + margin:0.3rem 1rem; +} + +.email-list li a { + padding:0 10px; +} + +main, body { + padding:1rem; + margin:1rem; +} + +footer { + background-color:#efefef; + margin:0 1rem; + padding:1rem; + border-radius:1rem; +} diff --git a/app/controllers/credentials_controller.rb b/app/controllers/credentials_controller.rb index fc3f963..618e928 100644 --- a/app/controllers/credentials_controller.rb +++ b/app/controllers/credentials_controller.rb @@ -24,12 +24,13 @@ class CredentialsController < ApplicationController def create @credential = Credential.new(credential_params) @credential.domain_id = @domain.id - + @credential.email << "@" << @domain.domain respond_to do |format| if @credential.save format.html { redirect_to domain_path(@domain), notice: "Credential was successfully created." } format.json { render :show, status: :created, location: @credential } else + @credential.email.sub! ("@" + @domain.domain), "" format.html { render :new, status: :unprocessable_entity } format.json { render json: @credential.errors, status: :unprocessable_entity } end diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index d655b66..e69de29 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,29 +0,0 @@ -

Sign up

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, autocomplete: "email" %> -
- -
- <%= f.label :password %> - <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autocomplete: "new-password" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "new-password" %> -
- -
- <%= f.submit "Sign up" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/app/views/domains/show.html.erb b/app/views/domains/show.html.erb index 0ec035e..beac1e8 100644 --- a/app/views/domains/show.html.erb +++ b/app/views/domains/show.html.erb @@ -1,38 +1,25 @@ -
-
-

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

+
+
+

<%= @domain.domain %> <%#= link_to "Edit", edit_domain_path(@domain) %> <%= button_to "Delete", @domain, method: :delete %>

-
-

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

+ -
- - -
-
- -

- -
- diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9e43edc..8975d9d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,29 +5,20 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> -
<% if notice %>
<%= notice %>
<% end %> @@ -35,11 +26,17 @@ <%= yield %>
- - diff --git a/test/models/credential_test.rb b/test/models/credential_test.rb index ab184c4..7c47f6e 100644 --- a/test/models/credential_test.rb +++ b/test/models/credential_test.rb @@ -3,18 +3,23 @@ require "test_helper" class CredentialTest < ActiveSupport::TestCase test "email must be present" do @c = Credential.new - assert !@c.save + assert_not @c.save end test "email must be valid" do @c = Credential.new @c.email = "not on your nelly" - assert !@c.save + assert_not @c.save end test "email must be unique" do @c = Credential.new @c.email = "bob@example.net" - assert !@c.save + assert_not @c.save + end + + test "domain added to name" do + @c = Credential.new(email: "jez", password: "1234567&ab", domain_id: domains(:one).id) + assert @c.save end end