diff --git a/pillar/web/nodes/routes.py b/pillar/web/nodes/routes.py index 91293f7a..0087cfaa 100644 --- a/pillar/web/nodes/routes.py +++ b/pillar/web/nodes/routes.py @@ -212,13 +212,23 @@ def view(node_id): # template_path, node_type_name) # raise NotFound("Missing template '{0}'".format(template_path)) - return render_template(template_path, - node_id=node._id, - node=node, - parent=node.parent, - children=children, - config=current_app.config, - api=api) + try: + return render_template(template_path, + node_id=node._id, + node=node, + parent=node.parent, + children=children, + config=current_app.config, + api=api) + except TemplateNotFound: + log.error('Template %s does not exist for node type %s', template_path, node_type_name) + return render_template('nodes/error_type_not_found.html', + node_id=node._id, + node=node, + parent=node.parent, + children=children, + config=current_app.config, + api=api) def _view_handler_asset(node, template_path, template_action, link_allowed): diff --git a/src/styles/_project.sass b/src/styles/_project.sass index 4d020b8c..dcebfc3a 100644 --- a/src/styles/_project.sass +++ b/src/styles/_project.sass @@ -1119,7 +1119,6 @@ section.node-preview.group border-radius: 3px cursor: default - .node-details-description +node-details-description @@ -1492,6 +1491,9 @@ section.node-details-container .featured-item-info opacity: 1 +.error-node-type-not-found + color: $color-danger + clear: both .node-extra display: flex diff --git a/src/templates/nodes/error_type_not_found.jade b/src/templates/nodes/error_type_not_found.jade new file mode 100644 index 00000000..5cb832c6 --- /dev/null +++ b/src/templates/nodes/error_type_not_found.jade @@ -0,0 +1,57 @@ +| {% block body %} + +#node-container + #node-overlay + + section.node-details-container + + .node-details-header + .node-title#node-title + | {{node.name}} + + | {% if node.description %} + .node-details-description#node-description + | {{node.description}} + | {% endif %} + + .node-details-meta.footer + p.error-node-type-not-found + | Sorry, I don't know how to display a node of type {{ node.node_type }}. + | {% if node.description %} + | I'll just show the description. + | {% endif %} + ul.node-details-meta-list + li.node-details-meta-list-item.status + | {{node.properties.status}} + + li.node-details-meta-list-item.author + | {{ node.user.full_name }} + + li.node-details-meta-list-item.date(title="Created {{ node._created }}") + | {{ node._created | pretty_date }} + | {% if (node._created | pretty_date) != (node._updated | pretty_date) %} + span(title="Updated {{ node._updated }}") (updated {{ node._updated | pretty_date }}) + | {% endif %} + + +include custom/_scripts + +| {% endblock %} + +| {% block footer_scripts %} +script. + // Generate GA pageview + ga('send', 'pageview', location.pathname); + + + $('.sorry').click(function() { + $.get('/403', function(data) { + $('#node-overlay').html(data).show().addClass('active'); + }) + }); + + $('#node-overlay').click(function(){ + $(this).removeClass('active').hide().html(); + }); + +| {% endblock %}