lib/snaptable/helpers/buttons_helper.rb in snaptable-1.0.0 vs lib/snaptable/helpers/buttons_helper.rb in snaptable-1.1.0
- old
+ new
@@ -1,26 +1,38 @@
module Snaptable
module Helpers
module ButtonsHelper
+ def add_button
+ link_to t("table.buttons.add"), request.path + "/new", class: "add"
+ end
+
+ def show_button
+ link_to t("table.buttons.show"), "#", class: "show"
+ end
+
+ def edit_button
+ link_to t("table.buttons.edit"), "#", class: "edit"
+ end
+
+ def delete_button
+ link_to t("table.buttons.delete"), "#", method: :delete, class: "delete", data: { confirm: "Etes-vous sûr de vouloir supprimer cette entrée ?" }
+ end
+
def add_button?
- Snaptable.add_button &&
- (!Snaptable.use_permission || rights?(:create, params[:controller]))
+ !Snaptable.use_permission || rights?(:create, params[:controller])
end
def edit_button?
- Snaptable.edit_button &&
- (!Snaptable.use_permission || rights?(:update, params[:controller]))
+ !Snaptable.use_permission || rights?(:update, params[:controller])
end
def show_button?
- Snaptable.show_button &&
- (!Snaptable.use_permission || rights?(:read, params[:controller]))
+ !Snaptable.use_permission || rights?(:read, params[:controller])
end
def delete_button?
- Snaptable.delete_button &&
- (!Snaptable.use_permission || rights?(:destroy, params[:controller]))
+ !Snaptable.use_permission || rights?(:destroy, params[:controller])
end
end
end
end
\ No newline at end of file