Introducing Pillar Framework
Refactor of pillar-server and pillar-web into a single python package. This simplifies the overall architecture of pillar applications. Special thanks @sybren and @venomgfx
This commit is contained in:
27
src/templates/_macros/_add_new_menu.jade
Normal file
27
src/templates/_macros/_add_new_menu.jade
Normal file
@@ -0,0 +1,27 @@
|
||||
| {% macro add_new_menu(node_types) %}
|
||||
|
||||
| {% for node_type in node_types %}
|
||||
| {% if node_type['name'] in ['group', 'group_texture', 'group_hdri', 'asset', 'texture', 'page', 'hdri'] %}
|
||||
| {% set node_type_name = node_type['name'] %}
|
||||
| {% if node_type_name == 'group' %}
|
||||
| {% set node_type_name = 'folder' %}
|
||||
| {% endif %}
|
||||
li(class="button-{{ node_type['name'] }}")
|
||||
a.item_add_node(
|
||||
href="#",
|
||||
title="{{ node_type['description'] }}",
|
||||
data-node-type-name="{{ node_type['name'] }}",
|
||||
data-toggle="tooltip",
|
||||
data-placement="left")
|
||||
i.pi(class="icon-{{ node_type['name'] }}")
|
||||
| {% if node_type_name == 'group_texture' %}
|
||||
| Texture Folder
|
||||
| {% elif node_type_name == 'group_hdri' %}
|
||||
| HDRi Folder
|
||||
| {% else %}
|
||||
| {{ node_type_name }}
|
||||
| {% endif %}
|
||||
| {% endif %}
|
||||
| {% endfor %}
|
||||
|
||||
| {% endmacro %}
|
18
src/templates/_macros/_file_uploader.jade
Normal file
18
src/templates/_macros/_file_uploader.jade
Normal file
@@ -0,0 +1,18 @@
|
||||
| {% macro render_file_uploader() %}
|
||||
|
||||
#fileUploaderModal.modal.fade(
|
||||
tabindex="-1", role="dialog", aria-labelledby="fileUploaderModalLabel", aria-hidden="true")
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
button.close(type="button", data-dismiss="modal", aria-label="Close")
|
||||
span(aria-hidden="true") ×
|
||||
h4.modal-title Upload file
|
||||
|
||||
.modal-body
|
||||
| {% include '_macros/include _file_uploader_form.html' %}
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-default(type="button", data-dismiss="modal") Close
|
||||
|
||||
| {% endmacro %}
|
70
src/templates/_macros/_file_uploader_form.jade
Normal file
70
src/templates/_macros/_file_uploader_form.jade
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
#node-add-container
|
||||
#node-add-header
|
||||
.node-add-title Upload Assets
|
||||
|
||||
#node-add-form
|
||||
p.
|
||||
This is the first step in the asset creation process. Once files are uploaded,
|
||||
they are stored in a temp location until further actions are taken.
|
||||
You can upload multiple assets simultaneously, but you can only edit one at a time.
|
||||
|
||||
hr
|
||||
|
||||
// The file upload form used as target for the file upload widget
|
||||
form#fileupload(action="{{url_for('files.upload')}}", method='POST', enctype='multipart/form-data')
|
||||
|
||||
// Redirect browsers with JavaScript disabled to the origin page
|
||||
noscript
|
||||
input(type='hidden', name='redirect', value="{{url_for('files.upload')}}")
|
||||
|
||||
// The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload
|
||||
.row.fileupload-buttonbar
|
||||
.col-lg-7
|
||||
|
||||
// The fileinput-button span is used to style the file input field as button
|
||||
span.btn.btn-success.fileinput-button
|
||||
i.pi-plus
|
||||
span Add files...
|
||||
input(type='file', name='file', multiple='')
|
||||
|
||||
button.btn.btn-primary.start(type='submit')
|
||||
i.pi-upload
|
||||
span Start upload
|
||||
|
||||
button.btn.btn-warning.cancel(type='reset')
|
||||
i.pi-cancel
|
||||
span Cancel upload
|
||||
|
||||
button.btn.btn-danger.delete(type='button')
|
||||
i.pi-trash
|
||||
span Delete
|
||||
|
||||
input.toggle(type='checkbox')
|
||||
// The global file processing state
|
||||
span.fileupload-process
|
||||
// The global progress state
|
||||
.col-lg-5.fileupload-progress.fade
|
||||
// The global progress bar
|
||||
.progress.progress-striped.active(role='progressbar', aria-valuemin='0', aria-valuemax='100')
|
||||
.progress-bar.progress-bar-success(style='width:0%;')
|
||||
// The extended global progress state
|
||||
.progress-extended
|
||||
// The table listing the files available for upload/download
|
||||
table.table(role='presentation')
|
||||
tbody.files
|
||||
br
|
||||
|
||||
h3 Notes
|
||||
ul
|
||||
li
|
||||
| The maximum file size for this interface is
|
||||
strong {{ config.MAX_CONTENT_LENGTH | filesizeformat }}
|
||||
| .
|
||||
li
|
||||
| Only the following formats are allowed:
|
||||
br
|
||||
strong.text-uppercase
|
||||
| {% for f in config.ALLOWED_EXTENSIONS %}
|
||||
| {{f}}
|
||||
| {% endfor %}
|
133
src/templates/_macros/_file_uploader_javascript.jade
Normal file
133
src/templates/_macros/_file_uploader_javascript.jade
Normal file
@@ -0,0 +1,133 @@
|
||||
| {% raw %}
|
||||
|
||||
// The template to display files available for upload
|
||||
script#template-upload(type="text/x-tmpl").
|
||||
| {% for (var i=0, file; file=o.files[i]; i++) { %}
|
||||
<tr class="template-upload fade">
|
||||
<td>
|
||||
<span class="preview"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="name">{%=file.name%}</span>
|
||||
<strong class="error text-danger"></strong>
|
||||
</td>
|
||||
<td>
|
||||
<p class="size">Processing...</p>
|
||||
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
|
||||
</td>
|
||||
<td>
|
||||
{% if (!i && !o.options.autoUpload) { %}
|
||||
<button class="btn btn-primary start" disabled>
|
||||
<i class="ion-upload"></i>
|
||||
<span>Start</span>
|
||||
</button>
|
||||
{% } %}
|
||||
{% if (!i) { %}
|
||||
<button class="btn btn-warning cancel">
|
||||
<i class="ion-close-round"></i>
|
||||
<span>Cancel</span>
|
||||
</button>
|
||||
{% } %}
|
||||
</td>
|
||||
</tr>
|
||||
| {% } %}
|
||||
|
||||
|
||||
// The template to display files available for download
|
||||
script#template-download(type="text/x-tmpl").
|
||||
| {% for (var i=0, file; file=o.files[i]; i++) { %}
|
||||
<tr class="template-download fade">
|
||||
<td>
|
||||
<span class="preview">
|
||||
{% if (file.thumbnailUrl) { %}
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
|
||||
{% } %}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="name">
|
||||
{% if (file.url) { %}
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
|
||||
{% } else { %}
|
||||
<span>{%=file.name%}</span>
|
||||
{% } %}
|
||||
</span>
|
||||
{% if (file.error) { %}
|
||||
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
|
||||
{% } %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="size">{%=o.formatFileSize(file.size)%}</span>
|
||||
</td>
|
||||
<td>
|
||||
{% if (file.deleteUrl) { %}
|
||||
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
|
||||
<i class="ion-trash-b"></i>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
<input type="checkbox" name="delete" value="1" class="toggle">
|
||||
<div class="btn btn-success create" data-name="{%=file.name%}" data-type="{%=file.type%}">
|
||||
<i class="ion-upload"></i>
|
||||
Create
|
||||
</div>
|
||||
{% } else { %}
|
||||
<button class="btn btn-warning cancel">
|
||||
<i class="ion-close-round"></i>
|
||||
<span>Cancel</span>
|
||||
</button>
|
||||
{% } %}
|
||||
</td>
|
||||
</tr>
|
||||
| {% } %}
|
||||
|
||||
| {% endraw %}
|
||||
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.iframe-transport.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='javascript-templates/js/tmpl.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='javascript-load-image/js/load-image.all.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='javascript-canvas-to-blob/js/canvas-to-blob.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='gallery/js/jquery.blueimp-gallery.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.iframe-transport.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.fileupload.min.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/jquery.fileupload-process.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/jquery.fileupload-image.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/jquery.fileupload-audio.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/jquery.fileupload-video.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/jquery.fileupload-validate.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/jquery.fileupload-ui.js') }}")
|
||||
script(src="{{ url_for('static_pillar', filename='jquery-file-upload/js/main.js') }}")
|
||||
|
||||
script().
|
||||
$('body').unbind('click');
|
||||
$('body').on('click', '.create', function(event) {
|
||||
// Start the asset creation process
|
||||
event.preventDefault();
|
||||
var parent_id = ProjectUtils.nodeId();
|
||||
$('#node-add-form').text('Please wait...');
|
||||
$.post('{{url_for('nodes.assets_create')}}', {
|
||||
name: $(this).attr('data-name'),
|
||||
project_id: ProjectUtils.projectId(),
|
||||
type: $(this).attr('data-type'),
|
||||
parent_id: parent_id})
|
||||
.done(function(data) {
|
||||
if (parent_id) {
|
||||
// We are in embedded mode and try to call the editNode function
|
||||
editNode(data.asset_id);
|
||||
} else {
|
||||
window.location.replace("/nodes/" + data.asset_id + "/edit");
|
||||
}
|
||||
//alert( "Data Loaded: " + data.message );
|
||||
});
|
||||
});
|
||||
|
||||
// Temporary list of CSS to style the upload form
|
||||
var cssLinks = ['/static/assets/css/blueimp/blueimp-gallery.min.css',
|
||||
'/static/jquery-file-upload/css/jquery.fileupload.css',
|
||||
'/static/jquery-file-upload/css/jquery.fileupload-ui.css']
|
||||
|
||||
$.each(cssLinks, function(index, value) {
|
||||
// Check if the CSS is needed
|
||||
if (!$("link[href='" + value + "']").length) {
|
||||
$('<link href="' + value + '" rel="stylesheet">').appendTo("head");
|
||||
}
|
||||
});
|
15
src/templates/_macros/_navigation.jade
Normal file
15
src/templates/_macros/_navigation.jade
Normal file
@@ -0,0 +1,15 @@
|
||||
| {% macro navigation_tabs(title) %}
|
||||
|
||||
section#nav-tabs
|
||||
ul#nav-tabs__list
|
||||
li.nav-tabs__list-tab(
|
||||
class="{% if title == 'homepage' %}active{% endif %}")
|
||||
a(href="{{ url_for('main.homepage') }}") Activity
|
||||
li.nav-tabs__list-tab(
|
||||
class="{% if title == 'dashboard' %}active{% endif %}")
|
||||
a(href="{{ url_for('projects.index') }}") My Projects
|
||||
li.nav-tabs__list-tab(
|
||||
class="{% if title == 'home' %}active{% endif %}")
|
||||
a(href="{{ url_for('projects.home_project') }}") Home
|
||||
|
||||
| {% endmacro %}
|
34
src/templates/_macros/_node_edit_form.jade
Normal file
34
src/templates/_macros/_node_edit_form.jade
Normal file
@@ -0,0 +1,34 @@
|
||||
| {% macro render_field(field) %}
|
||||
|
||||
.form-group(class="{{field.name}}{% if field.errors %} error{% endif %}")
|
||||
|
||||
| {% if field.type == 'BooleanField' %}
|
||||
.checkbox
|
||||
label
|
||||
| {{ field(class='checkbox') }}
|
||||
| {{ field.label }}
|
||||
| {% elif field.type == 'FieldList' %}
|
||||
|
||||
ul.fieldlist#files
|
||||
| {% for file in field %}
|
||||
li.fieldlist-item
|
||||
|
||||
| {% for subfield in file %}
|
||||
| {{ render_field(subfield) }}
|
||||
| {% endfor %}
|
||||
|
||||
| {% endfor %}
|
||||
|
||||
| {% else %}
|
||||
| {{ field.label }}
|
||||
| {{ field(class='form-control') }}
|
||||
| {% endif %}
|
||||
|
||||
| {% if field.errors %}
|
||||
ul.error
|
||||
| {% for error in field.errors %}
|
||||
li {{ error }}
|
||||
| {% endfor %}
|
||||
| {% endif %}
|
||||
|
||||
| {% endmacro %}
|
Reference in New Issue
Block a user