Skip to content

Instantly share code, notes, and snippets.

@wolfspyre
Forked from hussfelt/README.md
Last active May 21, 2019 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfspyre/1ef4ce1ab3bf38e793e2 to your computer and use it in GitHub Desktop.
Save wolfspyre/1ef4ce1ab3bf38e793e2 to your computer and use it in GitHub Desktop.
Dashing widget to display an iframe with specified src

dashing-iframe

IFrame plugin for dashing

Description

Dashing widget to display an iframe with specified src

Installation

Create the folder iframe in the /widgets/ directory. Put the files iframe.coffee, iframe.html and iframe.scss in that folder.

This can also be done by using the gist: https://gist.github.com/hussfelt/a6fe71ebd7cce327df29

dashing install a6fe71ebd7cce327df29

Dashboard configuration

Put the following in your dashboard.erb file to show the iframe:

    <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
      <div data-id="iframeId1" data-view="Iframe"></div>
    </li>

Updating the src

Curl

curl -d '{
	"auth_token": "YOUR_AUTH_TOKEN",
	"src": "http://example.com/"
}' http://0.0.0.0:3030/widgets/iframeId1

Inline

    <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
      <div data-id="iframeId1" data-view="Iframe" data-src="http://example.com/"></div>
    </li>

License

Distributed under the MIT license

class Dashing.Iframe extends Dashing.Widget
ready: ->
$(@node).find(".iframe").attr('src', @get('src'))
onData: (data) ->
$(@node).find(".iframe").attr('src', data.src)
<iframe class="iframe" data-bind-src="src" scrolling="no"></iframe>
// ----------------------------------------------------------------------------
// Sass declarations
// ----------------------------------------------------------------------------
$background-color: #FFF;
$title-color: #333;
$moreinfo-color: #333;
$iframe-background: darken($background-color, 25%);
// ----------------------------------------------------------------------------
// Widget-iframe styles
// ----------------------------------------------------------------------------
.widget-iframe {
background-color: $background-color;
padding: 0 !important;
margin: 0 !important;
iframe {
width: 100%;
height: 100%;
border: 0;
padding: 0;
margin: 0;
overflow: hidden;
}
}
@manikandanselva
Copy link

which file or which place add curl code?

curl -d '{
"auth_token": "YOUR_AUTH_TOKEN",
"src": "http://example.com/"
}' http://0.0.0.0:3030/widgets/iframeId1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment