Merge branch 'master' of git.blender.org:pillar into elastic

This commit is contained in:
Stephan preeker 2017-12-01 16:24:56 +01:00
commit b0d6f724ef
26 changed files with 202 additions and 352 deletions

View File

@ -59,6 +59,7 @@ def posts_view(project_id=None, project_url=None, url=None, *, archive=False, pa
for post in posts._items:
post.picture = get_file(post.picture, api=api)
post.url = url_for_node(node=post)
# Use the *_main_project.html template for the main blog
is_main_project = project_id == current_app.config['MAIN_PROJECT_ID']

View File

@ -1,81 +1,3 @@
function projectNavCollapse() {
$("#project-side-container").addClass('collapsed');
};
function projectNavExpand() {
$("#project-side-container").removeClass('collapsed');
};
function projectNavCheck(){
/* Only run if there is a tree */
if(document.getElementById("project_tree") !== null) {
var nav_status = Cookies.getJSON('bcloud_ui');
if (nav_status && nav_status.nav_collapsed) {
if (nav_status.nav_collapsed == 'expanded') {
projectNavExpand();
} else if ( nav_status.nav_collapsed == 'collapsed' ) {
projectNavCollapse();
}
} else {
projectNavExpand();
}
}
}
function projectNavToggle(){
var nav_status = Cookies.getJSON('bcloud_ui');
if (nav_status && nav_status.nav_collapsed) {
if (nav_status.nav_collapsed == 'expanded') {
projectNavCollapse();
setJSONCookie('bcloud_ui', 'nav_collapsed', 'collapsed');
} else if ( nav_status.nav_collapsed == 'collapsed' ) {
projectNavExpand();
setJSONCookie('bcloud_ui', 'nav_collapsed', 'expanded');
}
} else {
projectNavCollapse();
setJSONCookie('bcloud_ui', 'nav_collapsed', 'collapsed');
}
$('#project_context-header').width($('#project_context-container').width());
}
$(function () {
/* Check on first load */
projectNavCheck();
$('.project_split, .project_nav-toggle-btn').on('click', function (e) {
projectNavToggle();
});
/* Only run if there is a tree */
if(document.getElementById("project_tree") !== null) {
$(document).keypress(function(e) {
var tag = e.target.tagName.toLowerCase();
/* Toggle when pressing [T] key */
if(e.which == 116 && tag != 'input' && tag != 'textarea' && !e.ctrlKey && !e.metaKey && !e.altKey) {
projectNavToggle();
}
});
}
});
/* Small utility to enable specific node_types under the Add New dropdown */
/* It takes:
* empty: Enable every item

View File

@ -9,11 +9,11 @@ body.organizations
margin-left: auto
#side
.dashboard-secondary
.box
+container-box
padding: 10px 20px
margin: 20px 10px
margin: 0
#item-details
.organization
@ -29,7 +29,6 @@ body.organizations
input
font-size: 1.1em
.org-admin
#admin-name
padding: 10px 0

View File

@ -6,8 +6,8 @@
border-bottom-left-radius: 3px
border-bottom-right-radius: 3px
section#sub-nav-tabs.home,
section#sub-nav-tabs.projects
nav#sub-nav-tabs.home,
nav#sub-nav-tabs.projects
background-color: white
border-bottom: thin solid $color-background-dark
@ -17,7 +17,7 @@
section#home
background-color: $color-background-dark
section.nav-tabs__tab
nav.nav-tabs__tab
display: none
background-color: $color-background-light

View File

@ -41,10 +41,6 @@ body.blog
width: 100%
left: 0
#project-side-container.collapsed+#project_context-header
span#status-bar
left: $project-sidebar-width
#project_context-header
span#status-bar
text-align: left
@ -316,10 +312,6 @@ span#project-edit-title
weight: 400
white-space: nowrap
.project_split.collapsed+#project_context-header
span#project-edit-title
left: 0
/* Edit Asset buttons */
.project-mode-view,
@ -702,41 +694,6 @@ ul.project_nav-edit-list
min-height: 800px
border: none
#project-side-container
&.collapsed
.project_nav-toggle-btn i:before
content: '\e827'
.project_split
background-color: $project-sidebar-background
cursor: e-resize
right: 0
left: 8px
width: 5px
#project_nav
width: 5px
+media-xs
width: initial
#project_nav-container
width: 5px
+media-xs
display: block
width: initial
position: relative
#project_nav-header,
#project_context-header,
#project_tree
display: none
visibility: hidden
+media-xs
display: block
visibility: visible
position: relative
/* The actual navigation tree container */
#project_tree
@ -753,20 +710,6 @@ ul.project_nav-edit-list
&.edit
margin-top: 0
/* Clickable bar between navtree and context view, to collapse tree */
.project_split
float: right
position: absolute
width: 15px
margin-left: -8px
top: 0
right: -15px
bottom: 0
cursor: w-resize
user-select: none
+media-xs
display: none
/* Node Context */
=project-node-title

View File

@ -239,22 +239,18 @@
font:
family: $font-body
size: 1.8em
padding-bottom: 10px
padding-top: 20px
.item-info
color: $color-text-dark-secondary
font-size: 1em
padding: 10px 25px 10px
a
color: $color-text-dark-secondary
&:hover
color: $color-primary
ul.meta
+list-meta
font-size: .9em
padding: 15px 25px 5px
.item-content
+node-details-description
padding: 35px 25px
font-size: 1.3em
padding: 15px 25px 25px
+media-xs
padding:

View File

@ -1,6 +1,6 @@
| {% macro navigation_tabs(title) %}
section#nav-tabs
nav#nav-tabs
ul#nav-tabs__list
li.nav-tabs__list-tab(
class="{% if title == 'homepage' %}active{% endif %}")

View File

@ -1,17 +1,5 @@
script(type="text/javascript").
/* Convert Markdown */
var convert_fields = '.node-details-description, .blog_index-item .item-content';
var convert = new Markdown.getSanitizingConverter();
Markdown.Extra.init(convert);
convert = convert.makeHtml;
/* Parse description/content fields to convert markdown */
$(convert_fields).each(function(i){
$(convert_fields).eq(i).html(convert($(convert_fields).eq(i).text()));
});
ProjectUtils.setProjectAttributes({isProject: false});
// Click anywhere in the page to hide the overlay

View File

@ -18,7 +18,7 @@
| {% if node.description %}
.node-details-description#node-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
include ../../_node_details

View File

@ -18,7 +18,7 @@
| {% if node.description %}
.node-details-description#node-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
include ../../_node_details

View File

@ -40,7 +40,7 @@
| {% if node.description %}
.node-details-description#node-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
include ../../_node_details

View File

@ -1,27 +1,31 @@
//- ******************************************************* -//
| {% macro render_blog_post(node) %}
| {% if node.picture %}
a.blog_index-header(href="{{ url_for_node(node=node) }}")
a.blog_index-header(href="{{ node.url }}")
img(src="{{ node.picture.thumbnail('l', api=api) }}")
| {% endif %}
.blog_index-item
ul.meta
| {% if node.project.name %}
li {{ node.project.name }}
| {% endif %}
li.when
a(href="{{ node.url }}",
title="Updated {{ node._updated | pretty_date }}")
| {{ node._created | pretty_date }}
li
a(href="{{ node.url }}#comments")
| comment
a.item-title(
href="{{ url_for_node(node=node) }}")
href="{{ node.url }}")
| {{ node.name }}
.item-info.
#[span(title="{{node._created}}") {{node._created | pretty_date }}]
{% if node._created != node._updated %}
#[span(title="{{node._updated}}") (updated {{node._updated | pretty_date }})]
{% endif %}
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
· {{node.user.full_name}}
· #[a(href="{{ url_for_node(node=node) }}#comments") comment]
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
.item-content
| {{ node.properties.content }}
| {{ node.properties.content | markdown }}
| {% endmacro %}
@ -30,15 +34,15 @@ a.blog_index-header(href="{{ url_for_node(node=node) }}")
.blog_index-item.list
| {% if node.picture %}
a.item-header(href="{{ url_for_node(node=node) }}")
a.item-header(href="{{ node.url }}")
img.image(src="{{ node.picture.thumbnail('s', api=api) }}")
| {% else %}
a.item-header.nothumb(href="{{ url_for_node(node=node) }}")
a.item-header.nothumb(href="{{ node.url }}")
i.pi-document-text
| {% endif %}
a.item-title(
href="{{ url_for_node(node=node) }}")
href="{{ node.url }}")
| {{node.name}}
.item-info.

