Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

add new dashboard page using hotwired #349

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

adbatista
Copy link
Contributor

No description provided.

<div class="form-container mb-4">
<!-- Form Header -->
<div class="d-flex justify-content-between align-items-baseline selected-days-container">
<h6>Selecionado (<%= 0 %>)</h6>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n Selecionado

disabled=<%= true %>
type="button"
>
Remover seleção <i class="fa fa-times-circle fa-sm"></i>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n Remover seleção

disabled=<%= true %>
type="button"
>
Apagar <i style='color: "#c61515"' class="fa fa-trash fa-sm"></i>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n Apagar

<div class="row p-3">
<div class="col select-container">
<%= f.select :project_id, Project.all,
include_blank: 'Projeto',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n Projeto

</div>
</div>
<div class="col">
<%= f.submit class: "w-100", value: "Salvar", data: { calendar_target: "deactivatable" } %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n Salvar

@@ -45,6 +68,16 @@ def update
end
end

def calendar
@selected_month = params[:month].present? && params[:year].present? ? "#{params[:year]}/#{params[:month]}/1".to_date : Date.current.beginning_of_month
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract to a method

@punches = Punches::CalendarForm.new(punches_params)
@punches.validate
@punches_of_day = current_user.punches.group_by(&:date)
@current_month_by_weeks = (Date.current.beginning_of_month.beginning_of_week..Date.current.end_of_month.end_of_week).group_by do |date|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're also doing something similar at line 76. Can we abstract it?

@adbatista adbatista linked an issue Jun 1, 2023 that may be closed by this pull request


render :calendar
# @punch = Punch.new(punch_params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decidir se o código comentado fica ou não.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove React in favor of HotWired
3 participants