Skip to content

Commit

Permalink
Add new method to Message & Update alert wording
Browse files Browse the repository at this point in the history
  • Loading branch information
luciajanikova committed Jul 18, 2024
1 parent c1ffa38 commit e549eb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/message_draft_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% if @message.correctly_created? %>
<div class="gap-2 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div id="<%= dom_id(@message, :submission) %>" is="turbo-frame" class="flex gap-2">
<%= form_with(url: submit_message_draft_path(@message), method: :post, data: { turbo_frame: "_top", turbo_confirm: ("Naozaj chcete odoslať správu aj bez vyžiadaných podpisov?" if @message.objects.any?{|message_object| message_object.tags.where(type: SignatureRequestedFromTag.to_s).any?}) }, local: true) do |form| %>
<%= form_with(url: submit_message_draft_path(@message), method: :post, data: { turbo_frame: "_top", turbo_confirm: ("Správa ešte nebola podpísaná všetkými podpismi. Naozaj chcete odoslať správu aj bez nich?" if @message.any_objects_with_requested_signature?) }, local: true) do |form| %>
<%= form.submit "Odoslať", class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 text-white font-medium rounded-lg text-sm px-3.5 py-2.5 bg-blue-700 hover:bg-blue-800 dark:bg-blue-600 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:focus:ring-blue-800" %>
<% end %>

Expand Down
4 changes: 4 additions & 0 deletions app/models/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def build_html_visualization
template.transform(form_object.xml_unsigned_content)
end

def any_objects_with_requested_signature?
objects.any?{|message_object| message_object.tags.where(type: SignatureRequestedFromTag.to_s).any?}
end

def all_metadata
metadata.merge(template&.metadata || {})
end
Expand Down

0 comments on commit e549eb3

Please sign in to comment.