when I start meteor like this:
meteor --production
I get a blank page where my app should be and the following error shows up in my browser console:
No such function: navClassName
However if I start meteor normally like this:
meteor
My app runs without problem.
What could be the problem? Do meteor template helpers need to be loaded differently during production?
Relevant files:
client/navigation/navigation.html:
<template name="navigation">
<ul class="nav navbar-nav">
<li class="{{navClassName 'home'}}">
home
</li>
<li class="{{navClassName 'blog'}}">
Blog
</li>
</ul>
</template>
client/navigation/navigation.js:
Template.navigation.helpers({
'navClassName': function (route) {
if (Router.current()) {
return Router.current().route.options.navbarSelected.search(route) != -1 ? "active" : "";
}
}
});
Move navigation.js to the client/lib directory, or at least the Template.navigation.helpers part and fix/remove any other JavaScript that is causing errors.
I wish I could elaborate more, but this issue seems to be related to the file load order. Files in the lib directory are loaded first and moving the helpers there solved the problem for me.
A typical file structure can be found in the documentation. See the comments in the Example File Structure to learn about some of the special behaviors.
While this may work for you, finer control over dependencies can most easily be achieved through packages, as explained in this other answer from SO. This is specially necessary for code that should be available to both client and server.
Related
Needless to say, my experience with Meteor is lacking. I come from a Rails background, where you can do a lot more logic (and magic) in your views than Meteor.
The situation: I've got some routes that look like /things/:_id, and I've named that route 'thing' because it shows only one thing of a user's many owned things:
FlowRouter.route('/things/:_id', {
name: 'thing',
action() {
BlazeLayout.render('appPage', {app: 'thing', sidebar: "thingsListOnThing", header: 'thingTitle'});
}
});
As you can see, I'm also loading a template I've built to list all of the user's owned things on the sidebar for easy navigation. That template, thingsListOnThing is the target of this question.
Get the gist? I'm able to mark the route that dislays a template with a complete list of a user's things as active using zimme:active-route like so:
// A list of all a user's things
<div class="{{isActiveRoute name='things' class='is-active'}}">
List of Things
</div>
This package is great, but it won't help me with routes that look like /things/:_id because, then every link to each individual thing would be is-active on any thing page, not just the one where the current path's :_id matches the _id of the active thing.
I'm really kind of stuck here. My first guess would be to use template helpers, but I'm confused as to where to get started with that.
If need be, please as me to upload any piece of my code you require. I figured it's such a generic question that you guys probably don't need to see all of my code to understand what I'm trying to accomplish.
Using: zimme:active-route
Template Helpers
Template.listOfThings.helpers({
activeListClass(page) {
const active = ActiveRoute.name('thing') && FlowRouter.getParam('_id') === this._id;
return active && 'active';
},
});
Template HTML:
<a class="{{isActivePath 'thing'}}" href="/things/{{_id}}">
<div class="thingListItem {{activeListClass page}}">
{{title}}
</div>
</a>
I Updated to the latest meteor version and I'm also running the latest parsley.js version my validation has stopped working it seems that
$('#create-post').parsley().options.trigger = 'change';
$('#create-post').parsley().reset();
Is not firing in meteor (on render template) but works fine in JS Fiddle - https://jsfiddle.net/grbcwa9b/
Really not sure why it's not working anymore has anyone else run into this issues
I was finally able to get to the bottom of this I had create post id twice once in my navigation and once in form this was causing the conflict
<li class="{{isActiveRoute regex='create-post'}}">
<i class="glyphicon glyphicon-plus"></i><span class="title">{{mf 'create-post' 'Create Post'}}</span>
</li>
I created this simple nav bar, and everything is working great except the URLs for the links. When I click on the links, it just gives me "#" after the current page's url, so the links look great but go nowhere. So I assume that #node.Url isn't working for some reason. Any ideas?
<ul>
#{
var homeNode = Model.Content.AncestorOrSelf("Homepage");
}
#foreach (var node in homeNode.Children.Where("Visible"))
{
<li>
#node.AsDynamic().Name |
</li>
}
</ul>
This sounds like an issue directly related to the upgrade.
Assuming you took a backup of the code and database before performing the upgrade, I would recommend rolling back to the backups and updating again, being sure to follow the specific instructions supplied in the upgrade guide
The reason this was happening was because of a database error related to nested doctypes. The way I solved it was to completely reinstall Umbraco 7.2.2, and then download the dev version of the next Umbraco version. Then I had to build the dev version, in order to get the resulting umbraco.core.dll and copy it into my own /bin/ folder. After doing this, my code worked perfectly, as well as fixing a number of other errors. If anyone else is experiencing this, the steps to fix it may be found here: https://our.umbraco.org/forum/getting-started/installing-umbraco/60101-Upgrade-to-721-Document-Types-Break
The following is my current code,
https://github.com/daslicht/kiss
After cloning it to my server I have added the spiderable package
and added phantomjs to the $PATH.
The basic structure of my app is essentially a Master Details layout,
on the left we have a list of headlines(Master)
and on the right the according details to each Headline.
So far so good..., when I call one page with:
http://78.47.126.11:3000/?_escaped_fragment_=blog/SbZayHyqKmZhCEHme/1
I get my Headlines displayed but not the according Details.
Do you have any idea what could be going wrong ?
Currently it is running as bundle with forever.
Best Regards
Marc
If think the Spiderable package won't show stuff from MongoDB, only static template-stuff.
So in this example only the static stuff will show, not the DB-loop:
<template name="main">
{{> thisWillBeOutputted}}
</template>
<template name="thisWillBeOutputted">
<h1>This will be displayed, sweet!</h1>
{{#each thisLoopFetchesStuffFromDBAndWontShow}}
<!-- stuff in this loop won't be displayed :( -->
<p>Something which won't be displayed: {{dbDoc.something}}</p>
{{/each}}
</template>
To summarize (what I believe is correct):
The Spiderable package better than not displaying anything for bots (which is the case with vanilla-meteor), but it's not as good as a good-old-PHP/whatever-site.
EDIT
I misunderstood your problem. What I would do is add <meta name="fragment" content="!"> to your head instead of going with the escaped-fragment thing. More here: https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
I'm still pretty sure your DB-stuff won't get picked up by Google though. But I could be wrong!
If I understood, your app is ignoring 'blog/SbZayHyqKmZhCEHme/1'.
The error is because:
https://github.com/meteor/meteor/issues/487
The spiderable package does not currently reattach the escaped
fragment back onto the url sent to phantomjs, so it's not possible for
the page to display the correct content.
For example if googlebot encounters a url:
http://domain.com/#!page
It will make a request from the server:
http://domain.com/?_escaped_fragment_=page
However at the moment, the spiderable package will call phantomjs with
the following url:
http://domain.com/
My solution is to create your own spiderable package with fix by 'https://gist.github.com/4096777'
I'm trying to get the Gumby.js library to work with Meteor, but cant get it to work.
I've tried both installing it manually in /client/lib folder and using 'mrt add gumby'.
The CSS part seems to work pretty fine with the grid working perfectly, but the JS modules dont work.
I'm setting a responsive Navbar just like this
<template name="nav">
<div class="row navbar centered" id="nav1">
<!-- Toggle for mobile navigation, targeting the <ul> -->
<a id="nav-toggle" class="toggle" gumby-trigger="#nav-ul" href="#"><i class="icon-menu"></i></a>
<ul id="nav-ul" class="eight columns">
<li>Quienes somos</li>
<li>Marcas</li>
<li>Servicios</li>
<li>Laboratorios</li>
<li>Contacto</li>
<li>Otros</li>
</ul>
</div>
</template>
but the menu just does not popup on mobile width. And other modules like Folders and skip dont work at all when defined.
you can see a sample here
any idea on how to get it up and running?
Not sure about the real situation, because the js files are packed in the website and it's hard for me to tell from the source code. However, there is some clue you may find useful.
I assume you want to run the js script after the template is rendered. In this case, you need to write like this.
Template.nav.rendered = function() {
// Run the js to render the dropdown or whatever.
}
This is the Meteor programming paradigm. If you simply run the js files directly, the template may not be ready when you run that part of the code. The "rendered" callback is the place you need to place some actions after this template is ready.
In addition, you can refer the official document here http://docs.meteor.com/#template_rendered