Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.8 KiB

<% if @abstract_models %>
<table class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th class="shrink model-name">
<%= t "admin.table_headers.model_name" %>
</th>
<th class="shrink last-created">
<%= t "admin.table_headers.last_created" %>
</th>
<th class="records">
<%= t "admin.table_headers.records" %>
</th>
<th class="shrink controls"></th>
</tr>
</thead>
<tbody class="table-group-divider">
<% @abstract_models.each do |abstract_model| %>
<% if authorized? :index, abstract_model %>
<% index_path = index_path(model_name: abstract_model.to_param) %>
<% row_class = "#{cycle('odd', 'even')}#{' link' if index_path} #{abstract_model.param_key}_links" %>
<tr class="<%= row_class %>" data-link="<%= index_path %>">
<% last_created = @most_recent_created[abstract_model.model.name] %>
<% active = last_created.try(:today?) %>
<td>
<span class="show">
<%= link_to abstract_model.config.label_plural, index_path %>
</span>
</td>
<td>
<% if last_created %>
<%= t "admin.misc.time_ago", time: time_ago_in_words(last_created), default: "#{time_ago_in_words(last_created)} #{t('admin.misc.ago')}" %>
<% end %>
</td>
<td>
<% count = @count[abstract_model.model.name] %>
<% percent = if count.positive?
@max <= 1 ? count : ((Math.log(count + 1) * 100.0) / Math.log(@max + 1)).to_i
else
-1
end %>
<div class="<%= active ? "active progress-bar-striped " : "" %>progress" style="margin-bottom:0px">
<div class="bg-<%= get_indicator(percent) %> progress-bar animate-width-to" data-animate-length="<%= ([1.0, percent].max.to_i * 20) %>" data-animate-width-to="<%= [2.0, percent].max.to_i %>%" style="width:2%">
<%= @count[abstract_model.model.name] %>
</div>
</div>
</td>
<td class="last links rails-admin-actions">
<ul class="nav list-inline">
<%= menu_for :collection, abstract_model, nil, true %>
</ul>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<% end %>
<% if @history && authorized?(:history_index) %>
<div class="block" id="block-tables">
<div class="content">
<h2>
<%= t("admin.actions.history_index.menu") %>
</h2>
<%= render partial: "rails_admin/main/dashboard_history" %>
</div>
</div>
<% end %>