snaptable 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/snaptable/_buttons.html.erb +4 -15
- data/lib/snaptable/helpers/buttons_helper.rb +20 -8
- data/lib/snaptable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08b21c07882beab073b31b88ed3df1a9575277a5
|
4
|
+
data.tar.gz: af669f1fcd330994aa13c4a322f744755dd241a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4d522887278216eb17c5305fbd1c5a80b4f241d27994064194ce40998bcd54d08a9a805a5d47a531164b6b496b5cbbf08450b6abc0dbd0500251b0177351c31
|
7
|
+
data.tar.gz: 7712b08a99184ce9df4b5ba3b16a154b0dc5c49ff999b519ffb4f9073ae9f750760b5c5a77b7e3a2160f10a05e5fc20b08466b4e485a0374c47d20756b0e4a08
|
@@ -1,18 +1,7 @@
|
|
1
1
|
<p><%= t("table.buttons.title") %></p>
|
2
2
|
<p>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<a class="edit" href="#"><%= t("table.buttons.edit") %></a>
|
8
|
-
<% end %>
|
9
|
-
<% if show_button? %>
|
10
|
-
<a class="show" href="#"><%= t("table.buttons.show") %></a>
|
11
|
-
<% end %>
|
12
|
-
<% if delete_button? %>
|
13
|
-
<a class="delete" href="#" data-method="delete"
|
14
|
-
rel="nofollow" data-confirm="Etes-vous sûr de vouloir supprimer cette entrée ?">
|
15
|
-
<%= t("table.buttons.delete") %>
|
16
|
-
</a>
|
17
|
-
<% end %>
|
3
|
+
<%= add_button if Snaptable.add_button && add_button? %>
|
4
|
+
<%= edit_button if Snaptable.edit_button && edit_button? %>
|
5
|
+
<%= show_button if Snaptable.show_button && show_button? %>
|
6
|
+
<%= delete_button if Snaptable.delete_button && delete_button? %>
|
18
7
|
</p>
|
@@ -2,24 +2,36 @@ module Snaptable
|
|
2
2
|
module Helpers
|
3
3
|
module ButtonsHelper
|
4
4
|
|
5
|
+
def add_button
|
6
|
+
link_to t("table.buttons.add"), request.path + "/new", class: "add"
|
7
|
+
end
|
8
|
+
|
9
|
+
def show_button
|
10
|
+
link_to t("table.buttons.show"), "#", class: "show"
|
11
|
+
end
|
12
|
+
|
13
|
+
def edit_button
|
14
|
+
link_to t("table.buttons.edit"), "#", class: "edit"
|
15
|
+
end
|
16
|
+
|
17
|
+
def delete_button
|
18
|
+
link_to t("table.buttons.delete"), "#", method: :delete, class: "delete", data: { confirm: "Etes-vous sûr de vouloir supprimer cette entrée ?" }
|
19
|
+
end
|
20
|
+
|
5
21
|
def add_button?
|
6
|
-
Snaptable.
|
7
|
-
(!Snaptable.use_permission || rights?(:create, params[:controller]))
|
22
|
+
!Snaptable.use_permission || rights?(:create, params[:controller])
|
8
23
|
end
|
9
24
|
|
10
25
|
def edit_button?
|
11
|
-
Snaptable.
|
12
|
-
(!Snaptable.use_permission || rights?(:update, params[:controller]))
|
26
|
+
!Snaptable.use_permission || rights?(:update, params[:controller])
|
13
27
|
end
|
14
28
|
|
15
29
|
def show_button?
|
16
|
-
Snaptable.
|
17
|
-
(!Snaptable.use_permission || rights?(:read, params[:controller]))
|
30
|
+
!Snaptable.use_permission || rights?(:read, params[:controller])
|
18
31
|
end
|
19
32
|
|
20
33
|
def delete_button?
|
21
|
-
Snaptable.
|
22
|
-
(!Snaptable.use_permission || rights?(:destroy, params[:controller]))
|
34
|
+
!Snaptable.use_permission || rights?(:destroy, params[:controller])
|
23
35
|
end
|
24
36
|
|
25
37
|
end
|
data/lib/snaptable/version.rb
CHANGED