Module: WindowRails::Generators
- Includes:
- ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper, RailsJavaScriptHelpers
- Included in:
- Holder
- Defined in:
- lib/window_rails/generators.rb
Overview
Generator methods for dialogs
Instance Method Summary collapse
-
#close_alert_window ⇒ TrueClass
Close the alert dialog.
-
#close_confirm_window ⇒ TrueClass
Close the confirm dialog.
-
#close_window(name) ⇒ TrueClass
Close the window.
-
#create_window(options = {}) ⇒ TrueClass
Create a new window.
-
#open_alert_window(msg, options = {}) ⇒ TrueClass
Display alert dialog.
-
#open_confirm_window(msg, options = {}) ⇒ TrueClass
Display confirmation dialog.
-
#open_info_window(msg, options = {}) ⇒ TrueClass
Display information dialog.
-
#open_window(name) ⇒ TrueClass
Open the window.
-
#popover(element, options = {}) ⇒ TrueClass
Add popover support.
-
#update_window(name, options = {}) ⇒ Object
Update the contents of the window.
Instance Method Details
#close_alert_window ⇒ TrueClass
Close the alert dialog
25 26 27 28 |
# File 'lib/window_rails/generators.rb', line 25 def close_alert_window self << 'window_rails.alert.close();' true end |
#close_confirm_window ⇒ TrueClass
Close the confirm dialog
45 46 47 48 |
# File 'lib/window_rails/generators.rb', line 45 def close_confirm_window self << 'window_rails.confirm.close();' true end |
#close_window(name) ⇒ TrueClass
Close the window
93 94 95 96 |
# File 'lib/window_rails/generators.rb', line 93 def close_window(name) self << "window_rails.close_window('#{name}');" true end |
#create_window(options = {}) ⇒ TrueClass
Create a new window
72 73 74 75 76 77 78 |
# File 'lib/window_rails/generators.rb', line 72 def create_window(={}) self << "window_rails.create_window(#{format_type_to_js()});" if(.fetch(:auto_open, true)) self << "window_rails.open_window('#{[:name]}', #{format_type_to_js()});" end true end |
#open_alert_window(msg, options = {}) ⇒ TrueClass
Display alert dialog
17 18 19 20 |
# File 'lib/window_rails/generators.rb', line 17 def open_alert_window(msg, ={}) [:content] = msg self << "window_rails.alert.open(#{format_type_to_js()});" end |
#open_confirm_window(msg, options = {}) ⇒ TrueClass
Display confirmation dialog
36 37 38 39 40 |
# File 'lib/window_rails/generators.rb', line 36 def open_confirm_window(msg, ={}) [:content] = msg self << "window_rails.confirm.open(#{format_type_to_js()});" true end |
#open_info_window(msg, options = {}) ⇒ TrueClass
Display information dialog
56 57 58 59 60 |
# File 'lib/window_rails/generators.rb', line 56 def open_info_window(msg, ={}) [:content] = msg self << "window_rails.info.open(#{format_type_to_js()});" true end |
#open_window(name) ⇒ TrueClass
Open the window
84 85 86 87 |
# File 'lib/window_rails/generators.rb', line 84 def open_window(name) self << "window_rails.open_window('#{name}');" true end |
#popover(element, options = {}) ⇒ TrueClass
Add popover support
112 113 114 115 |
# File 'lib/window_rails/generators.rb', line 112 def popover(element, ={}) self << "$('#{element}').popover(#{format_type_to_js()});" true end |
#update_window(name, options = {}) ⇒ Object
Update the contents of the window
104 105 106 |
# File 'lib/window_rails/generators.rb', line 104 def update_window(name, ={}) create_window(.merge(:name => name, :show => false)) end |