crud_menu 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,8 +8,11 @@
|
|
8
8
|
<li><%= delete_crud_link %></li>
|
9
9
|
<li><%= close_crud_link %></li>
|
10
10
|
<% end %>
|
11
|
-
<% if action_called == 'edit'
|
11
|
+
<% if action_called == 'edit' %>
|
12
12
|
<li><%= cancel_crud_link %></li>
|
13
13
|
<% end %>
|
14
|
+
<% if action_called == 'new' %>
|
15
|
+
<li><%= close_crud_link(true) %></li>
|
16
|
+
<% end %>
|
14
17
|
</ul>
|
15
18
|
</div>
|
data/lib/crud_menu/version.rb
CHANGED
@@ -27,8 +27,10 @@ module CrudMenu
|
|
27
27
|
def delete_crud_link
|
28
28
|
link_to "Delete #{@controller.singularize.humanize}", @link_hash.merge({id: params[:id]}), method: :delete
|
29
29
|
end
|
30
|
-
def cancel_crud_link
|
31
|
-
|
30
|
+
def cancel_crud_link(new_page=false)
|
31
|
+
link_hash = @link_hash
|
32
|
+
link_hash.merge({action: 'show', id: params[:id]}) unless new_page
|
33
|
+
link_to "Cancel", link_hash)
|
32
34
|
end
|
33
35
|
def close_crud_link
|
34
36
|
link_to "Close", @link_hash.merge({action: 'index'})
|