Use view_base for assets

This commit is contained in:
Pablo Vazquez 2018-03-27 19:39:49 +02:00
parent 641f29ab30
commit a7cb3b9658
4 changed files with 102 additions and 288 deletions

View File

@ -1,43 +1 @@
| {% block body %} | {% extends "nodes/view_base.html" %}
#node-container
#node-overlay
| {% if node.picture %}
section#node-preview.node-preview.file
img.node-preview-thumbnail#node-preview-thumbnail(
src="{{ node.picture.thumbnail('l', api=api) }}")
| {% endif %}
section.node-details-container
include ../../_node_details
#comments-embed
.comments-list-loading
i.pi-spin
include ../../_scripts
| {% endblock %}
| {% block footer_scripts %}
script.
// Generate GA pageview
ga('send', 'pageview', location.pathname);
var content_type = $("li.node-details-meta-list-item.type").text();
var type_trimmed = content_type.substring(content_type.indexOf("/") + 1);
if (type_trimmed == 'x-blender' || type_trimmed == 'blend'){
type_trimmed = '<span class="blend"><i class="pi-blender-logo"></i></span>';
};
$("li.node-details-meta-list-item.type").html(type_trimmed);
$('.sorry').click(function() {
$.get('/403', function(data) {
$('#node-overlay').html(data).addClass('active');
})
});
| {% endblock %}

View File

@ -1,44 +1 @@
| {% block body %} | {% extends "nodes/view_base.html" %}
#node-container
#node-overlay
| {% if node.picture %}
| {% if current_user.has_cap('subscriber') %}
section#node-preview.node-preview.image.js-node-preview-image
img.node-preview-thumbnail#node-preview-thumbnail(
src="{{ node.picture.thumbnail('l', api=api) }}")
| {% else %}
section#node-preview.node-preview.image.node-preview-blur
img.node-preview-thumbnail#node-preview-thumbnail(
src="{{ node.picture.thumbnail('t', api=api) }}")
| {% endif %}
| {% endif %}
section.node-details-container
include ../../_node_details
#comments-embed
.comments-list-loading
i.pi-spin
include ../../_scripts
| {% endblock %}
| {% block footer_scripts %}
script.
// Generate GA pageview
ga('send', 'pageview', location.pathname);
var content_type = $("li.node-details-meta-list-item.type").text();
$("li.node-details-meta-list-item.type").text(content_type.substring(content_type.indexOf("/") + 1));
$('.sorry').click(function() {
$.get('/403', function(data) {
$('#node-overlay').html(data).addClass('active');
})
});
| {% endblock %}

View File

@ -1,10 +1,8 @@
| {% block body %} | {% extends "nodes/view_base.html" %}
#node-container | {% block node_preview %}
#node-overlay | {% if node.video_sources %}
section.node-preview.video
section.node-preview.video
| {% if node.video_sources %}
video#videoplayer.video-js( video#videoplayer.video-js(
controls, controls,
data-setup="{}", data-setup="{}",
@ -18,43 +16,38 @@
p.vjs-no-js. p.vjs-no-js.
To view this video please enable JavaScript, and consider upgrading to a web browser that To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a> <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
| {% else %} | {% else %}
.video-dummy.sorry( | {% include 'nodes/custom/_node_preview_forbidden.html' %}
style="{% if node.picture %}background-image: url({{ node.picture.thumbnail('l', api=api) }});{% endif %}") | {% endif %}
.video-dummy-content | {% endblock node_preview %}
.video-dummy-content-text
span Available to Blender Cloud subscribers | {% block node_download %}
span | {% if node.file_variations %}
small Support Blender and get awesome stuff! button.btn.btn-default.dropdown-toggle(
hr type="button",
| {% if current_user.has_cap('can-renew-subscription') %} data-toggle="dropdown",
a.subscribe(href="/renew") You have a subscription, it just needs to be renewed. <em>Renew your subscription now!</em> aria-haspopup="true",
| {% else %} aria-expanded="false")
a.subscribe(href="{{ url_for('cloud.join') }}") <em>Subscribe to Blender Cloud.</em> i.pi-download
| {% endif %} | Download
| {% if current_user.is_anonymous %} i.pi-angle-down.icon-dropdown-menu
a(href="{{ url_for('users.login') }}") Already a subscriber? Log in
| {% endif %} ul.dropdown-menu
| {% endif %} | {% for variation in node.file_variations %}
li
a(href="{{ variation.link }}",
title="Download this format",
download)
span.length {{ variation.length | filesizeformat }}
span.format {{ variation.format }}
span.size {{ variation.size }}
| {% endfor %}
| {% endif %}
| {% endblock node_download %}
section.node-details-container.video | {% block node_scripts %}
.node-details-header
.node-title#node-title
| {{node.name}}
| {% if node.description %}
.node-details-description#node-description
| {{ node.description | markdown }}
| {% endif %}
include ../../_node_details
#comments-embed
.comments-list-loading
i.pi-spin
script(type="text/javascript"). script(type="text/javascript").
{% if node.video_sources %} {% if node.video_sources %}
@ -114,17 +107,6 @@ script(type="text/javascript").
} }
}; };
{% endif %} {% endif %} // if node.video_sources
$(function(){ | {% endblock node_scripts %}
// Generate GA pageview
ga('send', 'pageview', location.pathname);
var content_type = $("li.node-details-meta-list-item.type").text();
$("li.node-details-meta-list-item.type").text(content_type.substring(content_type.indexOf("/") + 1));
});
include ../../_scripts
| {% endblock %}

View File

@ -1,144 +1,62 @@
| {% block body %} | {% extends "nodes/view_base.html" %}
#node-container.texture | {% block node_preview %}
#node-overlay | {% if node.picture %}
section.node-preview iframe(
| {% if node.picture %} id='vrview_window'
iframe( width='100%',
id='vrview_window' height='450px',
width='100%', scrolling='no',
height='450px', frameborder='0',
scrolling='no', allowfullscreen='',
frameborder='0', src="{{url_for('main.vrview', preview=node.picture.thumbnail('l', api=api), image=node.picture.thumbnail('h', api=api), default_yaw=(node.properties.default_yaw or 0))}}")
allowfullscreen='', | {% else %}
src="{{url_for('main.vrview', preview=node.picture.thumbnail('l', api=api), image=node.picture.thumbnail('h', api=api), default_yaw=(node.properties.default_yaw or 0))}}") section.node-preview
| {% endif %} h3 Missing Preview
| {% endif %}
| {% endblock node_preview %}
section.node-details-container | {% block node_details_meta_extra %}
| {% if write_access %}
.node-details-header li.node-details-meta-list-item
.node-title#node-title
| {{node.name}}
.node-details-meta.header
ul.node-details-meta-list
| {% if node.permissions.world %}
li.node-details-meta-list-item.access.public(
data-toggle="tooltip",
data-placement="bottom",
title="Anybody can download. Share it!")
i.pi-lock-open
span Public
| {% endif %}
| {% if node.properties.license_type %}
| {% if node.properties.license_notes %}
li.node-details-meta-list-item.video.license(
id="asset-license",
data-toggle="popover",
data-placement="left",
data-trigger="hover",
data-content="{{ node.properties.license_notes }}",
title="{{ node.properties.license_type }}")
i(class="pi-license-{{ node.properties.license_type }}")
| {% else %}
li.node-details-meta-list-item.video.license(
id="asset-license",
data-toggle="tooltip",
data-placement="bottom",
title="{{ node.properties.license_type }}")
i(class="pi-license-{{ node.properties.license_type }}")
| {% endif %}
| {% endif %}
| {% if write_access %}
li.node-details-meta-list-item
a.btn#copy_yaw( a.btn#copy_yaw(
href='javascript:void(0);' href='javascript:void(0);'
title='Copies current yaw of panorama to the clipboard, so you can set it as default yaw.' title='Copies current yaw of panorama to the clipboard, so you can set it as default yaw.'
) Copy yaw ) Copy yaw
| {% endif %} | {% endif %}
| {% endblock node_details_meta_extra %}
| {% if node.properties.files %} | {% block node_download %}
li.btn-group.node-details-meta-list-item.video.download( | {% if node.properties.files %}
title="Download HDRI") button.btn.btn-default.dropdown-toggle(
button.btn.btn-default.dropdown-toggle( title="Download HDRI",
type="button", type="button",
data-toggle="dropdown", data-toggle="dropdown",
aria-haspopup="true", aria-haspopup="true",
aria-expanded="false") aria-expanded="false")
i.pi-download i.pi-download
| Download
i.pi-angle-down.icon-dropdown-menu i.pi-angle-down.icon-dropdown-menu
ul.dropdown-menu ul.dropdown-menu
| {% for var in node.properties.files %} | {% for var in node.properties.files %}
li li
a(href="{{ var.file.link }}", a(href="{{ var.file.link }}",
title="Download this HDRi format", title="Download this HDRi format",
download) download)
span.length {{ var.file.length | filesizeformat }} span.length {{ var.file.length | filesizeformat }}
span.format {{ var.file.format | hide_none }} span.format {{ var.file.format | hide_none }}
span.size {{ var.resolution }} span.size {{ var.resolution }}
| {% endfor %} | {% endfor %}
| {% else %} | {% endif %}
li.btn-group.node-details-meta-list-item.video.download.disabled( | {% endblock node_download %}
title="Download HDRi")
button.btn.btn-default.sorry(type="button")
i.pi-lock
i.pi-download
| {% endif %}
| {% if node.description %} | {% block node_comments %}{% endblock %}
.node-details-description#node-description
| {{ node.description | markdown }}
| {% endif %}
| {% if node.properties.license_notes %} | {% block node_scripts %}
.node-details-meta.license
| {{ node.properties.license_notes }}
| {% endif %}
.node-details-meta.footer
ul.node-details-meta-list
li.node-details-meta-list-item.status
| {{ node.properties.status | undertitle }}
li.node-details-meta-list-item.author
| {{ node.user.full_name }}
li.node-details-meta-list-item.date(title="Created {{ node._created }}")
| {{ node._created | pretty_date }}
| {% if (node._created | pretty_date) != (node._updated | pretty_date) %}
span(title="Updated {{ node._updated }}") (updated {{ node._updated | pretty_date }})
| {% endif %}
include ../_scripts
| {% endblock %}
| {% block footer_scripts %}
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}") script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}")
script. script.
$('#asset-license').popover();
// Generate GA pageview
ga('send', 'pageview', location.pathname);
$('.sorry').click(function() {
$.get('/403', function(data) {
$('#node-overlay').html(data).show().addClass('active');
})
});
$('#node-overlay').click(function(){
$(this).removeClass('active').hide().html();
});
$().ready(function () { $().ready(function () {
new Clipboard('#copy_yaw', { new Clipboard('#copy_yaw', {
text: function(trigger) { text: function(trigger) {
@ -153,5 +71,4 @@ script.
$(e.trigger).flashOnce(); $(e.trigger).flashOnce();
}); });
}); });
| {% endblock node_scripts %}
| {% endblock %}