forked from SimpleUpdates/ThemePatternGuide
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscenario.html
More file actions
Latest commit
executable file
·42 lines (34 loc) · 1.5 KB
/
Copy pathscenario.html
File metadata and controls
executable file
·42 lines (34 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{% set scenarioId = "scenario_#{random()}" %}
{% set iframeId = "iframe_#{random()}" %}
<divrole="tabpanel" class="tab-pane component-iframe" id="{{ scenarioId }}" data-iframe-id="{{ iframeId }}">
<divclass="output-head" style="display:none;">
{% block scenarioHead %}{% endblock %}
</div>
<divclass="output disable-logo-js" style="display:none;">
<divclass="{% block wrapperClasses %}{% endblock %}">
{% block scenario %}{% endblock %}
</div>
</div>
<iframename="{{ iframeId }}" id="{{ iframeId }}"></iframe>
<script>
vartabs=jQuery("#{{ componentId }} .nav-pills");
jQuery(tabs).append(
'<li role="presentation"><a href="#{{ scenarioId }}" role="tab" data-toggle="tab">{{ name }}</a></li>'
);
functionpostToIframe(data,url,target){
jQuery('body').append('<form action="'+url+'" method="post" target="'+target+'" id="postToIframe"></form>');
jQuery.each(data,function(n,v){
varinput=jQuery('<input type="hidden" name="'+n+'" />').attr('value',v);
jQuery('#postToIframe').append(input);
});
jQuery('#postToIframe').submit().remove();
}
jQuery(document).ready(function(){
varcomponent=jQuery("[data-iframe-id='{{ iframeId }}']"),
head=component.find('.output-head').html(),
body=component.find('.output').html(),
iframeSrc='/admin/theme/view/{{ styleguideThemePath }}/view.html?myid={{ iframeId }}';
postToIframe({head:head,body:body},iframeSrc,'{{ iframeId }}');
});
</script>
</div>