Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/controllers/receipts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def create
include_spacing: params[:upload_method] != :receipt_center,
success: "#{"Receipt".pluralize(params[file_param].length)} added!",
global_paste: !@receiptable,
turbo: true
turbo: true,
ledger_instance: @ledger_instance
}
if @receiptable
receipt_upload_form_config[:enable_linking] = true
Expand Down Expand Up @@ -178,7 +179,7 @@ def create
partial: "receipts/form_v3", locals: {
upload_method: "receipt_center",
restricted_dropzone: true,
error: e.message
error: e.message, ledger_instance: @ledger_instance
}
)
)
Expand Down Expand Up @@ -309,7 +310,7 @@ def generate_streams
turbo_stream.replace(
"action-wrapper",
partial: "reimbursement/reports/actions",
locals: { report: @receiptable.report, user: @receiptable.report.user }
locals: { report: @receiptable.report, user: @receiptable.report.user, event: @event }
)
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/reimbursement/expenses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def blankslate_turbo_stream
end

def actions_turbo_stream
turbo_stream.replace("action-wrapper", partial: "reimbursement/reports/actions", locals: { report: @expense.report, user: @expense.report.user })
turbo_stream.replace("action-wrapper", partial: "reimbursement/reports/actions", locals: { report: @expense.report, user: @expense.report.user, event: @event })
end

EXPENSE_TYPE_MAP = [Reimbursement::Expense, Reimbursement::Expense::Mileage, Reimbursement::Expense::Fee].index_by(&:to_s).freeze
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/ledger_audits/tasks/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<div style="max-width: 600px; margin-left: auto; margin-right: auto;" class="mt4">
<h3>HCB Code Comments</h3>
<%= render "comments/list", comments: @hcb_code.comments %>
<%= render "comments/form", commentable: @hcb_code %>
<%= render "comments/form", commentable: @hcb_code, comment: @comment, popover: @popover %>
</div>

<style>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/transaction.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
receiptable: @canonical_transaction.local_hcb_code,
upload_method: "attach_receipt_page",
turbo: false,
redirect_url: ledger_admin_index_path
redirect_url: ledger_admin_index_path, ledger_instance: @ledger_instance
} %>
</div>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/canonical_pending_transactions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@
enable_linking: true,
upload_method: "transaction_page",
include_spacing: true,
turbo: false
turbo: false, ledger_instance: @ledger_instance
} %>

<h2>Comments</h2>
<%= render "comments/list", comments: @hcb_code.comments %>
<%= render "comments/form", commentable: @hcb_code %>
<%= render "comments/form", commentable: @hcb_code, comment: @comment, popover: @popover %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/card_grants/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@
<% if policy(@card_grant.comments.build).create? %>
<h2>Comments</h2>
<%= render "comments/list", comments: @card_grant.comments, show_blankslate: true %>
<%= render "comments/form", commentable: @card_grant %>
<%= render "comments/form", commentable: @card_grant, comment: @comment, popover: @popover %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/comments/_comments.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%# locals: () %>
<%# locals: (comment: nil, commentable: nil, comments: nil, popover: nil) %>

<%= render "comments/list", comments: @comments || [] %>
<%= render "comments/form", commentable: @commentable if current_user %>
<%= render "comments/list", comments: comments || [] %>
<%= render "comments/form", commentable: commentable, comment: comment, popover: popover if current_user %>
12 changes: 6 additions & 6 deletions app/views/comments/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%# locals: (commentable:, admin_only: nil, comment: nil, submit_text: nil) %>
<%# locals: (commentable:, admin_only: nil, comment: nil, submit_text: nil, popover: nil) %>

<%= form_with model: @comment&.new_record? ? [@comment.commentable, @comment] : @comment || [commentable, Comment.new] do |form| %>
<%= form_with model: comment&.new_record? ? [comment.commentable, comment] : comment || [commentable, Comment.new] do |form| %>
<%= form.hidden_field :redirect_url, value: url_for(only_path: false) %>
<%= form_errors @comment || Comment.new, "message", "We couldn't update your" %>
<%= form_errors comment || Comment.new, "message", "We couldn't update your" %>

<div class="comment__name mt2">
<%= user_mention current_user if organizer_signed_in? %>
Expand All @@ -25,7 +25,7 @@

