Skip to content
Snippets Groups Projects
Commit 6c7d4c0c authored by Dore, Kieran D (UG - Comp Sci & Elec Eng)'s avatar Dore, Kieran D (UG - Comp Sci & Elec Eng)
Browse files

Finished styling the login page

parent 1ffec278
No related branches found
No related tags found
No related merge requests found
let listFormActive = false; let listFormActive = false;
function removeList(id, elem){
getButton("/del_lst", "list_id", id);
elem.closest(".listCon").remove();
}
function toggleNewListForm(button){ function toggleNewListForm(button){
let listForm = document.getElementById("newListForm"); let listForm = document.getElementById("newListForm");
......
...@@ -6,7 +6,6 @@ let nextChangeNames = []; ...@@ -6,7 +6,6 @@ let nextChangeNames = [];
let timer; let timer;
function performUpdate(){ function performUpdate(){
$.ajax({ $.ajax({
url: "/change_prods", url: "/change_prods",
data: { data: {
......
...@@ -14,5 +14,17 @@ ...@@ -14,5 +14,17 @@
//= require activestorage //= require activestorage
//= require turbolinks //= require turbolinks
//= require jquery //= require jquery
//= require bootstrap-sprockets ////= require bootstrap-sprockets
//= require_tree . //= require_tree .
function getButton(url, name, value){
let dataHash = {};
dataHash[name] = value;
$.ajax({
url: url,
data: dataHash,
type: "get",
sucess: $("#lists").load(" #lists")
});
}
...@@ -19,6 +19,32 @@ $inputBackground: #eeeeee; ...@@ -19,6 +19,32 @@ $inputBackground: #eeeeee;
$borderRad1: 5px; $borderRad1: 5px;
$textSize: 20px; $textSize: 20px;
$padding: 10px; $padding: 10px;
$footerHeight: 100px;
.iconButton {
border: 0;
background-color: transparent;
font-size: 30px;
color: #434343;
}
footer {
width: 100%;
height: $footerHeight;
position: fixed;
bottom: 0;
left: 0;
background-color: $inputBackground;
box-sizing: border-box;
text-align: center;
padding-top: 20px;
color: #6f6f6f;
font-size: 30px;
}
.text {
font-size: $textSize;
}
.inputText { .inputText {
background-color: $inputBackground; background-color: $inputBackground;
...@@ -39,6 +65,11 @@ $padding: 10px; ...@@ -39,6 +65,11 @@ $padding: 10px;
margin: 5px; margin: 5px;
} }
.everything {
padding-bottom: $footerHeight;
}
body { body {
font-family: Arial, serif; font-family: Arial, serif;
margin: 0;
} }
\ No newline at end of file
...@@ -2,6 +2,22 @@ ...@@ -2,6 +2,22 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
@import "application";
.listCon {
background-color: #edeffa;
display: flex;
font-size: $textSize;
padding: 5px;
justify-content: space-between;
margin-bottom: 5px;
align-items: center;
}
.listButtons {
display: flex;
}
.mainTitle { .mainTitle {
font-size: 100px; font-size: 100px;
display: block; display: block;
...@@ -19,7 +35,7 @@ ...@@ -19,7 +35,7 @@
display: flex; display: flex;
} }
.loginOptions > .button1{ .loginOptions > .button1 {
flex-grow: 1; flex-grow: 1;
} }
......
...@@ -10,9 +10,13 @@ class HomeController < ApplicationController ...@@ -10,9 +10,13 @@ class HomeController < ApplicationController
end end
end end
def login def del_lst
List.destroy(params[:list_id]) unless List.find(params[:list_id]).blank?
redirect_to homepage_path
end end
def login; end
def logincheck def logincheck
if params[:email].blank? || params[:password].blank? if params[:email].blank? || params[:password].blank?
redirect_to root_path, alert: 'Blank fields' redirect_to root_path, alert: 'Blank fields'
...@@ -39,13 +43,11 @@ class HomeController < ApplicationController ...@@ -39,13 +43,11 @@ class HomeController < ApplicationController
redirect_to root_path, alert: 'Email already in use' redirect_to root_path, alert: 'Email already in use'
elsif params[:email].blank? || params[:name].blank? || params[:password].blank? elsif params[:email].blank? || params[:name].blank? || params[:password].blank?
redirect_to root_path, alert: 'Empty fields' redirect_to root_path, alert: 'Empty fields'
else elsif params[:email] =~ URI::MailTo::EMAIL_REGEXP
if params[:email] =~ URI::MailTo::EMAIL_REGEXP session[:user_id] = User.create(email: params[:email], name: params[:name], password: params[:password]).id
session[:user_id] = User.create(email: params[:email], name: params[:name], password: params[:password]).id redirect_to homepage_path
redirect_to homepage_path else
else redirect_to root_path, alert: 'Invalid email'
redirect_to root_path, alert: 'Invalid email'
end
end end
end end
end end
...@@ -33,7 +33,7 @@ class ListviewController < ApplicationController ...@@ -33,7 +33,7 @@ class ListviewController < ApplicationController
end end
def new_prod def new_prod
valid_quantity = !params[:quantity].blank? && Integer(params[:quantity]) >= 1 valid_quantity = (!params[:quantity].blank? && Integer(params[:quantity]) >= 1) || params[:quantity].blank?
valid_name = !params[:name].blank? valid_name = !params[:name].blank?
if valid_quantity && valid_name if valid_quantity && valid_name
......
...@@ -4,12 +4,17 @@ ...@@ -4,12 +4,17 @@
%br %br
%br %br
- List.all.user(@user_id).each do |list| #lists
%p= list.name - List.all.user(@user_id).each do |list|
= form_tag listview_path, method: 'get' do .listCon
%input{:type => "hidden", :value => list.id, :name => :list_id} %p{class: "text"}= list.name
%input{:type => "submit", :value => "View list"} .listButtons
%br = form_tag listview_path, method: 'get' do
%input{type: "hidden", value: list.id, name: :list_id}
%input{type: "submit", value: "View list", class: "button1"}
= button_tag(class: "iconButton", onclick: "removeList(" + String(list.id) + ", this)") do
%i.fas.fa-trash
%br %br
%br %br
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
%br %br
- flash.each do |key, value| - flash.each do |key, value|
= content_tag :div, content_tag(:p, value), id: "#{key}" unless value.blank? = content_tag :div, content_tag(:p, value, class: "text"), id: "#{key}" unless value.blank?
= form_tag login_path, method: 'post', id: "loginForm", class: "loginForm" do = form_tag login_path, method: 'post', id: "loginForm", class: "loginForm" do
= email_field_tag :email, "", required: true, class: "inputText", placeholder: "Email" = email_field_tag :email, "", required: true, class: "inputText", placeholder: "Email"
......
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
= stylesheet_link_tag 'application.css', media: 'all', 'data-turbolinks-track' => true = stylesheet_link_tag 'application.css', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application.js', 'data-turbolinks-track' => true = javascript_include_tag 'application.js', 'data-turbolinks-track' => true
= csrf_meta_tags = csrf_meta_tags
%script{src: "https://kit.fontawesome.com/caf9832e26.js", crossorigin: "anonymous"}
%body %body
=render 'shared/header'
= yield .everything
= yield
%br
=render 'shared/footer' =render 'shared/footer'
\ No newline at end of file
%footer %footer
%p= "Listify" Listify
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,7 @@ Rails.application.routes.draw do ...@@ -7,6 +7,7 @@ Rails.application.routes.draw do
post 'new_acc', to: 'home#new_acc' post 'new_acc', to: 'home#new_acc'
get 'homepage', to: 'home#homepage' get 'homepage', to: 'home#homepage'
post 'new_lst', to: 'home#new_lst' post 'new_lst', to: 'home#new_lst'
get 'del_lst', to: 'home#del_lst'
get 'listview', to: 'listview#listview' get 'listview', to: 'listview#listview'
post 'new_prod', to: 'listview#new_prod' post 'new_prod', to: 'listview#new_prod'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment