Skip to content

Commit

Permalink
Fix: All errros related to titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandroq12 committed Mar 3, 2024
1 parent 59c30f1 commit fec188c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/views/groups/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% end %>
<div class="group_page__buttons">
<%= link_to "Add a category", new_user_group_path(current_user), class: "group_page__main_button" %>
<%= link_to "Add a new movement", new_movement_path, class: "group_page__main_button" %>
<%= link_to "Add a new transaction", new_movement_path, class: "group_page__main_button" %>
</div>
<% else %>
<p class="groups_page__no_groups--paragraph">There are no categories.</p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/groups/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<%= form.text_field :name, class: 'form__text-field' %>
</div>

<%= form.submit "Create group", class: 'form__submit-button' %>
<%= form.submit "Create category", class: 'form__submit-button' %>
<%= link_to "Go back", authenticated_root_path, class: 'form__link' %>
<% end %>
8 changes: 4 additions & 4 deletions app/views/groups/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="group">
<%= image_tag("group_icons/#{@group.icon}", alt: @group.icon, class: "group__icon") %>
<h1 class="group__title"><%= @group.name %> Movements</h1>
<h1 class="group__title"><%= @group.name %> Transactions</h1>
<% if @movements.any? %>
<div class="group__sum">Total: $<%= @movements.sum(:amount) %></div>
<div class="group__movements">
Expand All @@ -9,15 +9,15 @@
<p class="movement__name"><%= movement.name %></p>
<p class="movement__date">Date: <%= movement.created_at.strftime("%B %d, %Y at %I:%M%p") %></p>
<p class="movement__amount">Total payment: $<%= movement.amount %></p>
<%= button_to "Delete movement", user_group_movement_path(current_user, @group, movement), method: :delete,
<%= button_to "Delete transaction", user_group_movement_path(current_user, @group, movement), method: :delete,
data: { turbo_confirm: "Are you sure you want to delete this movement?" },
aria: { label: "Delete #{movement.name}" },
class: "movement__delete-btn" %>
</div>
<% end %>
</div>
<% else %>
<p class="group__no-movements">There are no movements, yet.</p>
<p class="group__no-movements">There are no transactions, yet.</p>
<% end %>
<%= link_to "Add a new movement", new_user_group_movement_path(current_user, @group), class: "group__link--add" %>
<%= link_to "Add a new transaction", new_user_group_movement_path(current_user, @group), class: "group__link--add" %>
</div>
12 changes: 9 additions & 3 deletions app/views/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@
<div class="nav_bar__title" role="heading" aria-level="1">
<% if user_signed_in? && current_page?(authenticated_root_path) %>
<h1 class="groups_page__title">Categories</h1>
<% elsif user_signed_in? && (current_page?(new_movement_path)) %>
<h1>Add a new transaction</h1>



<% elsif user_signed_in? && (current_page?(new_user_group_path(current_user)) || current_page?(new_movement_path)) %>
<h1>Add a new group</h1>
<h1>Add a new categoty</h1>

<% elsif user_signed_in? && current_page?(user_group_path(current_user, @group)) %>
<h1 class="movement__title">Movements</h1>
<h1 class="movement__title">Transactions</h1>
<% elsif user_signed_in? && current_page?(new_user_group_movement_path) %>
<h1>Add a new movement</h1>
<h1>Add a new transaction</h1>
<% elsif current_page?(new_user_session_path) || controller_name == "sessions" %>
<h1 class="login_page__title">Login</h1>
<% elsif current_page?(new_user_registration_path) || controller_name == "registrations" %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/movements/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="form--movement">
<% if @movement.errors.any? %>
<div id="error_explanation" class="form__errors">
<h2 class="form__errors-title"><%= pluralize(@movement.errors.count, "error") %> prohibited this movement from being saved:</h2>
<h2 class="form__errors-title"><%= pluralize(@movement.errors.count, "error") %> prohibited this transaction from being saved:</h2>
<ul class="form__errors-list">
<% @movement.errors.full_messages.each do |message| %>
<li class="form__error-message"><%= message %></li>
Expand All @@ -21,7 +21,7 @@
<%= form.label :amount, class: 'form__label' %>
<%= form.number_field :amount, class: 'form__number-field' %>
</div>
<%= form.submit "Add a movement", class: 'form__submit-button' %>
<%= form.submit "Add a transaction", class: 'form__submit-button' %>
<% end %>
<% else %>
<%= form_with(model: @movement, local: true, html: { class: 'form__body' }) do |form| %>
Expand All @@ -38,7 +38,7 @@
<%= form.label :amount, class: 'form__label' %>
<%= form.number_field :amount, class: 'form__number-field' %>
</div>
<%= form.submit "Add a movement", class: 'form__submit-button' %>
<%= form.submit "Add a transaction", class: 'form__submit-button' %>
<% end %>
<% end %>
</div>

0 comments on commit fec188c

Please sign in to comment.