<div class="flex flex-row mb2 justify-between items-center">

<% if @comment&.persisted? %>
<% if comment&.persisted? %>
<% if comment.file.attached? %>
<div class="field mb0">
<%= link_to "📎 1 attachment", url_for(comment.file), target: "_blank" %>
Expand Down Expand Up @@ -57,7 +57,7 @@

</div>

<% if commentable.shared_commentable? && !@comment&.persisted? %>
<% if commentable.shared_commentable? && !comment&.persisted? %>
<% disbursement = commentable.outgoing_disbursement || commentable.incoming_disbursement %>
<div data-controller="commentable"
data-commentable-shared-type-value="<%= commentable.shared_commentable.class.to_s %>"
Expand All @@ -83,7 +83,7 @@
<% end %>
<% end %>

<% unless @popover %>
<% unless popover %>
<%= turbo_stream_from commentable, :comments %>
<% turbo_refreshes_with method: :morph, scroll: :preserve %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/comments/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

<h1>Edit note</h1>

<%= render "comments/form", comment: @comment, commentable: @commentable %>
<%= render "comments/form", comment: @comment, commentable: @commentable, popover: @popover %>
2 changes: 1 addition & 1 deletion app/views/comments/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

<h1>New note</h1>

<%= render "comments/form", commentable: @commentable if current_user %>
<%= render "comments/form", commentable: @commentable, comment: @comment, popover: @popover if current_user %>
4 changes: 2 additions & 2 deletions app/views/disbursements/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@
enable_linking: true,
upload_method: "transaction_page",
include_spacing: true,
turbo: false
turbo: false, ledger_instance: @ledger_instance
} %>

<h2>Comments</h2>
<%= render "comments/list", comments: @disbursement.all_comments, viewing_commentable: @disbursement %>
<%= render "comments/form", commentable: @disbursement, submit_text: "Add comment (visible to both organizations)" %>
<%= render "comments/form", commentable: @disbursement, submit_text: "Add comment (visible to both organizations)", comment: @comment, popover: @popover %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/events/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<% elsif @settings_tab == "audit_log" %>
<%= render "events/settings/audit_log", event: @event, activities: @activities, activities_before: @activities_before %>
<% elsif @settings_tab == "admin" && auditor_signed_in? %>
<%= render "events/settings/admin", event: @event %>
<%= render "events/settings/admin", event: @event, comment: @comment, popover: @popover %>
<% else %>
<%= render "events/settings/account_info", event: @event %>
<%= render "events/settings/details", event: @event %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/events/settings/_admin.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%# locals: (event:) %>
<%# locals: (event:, comment: nil, popover: nil) %>

<% disabled = !admin_signed_in? %>

Expand All @@ -7,9 +7,9 @@
<strong>Organization’s slug history:</strong> <%= event.slugs.pluck(:slug).join ", " %>
<% end %>

<% if @event.application.present? %>
<% if event.application.present? %>
<% admin_tool "p-3" do %>
<%= link_to "Go to organization's application", submission_application_path(@event.application) %>
<%= link_to "Go to organization's application", submission_application_path(event.application) %>
<% end %>
<% end %>

Expand Down Expand Up @@ -234,7 +234,7 @@

<% admin_tool "p-3" do %>
<%= render "comments/list", comments: event.comments, show_blankslate: true %>
<%= render "comments/form", commentable: event, admin_only: true %>
<%= render "comments/form", commentable: event, admin_only: true, comment: comment, popover: popover %>
<% end %>

</div>
18 changes: 9 additions & 9 deletions app/views/hcb_codes/_admin_tools.html.erb
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<%# locals: () %>
<%# locals: (hcb_code:) %>

