Skip to content

Commit

Permalink
#44 Fixed scrolling and added width option
Browse files Browse the repository at this point in the history
  • Loading branch information
raulfraile committed Oct 14, 2013
1 parent bff11db commit 7bfe11c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Ladybug/Renderer/AbstractRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ abstract class AbstractRenderer implements RendererInterface
/** @var \Ladybug\Theme\ThemeResolver $themeResolver */
protected $themeResolver;

/** @var array $options */
protected $options;

/**
* Constructor
* @param \Ladybug\Theme\ThemeResolver $themeResolver
*/
public function __construct(ThemeResolver $themeResolver)
public function __construct(ThemeResolver $themeResolver, $options = array())
{
$this->themeResolver = $themeResolver;
$this->options = $options;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Ladybug/Renderer/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public function render(array $nodes, array $extraData = array())
{
$this->loadTemplatingEngine();

$extraData = array_merge($extraData, array('options' => $this->options));

return $this->templatingEngine->render('layout.html.twig', array_merge(array(
'nodes' => $nodes,
'css' => $this->getCssContents(),
Expand Down
5 changes: 5 additions & 0 deletions src/Ladybug/Resources/container/container.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<parameter key="object_max_nesting_level">3</parameter>
<parameter key="expanded">false</parameter>
<parameter key="silenced">false</parameter>

<parameter key="renderer.html" type="collection">
<parameter key="width">500px</parameter>
</parameter>

</parameters>

<services>
Expand Down
1 change: 1 addition & 0 deletions src/Ladybug/Resources/container/renderers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<service id="render_html" class="Ladybug\Renderer\HtmlRenderer">
<argument type="service" id="theme_resolver" />
<argument>%renderer.html%</argument>
<tag name="ladybug.renderer" />
</service>

Expand Down
2 changes: 1 addition & 1 deletion src/Ladybug/Theme/Base/View/Html/iframe.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<iframe id="ladybug_iframe_{{ id }}" frameborder="0" width="500" height="100" style="margin: 5px;overflow:hidden"></iframe>
<iframe id="ladybug_iframe_{{ id }}" frameborder="0" width="{{ options.width }}" height="100" style="margin: 5px;overflow:hidden" scrolling="no"></iframe>
<input type="hidden" id="ladybug_theme_{{ id }}" value="{{ theme }}" />
<script>
function resizeIframe{{ id }}(height, width) {
Expand Down

0 comments on commit 7bfe11c

Please sign in to comment.