View File

@ -29,7 +29,7 @@ link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=1732017
| {% for post in posts %}
li.jstree-node
a.jstree-anchor.tree-item.post(
href="{{ url_for_node(node=post) }}")
href="{{ node.url }}")
.tree-item-thumbnail
| {% if post.picture %}
img(src="{{ post.picture.thumbnail('s', api=api) }}")

View File

@ -73,32 +73,6 @@
| {% block comment_scripts %}
script.
// If there's a comment link in the URL, scroll there
function scrollToLinkedComment() {
var scrollToId = location.hash;
if (scrollToId.length <= 1) return;
$(scrollToId)
.addClass('comment-linked')
.scrollHere();
}
$(scrollToLinkedComment);
$('#comment_field').autoResize();
// Initialize Markdown to later convert comment as we type
var convert = new Markdown.getSanitizingConverter();
Markdown.Extra.init(convert);
convert = convert.makeHtml;
// Submit new comment
$(document)
.off('click','body .comment-action-submit')
.on( 'click','body .comment-action-submit', function(e){
post_comment($(this));
});
{% if show_comments %}
$('body')
.off('pillar:comment-posted')
@ -111,9 +85,37 @@ script.
$('#' + comment_node_id).scrollHere();
});
});
// If there's a comment link in the URL, scroll there
function scrollToLinkedComment() {
var scrollToId = location.hash;
if (scrollToId.length <= 1) return;
$(scrollToId)
.addClass('comment-linked')
.scrollHere();
}
$(scrollToLinkedComment);
{% endif %}
{% if can_post_comments %}
// If we can actually comment, load the tools to do it
// Initialize Markdown to later convert comment as we type
var convert = new Markdown.getSanitizingConverter();
Markdown.Extra.init(convert);
convert = convert.makeHtml;
// Submit new comment
$(document)
.off('click','body .comment-action-submit')
.on( 'click','body .comment-action-submit', function(e){
post_comment($(this));
});
// Writing comment
// Markdown convert as we type in the textarea
$(document)
@ -142,6 +144,9 @@ script.
}
});
// Autoresize the textarea as we type
$('#comment_field').autoResize();
// Edit comment
// Enter edit mode
@ -218,4 +223,6 @@ script.
});
});
{% endif %}
| {% endblock %}

