Module: Vision::ApplicationHelper

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

Instance Method Summary collapse

Instance Method Details

#icon_button_tag(text, icon_type = " ", *options) ⇒ Object

метод для button_tag с bootstrap icon внутри

пример (текст из локали, класс иконки, опции кнопки)

<%= icon_button_tag( t(“.save”), “icon-ok-sign”, type: ‘submit’, class: “btn-large btn-success aligned”) %>



20
21
22
23
24
# File 'app/helpers/vision/application_helper.rb', line 20

def icon_button_tag(text,icon_type=" ", *options)
  button_tag(*options) do
    ( :i, " " ,:class=>icon_type)+" "+text
  end
end

#icon_button_to_tag(text, icon_type = " ", options = {}) ⇒ Object

метод для button_to с bootstrap icon внутри

пример (текст из локали, класс иконки, опции кнопки)

<%= icon_button_to( t(“.save”), “icon-ok-sign”,url_for ‘submit’, class: “btn-large btn-success aligned”) %>



8
9
10
11
12
# File 'app/helpers/vision/application_helper.rb', line 8

def icon_button_to_tag(text,icon_type=" ", options={})
  button_tag(options) do
    ( :i, " " ,:class=>icon_type)+" "+text
  end
end

метод для link_to с bootstrap icon внутри

пример (текст из локали, класс иконки, опции ссылки)

<%= icon_link_to(t(“layouts.top_menu.logout”), “icon-eject”, destroy_user_session_path, :method =>:delete) %>



31
32
33
34
35
# File 'app/helpers/vision/application_helper.rb', line 31

def icon_link_to(text,icon_type=" ", *options)
  link_to(*options) do
    ( :i, " " ,:class=>icon_type)+" "+text
  end
end

#user_nameObject



38
39
40
# File 'app/helpers/vision/application_helper.rb', line 38

def user_name
  current_user.try(:email) || current_user.id
end