Introducing attachments fixes for blog posts and assets.
Requires migration of attachments schema using python manage.py maintenance upgrade_attachment_schema --all
This commit is contained in:
@@ -427,8 +427,11 @@ html(lang="en")
|
||||
$('[data-toggle="popover"]').popover();
|
||||
}
|
||||
|
||||
| {% block footer_scripts_pre %}{% endblock %}
|
||||
| {% block footer_scripts %}{% endblock %}
|
||||
|
||||
|
||||
|
||||
script.
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
|
@@ -1 +1,11 @@
|
||||
img(src="{{ vars['l'].link }}",alt="{{ file.filename }}")
|
||||
| {% if 'link' in attachment and attachment['link'] != 'none' %}
|
||||
| {% if attachment['link'] == 'self' %}
|
||||
a(href="{{ vars['l'].link }}")
|
||||
img(src="{{ vars['l'].link }}", alt="{{ file.filename }}")
|
||||
| {% elif attachment['link'] == 'custom' %}
|
||||
a(href="{{ attachment['link_custom'] }}")
|
||||
img(src="{{ vars['l'].link }}", alt="{{ file.filename }}")
|
||||
| {% endif %}
|
||||
| {% else %}
|
||||
img(src="{{ vars['l'].link }}", alt="{{ file.filename }}")
|
||||
| {% endif %}
|
||||
|
@@ -77,7 +77,6 @@
|
||||
| {% endif %}
|
||||
|
||||
| {% block comment_scripts %}
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/markdown.min.js', v=171020161) }}")
|
||||
script.
|
||||
|
||||
// Markdown initialization
|
||||
|
@@ -1,168 +0,0 @@
|
||||
| {% extends 'layout.html' %}
|
||||
|
||||
| {% set title = 'blog' %}
|
||||
|
||||
| {% block page_title %}New {{ node_type.name }}{% endblock %}
|
||||
|
||||
| {% block body %}
|
||||
|
||||
.container
|
||||
form(
|
||||
method='POST',
|
||||
action="{{url_for('nodes.posts_edit', post_id=post._id)}}")
|
||||
|
||||
#blog_container.post-create
|
||||
|
||||
| {% with errors = errors %}
|
||||
| {% if errors %}
|
||||
| {% for field in errors %}
|
||||
.alert.alert-danger(role='alert')
|
||||
strong {{field}}
|
||||
| {% for message in errors[field] %}
|
||||
| {{message}}|
|
||||
| {% endfor %}
|
||||
| {% endfor %}
|
||||
| {% endif %}
|
||||
| {% endwith %}
|
||||
|
||||
#blog_index-sidebar
|
||||
| {% if project._id != config.MAIN_PROJECT_ID %}
|
||||
.blog_project-card
|
||||
a.item-header(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
|
||||
.overlay
|
||||
| {% if project.picture_header %}
|
||||
img.background(src="{{ project.picture_header.thumbnail('m', api=api) }}")
|
||||
| {% endif %}
|
||||
|
||||
a.card-thumbnail(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
| {% if project.picture_square %}
|
||||
img.thumb(src="{{ project.picture_square.thumbnail('m', api=api) }}")
|
||||
| {% endif %}
|
||||
|
||||
.item-info
|
||||
|
||||
a.item-title(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
| {{ project.name }}
|
||||
|
||||
| {% endif %}
|
||||
|
||||
.blog_project-sidebar
|
||||
#blog_post-edit-form
|
||||
| {% for field in form %}
|
||||
| {% if field.name in ['picture', 'status'] %}
|
||||
|
||||
.form-group(class="{{field.name}}{% if field.errors %} error{% endif %}")
|
||||
| {{ field.label }}
|
||||
| {{ field(class='form-control') }}
|
||||
|
||||
| {% if field.errors %}
|
||||
ul.error
|
||||
| {% for error in field.errors %}
|
||||
li {{ error }}
|
||||
| {% endfor %}
|
||||
| {% endif %}
|
||||
|
||||
| {% endif %}
|
||||
| {% endfor %}
|
||||
|
||||
button.btn.btn-default.button-create(type='submit')
|
||||
i.pi-check
|
||||
| Update {{ node_type.name }}
|
||||
|
||||
a.btn.btn-default.button-back(href="{{ url_for_node(node=post) }}")
|
||||
i.pi-angle-left
|
||||
| Back to Post
|
||||
|
||||
a.btn.btn-default.button-back(href="{{ url_for('projects.view', project_url=project.url) }}blog")
|
||||
| Go to Blog
|
||||
|
||||
#blog_post-edit-container
|
||||
#blog_post-edit-title
|
||||
| Edit {{ node_type.name }}
|
||||
|
||||
#blog_post-edit-form
|
||||
| {% for field in form %}
|
||||
| {% if field.name == 'csrf_token' %}
|
||||
| {{ field }}
|
||||
| {% else %}
|
||||
| {% if field.type == 'HiddenField' %}
|
||||
| {{ field }}
|
||||
| {% else %}
|
||||
|
||||
| {% if field.name not in ['description', 'picture', 'category', 'status'] %}
|
||||
|
||||
.form-group(class="{{field.name}}{% if field.errors %} error{% endif %}")
|
||||
| {{ field.label }}
|
||||
| {{ field(class='form-control') }}
|
||||
|
||||
| {% if field.errors %}
|
||||
ul.error
|
||||
| {% for error in field.errors %}
|
||||
li {{ error }}
|
||||
| {% endfor %}
|
||||
| {% endif %}
|
||||
|
||||
| {% endif %}
|
||||
| {% endif %}
|
||||
| {% endif %}
|
||||
| {% endfor %}
|
||||
|
||||
|
||||
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.ui.widget.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='assets/js/file_upload.min.js') }}")
|
||||
|
||||
script(type="text/javascript").
|
||||
var convert = new Markdown.getSanitizingConverter().makeHtml;
|
||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}"});
|
||||
|
||||
/* Build the markdown preview when typing in textarea */
|
||||
$(function() {
|
||||
|
||||
var $textarea = $('.form-group.content textarea'),
|
||||
$loader = $('<div class="md-preview-loading"><i class="pi-spin spin"></i></div>').insertAfter($textarea),
|
||||
$preview = $('<div class="node-edit-form-md-preview" />').insertAfter($loader);
|
||||
|
||||
$loader.hide();
|
||||
|
||||
// Delay function to not start converting heavy posts immediately
|
||||
var delay = (function(){
|
||||
var timer = 0;
|
||||
return function(callback, ms){
|
||||
clearTimeout (timer);
|
||||
timer = setTimeout(callback, ms);
|
||||
};
|
||||
})();
|
||||
|
||||
$textarea.keyup(function() {
|
||||
/* If there's an iframe (YouTube embed), delay markdown convert 1.5s */
|
||||
if (/iframe/i.test($textarea.val())) {
|
||||
$loader.show();
|
||||
|
||||
delay(function(){
|
||||
// Convert markdown
|
||||
$preview.html(convert($textarea.val()));
|
||||
$loader.hide();
|
||||
}, 1500 );
|
||||
} else {
|
||||
// Convert markdown
|
||||
$preview.html(convert($textarea.val()));
|
||||
};
|
||||
}).trigger('keyup');
|
||||
});
|
||||
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_navigation %}
|
||||
| {% endblock %}
|
||||
| {% block footer %}
|
||||
| {% endblock %}
|
@@ -1,55 +1,15 @@
|
||||
| {% extends 'projects/view.html' %}
|
||||
| {% set title = 'blog' %}
|
||||
|
||||
| {% block page_title %}{{node.name}} - Blog{% endblock%}
|
||||
|
||||
| {% block css %}
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=6220171) }}", rel="stylesheet")
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=6220171) }}", rel="stylesheet")
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v=6220171) }}", rel="stylesheet")
|
||||
| {{ super() }}
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=6220171) }}", rel="stylesheet")
|
||||
| {% endblock %}
|
||||
|
||||
| {% block project_context %}
|
||||
#blog_container(class="{% if project._id == config.MAIN_PROJECT_ID %}cloud-blog{% endif %}")
|
||||
|
||||
#blog_post-container
|
||||
| {% if project._id == config.MAIN_PROJECT_ID %}
|
||||
a.btn.btn-default.button-back(href="{{ url_for('projects.view', project_url=project.url) }}blog")
|
||||
| Back to Blog
|
||||
|
||||
| {% if node.has_method('PUT') %}
|
||||
a.btn.btn-default.button-edit(href="{{url_for('nodes.posts_edit', post_id=node._id)}}")
|
||||
i.pi-edit
|
||||
| Edit Post
|
||||
| {% endif %}
|
||||
|
||||
.clearfix
|
||||
| {% endif %}
|
||||
|
||||
| {% if node.picture %}
|
||||
.blog_index-header
|
||||
img(src="{{ node.picture.thumbnail('l', api=api) }}")
|
||||
| {% endif %}
|
||||
.blog_index-item
|
||||
|
||||
.item-title
|
||||
| {{node.name}}
|
||||
|
||||
.item-info.
|
||||
<span title="{{node._created}}">{{node._created | pretty_date }}</span>
|
||||
{% if node._created != node._updated %}
|
||||
<span title="{{node._updated}}">(updated {{node._updated | pretty_date }})</span>
|
||||
{% endif %}
|
||||
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
|
||||
| by {{node.user.full_name}}
|
||||
|
||||
.item-content
|
||||
| {{ node.properties.content }}
|
||||
|
||||
|
||||
#comments-embed
|
||||
#comments-list-items-loading
|
||||
i.pi-spin
|
||||
| {% include 'nodes/custom/post/view_embed.html' %}
|
||||
| {% endblock %}
|
||||
|
||||
| {% block project_tree %}
|
||||
@@ -57,18 +17,18 @@ link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=6220171
|
||||
ul.jstree-container-ul.jstree-children
|
||||
li.jstree-node(data-node-type="page")
|
||||
a.jstree-anchor(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
| Browse Project
|
||||
|
||||
li.jstree-node.jstree-leaf(data-node-type="page")
|
||||
a.jstree-anchor(
|
||||
href="{{ url_for('main.project_blog', project_url=project.url) }}") Blog
|
||||
href="{{ url_for('main.project_blog', project_url=project.url) }}") Blog
|
||||
|
||||
| {% for post in posts %}
|
||||
li.jstree-node
|
||||
a.jstree-anchor(
|
||||
href="{{ url_for_node(node=post) }}",
|
||||
class="{% if post._id == node._id %}jstree-clicked{% endif %}")
|
||||
href="{{ url_for_node(node=post) }}",
|
||||
class="{% if post._id == node._id %}jstree-clicked{% endif %}")
|
||||
.tree-item-thumbnail
|
||||
| {% if post.picture %}
|
||||
img(src="{{ post.picture.thumbnail('s', api=api) }}")
|
||||
@@ -83,32 +43,25 @@ link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=6220171
|
||||
|
||||
| {% block footer_scripts %}
|
||||
|
||||
include ../_scripts
|
||||
script.
|
||||
{% if project.has_method('PUT') %}
|
||||
/* Edit Button */
|
||||
$('#item_edit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('.button-edit-icon').addClass('pi-spin spin').removeClass('pi-edit');
|
||||
window.location.replace("{{url_for('nodes.posts_edit', post_id=node._id)}}");
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: false, nodeId: '{{node._id}}'});
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from blog index */
|
||||
$('.blog_index-item .item-content a img').on('click', function(e){
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$('.blog_index-item .item-content a img').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var href = $(this).parent().attr('href');
|
||||
var href = $(this).parent().attr('href').split("?")[0];
|
||||
var src = $(this).attr('src');
|
||||
|
||||
if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
| {% endblock %}
|
||||
|
||||
| {% endblock footer_scripts %}
|
||||
|
@@ -1,111 +1,43 @@
|
||||
| {% set title = 'blog' %}
|
||||
|
||||
| {% block body %}
|
||||
#blog_container(class="{% if project and project._id == config.MAIN_PROJECT_ID %}cloud-blog{% endif %}")
|
||||
|
||||
.container
|
||||
#blog_container(class="{% if project._id == config.MAIN_PROJECT_ID %}cloud-blog{% endif %}")
|
||||
#blog_post-container
|
||||
| {% if project and project._id == config.MAIN_PROJECT_ID %}
|
||||
a.btn.btn-default.button-back(href="{{ url_for('projects.view', project_url=project.url) }}blog")
|
||||
| Back to Blog
|
||||
|
||||
#blog_post-container
|
||||
| {% if project._id == config.MAIN_PROJECT_ID %}
|
||||
a.btn.btn-default.button-back(href="{{ url_for('projects.view', project_url=project.url) }}blog")
|
||||
| Back to Blog
|
||||
|
||||
| {% if node.has_method('PUT') %}
|
||||
a.btn.btn-default.button-edit(href="{{url_for('nodes.posts_edit', post_id=node._id)}}")
|
||||
i.pi-edit
|
||||
| Edit Post
|
||||
| {% endif %}
|
||||
|
||||
.clearfix
|
||||
| {% endif %}
|
||||
|
||||
| {% if node.picture %}
|
||||
.blog_index-header
|
||||
img(src="{{ node.picture.thumbnail('l', api=api) }}")
|
||||
| {% endif %}
|
||||
.blog_index-item
|
||||
|
||||
.item-title
|
||||
| {{node.name}}
|
||||
|
||||
.item-info.
|
||||
<span title="{{node._created}}">{{node._created | pretty_date }}</span>
|
||||
{% if node._created != node._updated %}
|
||||
<span title="{{node._updated}}">(updated {{node._updated | pretty_date }})</span>
|
||||
{% endif %}
|
||||
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
|
||||
| by {{node.user.full_name}}
|
||||
|
||||
.item-content
|
||||
| {{ node.properties.content }}
|
||||
|
||||
|
||||
#comments-embed
|
||||
#comments-list-items-loading
|
||||
i.pi-spin
|
||||
|
||||
| {% if project._id != config.MAIN_PROJECT_ID %}
|
||||
#blog_index-sidebar
|
||||
.blog_project-card
|
||||
a.item-header(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
|
||||
.overlay
|
||||
| {% if project.picture_header %}
|
||||
img.background(src="{{ project.picture_header.thumbnail('m', api=api) }}")
|
||||
| {% endif %}
|
||||
|
||||
a.card-thumbnail(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
| {% if project.picture_square %}
|
||||
img.thumb(src="{{ project.picture_square.thumbnail('m', api=api) }}")
|
||||
| {% endif %}
|
||||
|
||||
.item-info
|
||||
|
||||
a.item-title(
|
||||
href="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
| {{ project.name }}
|
||||
|
||||
| {% if project.summary %}
|
||||
p.item-description
|
||||
| {{project.summary|safe}}
|
||||
| {% endif %}
|
||||
.blog_project-sidebar
|
||||
| {% if node.has_method('PUT') %}
|
||||
a.btn.btn-default.button-create(href="{{url_for('nodes.posts_edit', post_id=node._id)}}")
|
||||
| Edit Post
|
||||
| {% endif %}
|
||||
|
||||
a.btn.btn-default.button-back(href="{{ url_for('projects.view', project_url=project.url) }}blog")
|
||||
| Back to Blog
|
||||
| {% if node.has_method('PUT') %}
|
||||
a.btn.btn-default.button-edit(href="{{url_for('nodes.edit', node_id=node._id)}}")
|
||||
i.pi-edit
|
||||
| Edit Post
|
||||
| {% endif %}
|
||||
|
||||
.clearfix
|
||||
| {% endif %}
|
||||
|
||||
| {% endblock %}
|
||||
| {% if node.picture %}
|
||||
.blog_index-header
|
||||
img(src="{{ node.picture.thumbnail('l', api=api) }}")
|
||||
| {% endif %}
|
||||
.blog_index-item
|
||||
|
||||
.item-title
|
||||
| {{node.name}}
|
||||
|
||||
.item-info.
|
||||
<span title="{{node._created}}">{{node._created | pretty_date }}</span>
|
||||
{% if node._created != node._updated %}
|
||||
<span title="{{node._updated}}">(updated {{node._updated | pretty_date }})</span>
|
||||
{% endif %}
|
||||
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
|
||||
| by {{node.user.full_name}}
|
||||
|
||||
.item-content
|
||||
| {{ node.properties.content }}
|
||||
|
||||
|
||||
| {% block footer_scripts %}
|
||||
#comments-embed
|
||||
#comments-list-items-loading
|
||||
i.pi-spin
|
||||
|
||||
include ../_scripts
|
||||
script.
|
||||
hopToTop(); // Display jump to top button
|
||||
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from view post */
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$('.blog_index-item .item-content a img').on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var href = $(this).parent().attr('href');
|
||||
var src = $(this).attr('src');
|
||||
|
||||
if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
| {% endblock %}
|
||||
|
@@ -1,4 +1,37 @@
|
||||
| {% extends 'layout.html' %}
|
||||
| {% block page_title %}{{node.name}} - Blog{% endblock%}
|
||||
|
||||
include view_embed
|
||||
| {% set title = 'blog' %}
|
||||
|
||||
| {% block body %}
|
||||
|
||||
.container
|
||||
| {% include 'nodes/custom/post/view_embed.html' %}
|
||||
|
||||
| {% endblock %}
|
||||
|
||||
|
||||
| {% block footer_scripts %}
|
||||
|
||||
script.
|
||||
hopToTop(); // Display jump to top button
|
||||
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from view post */
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$('.blog_index-item .item-content a img').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var href = $(this).parent().attr('href').split("?")[0];
|
||||
var src = $(this).attr('src');
|
||||
|
||||
|
||||
if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
| {% endblock %}
|
||||
|
@@ -1,11 +1,17 @@
|
||||
| {% extends 'layout.html' %}
|
||||
| {% extends 'projects/view.html' %}
|
||||
|
||||
| {% block body %}
|
||||
div.container
|
||||
#project-container.container
|
||||
div.page-content
|
||||
| {% include 'nodes/edit_embed.html' %}
|
||||
| {% endblock %}
|
||||
| {% endblock body %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
| {% include '_macros/_file_uploader_javascript.html' %}
|
||||
| {% endblock %}
|
||||
| {{ super() }}
|
||||
script.
|
||||
$(function () {
|
||||
updateUi('', 'edit');
|
||||
});
|
||||
|
||||
| {% endblock footer_scripts %}
|
||||
|
||||
|
@@ -148,10 +148,19 @@ script(type="text/javascript").
|
||||
|
||||
|
||||
/* Submit changes */
|
||||
$("#node-edit-form").unbind( "submit" )
|
||||
.submit(function(e) {
|
||||
$("#node-edit-form").unbind("submit").submit(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Assets always need a file
|
||||
var $file = $('.form-group.file #file');
|
||||
if ($file.val() == '') {
|
||||
$file.addClass('error');
|
||||
statusBarSet('error', 'No File Selected', 'pi-warning', 5000);
|
||||
return jQuery.Deferred().reject("nofile");
|
||||
}
|
||||
|
||||
$file.removeClass('error');
|
||||
|
||||
/* Let us know started saving */
|
||||
$("li.button-save").addClass('saving');
|
||||
$("li.button-save a#item_save").html('<i class="pi-spin spin"></i> Saving...');
|
||||
@@ -181,7 +190,10 @@ script(type="text/javascript").
|
||||
})
|
||||
.done(function(dataHtml){
|
||||
/* Success! */
|
||||
// Disable beforeunolad when submitting a form
|
||||
$(window).off('beforeunload');
|
||||
|
||||
{% if is_embedded_edit %}
|
||||
/* Load content*/
|
||||
$('#project_context').html(dataHtml);
|
||||
statusBarSet('success', 'Saved Successfully', 'pi-check');
|
||||
@@ -194,24 +206,18 @@ script(type="text/javascript").
|
||||
//- $('#project_tree').jstree("refresh");
|
||||
|
||||
updateUi(ProjectUtils.nodeId(), 'view');
|
||||
{% else %}
|
||||
// This code runs only if we are in direct node editing mode, and since we do a redirect,
|
||||
// nothing of what follows is executed, because of the redirect.
|
||||
location.href = "{{ url_for('nodes.view', node_id=node._id)}}";
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#item_save, .item-save').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
// Assets always need a file
|
||||
if ($('.form-group.file #file').val() == ''){
|
||||
$('.form-group.file').addClass('error');
|
||||
statusBarSet('error', 'No File Selected', 'pi-warning', 5000);
|
||||
} else {
|
||||
$('.form-group.file').removeClass('error');
|
||||
$("#node-edit-form").submit();
|
||||
|
||||
// Disable beforeunolad when submitting a form
|
||||
$(window).off('beforeunload');
|
||||
}
|
||||
$("#node-edit-form").submit();
|
||||
});
|
||||
|
||||
$('#item_cancel, .item-cancel').click(function(e){
|
||||
|
@@ -137,7 +137,7 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
|
||||
|
||||
| {% block project_tree %}
|
||||
#project_tree
|
||||
| {% endblock %}
|
||||
| {% endblock project_tree %}
|
||||
| {% endif %}
|
||||
|
||||
.project_split(title="Toggle Navigation [T]")
|
||||
@@ -246,7 +246,7 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
|
||||
| {% if show_project %}
|
||||
| {% include "projects/view_embed.html" %}
|
||||
| {% endif %}
|
||||
| {% endblock %}
|
||||
| {% endblock project_context %}
|
||||
|
||||
#overlay-mode-move-container
|
||||
.overlay-container
|
||||
@@ -265,8 +265,8 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
|
||||
| {% block footer_navigation %}{% endblock %}
|
||||
| {% block footer %}{% endblock %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
script(src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.1/jstree.min.js")
|
||||
|
||||
| {% block footer_scripts_pre %}
|
||||
|
||||
| {% if project.has_method('PUT') %}
|
||||
| {# JS containing the Edit, Add, Featured, and Move functions #}
|
||||
@@ -274,24 +274,6 @@ script(type="text/javascript", src="{{ url_for('static_pillar', filename='assets
|
||||
| {% endif %}
|
||||
|
||||
script.
|
||||
{% if show_project %}
|
||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: true, nodeId: ''});
|
||||
{% else %}
|
||||
{% if node %}
|
||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: false, nodeId: '{{node._id}}'});
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
var projectTree = document.getElementById('project_tree');
|
||||
|
||||
var urlNodeMove = "{{url_for('projects.move_node')}}";
|
||||
var urlNodeFeature = "{{url_for('projects.add_featured_node')}}";
|
||||
var urlNodeDelete = "{{url_for('projects.delete_node')}}";
|
||||
var urlNodeTogglePublic = "{{url_for('projects.toggle_node_public')}}";
|
||||
var urlNodeToggleProjHeader = "{{url_for('projects.toggle_node_project_header')}}";
|
||||
var urlProjectDelete = "{{url_for('projects.delete')}}";
|
||||
var urlProjectEdit = "{{url_for('projects.edit', project_url=project.url)}}";
|
||||
|
||||
function updateToggleProjHeaderMenuItem() {
|
||||
var $toggle_projheader = $('#item_toggle_projheader');
|
||||
|
||||
@@ -308,15 +290,15 @@ script.
|
||||
$(updateToggleProjHeaderMenuItem);
|
||||
|
||||
// Function to update the interface on loadNodeContent, and edit/saving assets
|
||||
function updateUi(nodeId, mode){
|
||||
function updateUi(nodeId, mode) {
|
||||
|
||||
if (mode === 'view') {
|
||||
$('.project-mode-view').show();
|
||||
$('.project-mode-edit').hide();
|
||||
|
||||
$("#node-edit-form").unbind( "submit" );
|
||||
$("#item_save").unbind( "click" );
|
||||
$("#item_cancel").unbind( "click" );
|
||||
$("#node-edit-form").unbind("submit");
|
||||
$("#item_save").unbind("click");
|
||||
$("#item_cancel").unbind("click");
|
||||
} else if (mode === 'edit') {
|
||||
$('.project-mode-view').hide();
|
||||
$('.project-mode-edit').show();
|
||||
@@ -352,11 +334,33 @@ script.
|
||||
// it's done like that in all users of updateUi().
|
||||
$('#project-loading').removeAttr('class');
|
||||
}
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
script(src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.1/jstree.min.js")
|
||||
|
||||
script.
|
||||
{% if show_project %}
|
||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: true, nodeId: ''});
|
||||
{% else %}
|
||||
{% if node %}
|
||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: false, nodeId: '{{node._id}}'});
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
var projectTree = document.getElementById('project_tree');
|
||||
|
||||
var urlNodeMove = "{{url_for('projects.move_node')}}";
|
||||
var urlNodeFeature = "{{url_for('projects.add_featured_node')}}";
|
||||
var urlNodeDelete = "{{url_for('projects.delete_node')}}";
|
||||
var urlNodeTogglePublic = "{{url_for('projects.toggle_node_public')}}";
|
||||
var urlNodeToggleProjHeader = "{{url_for('projects.toggle_node_project_header')}}";
|
||||
var urlProjectDelete = "{{url_for('projects.delete')}}";
|
||||
var urlProjectEdit = "{{url_for('projects.edit', project_url=project.url)}}";
|
||||
|
||||
|
||||
function loadNodeContent(url, nodeId) {
|
||||
$('#project-loading').addClass('active');
|
||||
|
||||
$.get(url, function(dataHtml) {
|
||||
// Update the DOM injecting the generate HTML into the page
|
||||
$('#project_context').html(dataHtml);
|
||||
@@ -608,8 +612,10 @@ script.
|
||||
});
|
||||
};
|
||||
|
||||
// Initialize the page
|
||||
{% if is_embedded_edit is not defined or is_embedded_edit %}
|
||||
// Initialize the page if we are not directly editing a node (most of the time)
|
||||
loadContent();
|
||||
{% endif %}
|
||||
|
||||
var project_container = document.getElementById('project-container');
|
||||
|
||||
|
Reference in New Issue
Block a user