refresh highlights on debug mode trigger; various template tweaks

This commit is contained in:
Sacha Greif 2015-07-15 14:56:04 +09:00
parent f8c1cb7c6e
commit b6c8c8df80
7 changed files with 27 additions and 40 deletions

View file

@ -4,7 +4,6 @@
{{> before_day}} {{> before_day}}
{{> day_heading date=date}} {{> day_heading date=date}}
{{> posts_list_controller context}} {{> posts_list_controller context}}
{{> after_day}} {{> after_day}}
{{/each}} {{/each}}
{{> load_more_days}} {{> load_more_days}}

View file

@ -11,8 +11,8 @@
} }
} }
.template-highlighter:hover:after{ .template-highlighter:after{
display: inline-block; display: none;
content: attr(data-template); content: attr(data-template);
background:red; background:red;
color:white; color:white;
@ -23,13 +23,14 @@
z-index: 20000; z-index: 20000;
padding: 2px 8px; padding: 2px 8px;
} }
.template-highlighter:hover:after{
display: inline-block;
}
.zone-highlighter{ .zone-highlighter{
border-color: rgba(0,0,255,0.3); border-color: rgba(0,0,255,0.3);
&:hover{ &:after, &:hover:after{
// background: rgba(0,0,255,0.15); display: inline-block;
background: blue;
} }
} }
.zone-highlighter:hover:after{
background: blue;
}

View file

@ -42,22 +42,12 @@ var createHighlighter = function (templateName, $node) {
$node.append(div); $node.append(div);
}; };
Router.configure({
onBeforeAction: function () {
// clear out all previous template highlighters
this.next();
},
onRun: function () {
// console.log("route changed");
$(".template-highlighter").remove();
// trigger autorun to re-run
templatesDep.changed();
}
});
Telescope.debug.refresh = function () { Telescope.debug.refresh = function () {
console.log('refreshing…') console.log('refreshing…')
$(".template-highlighter").remove();
// trigger autorun to re-run
templatesDep.changed(); templatesDep.changed();
}; };
@ -67,7 +57,7 @@ Template.onRendered(function () {
var templateName = template.view.name.replace("Template.", ""); var templateName = template.view.name.replace("Template.", "");
// exclude weird Blaze stuff and special templates // exclude weird Blaze stuff and special templates
var excludedTemplates = ["__dynamicWithDataContext", "__dynamic", "module", "menuComponent", "menuItem", "avatar"]; var excludedTemplates = ["__dynamicWithDataContext", "__dynamic", "module", "menuComponent", "menuItem", "avatar", "posts_list_controller"];
if (!_.contains(excludedTemplates, templateName)) { if (!_.contains(excludedTemplates, templateName)) {
@ -75,13 +65,14 @@ Template.onRendered(function () {
templatesDep.depend() ; templatesDep.depend() ;
// console.log(templateName) console.log(templateName)
// console.log(template) console.log(_.clone(template))
// console.log("-------------") console.log("-------------")
// put this in setTimeout so app has the time to load in and render content // put this in setTimeout so app has the time to load in and render content
Meteor.setTimeout(function () { Meteor.setTimeout(function () {
// TODO: when using {{#if}}, template.firstNode stays empty even after it's rendered
var node = template.firstNode; var node = template.firstNode;
if (node) { if (node) {
@ -93,8 +84,8 @@ Template.onRendered(function () {
// if this is a text node, try using nextElementSibling instead // if this is a text node, try using nextElementSibling instead
if (node.nodeName === "#text") { if (node.nodeName === "#text") {
if (node.nextElementSibling) { if (node.nextSibling && node.nextSibling.nodeName !== "#text") {
node = node.nextElementSibling; node = node.nextSibling;
} else { } else {
throw new Error("Node has no content"); throw new Error("Node has no content");
} }
@ -110,7 +101,7 @@ Template.onRendered(function () {
console.log(error); console.log(error);
} }
} }
}, 1000); }, 100);
}); });
} }
@ -124,11 +115,8 @@ $(function () {
if (!allowKeydown) return; if (!allowKeydown) return;
if(e.keyCode === 192){ if(e.keyCode === 192){
$("body").addClass("show-highlighters");
}
if(e.keyCode === 27){
Telescope.debug.refresh(); Telescope.debug.refresh();
$("body").addClass("show-highlighters");
} }
allowKeydown = false; allowKeydown = false;

View file

@ -29,7 +29,6 @@ showFilters (Boolean)
<template name="posts_list"> <template name="posts_list">
<div class="posts-wrapper grid grid-module"> <div class="posts-wrapper grid grid-module">
{{> postsListIncoming data=incoming}}
<div class="posts list {{postsLayout}}" aria-live="polite"> <div class="posts list {{postsLayout}}" aria-live="polite">
{{#each postsCursor}} {{#each postsCursor}}
{{> before_post_item}} {{> before_post_item}}

View file

@ -1,6 +1,6 @@
<template name="posts_views_nav"> <template name="posts_views_nav">
{{#if showNav}} {{#if showNav}}
<div class="posts-list-views grid-module"> <div class="posts-views-nav grid-module">
{{> menuComponent menuName="view" menuItems=menuItems mode="list"}} {{> menuComponent menuName="view" menuItems=menuItems mode="list"}}
</div> </div>
{{/if}} {{/if}}

View file

@ -1,7 +1,7 @@
<template name="tagline_banner"> <template name="tagline_banner">
<div class="tagline-banner"> {{#if showTaglineBanner}}
{{#if showTaglineBanner}} <div class="tagline-banner">
<h3 class="tagline"><span>{{getSetting "tagline"}}</span></h3> <h3 class="tagline"><span>{{getSetting "tagline"}}</span></h3>
{{/if}} </div>
</div> {{/if}}
</template> </template>

View file

@ -44,7 +44,7 @@
} }
// ------------------------------------ posts views nav ------------------------------------ // // ------------------------------------ posts views nav ------------------------------------ //
.posts-list-views{ .posts-views-nav{
background: white(0.6); background: white(0.6);
border-radius: 3px; border-radius: 3px;
.menu-top-level, .menu-menu, .menu-contents, .menu-item{ .menu-top-level, .menu-menu, .menu-contents, .menu-item{