diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 5a4d6cb13a52c64d76eb1eb779826f432343d4bd..ea49fa4feaf1740625b78c1ba51ddd1848a3603c 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -15,6 +15,7 @@ */ $buttonColor: #545eba; +$buttonHoverColor: #47519f; $buttonDisabledColor: #b9b9bf; $inputBackground: #eeeeee; $inputBackgroundAlt: #ffffff; @@ -109,6 +110,13 @@ footer { padding: $padding; color: white; margin: 5px; + transition: all 200ms; +} + +.button1:hover { + background-color: $buttonHoverColor; + transform: scale(1.06); + transition: all 200ms; } .button1:disabled { diff --git a/app/controllers/contact_controller.rb b/app/controllers/contact_controller.rb index df4c904951e5a0362302940bfe6d93923fda0fd4..802ccb6715f2186ab6307fedff5dedc6b08d1bda 100644 --- a/app/controllers/contact_controller.rb +++ b/app/controllers/contact_controller.rb @@ -7,21 +7,21 @@ class ContactController < ApplicationController end @username = User.find(session[:user_id]).name - @pagename = 'Contact Us' + @pagename = t('.page_title') end def sendmessage if params[:email].blank? - flash[:alert] = 'Blank email' + flash[:alert] = t('.contact.blank_email') redirect_to contact_path elsif params[:message].blank? - flash[:alert] = 'Blank message' + flash[:alert] = t('.contact.blank_message') redirect_to contact_path - elsif params[:email] =~ URI::MailTo::EMAIL_REGEXP + elsif params[:email] =~ URI::MailTso::EMAIL_REGEXP ContactMailer.contact_email(params[:email], params[:message]).deliver_now redirect_to homepage_path else - flash[:alert] = 'Invalid email format' + flash[:alert] = t('.contact.invalid') redirect_to contact_path end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 22f2c950bf905f565e97d485d4f95b67abca8512..59b73f7066adedf7c0c06495e35de56d6059c2c9 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,7 +2,7 @@ class HomeController < ApplicationController def new_lst if List.where(name: params[:name]).exists? - redirect_to homepage_path(alert: 'List "' + params[:name] + '" already exists') + redirect_to homepage_path alert: t('.homepage.existing', name: params[:name]) else user = User.find(session[:user_id]) List.create(name: params[:name], user: user) @@ -17,17 +17,17 @@ class HomeController < ApplicationController def login; @username = '' - @pagename = 'Login' + @pagename = t('.page_title') end def logincheck if params[:email].blank? || params[:password].blank? - redirect_to root_path, alert: 'Blank fields' + redirect_to root_path, alert: t('.login.blank') elsif User.where(email: params[:email], password: params[:password]).exists? session[:user_id] = User.find_by(email: params[:email]).id redirect_to homepage_path else - redirect_to root_path, alert: 'Email or password incorrect' + redirect_to root_path, alert: t('.login.incorrect') end end @@ -38,7 +38,7 @@ class HomeController < ApplicationController user = User.find(session[:user_id]) @username = user.name - @pagename = 'My Lists' + @pagename = t('.page_title') @user_id = user.id end @@ -46,14 +46,14 @@ class HomeController < ApplicationController def new_acc if User.where(email: params[:email]).exists? - redirect_to root_path, alert: 'Email already in use' + redirect_to root_path, alert: t('.login.in_use') elsif params[:email].blank? || params[:name].blank? || params[:password].blank? - redirect_to root_path, alert: 'Empty fields' + redirect_to root_path, alert: t('.login.blank') elsif params[:email] =~ URI::MailTo::EMAIL_REGEXP session[:user_id] = User.create(email: params[:email], name: params[:name], password: params[:password]).id redirect_to homepage_path else - redirect_to root_path, alert: 'Invalid email' + redirect_to root_path, alert: t('.login.invalid') end end end diff --git a/app/views/contact/contact.html.haml b/app/views/contact/contact.html.haml index 37125eed888ed978dc205355ce1857a2d175ff9a..634b24b46179a23056292d938653723a9741bf95 100644 --- a/app/views/contact/contact.html.haml +++ b/app/views/contact/contact.html.haml @@ -1,16 +1,16 @@ - 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 sendmessage_path, method: 'post' do - = email_field_tag :email, @email, required: true, pattern: "[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$", class: "inputText", placeholder: "Email" + = email_field_tag :email, @email, required: true, pattern: "[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$", class: "inputText", placeholder: t('.email') %br - = text_area_tag :message, "", required: true, class: "inputText", placeholder: "Message" + = text_area_tag :message, "", required: true, class: "inputText", placeholder: t('.message') %br - %input{:type => "submit", :value => "Send", class: "button1"} + %input{type: "submit", value: t('.send'), class: "button1"} %br %br = form_tag homepage_path, method: 'get' do - %input{:type => "submit", :value => "Back", class: "button1"} \ No newline at end of file + %input{type: "submit", value: t('.back'), class: "button1"} \ No newline at end of file diff --git a/app/views/home/homepage.html.haml b/app/views/home/homepage.html.haml index c2727072a1d6c9e1824ee2743d4fbf1764615347..32d2bc1b8929c694ea2da5f01f31011f5e7c26fa 100644 --- a/app/views/home/homepage.html.haml +++ b/app/views/home/homepage.html.haml @@ -1,12 +1,13 @@ %br %br + - List.all.user(@user_id).each do |list| .listCon %p{class: "text"}= list.name .listButtons = form_tag listview_path, method: 'get' do %input{type: "hidden", value: list.id, name: :list_id} - %input{type: "submit", value: "View list", class: "button1"} + %input{type: "submit", value: t('.view'), class: "button1"} = button_tag(class: "iconButton", onclick: "removeList(" + String(list.id) + ", this)") do %i.fas.fa-trash @@ -14,19 +15,21 @@ %br %br += content_tag :div, content_tag(:p, params[:alert], class: "text"), id: "#{"alert"}" + = form_tag new_lst_path, method: 'post', id: "newListForm", remote: true do - = text_field_tag :name, "", class: "inputText", placeholder: "New List", oninput: "newListCheck(this)" - %input{type: "submit", value: "Add", class: "button1", id: "newListSubmit", disabled: ""} + = text_field_tag :name, "", class: "inputText", placeholder: t('.new'), oninput: "newListCheck(this)" + %input{type: "submit", value: t('.add'), class: "button1", id: "newListSubmit", disabled: ""} %br %br %br = form_tag contact_path, method: 'get' do - %input{type: "submit", value: "Contact Us", class: "button1"} + %input{type: "submit", value: t('.contact'), class: "button1"} %br %br = form_tag root_path, method: 'get' do - %input{type: "submit", value: "Logout", class: "button1"} + %input{type: "submit", value: t('.logout'), class: "button1"} \ No newline at end of file diff --git a/app/views/home/login.html.haml b/app/views/home/login.html.haml index d59274b32667ee534b0da9f8adfeccb4c368b8b0..ea133f840a0428b6fa14c8fbb5175390425a4173 100644 --- a/app/views/home/login.html.haml +++ b/app/views/home/login.html.haml @@ -1,10 +1,10 @@ -%h1{class: "mainTitle"}= "Listify" +%h1{class: "mainTitle"}= t('.title') %br .login .loginOptions - %button.button1#loginButton{onclick: "showLoginForm();"}= "Login" - %button.button1#createButton{onclick: "showCreateForm();"}= "Create new account" + %button.button1#loginButton{onclick: "showLoginForm();"}= t('.login') + %button.button1#createButton{onclick: "showCreateForm();"}= t('.new_acc') %br @@ -12,19 +12,19 @@ = 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 - = email_field_tag :email, "", required: true, class: "inputText", placeholder: "Email" + = email_field_tag :email, "", required: true, class: "inputText", placeholder: t('.email') %br - = password_field_tag :password, "", required: true, class: "inputText", placeholder: "Password" + = password_field_tag :password, "", required: true, class: "inputText", placeholder: t('.password') %br %br - %input.button1{:type => "submit", :value => "Sign in"} + %input.button1{type: "submit", value: t('.sign_in')} = form_tag new_acc_path, method: 'post', id: "createForm", style: "display: none", class: "loginForm" do - = text_field_tag :name, "", required: true, class: "inputText", placeholder: "Name" + = text_field_tag :name, "", required: true, class: "inputText", placeholder: t('.name') %br - = email_field_tag :email, "", required: true, class: "inputText", placeholder: "Email" + = email_field_tag :email, "", required: true, class: "inputText", placeholder: t('.email') %br - = password_field_tag :password, "", required: true, class: "inputText", placeholder: "Password" + = password_field_tag :password, "", required: true, class: "inputText", placeholder: t('.password') %br %br - %input.button1{type: "submit", value:"Create Account"} \ No newline at end of file + %input.button1{type: "submit", value: t('.new_acc')} \ No newline at end of file diff --git a/app/views/listview/listview.html.haml b/app/views/listview/listview.html.haml index 33d183a3cf4e67f10700c8843f5e43e1b61ec9fe..9ee3d2e69269ef821483cb3fca419419736ecfb3 100644 --- a/app/views/listview/listview.html.haml +++ b/app/views/listview/listview.html.haml @@ -13,15 +13,15 @@ %br = form_tag new_prod_path, method: "post", remote: true, id: "newProductForm" do - = text_field_tag :name, "", required: true, class: "inputText", placeholder: "Name" + = text_field_tag :name, "", required: true, class: "inputText", placeholder: t('.name') %br - = number_field_tag :quantity, "", min: 1, class: "inputText", placeholder: "Quantity" + = number_field_tag :quantity, "", min: 1, class: "inputText", placeholder: t('.quantity') =hidden_field_tag :list_id, @list_id - %input{type: "submit", value: "Add", class: "button1"} + %input{type: "submit", value: t('.add'), class: "button1"} %br %br = form_tag homepage_path, method: 'get' do - %input{type: "submit", value: "Back", class: "button1"} + %input{type: "submit", value: t('.back'), class: "button1"} diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index 5ba005ca84b60f14522d3f442321faa1b054a9b4..36dc127c7ceec0a4a10a2c388eb227767d9b9526 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -1,2 +1 @@ -%footer - Listify \ No newline at end of file +%footer= t('footer') \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 1113506198a97fd2ad73d71cc0c7bd0fdf9a2b8b..596ef9dd5f2334b1a9fc8d8c1cd24aedd6d3a1bd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -32,3 +32,46 @@ en: app_title: Listify app_description: Shoping List + footer: Listify + + listview: + listview: + name: Name + quantity: Quantity + add: Add + back: Back + + contact: + contact: + page_title: Contact Us + email: Email + message: Message + send: Send + back: Back + blank_email: Email is blank + blank_message: Message is blank + invalid: Invalid email address + + home: + homepage: + page_title: My Lists + view: View List + new: New List + add: Add + contact: Contact Us + logout: Logout + existing: List "%{name}" already exists + + + login: + title: Listify + page_title: Login + new_acc: Create new account + email: Email + name: Name + password: Password + sign_in: Sign In + blank: Blank fields + incorrect: Email or password incorrect + invalid: Invalid email + in_use: Email already in use \ No newline at end of file