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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e99241310030666c77c51744b07fa34293025bea
4
- data.tar.gz: f796a2c56420af3425159a6c12d09e6bf8526605
3
+ metadata.gz: 08b21c07882beab073b31b88ed3df1a9575277a5
4
+ data.tar.gz: af669f1fcd330994aa13c4a322f744755dd241a5
5
5
  SHA512:
6
- metadata.gz: fbf86f29ed27079a301a36c2a28c65d14fe3316d175b252dc02e216ae8e8b3b2df84796bad762b2bc22f59d5321cc3501ebf16c2d50ea2a4a65af53cc7bf7145
7
- data.tar.gz: 3f8a32a4ba14ad93322de8e5922bfe696d722ac21e941568d5a1bf6208a0d7bf44a44d6f394c2f9ac3e7b02ee9319dcabefc97a86d91d52344ee18e466fed5af
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
- <% if add_button? %>
4
- <%= link_to t("table.buttons.add"), request.path + "/new", class: "add" %>
5
- <% end %>
6
- <% if edit_button? %>
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.add_button &&
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.edit_button &&
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.show_button &&
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.delete_button &&
22
- (!Snaptable.use_permission || rights?(:destroy, params[:controller]))
34
+ !Snaptable.use_permission || rights?(:destroy, params[:controller])
23
35
  end
24
36
 
25
37
  end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr