Display blog list and posts within the project
TODO: Edit within the project as well
This commit is contained in:
@@ -2,6 +2,7 @@ from pillarsdk import Node
|
|||||||
from pillarsdk import Project
|
from pillarsdk import Project
|
||||||
from pillarsdk.exceptions import ResourceNotFound
|
from pillarsdk.exceptions import ResourceNotFound
|
||||||
from flask import abort
|
from flask import abort
|
||||||
|
from flask import current_app
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask import redirect
|
from flask import redirect
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
@@ -40,6 +41,22 @@ def posts_view(project_id=None, project_url=None, url=None):
|
|||||||
'where': {'node_type': 'blog', 'project': project_id},
|
'where': {'node_type': 'blog', 'project': project_id},
|
||||||
}, api=api)
|
}, api=api)
|
||||||
|
|
||||||
|
status_query = "" if blog.has_method('PUT') else ', "properties.status": "published"'
|
||||||
|
posts = Node.all({
|
||||||
|
'where': '{"parent": "%s" %s}' % (blog._id, status_query),
|
||||||
|
'embedded': '{"user": 1}',
|
||||||
|
'sort': '-_created'
|
||||||
|
}, api=api)
|
||||||
|
|
||||||
|
for post in posts._items:
|
||||||
|
post.picture = get_file(post.picture, api=api)
|
||||||
|
|
||||||
|
post['properties']['content'] = pillar.web.nodes.attachments.render_attachments(
|
||||||
|
post, post['properties']['content'])
|
||||||
|
|
||||||
|
# Use the *_main_project.html template for the main blog
|
||||||
|
main_project_template = '_main_project' if project_id == current_app.config['MAIN_PROJECT_ID'] else ''
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
post = Node.find_one({
|
post = Node.find_one({
|
||||||
'where': {'parent': blog._id, 'properties.url': url},
|
'where': {'parent': blog._id, 'properties.url': url},
|
||||||
@@ -58,29 +75,19 @@ def posts_view(project_id=None, project_url=None, url=None):
|
|||||||
post, post['properties']['content'])
|
post, post['properties']['content'])
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'nodes/custom/post/view.html',
|
'nodes/custom/post/view{0}.html'.format(main_project_template),
|
||||||
blog=blog,
|
blog=blog,
|
||||||
node=post,
|
node=post,
|
||||||
|
posts=posts._items,
|
||||||
project=project,
|
project=project,
|
||||||
title='blog',
|
title='blog',
|
||||||
api=api)
|
api=api)
|
||||||
else:
|
else:
|
||||||
node_type_post = project.get_node_type('post')
|
node_type_post = project.get_node_type('post')
|
||||||
status_query = "" if blog.has_method('PUT') else ', "properties.status": "published"'
|
template_path = 'nodes/custom/blog/index.html'
|
||||||
posts = Node.all({
|
|
||||||
'where': '{"parent": "%s" %s}' % (blog._id, status_query),
|
|
||||||
'embedded': '{"user": 1}',
|
|
||||||
'sort': '-_created'
|
|
||||||
}, api=api)
|
|
||||||
|
|
||||||
for post in posts._items:
|
|
||||||
post.picture = get_file(post.picture, api=api)
|
|
||||||
|
|
||||||
post['properties']['content'] = pillar.web.nodes.attachments.render_attachments(
|
|
||||||
post, post['properties']['content'])
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'nodes/custom/blog/index.html',
|
'nodes/custom/blog/index{0}.html'.format(main_project_template),
|
||||||
node_type_post=node_type_post,
|
node_type_post=node_type_post,
|
||||||
posts=posts._items,
|
posts=posts._items,
|
||||||
project=project,
|
project=project,
|
||||||
|
@@ -169,8 +169,6 @@ $project-sidebar-background: lighten($color-background, 5%)
|
|||||||
width: $project_nav-width
|
width: $project_nav-width
|
||||||
position: relative
|
position: relative
|
||||||
background-color: $project-sidebar-background
|
background-color: $project-sidebar-background
|
||||||
|
|
||||||
color: white
|
|
||||||
left: 0
|
left: 0
|
||||||
|
|
||||||
&.about
|
&.about
|
||||||
@@ -2663,3 +2661,17 @@ section.node-children
|
|||||||
|
|
||||||
.file_delete, .file_original
|
.file_delete, .file_original
|
||||||
display: block
|
display: block
|
||||||
|
|
||||||
|
/* Project blog overrides */
|
||||||
|
#project_context
|
||||||
|
#blog_container
|
||||||
|
padding: 0
|
||||||
|
#blog_index-container,
|
||||||
|
#blog_post-container
|
||||||
|
width: 100%
|
||||||
|
padding: 0
|
||||||
|
border: none
|
||||||
|
border-radius: 0
|
||||||
|
|
||||||
|
.blog_index-header
|
||||||
|
border-radius: 0
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#blog_container
|
#blog_container
|
||||||
margin: 0
|
|
||||||
padding:
|
padding:
|
||||||
top: 15px
|
top: 15px
|
||||||
bottom: 15px
|
bottom: 15px
|
||||||
@@ -362,8 +361,6 @@
|
|||||||
weight: 300
|
weight: 300
|
||||||
margin: 0 20px 15px 0
|
margin: 0 20px 15px 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#blog_index-sidebar
|
#blog_index-sidebar
|
||||||
width: 25%
|
width: 25%
|
||||||
padding: 0 15px
|
padding: 0 15px
|
||||||
@@ -437,8 +434,6 @@
|
|||||||
|
|
||||||
img.background
|
img.background
|
||||||
width: 100%
|
width: 100%
|
||||||
// We can't have nice things because of Edge
|
|
||||||
// filter: blur(5px)
|
|
||||||
transform: scale(1.4)
|
transform: scale(1.4)
|
||||||
|
|
||||||
.card-thumbnail
|
.card-thumbnail
|
||||||
|
@@ -52,9 +52,14 @@ $tree-color-highlight-background-text: white
|
|||||||
color: darken($tree-color-highlight, 5%)
|
color: darken($tree-color-highlight, 5%)
|
||||||
border-bottom: 2px solid $tree-color-highlight
|
border-bottom: 2px solid $tree-color-highlight
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
border-bottom-color: lighten($tree-color-highlight, 5%)
|
||||||
|
|
||||||
.jstree-anchor
|
.jstree-anchor
|
||||||
padding: 3px 8px
|
padding: 5px 8px 1px 8px
|
||||||
.jstree-icon.jstree-themeicon
|
&:after
|
||||||
|
top: 3px !important
|
||||||
|
.jstree-icon
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
/* Brief moment when a node is being loaded */
|
/* Brief moment when a node is being loaded */
|
||||||
@@ -63,7 +68,7 @@ $tree-color-highlight-background-text: white
|
|||||||
|
|
||||||
/* Items at top level */
|
/* Items at top level */
|
||||||
&.jstree-leaf
|
&.jstree-leaf
|
||||||
.jstree-icon.jstree-themeicon
|
.jstree-icon
|
||||||
opacity: 1
|
opacity: 1
|
||||||
width: 24px !important
|
width: 24px !important
|
||||||
|
|
||||||
@@ -120,7 +125,7 @@ $tree-color-highlight-background-text: white
|
|||||||
width: 98%
|
width: 98%
|
||||||
padding: 0 !important
|
padding: 0 !important
|
||||||
|
|
||||||
.jstree-themeicon
|
.jstree-icon
|
||||||
margin: 0 !important
|
margin: 0 !important
|
||||||
font-size: 95% !important
|
font-size: 95% !important
|
||||||
color: $color-text-dark-secondary
|
color: $color-text-dark-secondary
|
||||||
@@ -130,7 +135,7 @@ $tree-color-highlight-background-text: white
|
|||||||
background-color: $tree-color-highlight-background !important
|
background-color: $tree-color-highlight-background !important
|
||||||
color: $tree-color-highlight-background-text !important
|
color: $tree-color-highlight-background-text !important
|
||||||
|
|
||||||
.jstree-ocl, .jstree-themeicon
|
.jstree-ocl, .jstree-icon
|
||||||
color: $tree-color-highlight-background-text !important
|
color: $tree-color-highlight-background-text !important
|
||||||
|
|
||||||
&:after
|
&:after
|
||||||
@@ -147,7 +152,7 @@ $tree-color-highlight-background-text: white
|
|||||||
|
|
||||||
/* hover an active item */
|
/* hover an active item */
|
||||||
&.jstree-hovered,
|
&.jstree-hovered,
|
||||||
&.jstree-hovered .jstree-icon.jstree-themeicon
|
&.jstree-hovered .jstree-icon
|
||||||
color: $tree-color-highlight-background-text !important
|
color: $tree-color-highlight-background-text !important
|
||||||
box-shadow: none
|
box-shadow: none
|
||||||
|
|
||||||
@@ -198,6 +203,11 @@ $tree-color-highlight-background-text: white
|
|||||||
&:after
|
&:after
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
&.blog
|
||||||
|
.jstree-anchor
|
||||||
|
&:hover, &:hover i
|
||||||
|
color: $tree-color-highlight
|
||||||
|
|
||||||
.jstree-loading
|
.jstree-loading
|
||||||
padding: 5px
|
padding: 5px
|
||||||
color: $color-text-light-secondary
|
color: $color-text-light-secondary
|
||||||
@@ -219,7 +229,7 @@ $tree-color-highlight-background-text: white
|
|||||||
/* hovered text */
|
/* hovered text */
|
||||||
.jstree-default .jstree-hovered,
|
.jstree-default .jstree-hovered,
|
||||||
.jstree-default .jstree-open .jstree-hovered,
|
.jstree-default .jstree-open .jstree-hovered,
|
||||||
.jstree-default .jstree-hovered .jstree-icon.jstree-themeicon
|
.jstree-default .jstree-hovered .jstree-icon
|
||||||
color: $tree-color-highlight !important
|
color: $tree-color-highlight !important
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
| {% set title = 'join' %}
|
| {% 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 %}
|
| {% block body %}
|
||||||
#page-container.join
|
#page-container.join
|
||||||
|
@@ -37,8 +37,8 @@ html(lang="en")
|
|||||||
|
|
||||||
loadCSS( "//fonts.googleapis.com/css?family=Roboto:300,400" );
|
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/markdown.min.js', v=11220161) }}")
|
||||||
script(src="{{ url_for('static_pillar', filename='assets/js/tutti.min.js', v=291120162) }}")
|
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/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")
|
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 head %}{% endblock %}
|
||||||
|
|
||||||
| {% block css %}
|
| {% 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/font-pillar.css', v=11220161) }}", 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/base.css', v=11220161) }}", rel="stylesheet")
|
||||||
| {% if title == 'blog' %}
|
| {% 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 %}
|
| {% 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 %}
|
| {% endif %}
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
@@ -407,7 +407,7 @@ html(lang="en")
|
|||||||
noscript
|
noscript
|
||||||
link(href='//fonts.googleapis.com/css?family=Roboto:300,400', rel='stylesheet', type='text/css')
|
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.
|
script.
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@@ -1,130 +1,118 @@
|
|||||||
| {% extends 'layout.html' %}
|
| {% extends 'projects/view.html' %}
|
||||||
|
|
||||||
| {% set title = 'blog' %}
|
| {% set title = 'blog' %}
|
||||||
|
|
||||||
| {% block page_title %}Blog{% endblock%}
|
| {% 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
|
| {% block project_context %}
|
||||||
#blog_container(class="{% if project._id == config.MAIN_PROJECT_ID %}cloud-blog{% endif %}")
|
|
||||||
|
|
||||||
#blog_index-container
|
#blog_container
|
||||||
|
|
||||||
| {% if project._id == config.MAIN_PROJECT_ID and project.node_type_has_method('post', 'POST', api=api) %}
|
#blog_index-container
|
||||||
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 %}
|
| {% 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)}}")
|
||||||
| {% for node in posts %}
|
i.pi-plus
|
||||||
|
| Create New Post
|
||||||
| {% 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 %}
|
|
||||||
| {% endif %}
|
| {% 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 %}
|
| {% endblock %}
|
||||||
|
|
||||||
| {% block footer_scripts %}
|
| {% block footer_scripts %}
|
||||||
|
|
||||||
include ../_scripts
|
include ../_scripts
|
||||||
script hopToTop(); // Display jump to top button
|
|
||||||
|
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
95
src/templates/nodes/custom/blog/index_main_project.jade
Normal file
95
src/templates/nodes/custom/blog/index_main_project.jade
Normal 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 %}
|
@@ -1,4 +1,90 @@
|
|||||||
| {% extends 'layout.html' %}
|
| {% extends 'projects/view.html' %}
|
||||||
|
| {% set title = 'blog' %}
|
||||||
| {% block page_title %}{{node.name}} - Blog{% endblock%}
|
| {% 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 %}
|
||||||
|
4
src/templates/nodes/custom/post/view_main_project.jade
Normal file
4
src/templates/nodes/custom/post/view_main_project.jade
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
| {% extends 'layout.html' %}
|
||||||
|
| {% block page_title %}{{node.name}} - Blog{% endblock%}
|
||||||
|
|
||||||
|
include view_embed
|
@@ -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:url", content="{{url_for('projects.view', project_url=project.url, _external=True)}}")
|
||||||
meta(property="og:description", content="{{project.summary}}")
|
meta(property="og:description", content="{{project.summary}}")
|
||||||
| {% else %}
|
| {% else %}
|
||||||
|
| {% if node %}
|
||||||
meta(property="og:title", content="{{node.name}} - Blender Cloud")
|
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:url", content="{{url_for('projects.view_node', project_url=project.url, node_id=node._id)}}")
|
||||||
meta(property="og:description", content="{{node.description}}")
|
meta(property="og:description", content="{{node.description}}")
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
| {% endif %}
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
| {% block tw %}
|
| {% 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:title", content="{{project.name}} on Blender Cloud")
|
||||||
meta(name="twitter:description", content="{{project.summary}}")
|
meta(name="twitter:description", content="{{project.summary}}")
|
||||||
| {% else %}
|
| {% else %}
|
||||||
|
| {% if node %}
|
||||||
meta(name="twitter:title", content="{{node.name}} on Blender Cloud")
|
meta(name="twitter:title", content="{{node.name}} on Blender Cloud")
|
||||||
meta(name="twitter:description", content="{{node.description}}")
|
meta(name="twitter:description", content="{{node.description}}")
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
| {% endif %}
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
| {% block head %}
|
| {% block head %}
|
||||||
@@ -37,9 +41,9 @@ link(href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.1/themes/default/style.mi
|
|||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
| {% block css %}
|
| {% 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/font-pillar.css', v=11220161) }}", 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/base.css', v=11220161) }}", 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/project-main.css', v=11220161) }}", rel="stylesheet")
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
| {% block body %}
|
| {% 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)}}")
|
a(href="{{url_for('projects.view', project_url=project.url, _external=True)}}")
|
||||||
| {{ project.name }}
|
| {{ project.name }}
|
||||||
|
|
||||||
|
| {% block project_tree %}
|
||||||
#project_tree
|
#project_tree
|
||||||
|
| {% endblock %}
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
|
||||||
.project_split(title="Toggle Navigation [T]")
|
.project_split(title="Toggle Navigation [T]")
|
||||||
|
|
||||||
|
|
||||||
#project_context-container
|
#project_context-container
|
||||||
| {% if project.has_method('PUT') %}
|
| {% if project.has_method('PUT') %}
|
||||||
#project_context-header
|
#project_context-header
|
||||||
@@ -197,9 +202,11 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
|
|||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
|
||||||
#project_context
|
#project_context
|
||||||
|
| {% block project_context %}
|
||||||
| {% if show_project %}
|
| {% if show_project %}
|
||||||
| {% include "projects/view_embed.html" %}
|
| {% include "projects/view_embed.html" %}
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
| {% endblock %}
|
||||||
|
|
||||||
#overlay-mode-move-container
|
#overlay-mode-move-container
|
||||||
.overlay-container
|
.overlay-container
|
||||||
@@ -224,15 +231,17 @@ script(src="//releases.flowplayer.org/6.0.5/flowplayer.min.js")
|
|||||||
|
|
||||||
| {% if project.has_method('PUT') %}
|
| {% if project.has_method('PUT') %}
|
||||||
| {# JS containing the Edit, Add, Featured, and Move functions #}
|
| {# 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 %}
|
| {% endif %}
|
||||||
|
|
||||||
script.
|
script.
|
||||||
{% if show_project %}
|
{% if show_project %}
|
||||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: true, nodeId: ''});
|
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: true, nodeId: ''});
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% if node %}
|
||||||
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: false, nodeId: '{{node._id}}'});
|
ProjectUtils.setProjectAttributes({projectId: "{{project._id}}", isProject: false, nodeId: '{{node._id}}'});
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
var projectTree = document.getElementById('project_tree');
|
var projectTree = document.getElementById('project_tree');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user