public function _render_view() { try { ActionView\ViewHelpers::load(); $this->_renderer = new ActionView\Template($this->_params, $this->_params['layout']); $locals = Rails::application()->controller()->vars(); if (!empty($this->_params['is_xml'])) { $this->_xml = new ActionView\Xml(); $locals->xml = $this->_xml; } $this->_renderer->setLocals($locals); $this->_renderer->render_content(); } catch (ActionView\Template\Exception\ExceptionInterface $e) { switch (get_class($e)) { case 'Rails\\ActionView\\Template\\Exception\\LayoutMissingException': case 'Rails\\ActionView\\Template\\Exception\\TemplateMissingException': $route = $this->router()->route(); if (Rails::application()->dispatcher()->action_ran()) { $token = $route->to(); throw new Exception\ViewNotFoundException(sprintf("View for %s not found", $token)); } else { if ($route->namespaces()) { $namespaces = ' [ namespaces => [ ' . implode(', ', $route->namespaces()) . ' ] ]'; } else { $namespaces = ''; } throw new Exception\ActionNotFoundException(sprintf("Action '%s' not found for controller '%s'%s", $route->action(), $route->controller(), $namespace)); } break; default: throw $e; break; } } }
public function _render_view() { # Include helpers. ActionView\ViewHelpers::load(); $layout = !empty($this->_params['layout']) ? $this->_params['layout'] : false; $this->_template = new ActionView\Template(['lambda' => $this->_params['lambda']], ['layout' => $layout]); $this->_template->setLocals(\Rails::application()->controller()->locals()); $this->_template->renderContent(); }
public function __call($method, $params) { if ($helper = ViewHelpers::findHelperFor($method)) { $helper->setView($this); return call_user_func_array(array($helper, $method), $params); } elseif ($this->isNamedPathMethod($method)) { return $this->getNamedPath($method, $params); } throw new Exception\BadMethodCallException(sprintf("Called to unknown method/helper: %s", $method)); }
public function _render_view() { # Include helpers. ActionView\ViewHelpers::load(); $layout = !empty($this->_params['layout']) ? $this->_params['layout'] : false; # Create a template so we can call render_inline; $this->_template = new ActionView\Template(['inline' => $this->_params['code']], ['layout' => $layout]); $this->_template->setLocals(\Rails::application()->controller()->vars()); $this->_template->renderContent(); }
private function buildMessage() { $this->message = new Mail\Message(); $this->setCharset(); $this->setFrom(); $this->setTo(); $this->setSubject(); ActionView\ViewHelpers::load(); $this->createTextPart(); $this->createHtmlPart(); $this->body = new Mime\Message(); $this->addTemplates(); $this->addAttachments(); $this->message->setBody($this->body); /** * Set content-type to alternative if both text and html are being send. */ if ($this->textTemplate && $this->htmlTemplate) { $this->message->getHeaders()->get('content-type')->setType('multipart/alternative'); } unset($this->textTemplate, $this->htmlTemplate); }
public function _render_view() { try { ActionView\ViewHelpers::load(); $this->build_template_file_name(); $params = ['layout' => $this->_params['layout']]; if (!empty($this->_params['optionalLayout'])) { $params['optionalLayout'] = true; } $this->renderer = new ActionView\Template($this->template_file_name, $params); $locals = Rails::application()->controller()->vars(); if (!empty($this->_params['is_xml'])) { $this->_xml = new ActionView\Xml(); $locals->xml = $this->_xml; } $this->renderer->setLocals($locals); $this->renderer->renderContent(); } catch (ActionView\Template\Exception\ExceptionInterface $e) { switch (get_class($e)) { case 'Rails\\ActionView\\Template\\Exception\\TemplateMissingException': $route = Rails::application()->router()->route(); if (Rails::application()->dispatcher()->controller()->actionRan()) { throw new Exception\ViewNotFoundException(sprintf("View file not found: %s", $this->template_file_name)); } else { if ($route->namespaces()) { $namespaces = ' [ namespaces => [ ' . implode(', ', $route->namespaces()) . ' ] ]'; } else { $namespaces = ''; } throw new Exception\ActionNotFoundException(sprintf("Action '%s' not found for controller '%s'%s", $route->action(), $route->controller(), $namespaces)); } break; // default: // break; } throw $e; } }
public function _render_view() { # Include helpers. ActionView\ViewHelpers::load(); $layout = !empty($this->_params['layout']) ? $this->_params['layout'] : false; $partial = $this->_params['partial']; $locals = (array) \Rails::application()->controller()->locals(); $this->_template = new ActionView\Template(['lambda' => function () use($partial, $locals) { echo $this->partial($partial, $locals); }], ['layout' => $layout]); // $this->_template->setLocals(); $this->_template->renderContent(); // $params = [$this->_params['partial']]; // if (isset($this->_params['locals'])) // $params = array_merge($params, [$this->_params['locals']]); # Include helpers. // ActionView\ViewHelpers::load(); # Create a template so we can call render_partial. # This shouldn't be done this way. // $template = new ActionView\Template([]); // vpe($this); // $this->_body = call_user_func_array([$template, 'renderContent'], $params); }
public function initialize() { \Rails::assets()->addPaths([realpath(__DIR__ . '/../../../vendor/assets/javascripts'), realpath(__DIR__ . '/../../../vendor/assets/stylesheets'), realpath(__DIR__ . '/../../../vendor/assets/images')]); \Rails\ActionView\ViewHelpers::addHelper('Rails\\Bootstrap2\\ViewHelper'); }
public function renderContent() { Rails\ActionView\ViewHelpers::load(); $this->_set_initial_ob_level(); if (!$this->_init_rendered) { ob_start(); $this->_init_rendered = true; $this->_init_render(); $this->_buffer = ob_get_clean(); if (!$this->_validate_ob_level()) { $status = ob_get_status(); throw new Exception\OutputLeakedException(sprintf('Buffer level: %s; File: %s<br />Topmost buffer\'s contents: <br />%s', $status['level'], substr($this->_filename, strlen(Rails::root()) + 1), htmlentities(ob_get_clean()))); } } return $this; }
public function initialize() { \Rails::assets()->addPaths([realpath(__DIR__ . '/../../../vendor/assets/javascripts'), realpath(__DIR__ . '/../../../vendor/assets/stylesheets'), realpath(__DIR__ . '/../../../vendor/assets/fonts')]); \Rails::assets()->addFilePatterns(['*.eot', '*.svg', '*.ttf', '*.woff']); \Rails\ActionView\ViewHelpers::addHelper('Rails\\Bootstrap3\\ViewHelper'); }
public static function initialize() { self::$config = new Config(); \Rails\ActionView\ViewHelpers::addHelper('Rails\\WillPaginate\\Helper'); }
/** * Adds view helpers to the load list. * Accepts one or many strings. */ public function helper() { ActionView\ViewHelpers::addAppHelpers(func_get_args()); }
/** * Returns instance of Helper\Base */ public function base() { return ViewHelpers::getBaseHelper(); }