Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<%= bootstrap_form_with model: [releasable, note] do |form| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Note to <%= releasable.name %></h5>
<%= button_tag type: "button", class: "close", data: { dismiss: "modal" }, aria: { label: "Close" } do %>
<span aria-hidden="true">&times;</span>
<% end %>
</div>
<div class="modal-body">
<%= form.text_area :content, hide_label: true, placeholder: true, rows: 6 %>
</div>
<div class="modal-footer">
<%= form.submit class: "btn btn-primary", data: { disable_with: t("shared.disable_with") } %>
<%= form.button "Close", class: "btn btn-secondary", type: "button", data: { dismiss: "modal" } %>
</div>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,3 @@
<div class="modal" id="<%= dom_id(note, dom_id(releasable)) %>" tabindex="-1" role="dialog">
<%= render "form", releasable: releasable, note: note %>
</div>

View File

@@ -0,0 +1,29 @@
<div class="modal" id="<%= dom_id(releasable, "notes") %>" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Notes for <%= releasable.name %></h5>
<%= button_tag type: "button", class: "close", data: { dismiss: "modal" }, aria: { label: "Close" } do %>
<span aria-hidden="true">&times;</span>
<% end %>
</div>
<div class="modal-body">
<div class="list-group overflow-auto" style="height: 50vh">
<% notes.each do |note| %>
<div class="list-group-item">
<p class="mb-1"><%= note.content %></p>
<div class="d-flex w-100 justify-content-between">
<small><%= mail_to note.email %></small>
<small><%= time_ago_in_words note.created_at %> ago</small>
</div>
</div>
<% end %>
</div>
</div>
<div class="modal-footer">
<%= button_tag "Close", class: "btn btn-secondary", type: "button", data: { dismiss: "modal" } %>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,8 @@
var $modal = $("#<%= dom_id Note.new, dom_id(@releasable) %>")
<% if @note.valid? %>
$modal.modal("toggle");
$("tr#<%= dom_id @releasable %>").replaceWith("<%= j render(@releasable) %>");
<% else %>
$modal.html("<%= j render(partial: "form", locals: { releasable: @releasable, note: @note }) %>")
<% end %>

View File

@@ -0,0 +1,11 @@
var modalSelector = "#<%= dom_id @releasable, "notes" %>"
var modal = "<%= j render("notes_modal", releasable: @releasable, notes: @notes) %>"
// If the modal already exists, replace it. Otherwise, create it
if ($(modalSelector).length > 0) {
$(modalSelector).replaceWith(modal)
} else {
$('body').append(modal)
}
$(modalSelector).modal("toggle")

View File

@@ -0,0 +1,11 @@
var modalSelector = "#<%= dom_id @note, dom_id(@releasable) %>"
var modal = "<%= j render("new_note_modal", releasable: @releasable, note: @note) %>"
// If the modal already exists, replace it. Otherwise, create it
if ($(modalSelector).length > 0) {
$(modalSelector).replaceWith(modal)
} else {
$('body').append(modal)
}
$(modalSelector).modal("toggle")