Skip to content

Commit

Permalink
Editor dashboard tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
arfon committed Feb 4, 2024
1 parent a7e1cff commit d9629f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions app/helpers/editors_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ def display_availability(editor)

comment = "#{editor.max_assignments} max."

display_count = editor.max_assignments
display_count = "#{active_assignments} / #{editor.max_assignments}"

if editor.availability_comment.present?
display_count = "#{display_count}*"
display_count = "#{active_assignments} / #{editor.max_assignments}*"
comment += " : #{editor.availability_comment}"
end


"<span class='#{availability_class}' title='#{comment}' %>#{display_count}</span>".html_safe
end
Expand All @@ -33,6 +34,11 @@ def availability_remaining(editor)
return "#{availability}"
end

def active_assignments_for_editor(editor)
active_assignments = @assignment_by_editor[editor.id].to_i - @paused_by_editor[editor.id].to_i
return "#{active_assignments}"
end

def in_progress_for_editor(editor)
paused_count = @paused_by_editor[editor.id].to_i
total_paper_count = @assignment_by_editor[editor.id].to_i
Expand Down
6 changes: 3 additions & 3 deletions app/views/editors/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<th scope="col" width="30%" >Categories</th>
<th scope="col" width="8%" class="text-center">Start date</th>
<th scope="col" width="8%" class="text-center" title="Papers assigned (+ paused)">Editing</th>
<th scope="col" width="8%" class="text-center">Capacity</th>
<th scope="col" width="6%" class="text-center">Space</th>
<th scope="col" width="8%" class="text-center">Invites</th>
<th scope="col" class="sorttable_nosort"></th>
</tr>
Expand All @@ -38,8 +38,8 @@
</td>
<td style="max-width:250px"><%= editor.category_list %></td>
<td class="text-center"><%= editor.created_at.strftime('%Y-%m-%d') %></td>
<td class="text-center" title="Max: <%= editor.max_assignments %>"><%= link_to in_progress_for_editor(editor), "/dashboard/#{editor.login}" %></td>
<td sorttable_customkey=<%= availability_remaining(editor) %> class="text-center" title="Limit: <%= editor.max_assignments %>"><%= display_availability(editor) %></td>
<td sorttable_customkey=<%= active_assignments_for_editor(editor) %> class="text-center" title="Limit: <%= editor.max_assignments %>"><%= link_to display_availability(editor), "/dashboard/#{editor.login}" %></td>
<td sorttable_customkey=<%= availability_remaining(editor) %> class="text-center" title="Limit: <%= editor.max_assignments %>"><%= availability_remaining(editor) %></td>
<td sorttable_customkey=<%= @pending_invitations_by_editor[editor.id].to_i %> class="text-center" title="Invites"><%= open_invites_for_editor(editor) %></td>
<td><%= link_to 'Edit', edit_editor_path(editor), title: 'Edit' %></td>
</tr>
Expand Down

0 comments on commit d9629f3

Please sign in to comment.