app/views/admin/propositions/index.html.erb
<% page_title "Forslagsvask - Admin - #{t('app.title')}" %>
<div class="page-header">
<a href="#" class="pull-right">Hjelp?</a>
<h1>Forslagsvask</h1>
</div>
<section class="proposition-index">
<div class="row-fluid">
<form action="<%= admin_propositions_path %>" method="get">
<div class="span6">
<div class="input-append">
<input type="search"
name="q"
id="proposition-query"
class="input-medium search-query"
placeholder="Søk i forslag"
value="<%= params[:q] %>"
autofocus>
</div>
</div>
<div class="span6">
<div class="pull-right">
<%= select_tag 'parliament_session_name',
options_from_collection_for_select(
ParliamentSession.order(:start_date).reverse_order, :name, :name,
@search.params[:parliament_session_name],
)
%>
</div>
</div>
</form>
</div>
<div class="row-fluid">
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="wide-table-header">Importert</th>
<th></th>
<th>Forslagstittel</th>
<th>Forslagstekst</th>
<th></th>
</tr>
</thead>
<tbody>
<% @propositions.each do |prop| %>
<tr data-id="<%= prop._id %>">
<td><%= l prop.vote_time.to_time.localtime, format: :short_text %></td>
<td>
<% unless prop.interesting %>
<small class="muted">Uinteressant</small>
<% end %>
</td>
<td>
<%= prop.simple_description || prop.auto_title %>
<p class="muted"><%= prop.description %></p>
</td>
<% if prop.simple_body.present? %>
<td><%= prop.simple_body.truncate(200) %>
<p class="muted"><%= prop.plain_body.truncate(200) %></p>
</td>
<% else %>
<td><%= prop.plain_body.truncate(200) %></td>
<% end %>
<td><%= link_to 'Rediger', edit_admin_proposition_path(prop._id), class: 'btn btn-small' %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= paginate @propositions %>
</section>
<% content_for :document_ready do %>
<script>
$(function() {
$("select[name=parliament_session_name]").change(function() {
$(this).parents('form:first').submit();
});
});
</script>
<% end %>