Introducing setup_for_film functionality

It is now possible, only for user with admin capability, to setup a
project as ‘film’. This action can be performed via CLI using
./manage.py cloud setup_for_film <project_url> or via the web
interface in the Cloud settings area.
Setting up a project for film creates a number of extension props
under the ‘cloud’ key. Such properties are listed in the
cloud_extension_props variable in setup.py.

At this moment the functionality exists for a very specific purpose:
improving the presentation of public Film projects in the Blender
Cloud. It can be further extended to improve the presentation of
Training and Libraries later on.
This commit is contained in:
2019-04-03 15:54:37 +02:00
parent 6ac75c6a14
commit 4a180e3784
8 changed files with 346 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
| {% extends 'projects/edit_layout.html' %}
| {% set title = 'cloud' %}
| {% block page_title %}Blender Cloud settings for {{ project.name }}{% endblock %}
| {% block head %}
script(src="{{ url_for('static_attract', filename='assets/js/generated/tutti.min.js') }}")
| {% endblock %}
| {% block project_context %}
.container-fluid
.row
.col-md-12
h5.pt-3 {{ self.page_title() }}
hr
#node-edit-container
| {% block cloud_container %}
| {% endblock cloud_container %}
| {% endblock project_context %}

View File

@@ -0,0 +1,28 @@
| {% extends 'project_settings/cloud_layout.html' %}
| {% block cloud_container %}
#node-edit-form
p This project is not setup for Blender Cloud #[span.text-muted (yet!)]
p
button.btn.btn-outline-primary.px-3(onclick='setupForFilm()')
i.pr-2.pi-blender-cloud
| Setup Project for Film
| {% endblock cloud_container %}
| {% block footer_scripts %}
script.
function setupForFilm() {
$.ajax({
url: '{{ url_for( "cloud.setup_for_film", project_url=project.url) }}',
method: 'POST',
})
.done(function() {
window.location.reload();
})
.fail(function(err) {
var err_elt = xhrErrorResponseElement(err, 'Error setting up your project: ');
toastr.error(err_elt);
});
}
| {% endblock %}

View File

@@ -0,0 +1,67 @@
| {% extends 'project_settings/cloud_layout.html' %}
| {% block cloud_container %}
#node-edit-form
form(onsubmit="save(this, '{{ url_for('cloud.save_film_settings', project_url=project['url']) }}'); return false;")
| {% for field in form %}
| {% if field.name == 'csrf_token' %}
| {{ field }}
| {% else %}
| {% if field.type == 'HiddenField' %}
| {{ field }}
| {% else %}
| {% if field.name not in hidden_fields %}
.form-group(class="{{field.name}}{% if field.errors %} error{% endif %}")
| {{ field.label }}
| {% if field.name == 'picture' %}
| {% if post.picture %}
img.node-preview-thumbnail(src="{{ post.picture.thumbnail('m', api=api) }}")
a(href="#", class="file_delete", data-field-name="picture", data-file_id="{{post.picture._id}}") Delete
| {% endif %}
| {% endif %}
| {{ field(class='form-control') }}
| {% if field.errors %}
ul.error
| {% for error in field.errors %}
li {{ error }}
| {% endfor %}
| {% endif %}
| {% else %}
| {{ field(class='d-none') }}
| {% endif %}
| {% endif %}
| {% endif %}
| {% endfor %}
button.btn.btn-outline-success.btn-block(type='submit')
i.pi-check
| Save
| {% endblock cloud_container %}
| {% block footer_scripts %}
script(type='text/javascript', src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.ui.widget.min.js') }}")
script(type='text/javascript', src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.iframe-transport.min.js') }}")
script(type='text/javascript', src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.fileupload.min.js') }}")
script(type='text/javascript', src="{{ url_for('static_pillar', filename='assets/js/file_upload.min.js') }}")
script.
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: true, nodeId: ''});
function save(form, url) {
let serizalizedData = $(form).serializeArray()
$.post(url, serizalizedData)
.done(function(xhr) {
toastr.success('Properties saved');
})
.fail(function(err) {
toastr.error(xhrErrorResponseElement(err, 'Error saving properties: '));
});
}
| {% endblock %}