Just the blockers now!!

This commit is contained in:
Jez Caudle 2024-05-10 07:27:32 +01:00
parent abff880184
commit e3901d26c6
6 changed files with 81 additions and 73 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -1,29 +0,0 @@
<h2>Sign up</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "new-password" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -1,38 +1,25 @@
<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="domain-header">
<h2><%= @domain.domain %> <%#= link_to "Edit", edit_domain_path(@domain) %> <%= button_to "Delete", @domain, method: :delete %></h2>
</div>
<div class="p-5">
<h2>Credentials (<%= @domain.credentials.count %>)</h2>
<div class="email-list">
<h3>Credentials (<%= @domain.credentials.count %>) <%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %></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>
<li><%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> <%= button_to "Delete this email address", [@domain, credential], method: :delete %></li>
<% end %>
</ul>
<hr/>
<h2>Virtuals (<%= @domain.virtuals.count %>)</h2>
<h3>Virtuals (<%= @domain.virtuals.count %>) <%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %></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>
<li><%= virtual.email%> >> <%= virtual.destination%> <%= link_to "Edit", edit_domain_virtual_path(@domain,virtual)%> <%= button_to "Delete", [@domain, virtual], method: :delete, style: "display:inline" %></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>

View File

@ -5,29 +5,20 @@
<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>
<body>
<nav class="flex flex-column md-flex-row bg-gray-lighter px-4">
<div class="flex justify-between">
<div>
<menu>
<li><%= link_to "Home", root_path %></li><% if user_signed_in? %>
<li><%= link_to "Edit account", edit_user_registration_path %></li>
<li><%= button_to "Log out", destroy_user_session_path, method: :delete %></li><% end %>
</menu>
</div>
<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? %><%= link_to "Edit account", edit_user_registration_path, class: "button" %> <%= 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 %>
@ -35,11 +26,17 @@
<%= yield %>
</main>
<footer>
<hr/>
RoR Version <%= Rails.version %> (<%=Rails.env%>) | Ruby <%= "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}" %> | OS <%= RUBY_PLATFORM %>
<hr/>
<h3>Blockers:</h3>
<ul>
<li>2FA</li>
<li>Blocking Sign-up at Routes level</li>
<li>Tests for controllers and integration</li>
<li>Version number</li>
</ul>
</footer>
</body>
</html>

View File

@ -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