View File

@ -15,7 +15,7 @@
| {% if node.description %}
.node-details-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
section.node-children.group

View File

@ -12,7 +12,7 @@
| {% if node.description %}
section.node-row
.node-details-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
| {% if children %}

View File

@ -12,7 +12,7 @@
| {% if node.description %}
section.node-row
.node-details-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
| {% if children %}

View File

@ -93,7 +93,7 @@
| {% if node.description %}
.node-details-description#node-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
| {% if node.properties.license_notes %}

View File

@ -17,7 +17,7 @@
| {% if node.description %}
.node-details-description#node-description
| {{node.description}}
| {{ node.description | markdown }}
| {% endif %}
.node-details-meta.footer

View File

@ -17,13 +17,13 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
| {% block body %}
.dashboard-container
section#main
section.dashboard-main
| {{ navigation_tabs(title) }}
section#projects
| {% if can_create_organization %}
section#sub-nav-tabs.projects
nav#sub-nav-tabs.projects
ul#sub-nav-tabs__list
li.result#create_organization_result_panel
li.create
@ -32,7 +32,7 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
| Create Organization
| {% endif %}
section.nav-tabs__tab.active#own_projects
nav.nav-tabs__tab.active#own_projects
ul.projects__list
| {% if organizations %}
| {% for organization in organizations['_items'] %}
@ -65,7 +65,7 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
span Create an Organization to get started!
| {% endif %}
section#side
section.dashboard-secondary
section.box
#item-details

