more return paths

Andrew Cantino 9 gadi atpakaļ
vecāks
revīzija
4f329a86ed
2 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 1 1
      app/controllers/application_controller.rb
  2. 2 2
      app/views/events/index.html.erb

+ 1 - 1
app/controllers/application_controller.rb

@@ -38,7 +38,7 @@ class ApplicationController < ActionController::Base
38 38
         else
39 39
           agents_path
40 40
         end
41
-      when /\A#{Regexp::escape scenarios_path}\/\d+\z/, agents_path
41
+      when /\A#{(Regexp::escape scenarios_path)}/, /\A#{(Regexp::escape agents_path)}/, /\A#{(Regexp::escape events_path)}/
42 42
         ret
43 43
     end
44 44
   end

+ 2 - 2
app/views/events/index.html.erb

@@ -19,7 +19,7 @@
19 19
         <% @events.each do |event| %>
20 20
           <% next unless event.agent %>
21 21
           <%= content_tag :tr, class: (highlighted?(event.id) ? 'hl' : nil) do %>
22
-            <td><%= link_to event.agent.name, agent_path(event.agent) %></td>
22
+            <td><%= link_to event.agent.name, agent_path(event.agent, return: request.fullpath) %></td>
23 23
             <td title='<%= event.created_at %>'><%= time_ago_in_words event.created_at %> ago</td>
24 24
             <td class='payload'><%= truncate event.payload.to_json, :length => 90, :omission => "" %></td>
25 25
             <td>
@@ -40,7 +40,7 @@
40 40
 
41 41
       <% if @agent %>
42 42
         <div class="btn-group">
43
-          <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, agents_path, class: "btn btn-default" %>
43
+          <%= link_to icon_tag('glyphicon-eye-open') + ' View Agent'.html_safe, agent_path(@agent, return: request.fullpath), class: "btn btn-default" %>
44 44
           <%= link_to icon_tag('glyphicon-random') + ' See all events'.html_safe, events_path, class: "btn btn-default" %>
45 45
         </div>
46 46
       <% end %>