Skip to content

Commit

Permalink
fix: Tweaks nos conflitos
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzer0 committed Jun 16, 2024
2 parents 4a56916 + e5212fe commit 77feefa
Show file tree
Hide file tree
Showing 47 changed files with 941 additions and 730 deletions.
32 changes: 16 additions & 16 deletions backend/app/controllers/acaos_controller.rb
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
class AcaosController < ApplicationController
before_action :set_acao, only: %i[ show edit update destroy ]
before_action :set_acao, only: %i[show edit update destroy]

# GET /acaos or /acaos.json
def index
@acaos = Acao.all
render json: @acaos
end

# GET /acaos/1 or /acaos/1.json
def show
end
def show; end

# GET /acaos/new
def new
@acao = Acao.new
end

# GET /acaos/1/edit
def edit
end
def edit; end

# POST /acaos or /acaos.json
def create
@acao = Acao.new(acao_params)

respond_to do |format|
if @acao.save
format.html { redirect_to acao_url(@acao), notice: "Acao was successfully created." }
format.html { redirect_to acao_url(@acao), notice: 'Acao was successfully created.' }
format.json { render :show, status: :created, location: @acao }
else
format.html { render :new, status: :unprocessable_entity }
Expand All @@ -38,7 +37,7 @@ def create
def update
respond_to do |format|
if @acao.update(acao_params)
format.html { redirect_to acao_url(@acao), notice: "Acao was successfully updated." }
format.html { redirect_to acao_url(@acao), notice: 'Acao was successfully updated.' }
format.json { render :show, status: :ok, location: @acao }
else
format.html { render :edit, status: :unprocessable_entity }
Expand All @@ -52,19 +51,20 @@ def destroy
@acao.destroy!

