Module: Adherent::ApplicationHelper

Defined in:
app/helpers/adherent/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#icon_to(icon_file, options = {}, html_options = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/adherent/application_helper.rb', line 5

def icon_to(icon_file, options={}, html_options={})
  raise ArgumentError unless icon_file
  title = alt = icon_file.split('.')[0].capitalize

  html_options[:title] ||=title
  html_options[:class] ||= 'icon_menu'
  # html_options[:tabindex]= "-1"
  img_path="adherent/icones/#{icon_file}"
  link_to image_tag(img_path, :alt=> alt), options, html_options
end

#icon_to_usersObject



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 << "&nbsp;&nbsp;"
  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)
  
  (:ul) do
    payment.reglements.map do |r|
      (: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