View File

@ -20,23 +20,23 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
| {% block body %}
.dashboard-container
section#main
section.dashboard-main
| {{ navigation_tabs(title) }}
section#projects
section#sub-nav-tabs.home
nav#sub-nav-tabs.home
ul#sub-nav-tabs__list
li.nav-tabs__list-tab#subtab-blender_sync(data-tab-url='.')
li.nav-tabs__list-tab#subtab-blender_sync(data-tab-url="{{ url_for('projects.home_project')}}")
i.pi-blender
| Blender Sync
li.nav-tabs__list-tab#subtab-images(data-tab-url='images')
li.nav-tabs__list-tab#subtab-images(data-tab-url="{{ url_for('projects.home_project_shared_images')}}")
i.pi-picture
| Images
| {% block currenttab %}{% endblock %}
section#side
section.dashboard-secondary
section.announcement
img.header(
src="{{ url_for('static', filename='assets/img/blender_sync_header.jpg') }}")

View File

@ -20,12 +20,12 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
| {% block body %}
.dashboard-container
section#main
section.dashboard-main
| {{ navigation_tabs(title) }}
section#projects
section#sub-nav-tabs.projects
nav#sub-nav-tabs.projects
ul#sub-nav-tabs__list
li.nav-tabs__list-tab.active(data-tab-toggle='own_projects')
| Own Projects
@ -48,7 +48,7 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
| Create Project
| {% endif %}
section.nav-tabs__tab.active#own_projects
nav.nav-tabs__tab.active#own_projects
ul.projects__list
| {% for project in projects_user %}
li.projects__list-item(
@ -148,7 +148,7 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
| No projects shared with you... yet!
| {% endif %}
section#side
section.dashboard-secondary
section.announcement
img.header(
src="{{ url_for('static', filename='assets/img/backgrounds/services_projects.jpg')}}")

View File

@ -131,11 +131,6 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
i.pi-cog
| {% endif %}
.project_nav-toggle-btn(
title="Toggle navigation [T]",
data-toggle="tooltip",
data-placement="right")
i.pi-angle-double-left
#project_nav(class="{{ title }}")
#project_nav-container
@ -150,7 +145,6 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
| {% endblock project_tree %}
| {% endif %}
.project_split(title="Toggle Navigation [T]")
#project_context-container
| {% if project.has_method('PUT') %}

View File

@ -39,7 +39,7 @@
| {% if project.description %}
.node-details-description
| {{ project.description }}
| {{ project.description | markdown }}
| {% endif %}
| {# Until we implement urls for pages

View File

@ -1,115 +1 @@
| {% block body %}
#user-edit-container
#user-edit-header
.user-edit-name(title="Full Name") {{user.full_name}}
.user-edit-username(title="Username")
i.pi-users
| {{user.username}}
.user-edit-email(title="E-mail")
i.pi-email
| {{user.email}}
.user-edit-id(title="User ID")
i.pi-vcard
| {{user.user_id}} &nbsp;
a.copy-to-clipboard(
style="margin-left: auto",
name="Copy to Clipboard",
type="button",
href="javascript:void(0)",
data-clipboard-text="{{ user.user_id }}",
title="Copy ID to clipboard")
| (copy to clipboard)
p This user on:
=' '
a(href="https://store.blender.org/wp-admin/users.php?s={{ user.email | urlencode }}") Blender Store
=' | '
a(href="https://www.blender.org/id/admin/users/?flt1_4={{ user.email | urlencode }}") Blender ID
form(
id="user-edit-form",
method="POST",
enctype="multipart/form-data",
action="{{url_for('users.users_edit', user_id=user.user_id)}}")
| {% for field in form %}
| {% if field.name == 'csrf_token' %}
| {{ field }}
| {% else %}
| {% if field.type == 'HiddenField' %}
| {{ field }}
| {% else %}
.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 %}
span.field-description {{ field.description }}
| {% endif %}
| {% endif %}
| {% endfor %}
.form-group.capabilities
label Capabilities
| {% if user.capabilities %}
ul
| {% for cap in user.capabilities|sort %}
li {{ cap }}
| {% endfor %}
| {% else %}
p
i.pi-cancel
| none
| {% endif %}
a#button-cancel.btn.btn-default(href="#", data-user-id='{{user.user_id}}') Cancel
input#submit_edit_user.btn.btn-default(
data-user-id="{{user.user_id}}",
type="submit" value="Submit")
#user-edit-notification
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}")
script(type="text/javascript").
$('#roles').select2();
$('#user-edit-form').submit(function(e){
e.preventDefault();
//- console.log($(this).serialize());
$.post($(this).attr('action'), $(this).serialize())
.done(function(data){
// This function is defined in index.pug.
displayUser('{{ user.user_id }}')
.done(function() {
$('#user-edit-notification').addClass('success').html('Success!');
});
})
.fail(function(data){
$('#user-edit-notification').addClass('fail').html('Houston!');
});
//- $("#user-edit-form").submit();
});
$('#button-cancel').click(function(e){
$('#user-container').html('')
});
new Clipboard('.copy-to-clipboard');
| {% endblock %}
| {% extends "users/edit_embed_base.html" %}