respond_to do |format|
format.html { redirect_to acaos_url, notice: "Acao was successfully destroyed." }
format.html { redirect_to acaos_url, notice: 'Acao was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_acao
@acao = Acao.find(params[:id])
end

# Only allow a list of trusted parameters through.
def acao_params
params.fetch(:acao, {})
end
# Use callbacks to share common setup or constraints between actions.
def set_acao
@acao = Acao.find(params[:id])
end

# Only allow a list of trusted parameters through.
def acao_params
params.require(:acao).permit(:titulo, :valor, :tipo, :mes, :ano)
end
end
1 change: 0 additions & 1 deletion backend/app/models/acao.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
class Acao < ApplicationRecord
belongs_to :user
end
27 changes: 27 additions & 0 deletions backend/app/views/acaos/_acao.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div id="<%= dom_id acao %>">
<p>
<strong>Titulo:</strong>
<%= acao.titulo %>
</p>

<p>
<strong>Valor:</strong>
<%= acao.valor %>
</p>

<p>
<strong>Tipo:</strong>
<%= acao.tipo %>
</p>

<p>
<strong>Mes:</strong>
<%= acao.mes %>
</p>

<p>
<strong>Ano:</strong>
<%= acao.ano %>
</p>

</div>
2 changes: 2 additions & 0 deletions backend/app/views/acaos/_acao.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json.extract! acao, :id, :titulo, :valor, :tipo, :mes, :ano, :created_at, :updated_at
json.url acao_url(acao, format: :json)
42 changes: 42 additions & 0 deletions backend/app/views/acaos/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<%= form_with(model: acao) do |form| %>
<% if acao.errors.any? %>
<div style="color: red">
<h2><%= pluralize(acao.errors.count, "error") %> prohibited this acao from being saved:</h2>

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

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

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

<div>
<%= form.label :tipo, style: "display: block" %>
<%= form.check_box :tipo %>
</div>

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

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

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

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

<br>

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

<h1>Acaos</h1>

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

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

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

<br>

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

<%= render @acao %>

<div>
<%= link_to "Edit this acao", edit_acao_path(@acao) %> |
<%= link_to "Back to acaos", acaos_path %>

<%= button_to "Destroy this acao", @acao, method: :delete %>
</div>
1 change: 1 addition & 0 deletions backend/app/views/acaos/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.partial! "acaos/acao", acao: @acao
2 changes: 2 additions & 0 deletions backend/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Rails.application.routes.draw do
resources :acessos
resources :acaos
resources :storages
resources :eventos
resources :reuniaos
Expand All @@ -12,6 +13,7 @@
post '/documentos/delete', to: 'documentos#destroy'
post '/storages/delete', to: 'storages#destroy'
post '/storages/edit', to: 'storages#update'
post '/acaos/delete', to: 'acaos#destroy'

resources :tarefas
resources :acaos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ def change
create_table :acaos do |t|
t.string :titulo
t.float :valor
t.boolean :type
t.string :data
t.references :user, null: false, foreign_key: true
t.boolean :tipo
t.string :mes
t.string :ano

t.timestamps
end
Expand Down
11 changes: 7 additions & 4 deletions backend/db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backend/test/controllers/acaos_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AcaosControllerTest < ActionDispatch::IntegrationTest

test "should create acao" do
assert_difference("Acao.count") do
post acaos_url, params: { acao: { } }
post acaos_url, params: { acao: { ano: @acao.ano, mes: @acao.mes, tipo: @acao.tipo, titulo: @acao.titulo, valor: @acao.valor } }
end

assert_redirected_to acao_url(Acao.last)
Expand All @@ -34,7 +34,7 @@ class AcaosControllerTest < ActionDispatch::IntegrationTest
end

test "should update acao" do
patch acao_url(@acao), params: { acao: { } }
patch acao_url(@acao), params: { acao: { ano: @acao.ano, mes: @acao.mes, tipo: @acao.tipo, titulo: @acao.titulo, valor: @acao.valor } }
assert_redirected_to acao_url(@acao)
end

Expand Down
12 changes: 6 additions & 6 deletions backend/test/fixtures/acaos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
one:
titulo: MyString
valor: 1.5
type: false
data: MyString
user: one
tipo: false
mes: MyString
ano: MyString

two:
titulo: MyString
valor: 1.5
type: false
data: MyString
user: two
tipo: false
mes: MyString
ano: MyString
10 changes: 10 additions & 0 deletions backend/test/system/acaos_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class AcaosTest < ApplicationSystemTestCase
visit acaos_url
click_on "New acao"

fill_in "Ano", with: @acao.ano
fill_in "Mes", with: @acao.mes
check "Tipo" if @acao.tipo
fill_in "Titulo", with: @acao.titulo
fill_in "Valor", with: @acao.valor
click_on "Create Acao"

assert_text "Acao was successfully created"
Expand All @@ -24,6 +29,11 @@ class AcaosTest < ApplicationSystemTestCase
visit acao_url(@acao)
click_on "Edit this acao", match: :first

fill_in "Ano", with: @acao.ano
fill_in "Mes", with: @acao.mes
check "Tipo" if @acao.tipo
fill_in "Titulo", with: @acao.titulo
fill_in "Valor", with: @acao.valor
click_on "Update Acao"

assert_text "Acao was successfully updated"
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion view/src/components/Header/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ header {
.navHeader {
display: flex;
align-items: center;

}

.linksHeader {
Expand Down
16 changes: 10 additions & 6 deletions view/src/components/Kanban/Kanban.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.kanban {
text-align: center;
margin-left: 120px;

}

.bntTarefa {
border: none;
background-color: #414191;
color: white;
font-size: 16px;
font-size: 15px;
padding: 9px 22px;
border-radius: 6px;
cursor: pointer;
Expand Down Expand Up @@ -42,6 +42,7 @@
text-align: center;
border-radius: 5px;
margin-bottom: 10px;
font-size: 13px;
}

.tarefaItem {
Expand All @@ -59,6 +60,7 @@
.tarefaItem p {
margin: 5px 0;
color: black;
font-size: 13px;
}

.close {
Expand Down Expand Up @@ -91,7 +93,9 @@
}

.separador {
height: 1px;
background-color: black; /* Ou qualquer cor desejada */
margin: 10px 0; /* Adapte conforme necessário */
}
height: 1px;
background-color: black;
/* Ou qualquer cor desejada */
margin: 10px 0;
/* Adapte conforme necessário */
}
6 changes: 3 additions & 3 deletions view/src/components/Kanban/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function Kanban() {
setQuem('');
}
};


const handleRemoveTarefa = (column, index) => {
const updatedTarefas = [...tarefas[column]];
Expand Down Expand Up @@ -113,8 +113,8 @@ function Kanban() {
setCurrentColumn(column); // Define a coluna atual para uso na edição
setShowPopup(true); // Mostrar o popup de edição
};



return (
<div className='kanban'>
Expand Down
Loading

0 comments on commit 77feefa

Please sign in to comment.