Skip to content

Commit

Permalink
Fix(dashboard): Use tables for soon-ending contracts and missing time…
Browse files Browse the repository at this point in the history
… shhet display. Ref #521, #504
  • Loading branch information
chrisma committed Jan 9, 2017
1 parent e7c512e commit 82ee32e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 32 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/bootstrap_and_overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ h1,h2,h3,h4 {
margin-top: 0px;
}

.table-condensed {
margin-bottom: 0px;
}

.vertical-align {
display: flex;
flex-direction: row;
Expand Down
46 changes: 26 additions & 20 deletions app/views/dashboard/_missing_timesheets.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@
<h4><%= t 'dashboard.index.missing_timesheets' %></h4>
</div>
<div class="panel-body">
<div class="row">
<% if @missing_timesheets.each do |dates,contract| %>
<% dates.each do |date| %>
<div class="col-md-3">
<%= l date, format: :short_month_year %>
</div>
<div class="col-md-3">
<%= t('activerecord.models.contract.one').capitalize %>: <%= linked_name contract %>
</div>
<div class="col-md-3">
<%= t 'activerecord.attributes.contract.hiwi' %>: <%= linked_name contract.hiwi %>
</div>
<div class="col-md-3">
<%= link_to "x", dismiss_contract_path(id: contract.id, month: date), class: "btn btn-xs btn-danger" %>
</div>
<% end %>
<% end.empty? %>
<%= t 'no_entries_yet', target: t('activerecord.models.time_sheet.other') %>
<% end %>
</div>
<% if @missing_timesheets.empty? %>
<%= t 'no_entries_yet', target: t('activerecord.models.time_sheet.other') %>
<% else %>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th><%= TimeSheet.human_attribute_name(:month).capitalize %></th>
<th><%= t('activerecord.models.contract.one').capitalize %></th>
<th><%= Contract.human_attribute_name(:responsible).capitalize %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @missing_timesheets.each do |dates,contract| %>
<% dates.each do |date| %>
<tr>
<td><%= l date, format: :short_month_year %></td>
<td><%= linked_name contract %></td>
<td><%= linked_name contract.responsible %></td>
<td><%= link_to "x", dismiss_contract_path(id: contract.id, month: date), class: "btn btn-xs btn-danger" %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>
</div>
Expand Down
34 changes: 22 additions & 12 deletions app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,28 @@
<h4><%= t '.ending_contracts' %></h4>
</div>
<div class="panel-body">
<div class="row">
<% if @ending_contracts.each do |contract| %>
<div class="col-md-6">
<%= linked_name contract %>
</div>
<div class="col-md-6">
<%= t 'activerecord.attributes.contract.responsible' %>: <%= linked_name contract.responsible %>
</div>
<% end.empty? %>
<%= t 'no_entries_yet', target: t('activerecord.models.contract.other') %>
<% end %>
</div>
<% if @ending_contracts.empty? %>
<%= t 'no_entries_yet', target: t('activerecord.models.contract.other') %>
<% else %>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th><%= Contract.human_attribute_name(:end_date) %></th>
<th><%= Contract.human_attribute_name(:hiwi) %></th>
<th><%= Contract.human_attribute_name(:responsible) %></th>
</tr>
</thead>
<tbody>
<% @ending_contracts.each do |contract| %>
<tr>
<td><%= l contract.end_date, format: :short_month_year %></td>
<td><%= linked_name contract.hiwi %></td>
<td><%= linked_name contract.responsible %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>
</div>
Expand Down

0 comments on commit 82ee32e

Please sign in to comment.