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}}
{{> day_heading date=date}}
{{> posts_list_controller context}}
{{> after_day}}
{{/each}}
{{> load_more_days}}

View file

@ -11,8 +11,8 @@
}
}
.template-highlighter:hover:after{
display: inline-block;
.template-highlighter:after{
display: none;
content: attr(data-template);
background:red;
color:white;
@ -23,13 +23,14 @@
z-index: 20000;
padding: 2px 8px;
}
.template-highlighter:hover:after{
display: inline-block;
}
.zone-highlighter{
border-color: rgba(0,0,255,0.3);
&:hover{
// background: rgba(0,0,255,0.15);
&:after, &:hover:after{
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);
};
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 () {
console.log('refreshing…')
$(".template-highlighter").remove();
// trigger autorun to re-run
templatesDep.changed();
};
@ -67,7 +57,7 @@ Template.onRendered(function () {
var templateName = template.view.name.replace("Template.", "");
// 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)) {
@ -75,13 +65,14 @@ Template.onRendered(function () {
templatesDep.depend() ;
// console.log(templateName)
// console.log(template)
// console.log("-------------")
console.log(templateName)
console.log(_.clone(template))
console.log("-------------")
// put this in setTimeout so app has the time to load in and render content
Meteor.setTimeout(function () {
// TODO: when using {{#if}}, template.firstNode stays empty even after it's rendered
var node = template.firstNode;
if (node) {
@ -93,8 +84,8 @@ Template.onRendered(function () {
// if this is a text node, try using nextElementSibling instead
if (node.nodeName === "#text") {
if (node.nextElementSibling) {
node = node.nextElementSibling;
if (node.nextSibling && node.nextSibling.nodeName !== "#text") {
node = node.nextSibling;
} else {
throw new Error("Node has no content");
}
@ -110,7 +101,7 @@ Template.onRendered(function () {
console.log(error);
}
}
}, 1000);
}, 100);
});
}
@ -124,11 +115,8 @@ $(function () {
if (!allowKeydown) return;
if(e.keyCode === 192){
$("body").addClass("show-highlighters");
}
if(e.keyCode === 27){
Telescope.debug.refresh();
$("body").addClass("show-highlighters");
}
allowKeydown = false;

View file

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

View file

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

View file

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

View file

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