<%= turbo_frame_tag "#{@hcb_code.public_id}:admin_tools", target: "_top" do %>
<%= turbo_frame_tag "#{hcb_code.public_id}:admin_tools", target: "_top" do %>
<% admin_tool("mt3 pb1") do %>
<div class="overflow-x-auto mb3 max-w-full">
<table class="mb2">
<tr>
<th>HCB CODE</th>
<% if @hcb_code.ledger_item.present? %><th class="w-full">LEDGER ITEM</th><% end %>
<% if hcb_code.ledger_item.present? %><th class="w-full">LEDGER ITEM</th><% end %>
</tr>
<tr>
<td><%= @hcb_code.hcb_code %></td>
<% if @hcb_code.ledger_item.present? %><td><%= link_to @hcb_code.ledger_item.hashid, ledger_item_path(@hcb_code.ledger_item) %></td><% end %>
<td><%= hcb_code.hcb_code %></td>
<% if hcb_code.ledger_item.present? %><td><%= link_to hcb_code.ledger_item.hashid, ledger_item_path(hcb_code.ledger_item) %></td><% end %>
</tr>
</table>
<%= render(
partial: "transactions_table",
locals: {
canonical_transactions:
@hcb_code
hcb_code
.canonical_pending_transactions
.preload(:category)
.strict_loading,
canonical_pending_transactions:
@hcb_code
hcb_code
.canonical_transactions
.preload(:category)
.strict_loading
.to_a,
t_transaction: @hcb_code.ach_transfer&.t_transaction
t_transaction: hcb_code.ach_transfer&.t_transaction
}
) %>
</div>
<% end %>
<%= render partial: "application/admin_viewer", locals: { record: @hcb_code } %>
<%= render partial: "application/admin_viewer", locals: { record: hcb_code } %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/hcb_codes/_pending_transaction_history.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%# locals: () %>
<%# locals: (hcb_code:) %>

<h2 class="mt-0">Pending transaction history</h2>

<% if @hcb_code.canonical_pending_transactions.exists? %>
<% if hcb_code.canonical_pending_transactions.exists? %>
<article class="table-container">
<table>
<thead>
Expand All @@ -14,7 +14,7 @@
</tr>
</thead>
<tbody>
<% @hcb_code.canonical_pending_transactions.each do |ct| %>
<% hcb_code.canonical_pending_transactions.each do |ct| %>
<tr>
<td><%= format_date ct.date %></td>
<td><%= ct.smart_memo %></td>
Expand Down
6 changes: 3 additions & 3 deletions app/views/hcb_codes/_transaction_history.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%# locals: () %>
<%# locals: (hcb_code:) %>

<h2 class="mt-0">Transaction history</h2>

<% if @hcb_code.canonical_transactions.exists? %>
<% if hcb_code.canonical_transactions.exists? %>
<article class="table-container mb-2">
<table>
<thead>
Expand All @@ -14,7 +14,7 @@
</tr>
</thead>
<tbody>
<% @hcb_code.canonical_transactions.each do |ct| %>
<% hcb_code.canonical_transactions.each do |ct| %>
<tr>
<td><%= format_date ct.date %></td>
<td><%= ct.smart_memo %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/hcb_codes/attach_receipt.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
show_banner: true,
secret: @secret,
global_paste: true,
turbo: false
turbo: false, ledger_instance: @ledger_instance
} %>

<% admin_tool("mt2") do %>
Expand Down
11 changes: 6 additions & 5 deletions app/views/hcb_codes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<% title @hcb_code.pretty_title(show_event_name: false, show_amount: true, event: @event) unless content_for? :title %>

<%= turbo_frame_tag @hcb_code.public_id, target: "_top" do %>
<%= render partial: "hcb_codes/admin_tools" %>
<%= render partial: "hcb_codes/admin_tools", locals: { hcb_code: @hcb_code } %>
<div id="rich_metadata">
<%= render partial: "hcb_codes/rich_metadata" %>
</div>
Expand All @@ -31,7 +31,8 @@
enable_linking: true,
upload_method: "transaction_page",
include_spacing: true,
turbo: true
turbo: true,
ledger_instance: @ledger_instance
}
receipt_upload_form_config[:restricted_dropzone] = true if @frame
receipt_upload_form_config[:inline_linking] = true if @frame
Expand All @@ -57,11 +58,11 @@
</p>
<% end %>
<% end %>
<%= render "comments/form", commentable: @hcb_code %>
<%= render "comments/form", commentable: @hcb_code, comment: @comment, popover: @popover %>

