1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/app/views/sources/index.html.erb
2019-11-02 23:59:19 +01:00

49 lines
1.6 KiB
Plaintext

<% content_for :sidebar do %>
<%= render :partial => 'body_trackers/sidebar' %>
<% end %>
<div class="contextual">
<% if User.current.allowed_to?(:manage_common, @project) %>
<%= link_to t(".heading_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-form'} do |f| %>
<%= render :partial => 'sources/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-source").hide()' %>
<% end %>
<hr>
</div>
<h2><%= t ".heading" %></h2>
<% if @sources.any? { |s| s.persisted? } %>
<table class="list">
<thead>
<tr>
<th><%= l(:field_name) %></th>
<th><%= l(:field_description) %></th>
<th style="width:10%"><%= 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 %>