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 %}
#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 %}
| {% extends "nodes/view_base.html" %}

View File

@ -1,44 +1 @@
| {% block body %}
#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 %}
| {% extends "nodes/view_base.html" %}

View File

@ -1,10 +1,8 @@
| {% block body %}
| {% extends "nodes/view_base.html" %}
#node-container
#node-overlay
section.node-preview.video
| {% block node_preview %}
| {% if node.video_sources %}
section.node-preview.video
video#videoplayer.video-js(
controls,
data-setup="{}",
@ -19,42 +17,37 @@
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>
| {% else %}
.video-dummy.sorry(
style="{% if node.picture %}background-image: url({{ node.picture.thumbnail('l', api=api) }});{% endif %}")
.video-dummy-content
.video-dummy-content-text
span Available to Blender Cloud subscribers
span
small Support Blender and get awesome stuff!
hr
| {% if current_user.has_cap('can-renew-subscription') %}
a.subscribe(href="/renew") You have a subscription, it just needs to be renewed. <em>Renew your subscription now!</em>
| {% else %}
a.subscribe(href="{{ url_for('cloud.join') }}") <em>Subscribe to Blender Cloud.</em>
| {% endif %}
| {% if current_user.is_anonymous %}
a(href="{{ url_for('users.login') }}") Already a subscriber? Log in
| {% include 'nodes/custom/_node_preview_forbidden.html' %}
| {% endif %}
| {% endblock node_preview %}
| {% block node_download %}
| {% if node.file_variations %}
button.btn.btn-default.dropdown-toggle(
type="button",
data-toggle="dropdown",
aria-haspopup="true",
aria-expanded="false")
i.pi-download
| Download
i.pi-angle-down.icon-dropdown-menu
ul.dropdown-menu
| {% 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
.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
| {% block node_scripts %}
script(type="text/javascript").
{% if node.video_sources %}
@ -114,17 +107,6 @@ script(type="text/javascript").
}
};
{% endif %}
{% endif %} // if node.video_sources
$(function(){
// 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 %}
| {% endblock node_scripts %}

View File

@ -1,8 +1,6 @@
| {% block body %}
| {% extends "nodes/view_base.html" %}
#node-container.texture
#node-overlay
section.node-preview
| {% block node_preview %}
| {% if node.picture %}
iframe(
id='vrview_window'
@ -12,46 +10,13 @@
frameborder='0',
allowfullscreen='',
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))}}")
| {% endif %}
section.node-details-container
.node-details-header
.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 %}
section.node-preview
h3 Missing Preview
| {% endif %}
| {% endblock node_preview %}
| {% block node_details_meta_extra %}
| {% if write_access %}
li.node-details-meta-list-item
a.btn#copy_yaw(
@ -59,16 +24,18 @@
title='Copies current yaw of panorama to the clipboard, so you can set it as default yaw.'
) Copy yaw
| {% endif %}
| {% endblock node_details_meta_extra %}
| {% block node_download %}
| {% if node.properties.files %}
li.btn-group.node-details-meta-list-item.video.download(
title="Download HDRI")
button.btn.btn-default.dropdown-toggle(
title="Download HDRI",
type="button",
data-toggle="dropdown",
aria-haspopup="true",
aria-expanded="false")
i.pi-download
| Download
i.pi-angle-down.icon-dropdown-menu
ul.dropdown-menu
@ -78,67 +45,18 @@
title="Download this HDRi format",
download)
span.length {{ var.file.length | filesizeformat }}
span.format {{ var.file.format | hide_none }}
span.size {{ var.resolution }}
| {% endfor %}
| {% else %}
li.btn-group.node-details-meta-list-item.video.download.disabled(
title="Download HDRi")
button.btn.btn-default.sorry(type="button")
i.pi-lock
i.pi-download
| {% endif %}
| {% endblock node_download %}
| {% if node.description %}
.node-details-description#node-description
| {{ node.description | markdown }}
| {% endif %}
| {% block node_comments %}{% endblock %}
| {% if node.properties.license_notes %}
.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 %}
| {% block node_scripts %}
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}")
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 () {
new Clipboard('#copy_yaw', {
text: function(trigger) {
@ -153,5 +71,4 @@ script.
$(e.trigger).flashOnce();
});
});
| {% endblock %}
| {% endblock node_scripts %}