Scalfolding out the counter cluster groups.

This commit is contained in:
James Patrick 2020-05-22 14:41:22 -04:00
parent dd1ccffb0a
commit 23b20e1c37
18 changed files with 130 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# frozen_string_literal: true
# This is the landing for a specific tally cluster
class ClusterController < ApplicationController
before_action :only_for_unknown
def new; end
def create
# TODO: This will need to modify a shared object to insert a new tally cluster.
session[:cluster] = params[:cluster]
redirect_to root_path
end
private
def only_for_unknown
redirect_to root_path if session[:cluster]
end
end

View File

@ -0,0 +1,10 @@
class CounterController < ApplicationController
before_action :associate!
def show; end
private
def associate!
redirect_to cluster_path unless session[:cluster]
end
end

View File

@ -0,0 +1,2 @@
module ClusterHelper
end

View File

@ -0,0 +1,2 @@
module CounterHelper
end

View File

@ -0,0 +1,2 @@
module SessionHelper
end

View File

@ -0,0 +1,4 @@
<%= c("page") do %>
<%= c("cluster-list") %>
<%= c("cluster-new") %>
<% end %>

View File

@ -0,0 +1,13 @@
<section class="section">
<div class="container">
<h1 class="title">
Hello World
</h1>
<p class="subtitle">
<span class="icon">
<i class="fas fa-home"></i>
</span>
My first website with <strong>Bulma</strong>!
</p>
</div>
</section>

View File

@ -1,5 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
Rails.application.routes.draw do Rails.application.routes.draw do
root 'pages#home' root 'counter#show'
get '/cluster', to: 'cluster#new'
post '/cluster', to: 'cluster#create'
end end

View File

@ -0,0 +1 @@
import "./cluster-list.pcss";

View File

@ -0,0 +1 @@
/* placeholder */

View File

@ -0,0 +1,6 @@
<div class="create-cluster-form">
<%= form_tag cluster_path, method: :post do %>
<%= text_field_tag :cluster, "", class: "create-cluster-form--input", placeholder: "Cluster Name", autofocus: true, required: true %>
<%= submit_tag "Create", class: "create-cluster-form--submit" %>
<% end %>
</div>

View File

@ -0,0 +1 @@
import "./cluster-new.pcss";

View File

@ -0,0 +1,41 @@
.create-cluster-form {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
& input {
width: 100%;
padding: 12px 0;
border: 1px solid rgba(0, 0, 0, 0.1);
font-size: 18px;
text-align: center;
outline: none;
transition: border-color 150ms;
box-sizing: border-box;
&:hover,
&:focus {
border: 1px solid #3f94f9;
}
}
& input[type="submit"] {
width: 100%;
margin-top: 6px;
padding: 12px 0;
background: #3f94f9;
border: 1px solid #3f94f9;
color: white;
font-size: 18px;
outline: none;
transition: opacity 150ms;
cursor: pointer;
&:hover,
&:focus {
opacity: 0.7;
}
}
}

View File

@ -1,2 +1,5 @@
import "init"; import "init";
import "components/page/page"; import "components/page/page";
import "components/cluster-list/cluster-list";
import "components/cluster-new/cluster-new";

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ClusterControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class CounterControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class SessionControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end