View File

@ -0,0 +1,110 @@
| {% block body %}
#user-edit-container
#user-edit-header
.user-edit-name(title="Full Name") {{user.full_name}}
.user-edit-username(title="Username")
i.pi-users
| {{user.username}}
.user-edit-email(title="E-mail")
i.pi-email
| {{user.email}}
.user-edit-id(title="User ID")
i.pi-vcard
| {{user.user_id}} &nbsp;
a.copy-to-clipboard(
style="margin-left: auto",
name="Copy to Clipboard",
type="button",
href="javascript:void(0)",
data-clipboard-text="{{ user.user_id }}",
title="Copy ID to clipboard")
| (copy to clipboard)
| {% block user_links %}{% endblock %}
form(
id="user-edit-form",
method="POST",
enctype="multipart/form-data",
action="{{url_for('users.users_edit', user_id=user.user_id)}}")
| {% for field in form %}
| {% if field.name == 'csrf_token' %}
| {{ field }}
| {% else %}
| {% if field.type == 'HiddenField' %}
| {{ field }}
| {% else %}
.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 %}
span.field-description {{ field.description }}
| {% endif %}
| {% endif %}
| {% endfor %}
.form-group.capabilities
label Capabilities
| {% if user.capabilities %}
ul
| {% for cap in user.capabilities|sort %}
li {{ cap }}
| {% endfor %}
| {% else %}
p
i.pi-cancel
| none
| {% endif %}
a#button-cancel.btn.btn-default(href="#", data-user-id='{{user.user_id}}') Cancel
input#submit_edit_user.btn.btn-default(
data-user-id="{{user.user_id}}",
type="submit" value="Submit")
#user-edit-notification
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}")
script(type="text/javascript").
$('#roles').select2();
$('#user-edit-form').submit(function(e){
e.preventDefault();
//- console.log($(this).serialize());
$.post($(this).attr('action'), $(this).serialize())
.done(function(data){
// This function is defined in index.pug.
displayUser('{{ user.user_id }}')
.done(function() {
$('#user-edit-notification').addClass('success').html('Success!');
});
})
.fail(function(data){
$('#user-edit-notification').addClass('fail').html('Houston!');
});
//- $("#user-edit-form").submit();
});
$('#button-cancel').click(function(e){
$('#user-container').html('')
});
new Clipboard('.copy-to-clipboard');
| {% endblock %}