Mini action menu as view

Thiago Talma 9 年之前
父节点
当前提交
7bc0c0f173
共有 3 个文件被更改,包括 13 次插入7 次删除
  1. 7 0
      app/views/agents/_mini_action_menu.html.erb
  2. 5 1
      app/views/events/index.html.erb
  3. 1 6
      app/views/events/show.html.erb

+ 7 - 0
app/views/agents/_mini_action_menu.html.erb

@@ -0,0 +1,7 @@
1
+
2
+<div class="btn-group">
3
+  <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
4
+    <span class="caret"></span>
5
+  </button>
6
+  <%= render 'agents/action_menu', agent: agent, return_to: (defined?(return_to) && return_to) || request.path %>
7
+</div>

+ 5 - 1
app/views/events/index.html.erb

@@ -3,7 +3,11 @@
3 3
     <div class='col-md-12'>
4 4
       <div class="page-header">
5 5
         <h2>
6
-          Your Events <%= @agent && "from #{@agent.name}" %>
6
+          Your Events
7
+          <% if @agent %>
8
+            from <%= @agent.name %>
9
+            <%= render 'agents/mini_action_menu', agent: @agent, return_to:   request.path %>
10
+          <% end %>
7 11
         </h2>
8 12
       </div>
9 13
 

+ 1 - 6
app/views/events/show.html.erb

@@ -4,12 +4,7 @@
4 4
       <div class="page-header">
5 5
         <h2>
6 6
           Event from <%= @event.agent.name %>
7
-          <div class="btn-group">
8
-            <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
9
-              <span class="caret"></span>
10
-            </button>
11
-            <%= render 'agents/action_menu', agent: @event.agent, return_to: (defined?(return_to) && return_to) || request.path %>
12
-          </div>
7
+          <%= render 'agents/mini_action_menu', agent: @event.agent, return_to: event_path(@event) %>
13 8
         </h2>
14 9
       </div>
15 10