Module: TelegramChatbot::ApplicationHelper
- Defined in:
- app/helpers/telegram_chatbot/application_helper.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
16
17
18
19
20
21
22
|
# File 'app/helpers/telegram_chatbot/application_helper.rb', line 16
def method_missing(method, *args, &block)
if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)
main_app.send(method, *args)
else
super
end
end
|
Instance Method Details
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'app/helpers/telegram_chatbot/application_helper.rb', line 3
def form_check_toggle(option = {})
disabled = option[:disabled].present? ? "disabled" : ""
checked = option[:checked].present? ? "checked" : ""
str = "<div class='form-check'>"
str += "<label class='form-check-label form-check-toggle'>"
str += "<input type='hidden' name='#{option[:name]}' value='0'/>"
str += "<input type='checkbox' name='#{option[:name]}' #{checked} #{disabled}/>"
str += "<span>#{option[:label]}</span>"
str += "</label>"
str + "</div>"
end
|