Module: Redcar::HtmlController
- Includes:
- Observable
- Included in:
- ProjectSearch::WordSearchController, ClipboardViewer::BrowserController, Debug::OpenHistoryCommand::Controller, Redcar::Help::ViewController, Redcar::HtmlView::DefaultController, Macros::ManagerController, PluginManagerUi::OpenCommand::Controller, Project::DirController::BulkRenameController, Runnables::CommandOutputController, TaskManager::Controller, Textmate::BundleEditorController, Textmate::InstalledBundles::Controller, Textmate::SnippetEditorController, TodoList::TodoController
- Defined in:
- plugins/html_view/lib/html_controller.rb
Constant Summary
Constant Summary
Constants included from Observable
Instance Method Summary (collapse)
-
- (Object) ask_before_closing
Override this to return a message if the user should be prompted before closing the tab.
-
- (Object) close
Override this to run code right before the tab is closed.
-
- (Object) execute(script)
Call execute with a string of javascript to execute the script in the context of the browser widget.
- - (Object) javascript_controller_actions
-
- (Object) reload_index
Reload the index page.
Methods included from Observable
#add_listener, #notify_listeners, #remove_listener
Instance Method Details
- (Object) ask_before_closing
Override this to return a message if the user should be prompted before closing the tab.
13 14 15 |
# File 'plugins/html_view/lib/html_controller.rb', line 13 def ask_before_closing nil end |
- (Object) close
Override this to run code right before the tab is closed.
18 19 20 |
# File 'plugins/html_view/lib/html_controller.rb', line 18 def close nil end |
- (Object) execute(script)
Call execute with a string of javascript to execute the script in the context of the browser widget.
24 25 26 |
# File 'plugins/html_view/lib/html_controller.rb', line 24 def execute(script) notify_listeners(:execute_script, script) end |
- (Object) javascript_controller_actions
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'plugins/html_view/lib/html_controller.rb', line 28 def javascript_controller_actions methods = self.methods - Object.methods <<-JS <script type="text/javascript"> function makeController (methods) { var controller = {}; methods.map(function (method) { var jsMethod = method.replace(/_(.)/g, function () { return arguments[1].toUpperCase(); }); controller[jsMethod] = function () { var args = Array.prototype.slice.call(arguments); return JSON.parse(rubyCall.apply(this, [method].concat(args))); }; }); return controller; } Controller = makeController(#{methods.inspect}); </script> JS end |
- (Object) reload_index
Reload the index page
7 8 9 |
# File 'plugins/html_view/lib/html_controller.rb', line 7 def reload_index notify_listeners(:reload_index) end |