Scalfolding out the counter cluster groups.
This commit is contained in:
parent
dd1ccffb0a
commit
23b20e1c37
19
app/controllers/cluster_controller.rb
Normal file
19
app/controllers/cluster_controller.rb
Normal 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
|
10
app/controllers/counter_controller.rb
Normal file
10
app/controllers/counter_controller.rb
Normal 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
|
2
app/helpers/cluster_helper.rb
Normal file
2
app/helpers/cluster_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module ClusterHelper
|
||||||
|
end
|
2
app/helpers/counter_helper.rb
Normal file
2
app/helpers/counter_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module CounterHelper
|
||||||
|
end
|
2
app/helpers/session_helper.rb
Normal file
2
app/helpers/session_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module SessionHelper
|
||||||
|
end
|
4
app/views/cluster/new.html.erb
Normal file
4
app/views/cluster/new.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<%= c("page") do %>
|
||||||
|
<%= c("cluster-list") %>
|
||||||
|
<%= c("cluster-new") %>
|
||||||
|
<% end %>
|
13
app/views/counter/show.html.erb
Normal file
13
app/views/counter/show.html.erb
Normal 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>
|
|
@ -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
|
||||||
|
|
1
frontend/components/cluster-list/cluster-list.js
Normal file
1
frontend/components/cluster-list/cluster-list.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import "./cluster-list.pcss";
|
1
frontend/components/cluster-list/cluster-list.pcss
Normal file
1
frontend/components/cluster-list/cluster-list.pcss
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/* placeholder */
|
6
frontend/components/cluster-new/_cluster-new.html.erb
Normal file
6
frontend/components/cluster-new/_cluster-new.html.erb
Normal 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>
|
1
frontend/components/cluster-new/cluster-new.js
Normal file
1
frontend/components/cluster-new/cluster-new.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import "./cluster-new.pcss";
|
41
frontend/components/cluster-new/cluster-new.pcss
Normal file
41
frontend/components/cluster-new/cluster-new.pcss
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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";
|
||||||
|
|
7
test/controllers/cluster_controller_test.rb
Normal file
7
test/controllers/cluster_controller_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ClusterControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/controllers/counter_controller_test.rb
Normal file
7
test/controllers/counter_controller_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class CounterControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/controllers/session_controller_test.rb
Normal file
7
test/controllers/session_controller_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class SessionControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Reference in New Issue
Block a user