Skip to content

Commit

Permalink
Merge pull request #14 from Zilola-Nazarova/review-chenges
Browse files Browse the repository at this point in the history
Review chenges
  • Loading branch information
Zilola-Nazarova authored Nov 23, 2023
2 parents 151aa99 + e807723 commit 358ae7d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 11 deletions.
3 changes: 2 additions & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ body {
font-weight: 100;
display: flex;
flex-direction: column;
min-height: 100vh;
/* stylelint-disable-next-line */
min-height: 100dvh;
min-width: 300px;
}

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ def index
@groups = current_user.groups
end

def show; end

def new
@group = Group.new
end
Expand Down Expand Up @@ -46,6 +44,8 @@ def destroy
end
end

private

def group_params
params.require(:group).permit(:name, :icon)
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/purchases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def destroy
end
end

private

def purchase_params
params.require(:purchase).permit(:name, :amount, group_ids: [])
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= link_to pages_splash_path, data: { turbo: false } do %>
<%= inline_svg_tag "chevron_left.svg", class: "chevron" %>
<% end %>
<h1>sing up</h1>
<h1>sign up</h1>
<div id="whatever">
<%= inline_svg_tag "menu.svg", class: "burger-menu" %>
</div>
Expand Down
8 changes: 2 additions & 6 deletions app/views/purchases/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<%= image_tag(check_url(@group.icon), class: 'icon', alt: 'group_icon') %>
<div class="group_info">
<span class="name"><%= @group.name %></span>

<span class="amount">$<%= total_amount(@group)%></span>
<span class="date"><%= @group.created_at.strftime('%d %b %Y') %></span>
</div>
<% end %>
Expand All @@ -31,7 +31,7 @@
<% end %>

<ul class="purchase_list">
<% @purchases.each do |purchase| %>
<% @purchases.includes([:groups]).each do |purchase| %>
<li>
<%= link_to group_purchase_url(@group, purchase), data: { turbo: false }, class: "item purchase" do %>
<div class="group_info no_margin">
Expand All @@ -54,10 +54,6 @@
</li>
<% end %>
</ul>
<div class="item checkout">
<span class="name">total expences:</span>
<span class="amount">$<%= total_amount(@group)%></span>
</div>
</main>

<section id="actions">
Expand Down
9 changes: 9 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
require "active_support/core_ext/integer/time"

Rails.application.configure do
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
Bullet.add_footer = true
end

# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded any time
Expand Down
7 changes: 7 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
require "active_support/core_ext/integer/time"
require 'bullet'

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!

Rails.application.configure do
config.after_initialize do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs
end

# Settings specified here will take precedence over those in config/application.rb.

# While tests run files are not watched, reloading is not necessary.
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end
end

resources :groups do
resources :groups, only: [:index, :new, :create, :edit, :update, :destroy] do
resources :purchases
end

Expand Down

0 comments on commit 358ae7d

Please sign in to comment.