Module: Adherent::ApplicationHelper
- Defined in:
- app/helpers/adherent/application_helper.rb
Instance Method Summary collapse
- #icon_to(icon_file, options = {}, html_options = {}) ⇒ Object
- #icon_to_users ⇒ Object
- #imputation_with_actions(pay, reglt) ⇒ Object
- #list_imputations(payment) ⇒ Object
- #two_decimals(montant) ⇒ Object
-
#virgule(montant) ⇒ Object
Pour transformer un montant selon le format numérique français avec deux décimales.
Instance Method Details
#icon_to(icon_file, options = {}, html_options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/adherent/application_helper.rb', line 5 def icon_to(icon_file, ={}, ={}) raise ArgumentError unless icon_file title = alt = icon_file.split('.')[0].capitalize [:title] ||=title [:class] ||= 'icon_menu' # html_options[:tabindex]= "-1" img_path="adherent/icones/#{icon_file}" link_to image_tag(img_path, :alt=> alt), , end |
#icon_to_users ⇒ Object
26 27 28 |
# File 'app/helpers/adherent/application_helper.rb', line 26 def icon_to_users icon_to 'users.png', members_path, title:'Liste des membres' end |
#imputation_with_actions(pay, reglt) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/adherent/application_helper.rb', line 41 def imputation_with_actions(pay, reglt) html = '' html << "Adhésion #{reglt.adhesion.member.to_s} pour #{number_to_currency(reglt.amount, locale: :fr)}" html << " " html << "#{icon_to 'detail.png', payment_reglement_path(pay, reglt)}" # html << "#{icon_to 'imputation-edit.png', edit_payment_reglement_path(pay, reglt), title:'Modifier l\'imputation'}" # html << "#{icon_to 'imputation-delete.png', payment_reglement_path(pay, reglt), title:'Supprimer l\'imputation'}" html.html_safe end |
#list_imputations(payment) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/adherent/application_helper.rb', line 30 def list_imputations(payment) content_tag(:ul) do payment.reglements.map do |r| content_tag(:li) do imputation_with_actions(payment, r) end end.join.html_safe end end |
#two_decimals(montant) ⇒ Object
21 22 23 |
# File 'app/helpers/adherent/application_helper.rb', line 21 def two_decimals(montant) sprintf('%0.02f',montant) rescue '0.00' end |
#virgule(montant) ⇒ Object
Pour transformer un montant selon le format numérique français avec deux décimales
17 18 19 |
# File 'app/helpers/adherent/application_helper.rb', line 17 def virgule(montant) ActionController::Base.helpers.number_with_precision(montant, precision:2) rescue '0,00' end |