invoice_keeper/app/views/notes/index.html.erb

48 lines
2.2 KiB
Plaintext

<div class="col-md-12 panel-default">
<div class="content-box-header panel-heading">
<div class="panel-title">Klienci - notatki</div>
<div class="panel-options">
<%= link_to raw('<i class="glyphicon glyphicon-file text-success"></i> Nowa notatka'), new_note_path(client_id: @client.id), class: "text-primary" %><br/>
</div>
</div>
<div class="content-box-large box-with-header">
<table class="table table-striped table-bordered" style="table-layout: fixed; width: 100%;">
<tr>
<th style="width: 20%;">Nazwa</th>
<th style="width: calc(80% - 150px); ">Zawartość</th>
<th style="width: 150px;">Akcje</th>
</tr>
<% @notes.each do |note| %>
<tr>
<td><%= note.name %></td>
<td>
<% short_content = truncate(note.content, length: 30, separator: ' ', omission: '...') %>
<div style="max-width: 100%; overflow-x: auto; font-family: monospace; background: #f9f9f9; border: 1px solid #ddd; border-radius: 5px; padding: 8px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);">
<% if note.content.length > 30 %>
<a href="#" onclick="event.preventDefault(); this.nextElementSibling.style.display = 'block'; this.style.display = 'none';">
<div style="white-space: nowrap;"><%= raw simple_format(short_content) %></div>
</a>
<div style="display: none; margin-top: 5px; white-space: nowrap;">
<%= raw simple_format(note.content) %>
</div>
<% else %>
<div style="white-space: nowrap;"><%= raw simple_format(short_content) %></div>
<% end %>
</div>
</td>
<td>
<%= link_to raw('<i class="glyphicon glyphicon-pencil"></i> Edycja'), edit_note_path(note, client_id: @client.id), class: "btn btn-primary btn-xs" %>
<%= link_to raw('<i class="glyphicon glyphicon-trash"></i> Usuń'), note_path(note, client_id: @client.id), class: "btn btn-danger btn-xs", method: :delete, data: { confirm: 'Czy na pewno usunąć?' } %>
</td>
</tr>
<% end %>
</table>
</div>
</div>