Skip to content

Commit

Permalink
Merge branch 'feature/proposals-private-notes-replies' into staging-lot2
Browse files Browse the repository at this point in the history
  • Loading branch information
Crashillo committed Jun 19, 2024
2 parents 79d3604 + 311dbe2 commit 05d6615
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,59 +62,68 @@
}

&_notes {
&-grid {
@apply grid grid-cols-2 gap-4 my-4;
.comment,
.comment-reply {
@apply mt-4 p-4 rounded w-full border border-gray-3 space-y-2;

.comment {
@apply p-4 rounded;

background-color: rgba(255, 252, 238, 1);
}
background-color: rgba(255, 252, 238, 1);
}

.comment-reply {
@apply p-4 rounded bg-white border border-gray rounded mt-4;
}
.comment-reply {
@apply bg-white;
}

.comment-actions {
@apply flex items-center gap-4;
.comment-actions {
@apply flex items-center gap-4;

.button[aria-expanded="false"] {
svg:first-of-type {
@apply block;
}
.button[aria-expanded="false"] {
svg:first-of-type {
@apply block;
}

svg:last-of-type {
@apply hidden;
}
svg:last-of-type {
@apply hidden;
}

span:first-of-type {
@apply block;
}
span:first-of-type {
@apply block;
}

span:last-of-type {
@apply hidden;
}
span:last-of-type {
@apply hidden;
}
}

.button[aria-expanded="true"] {
svg:first-of-type {
@apply hidden;
}
.button[aria-expanded="true"] {
svg:first-of-type {
@apply hidden;
}

svg:last-of-type {
@apply block;
}
svg:last-of-type {
@apply block;
}

span:first-of-type {
@apply hidden;
}
span:first-of-type {
@apply hidden;
}

span:last-of-type {
@apply block;
}
span:last-of-type {
@apply block;
}
}
}

.form__wrapper {
@apply pb-4;

label {
@apply text-gray-2 text-sm;
}

textarea {
@apply mt-2;
}
}
}

.card-divider-button {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= decidim_form_for(@notes_form, url: form_path, html: { class: "form form-defaults new_proposal_note" }) do |f| %>
<%= decidim_form_for(@notes_form, url: form_path, html: { class: "form form-defaults new_proposal_note flex flex-col mt-4" }) do |f| %>
<div class="form__wrapper">
<%= f.text_area :body, rows: 4, label: t(".note"), class: "rounded border border-text-gray-2 mt-2 js-mentions" %>
<%= f.text_area :body, rows: 4, label: t(".note"), class: "js-mentions" %>
</div>

<%= f.submit t(".submit"), class: "button button__sm button__secondary" %>
<%= f.submit t(".submit"), class: "button button__sm button__secondary ml-auto" %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<% reply_id = "note#{proposal_note.id}-reply" %>

<div class="comment">
<div class="comment__header">
<div>
<div>
<div class="author">
<strong><span class="author__name"><%= proposal_note.author.name %></span></strong>
<span><%= l proposal_note.created_at, format: :decidim_short %></span>
</div>
</div>
</div>
<div class="comment__header author">
<%= cell "decidim/author", present(proposal_note.author), from: proposal_note, context_actions: [:date] %>
</div>

<div class="comment__content">
<%= simple_format proposal_note.formatted_body %>
</div>
<% reply_id = "note#{proposal_note.id}-reply" %>
<%= render partial: "decidim/proposals/admin/proposal_notes/proposal_note_reply", collection: proposal_note.replies %>

<div class="comment-actions">
<button class="button button__sm button__text-secondary" data-controls="panel-<%= reply_id %>" id="panel-<%= reply_id %>-trigger">
<%= icon "chat-1-line" %>
Expand All @@ -23,6 +18,10 @@
</button>
</div>

<div class="mt-6 space-y-2">
<%= render partial: "decidim/proposals/admin/proposal_notes/proposal_note_reply", collection: proposal_note.replies %>
</div>

<div id="panel-<%= reply_id %>" class="add-comment" data-additional-reply>
<%= render partial: "decidim/proposals/admin/proposal_notes/form", locals: { form_path: reply_proposal_proposal_note_path(proposal, proposal_note, @notes_form) } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<div class="comment-reply">
<div class="comment__header">
<div>
<div>
<div class="author">
<strong><span class="author__name"><%= proposal_note_reply.author.name %></span></strong>
<span><%= l proposal_note_reply.created_at, format: :decidim_short %></span>
</div>
</div>
</div>
<div class="comment__header author">
<%= cell "decidim/author", present(proposal_note_reply.author), from: proposal_note_reply, context_actions: [:date] %>
</div>

<div class="comment__content">
<%= simple_format proposal_note_reply.formatted_body %>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<div class="component__show_notes" data-component="accordion" id="accordion-notes">
<button class="card-divider-button" data-controls="panel-notes" type="button">
<button type="button" class="card-divider-button" data-controls="panel-notes" data-open="true">
<%= icon "arrow-right-s-line" %>
<h2 class="card-title">
<%= t("title", scope: "decidim.proposals.admin.proposal_notes") %>
</h2>
</button>

<div id="panel-notes">
<div class="component__show_notes-grid">
<%= render partial: "decidim/proposals/admin/proposal_notes/proposal_note", collection: proposal.notes.not_reply %>
</div>
<div class="card add-comment">
<div class="card-divider">
<h2 class="card-title"><%= t("leave_your_note", scope: "decidim.proposals.admin.proposal_notes") %></h2>
</div>
<div class="card-section">
<%= render partial: "decidim/proposals/admin/proposal_notes/form", locals: { form_path: proposal_proposal_notes_path(proposal, @notes_form) } %>
</div>
</div>
<%= render partial: "decidim/proposals/admin/proposal_notes/proposal_note", collection: proposal.notes.not_reply %>
<%= render partial: "decidim/proposals/admin/proposal_notes/form", locals: { form_path: proposal_proposal_notes_path(proposal, @notes_form) } %>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
expect(page).to have_admin_callout("successfully")

click_on "Private notes"
within ".component__show_notes-grid .comment:last-child" do
within "#panel-notes .comment:last-child" do
expect(page).to have_content(decidim_sanitize_translated(attributes[:body]))
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
end

click_on "Private notes"
within ".component__show_notes-grid .comment:last-child" do
within "#panel-notes .comment:last-child" do
expect(page).to have_content("This is my note")
end
end
Expand Down

0 comments on commit 05d6615

Please sign in to comment.