46 lines
1.5 KiB
Plaintext
46 lines
1.5 KiB
Plaintext
<div class="contextual">
|
|
<% if User.current.allowed_to?(:manage_body_trackers, @project) %>
|
|
<%= link_to t(".link_new_source"), '#', class: 'icon icon-add',
|
|
onclick: '$("#add-source").show(); $("#source_name").focus(); return false;' %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div id="add-source" <%= 'style=display:none;' if @source.errors.empty? %>>
|
|
<h2><%= t ".heading_new_source" %></h2>
|
|
|
|
<%= labelled_form_for @source,
|
|
url: project_sources_path(@project),
|
|
html: {id: 'source-add-form', name: 'source-add-form'} do |f| %>
|
|
|
|
<%= render partial: 'sources/form', locals: {f: f} %>
|
|
<%= submit_tag l(:button_create) %>
|
|
<%= link_to l(:button_cancel), "#", onclick: '$("#add-source").hide(); return false;' %>
|
|
<% end %>
|
|
<hr>
|
|
</div>
|
|
|
|
<%= title t(:body_trackers_title), t(".heading") %>
|
|
<% if @sources.any? { |s| s.persisted? } %>
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<th><%= l(:field_name) %></th>
|
|
<th><%= l(:field_description) %></th>
|
|
<th style="width:5%"><%= l(:field_action) %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @sources.each do |s| %>
|
|
<% next if s.new_record? %>
|
|
<tr id="source-<%= s.id %>" class="source">
|
|
<td class="name"><%= s.name %></td>
|
|
<td class="description"><%= s.description %></td>
|
|
<td class="action"><%= delete_link source_path(s), data: {} %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|