Skip to content

Commit

Permalink
Style home page following style guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
jodavid444 committed Jun 7, 2023
1 parent a1dad6f commit af2c7f0
Show file tree
Hide file tree
Showing 45 changed files with 369 additions and 213 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ group :development do

# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem 'pry'
gem 'pry-byebug'
end

group :test do
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ GEM
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
byebug (11.1.3)
cancancan (3.5.0)
capybara (3.38.0)
addressable
Expand All @@ -84,6 +85,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
Expand Down Expand Up @@ -143,6 +145,12 @@ GEM
parser (3.2.1.1)
ast (~> 2.4.1)
pg (1.4.6-x64-mingw-ucrt)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.0.1)
puma (5.6.5)
nio4r (~> 2.0)
Expand Down Expand Up @@ -271,6 +279,8 @@ DEPENDENCIES
importmap-rails
jbuilder
pg (~> 1.1)
pry
pry-byebug
puma (~> 5.0)
rails (~> 7.0.4, >= 7.0.4.3)
rspec-rails
Expand Down
Binary file added app/assets/images/favicon.ico
Binary file not shown.
Binary file added app/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 80 additions & 15 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,80 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
@import url('https://fonts.cdnfonts.com/css/proxima-nova-2');

body {
font-family: 'Proxima Nova', sans-serif;
margin: 0;
}

.logo {
width: 29px;
height: 29px;
}

.home-container {
margin: 10px;
}

.home-title {
margin-top: 100px;
text-align: center;
font-size: 32px;
}

.home-title span {
display: inline-flex;
align-items: center;
justify-content: center;
}

.home-texts p {
text-align: center;
}

.home-buttons {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 180px;
}

.home-buttons a {
text-decoration: none;
padding: 15px 0;
text-align: center;
width: 90%;
}

.home-buttons a:first-child {
background-color: #3778c2;
color: white;
border-radius: 3px;
}

.home-buttons a:last-child {
background-color: white;
color: gray;
}

.category-icon {
width: 100px;
height: 100px;
}

.add-category-btn {
display: block;
position: fixed;
bottom: 0;
text-align: center;
width: 100%;
padding: 30px 0;
text-decoration: none;
color: #fff;
background-color: #5fb523;
outline: 1px white solid;
outline-offset: -13px;
}

.height {
height: 80px;
}
1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class ApplicationController < ActionController::Base
before_action :authenticate_user!
protect_from_forgery with: :exception

before_action :update_allowed_parameters, if: :devise_controller?
Expand Down
69 changes: 0 additions & 69 deletions app/controllers/transactions_controller.rb

This file was deleted.

12 changes: 12 additions & 0 deletions app/views/entities/_entity.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div id="<%= dom_id entity %>">
<p>
<strong>Name:</strong>
<%= entity.name %>
</p>

<p>
<strong>Amount:</strong>
<%= entity.amount %>
</p>

</div>
2 changes: 2 additions & 0 deletions app/views/entities/_entity.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json.extract! entity, :id, :name, :amount, :created_at, :updated_at
json.url entity_url(entity, format: :json)
35 changes: 35 additions & 0 deletions app/views/entities/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<%= params[:category_id]%>

<%= form_with(model: entity) do |form| %>
<% if entity.errors.any? %>
<div style="color: red">
<h2><%= pluralize(entity.errors.count, "error") %> prohibited this entity from being saved:</h2>

<ul>
<% entity.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>

<div>
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>
</div>

<div>
<%= form.label :amount, style: "display: block" %>
<%= form.number_field :amount, step: "0.01" %>
</div>

<div>
<%= form.label :category_ids, 'Categories' %>
<%= form.select :category_ids, @categories.map { |category| [category.name, category.id, selected: @category_id == category.id] }, {include_blank: false}, { multiple: true} %>
</div>
<%= form.hidden_field :category_id, value: @category_id %>

<div>
<%= form.submit %>
</div>
<% end %>
10 changes: 10 additions & 0 deletions app/views/entities/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h1>Editing entity</h1>

<%= render "form", entity: @entity %>

<br>

<div>
<%= link_to "Show this entity", @entity %> |
<%= link_to "Back to entities", entities_path %>
</div>
14 changes: 14 additions & 0 deletions app/views/entities/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<p style="color: green"><%= notice %></p>

<h1>Entities</h1>

<div id="entities">
<% @entities.each do |entity| %>
<%= render entity %>
<p>
<%= link_to "Show this entity", entity %>
</p>
<% end %>
</div>

<%= link_to "New entity", new_entity_path %>
1 change: 1 addition & 0 deletions app/views/entities/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.array! @entities, partial: 'entities/entity', as: :entity
9 changes: 9 additions & 0 deletions app/views/entities/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h1>New entity</h1>

<%= render "form", entity: @entity %>

<br>

<div>
<%= link_to "Back to entities", entities_path %>
</div>
10 changes: 10 additions & 0 deletions app/views/entities/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<p style="color: green"><%= notice %></p>

<%= render @entity %>

<div>
<%= link_to "Edit this entity", edit_entity_path(@entity) %> |
<%= link_to "Back to entities", entities_path %>

<%= button_to "Destroy this entity", @entity, method: :delete %>
</div>
1 change: 1 addition & 0 deletions app/views/entities/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.partial! 'entities/entity', entity: @entity
12 changes: 12 additions & 0 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<section class="home-container">
<div>
<div class="home-texts">
<h1 class="home-title">BUDGET <br> <span>TRA <%= image_tag "logo.png", class: 'logo'%> KER<span></h1>
<p>Budget Tracker provides track of daily transaction that helps make wise financial desicions</p>
</div>
<div class="home-buttons">
<%= link_to "LOG IN", new_user_session_path %>
<%= link_to "SIGN UP", new_user_registration_path %>
</div>
</div>
</section>
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= favicon_link_tag 'favicon.ico' %>

<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
Expand Down
27 changes: 0 additions & 27 deletions app/views/transactions/_form.html.erb

This file was deleted.

12 changes: 0 additions & 12 deletions app/views/transactions/_transaction.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/transactions/_transaction.json.jbuilder

This file was deleted.

10 changes: 0 additions & 10 deletions app/views/transactions/edit.html.erb

This file was deleted.

Loading

0 comments on commit af2c7f0

Please sign in to comment.