Display blog list and posts within the project

TODO: Edit within the project as well
This commit is contained in:
2016-12-01 15:57:59 +01:00
parent f2942a20fe
commit b6b517688e
11 changed files with 365 additions and 159 deletions

View File

@@ -1,5 +1,5 @@
| {% set title = 'join' %}
link(href="{{ url_for('static_pillar', filename='assets/css/main.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/main.css', v=11220161) }}", rel="stylesheet")
| {% block body %}
#page-container.join

View File

@@ -37,8 +37,8 @@ html(lang="en")
loadCSS( "//fonts.googleapis.com/css?family=Roboto:300,400" );
script(src="{{ url_for('static_pillar', filename='assets/js/markdown.min.js', v=291120162) }}")
script(src="{{ url_for('static_pillar', filename='assets/js/tutti.min.js', v=291120162) }}")
script(src="{{ url_for('static_pillar', filename='assets/js/markdown.min.js', v=11220161) }}")
script(src="{{ url_for('static_pillar', filename='assets/js/tutti.min.js', v=11220161) }}")
link(href="{{ url_for('static', filename='assets/img/favicon.png') }}", rel="shortcut icon")
link(href="{{ url_for('static', filename='assets/img/apple-touch-icon-precomposed.png') }}", rel="icon apple-touch-icon-precomposed", sizes="192x192")
@@ -48,12 +48,12 @@ html(lang="en")
| {% block head %}{% endblock %}
| {% block css %}
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=11220161) }}", rel="stylesheet")
| {% if title == 'blog' %}
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=11220161) }}", rel="stylesheet")
| {% else %}
link(href="{{ url_for('static_pillar', filename='assets/css/main.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/main.css', v=11220161) }}", rel="stylesheet")
| {% endif %}
| {% endblock %}
@@ -407,7 +407,7 @@ html(lang="en")
noscript
link(href='//fonts.googleapis.com/css?family=Roboto:300,400', rel='stylesheet', type='text/css')
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.bootstrap-3.3.7.min.js') }}")
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.bootstrap-3.3.7.min.js', v=11220161) }}")
script.
$(document).ready(function() {

View File

@@ -1,130 +1,118 @@
| {% extends 'layout.html' %}
| {% extends 'projects/view.html' %}
| {% set title = 'blog' %}
| {% block page_title %}Blog{% endblock%}
| {% block body %}
| {% block css %}
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=11220161) }}", rel="stylesheet")
| {% endblock %}
.container
#blog_container(class="{% if project._id == config.MAIN_PROJECT_ID %}cloud-blog{% endif %}")
| {% block project_context %}
#blog_index-container
#blog_container
| {% if project._id == config.MAIN_PROJECT_ID and project.node_type_has_method('post', 'POST', api=api) %}
a.btn.btn-default.button-create(href="{{url_for('nodes.posts_create', project_id=project._id)}}")
i.pi-plus
| Create New Post
| {% endif %}
#blog_index-container
| {% if posts %}
| {% for node in posts %}
| {% if loop.first %}
| {% if node.picture %}
.blog_index-header
img(src="{{ node.picture.thumbnail('l', api=api) }}")
| {% endif %}
.blog_index-item
a.item-title(
href="{{ url_for_node(node=node) }}")
| {{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}}
| <a href="{{ url_for_node(node=node) }}#comments">Leave a comment</a>
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
.item-content
| {{node.properties.content}}
.item-meta
a(href="{{ url_for_node(node=node) }}#comments") Leave a comment
| {% else %}
| {% if loop.index == 2 %}
h4.blog_index-title Blasts from the past
| {% endif %}
.blog_index-item.list
| {% if node.picture %}
.item-header
img.image(src="{{ node.picture.thumbnail('s', api=api) }}")
| {% else %}
.item-header.nothumb
i.pi-document-text
| {% endif %}
a.item-title(
href="{{ url_for_node(node=node) }}")
| {{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}}
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
| {% endif %} {# loop #}
| {% endfor %} {# posts #}
| {% else %}
.blog_index-item
.item-content No posts yet.
| {% endif %} {# posts #}
| {% 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 %}
| {% if project.node_type_has_method('post', 'POST', api=api) %}
.blog_project-sidebar
a.btn.btn-default.button-create(href="{{url_for('nodes.posts_create', project_id=project._id)}}")
| Create New Post
| {% endif %}
| {% if project.node_type_has_method('post', 'POST', api=api) %}
a.btn.btn-default.button-create(href="{{url_for('nodes.posts_create', project_id=project._id)}}")
i.pi-plus
| Create New Post
| {% endif %}
| {% if posts %}
| {% for node in posts %}
| {% if loop.first %}
| {% if node.picture %}
.blog_index-header
img(src="{{ node.picture.thumbnail('l', api=api) }}")
| {% endif %}
.blog_index-item
a.item-title(
href="{{ url_for_node(node=node) }}")
| {{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}}
| <a href="{{ url_for_node(node=node) }}#comments">Leave a comment</a>
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
.item-content
| {{node.properties.content}}
.item-meta
a(href="{{ url_for_node(node=node) }}#comments") Leave a comment
| {% else %}
| {% if loop.index == 2 %}
h4.blog_index-title Blasts from the past
| {% endif %}
.blog_index-item.list
| {% if node.picture %}
.item-header
img.image(src="{{ node.picture.thumbnail('s', api=api) }}")
| {% else %}
.item-header.nothumb
i.pi-document-text
| {% endif %}
a.item-title(
href="{{ url_for_node(node=node) }}")
| {{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}}
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
| {% endif %} {# loop #}
| {% endfor %} {# posts #}
| {% else %}
.blog_index-item
.item-content No posts yet.
| {% endif %} {# posts #}
| {% endblock %}
| {% block project_tree %}
#project_tree.jstree.jstree-default.blog
ul.jstree-container-ul.jstree-children
li.jstree-node.jstree-leaf(data-node-type="page")
a.jstree-anchor.jstree-clicked(
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) }}")
i.jstree-icon.pi-document-text
| {{ post.name }}
| {% endfor %}
li.jstree-node(data-node-type="page")
a.jstree-anchor(
href="{{ url_for('projects.view', project_url=project.url) }}")
i.jstree-icon.pi-folder
| Browse Project
| {% endblock %}
| {% block footer_scripts %}
include ../_scripts
script hopToTop(); // Display jump to top button
| {% endblock %}

View File

@@ -0,0 +1,95 @@
| {% extends 'layout.html' %}
| {% set title = 'blog' %}
| {% block page_title %}Blog{% endblock%}
| {% block body %}
.container
#blog_container.cloud-blog
#blog_index-container
| {% if project.node_type_has_method('post', 'POST', api=api) %}
a.btn.btn-default.button-create(href="{{url_for('nodes.posts_create', project_id=project._id)}}")
i.pi-plus
| Create New Post
| {% endif %}
| {% if posts %}
| {% for node in posts %}
| {% if loop.first %}
| {% if node.picture %}
.blog_index-header
img(src="{{ node.picture.thumbnail('l', api=api) }}")
| {% endif %}
.blog_index-item
a.item-title(
href="{{ url_for_node(node=node) }}")
| {{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}}
| <a href="{{ url_for_node(node=node) }}#comments">Leave a comment</a>
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
.item-content
| {{node.properties.content}}
.item-meta
a(href="{{ url_for_node(node=node) }}#comments") Leave a comment
| {% else %}
| {% if loop.index == 2 %}
h4.blog_index-title Blasts from the past
| {% endif %}
.blog_index-item.list
| {% if node.picture %}
.item-header
img.image(src="{{ node.picture.thumbnail('s', api=api) }}")
| {% else %}
.item-header.nothumb
i.pi-document-text
| {% endif %}
a.item-title(
href="{{ url_for_node(node=node) }}")
| {{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}}
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
| {% endif %} {# loop #}
| {% endfor %} {# posts #}
| {% else %}
.blog_index-item
.item-content No posts yet.
| {% endif %} {# posts #}
| {% endblock %}
| {% block footer_scripts %}
include ../_scripts
script hopToTop(); // Display jump to top button
| {% endblock %}

View File

@@ -1,4 +1,90 @@
| {% extends 'layout.html' %}
| {% extends 'projects/view.html' %}
| {% set title = 'blog' %}
| {% block page_title %}{{node.name}} - Blog{% endblock%}
include view_embed
| {% block css %}
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=11220161) }}", 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
| {% endblock %}
| {% block project_tree %}
#project_tree.jstree.jstree-default.blog
ul.jstree-container-ul.jstree-children
li.jstree-node.jstree-leaf(data-node-type="page")
a.jstree-anchor(
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 %}")
i.jstree-icon.pi-document-text
| {{ post.name }}
| {% endfor %}
li.jstree-node(data-node-type="page")
a.jstree-anchor(
href="{{ url_for('projects.view', project_url=project.url) }}")
i.jstree-icon.pi-folder
| Browse Project
| {% endblock %}
| {% 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 %}
| {% endblock %}

View File

@@ -0,0 +1,4 @@
| {% extends 'layout.html' %}
| {% block page_title %}{{node.name}} - Blog{% endblock%}
include view_embed

View File

@@ -13,10 +13,12 @@ meta(property="og:title", content="{{project.name}} - Blender Cloud")
meta(property="og:url", content="{{url_for('projects.view', project_url=project.url, _external=True)}}")
meta(property="og:description", content="{{project.summary}}")
| {% else %}
| {% if node %}
meta(property="og:title", content="{{node.name}} - Blender Cloud")
meta(property="og:url", content="{{url_for('projects.view_node', project_url=project.url, node_id=node._id)}}")
meta(property="og:description", content="{{node.description}}")
| {% endif %}
| {% endif %}
| {% endblock %}
| {% block tw %}
@@ -27,9 +29,11 @@ meta(property="twitter:image", content="{{ og_picture.thumbnail('l', api=api) }}
meta(name="twitter:title", content="{{project.name}} on Blender Cloud")
meta(name="twitter:description", content="{{project.summary}}")
| {% else %}
| {% if node %}
meta(name="twitter:title", content="{{node.name}} on Blender Cloud")
meta(name="twitter:description", content="{{node.description}}")
| {% endif %}
| {% endif %}
| {% endblock %}
| {% block head %}
@@ -37,9 +41,9 @@ link(href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.1/themes/default/style.mi
| {% endblock %}
| {% block css %}
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=291120162) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v=291120163) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=11220161) }}", rel="stylesheet")
link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v=11220161) }}", rel="stylesheet")
| {% endblock %}
| {% block body %}
@@ -91,12 +95,13 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
a(href="{{url_for('projects.view', project_url=project.url, _external=True)}}")
| {{ project.name }}
| {% block project_tree %}
#project_tree
| {% endblock %}
| {% endif %}
.project_split(title="Toggle Navigation [T]")
#project_context-container
| {% if project.has_method('PUT') %}
#project_context-header
@@ -197,9 +202,11 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
| {% endif %}
#project_context
| {% block project_context %}
| {% if show_project %}
| {% include "projects/view_embed.html" %}
| {% endif %}
| {% endblock %}
#overlay-mode-move-container
.overlay-container
@@ -224,15 +231,17 @@ script(src="//releases.flowplayer.org/6.0.5/flowplayer.min.js")
| {% if project.has_method('PUT') %}
| {# JS containing the Edit, Add, Featured, and Move functions #}
script(type="text/javascript", src="{{ url_for('static_pillar', filename='assets/js/project-edit.min.js', v=291120162) }}")
script(type="text/javascript", src="{{ url_for('static_pillar', filename='assets/js/project-edit.min.js', v=11220161) }}")
| {% 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');