Skip to content

Commit

Permalink
Show disabled agents by default
Browse files Browse the repository at this point in the history
  • Loading branch information
knu committed May 21, 2015
1 parent b8896f6 commit b4a7dce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/diagrams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def show
agents = current_user.agents
end
@disabled_agents = agents.inactive
agents = agents.active unless params[:include_disabled].present?
agents = agents.active if params[:exclude_disabled].present?
@agents = agents.includes(:receivers)
end
end
6 changes: 3 additions & 3 deletions app/views/diagrams/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<div class="btn-group">
<%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, (@scenario ? scenario_path(@scenario) : agents_path), class: "btn btn-default" %>
<% if (num_disabled = @disabled_agents.count).nonzero? -%>
<% if params[:include_disabled] %>
<%= link_to @scenario ? scenario_diagram_path(@scenario) : diagram_path, class: 'btn btn-default' do %><%= icon_tag('glyphicon-eye-close') %> Hide <%= pluralize(num_disabled, 'disabled Agent') %><% end %>
<% if params[:exclude_disabled] %>
<%= link_to @scenario ? scenario_diagram_path(@scenario) : diagram_path, class: 'btn btn-default' do %><%= icon_tag('glyphicon-eye-open') %> Show <%= pluralize(num_disabled, 'disabled Agent') %><% end %>
<% else %>
<%= link_to @scenario ? scenario_diagram_path(@scenario, include_disabled: true) : diagram_path(include_disabled: true), class: 'btn btn-default' do %><%= icon_tag('glyphicon-eye-open') %> Show <%= pluralize(num_disabled, 'disabled Agent') %><% end %>
<%= link_to @scenario ? scenario_diagram_path(@scenario, exclude_disabled: true) : diagram_path(exclude_disabled: true), class: 'btn btn-default' do %><%= icon_tag('glyphicon-eye-close') %> Hide <%= pluralize(num_disabled, 'disabled Agent') %><% end %>
<% end %>
<% end %>
</div>
Expand Down

0 comments on commit b4a7dce

Please sign in to comment.