<% admin_tool("mt2 p-3") do %>
<%= render partial: "hcb_codes/transaction_history" %>
<%= render partial: "hcb_codes/pending_transaction_history" %>
<%= render partial: "hcb_codes/transaction_history", locals: { hcb_code: @hcb_code } %>
<%= render partial: "hcb_codes/pending_transaction_history", locals: { hcb_code: @hcb_code } %>
<% end %>

<% admin_tool("p-2 my-3") do %>
Expand Down
5 changes: 3 additions & 2 deletions app/views/ledger/items/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
enable_linking: true,
upload_method: "transaction_page",
include_spacing: true,
turbo: true
turbo: true,
ledger_instance: @ledger_instance
}
receipt_upload_form_config[:restricted_dropzone] = true if @frame
receipt_upload_form_config[:inline_linking] = true if @frame
Expand All @@ -133,7 +134,7 @@
</p>
<% end %>
<% end %>
<%= render "comments/form", commentable: @item.hcb_code %>
<%= render "comments/form", commentable: @item.hcb_code, comment: @comment, popover: @popover %>
<% end %>

<% admin_tool("p-2 my-3") do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/my/inbox.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
upload_method: "receipt_center",
restricted_dropzone: true,
turbo: true,
global_paste: true
global_paste: true, ledger_instance: @ledger_instance
} %>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@
</article>
</div>

<%= render "comments/comments" %>
<%= render "comments/comments", comment: @comment, commentable: @commentable, comments: @comments, popover: @popover %>
4 changes: 2 additions & 2 deletions app/views/payments/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
upload_method: "payment_page",
include_spacing: true,
redirect_url: payment_path(@payment),
turbo: false
turbo: false, ledger_instance: @ledger_instance
} %>

<%= render "comments/list", comments: @payment.all_comments, viewing_commentable: @payment %>
<%= render "comments/form", commentable: @payment if current_user %>
<%= render "comments/form", commentable: @payment, comment: @comment, popover: @popover if current_user %>
<% end %>
8 changes: 4 additions & 4 deletions app/views/receipts/_form_v3.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%# locals: (upload_method:, enable_linking: nil, error: nil, global_paste: nil, include_spacing: nil, inline_linking: nil, popover: nil, receiptable: nil, redirect_url: nil, restricted_dropzone: nil, secret: nil, show_author_img: nil, show_banner: nil, show_receipt_button: nil, success: nil, turbo: "false") %>
<%# locals: (upload_method:, enable_linking: nil, error: nil, global_paste: nil, include_spacing: nil, inline_linking: nil, popover: nil, receiptable: nil, redirect_url: nil, restricted_dropzone: nil, secret: nil, show_author_img: nil, show_banner: nil, show_receipt_button: nil, success: nil, turbo: "false", ledger_instance: nil) %>

<% instance = local_assigns.__id__ %>
<div id="<%= receiptable ? "#{receiptable.id}_" : "" %>receipt_upload_form">
Expand Down Expand Up @@ -50,10 +50,10 @@
<%= form.hidden_field :upload_method, value: upload_method, data: { "file-drop-target" => "uploadMethod" } %>
<%= form.hidden_field :show_receipt_button, value: show_receipt_button %>
<%= form.hidden_field :show_author_img, value: show_author_img %>
<%= form.hidden_field :ledger_instance, value: @ledger_instance %>
<%= form.hidden_field :ledger_instance, value: ledger_instance %>
<%= form.hidden_field :s, value: secret %>

<%= form.file_field @ledger_instance.present? ? "file_#{@ledger_instance}" : "file",
<%= form.file_field ledger_instance.present? ? "file_#{ledger_instance}" : "file",
multiple: true,
include_hidden: false,
required: true,
Expand All @@ -70,7 +70,7 @@
array << "bg-error" if error
array << "disabled" if receiptable && current_user && !ReceiptablePolicy.new(current_user, receiptable).upload?
end.join(", ") %>
<%= form.label @ledger_instance.present? ? "file_#{@ledger_instance}" : "file", class: "btn #{additional_classes}", id: "upload-receipt-button" do %>
<%= form.label ledger_instance.present? ? "file_#{ledger_instance}" : "file", class: "btn #{additional_classes}", id: "upload-receipt-button" do %>
<%= inline_icon "cloud-upload" %>
<% if success || error %>
<span id="upload-receipt-button-text"><%= success || error %></span>
Expand Down
Loading
Loading