I am watching the Bulding an app with ember.js (the intro 30 minute video) and I am having an issue with the date function with moment.
Ember.Handlebars.registerBoundHelper('date', function(date) {
return moment(date).fromNow();
});
I entered that code and everything is ok when I refresh the page. However when I go back to the index.html and change the code:
<h2>by {{author}} <small class="muted">({{ publishedAt}})</small></h2>
now when I add the date from the app.js to index.html
<h2>by {{author}} <small class="muted">({{date publishedAt}})</small></h2>
after I enter the date and reload my page I just get a blank page? What am I doing wrong?
I guess you are running into a js file loading order issue and thus the error ReferenceError moment is not defined.
I've setup the bloggr client app in a jsbin here and the moment lib works correctly as far I can see. Have a look at the jsbin, maybe you find the difference to your code.
Hope it helps
Related
I am using the plugin from https://github.com/thefrontside/emberx-file-input. I want to multi-select photos while uploading. I can do it from the laptop. But when I use ember-cordova and create app on my android device, I cannot multi-select photos even though I have added the multiple = true in the code. Here is the code below,
{{#x-file-input multiple=true action=(action "selectImg")}}
Do you use a block or inline component invocation? You use # at the start of component name, it means you have to close it by {{/x-file-input}}, I just try to understand if it just a typo..
I see emberx-file-input addon is out of date since the last activity in Github is Dec 2017. I suggest you to use ember-file-upload addon.
If you are implementing the file upload module only buy now i would suggest you to go with ember-file-upload addon.
I am doing my first project in Foundation 6 and am having trouble getting the responsive navigation to work. I started with the basic page template that comes with Foundation (installed F6 using CodeKit) then I pasted in the responsive menu code exactly as it appears here http://foundation.zurb.com/sites/docs/responsive-navigation.html#responsive-toggle but when viewed at small screen sizes, the word "menu" appears, but clicking it does nothing.
The Drilldown responsive menu also does not work -- pasted in the drilldown menu code (second example down, on the page referenced above) and what appears is a long long list of links, nothing is collapsed and nothing slides in. There must be a script missing but I have triple-checked and app.js, foundation.js and jquery scripts are loaded. What else am I missing?
First of all sorry for my bad English, did you initialize foundation's javascript?
That can be done with the following code in youre custom javascript file:
$(document).foundation();
I do it with jQuery like this:
$(document).ready(function() {
$(document).foundation();
});
for more information see: Foundation-6 documentation - initializing
and please check if you have the proper file structure for the foundation files, please see the following documentation: Foundation-6 documentation - File Structure
tl;dr: Faulty purifycss configuartion in the gulp.babel.js file.
I also had this problem. My setup:
generator-webapp
webapp's jade recipe
I can get the responsive dropdown menu to work by using the tab and enter key. This means that the relevant js files are being loaded correctly. The navigation 'burger' also does not appear.
Upon using the chrome dev tools to inspect the responsive dropdown menu example from the foundation website, I noticed that style of <button class="menu-icon" type="button" data-toggle=""></button> is being effected by the .menu-icon CSS rule from the scss partial, _menu-icon.scss. Mine wasn't. When I looked, the foundation.scss file from the app/ has the exact same style rule. The converted foundation.css was being served from the .tmp/ folder, but did not have the .menu-icon CSS rule. Then I suspected purifycss again (which I had commented out of the gulp file before and forgot to reset the gulp serve, saw no fix and thus falsely excluded the purifycss rule from the list of suspects).
I set my gulp styles task up like this:
gulp.task('styles', () => {
return gulp.src('app/styles/*.scss')
.pipe($.plumber())
.pipe($.sourcemaps.init())
.pipe($.sass.sync({
outputStyle: 'expanded',
precision: 10,
includePaths: ['.']
}).on('error', $.sass.logError))
.pipe($.autoprefixer({browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']}))
/*Stupidly assumed that purifycss supported jade files as src files*/
.pipe($.purifycss(['app/**/*.js', 'app/*.jade']))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('.tmp/styles'))
.pipe(reload({stream: true}));
});
Which meant that the necessary styles were being deleted (including .menu-icon). I think I will use stylperjade or rearrange the tasks so that I can do this: .pipe($.purifycss(['app/**/*.js', '.tmp/*.jade']))\
Let me know if this was your solution as well
I play with telescope (meteor open source project) and I want to share the post link instead of source link on Facebook; so I did,in the telescope-module-share package, something like this:
sourceLink: function(){
return window.location.origin + "/posts/"+this._id;
},
It works great, except when I share the post on Facebook, it display the title and description of home page instead of the post shared!!
Anyone have an idea to fix it, please!!!
Consider using Server Side Rendering, there's a great package for this : https://github.com/meteorhacks/meteor-ssr
I'm using the django-simple-captcha in django forms,i used it in a
subclass of sessionwizardform,and in the last wizard form,i put a captcha field in it .
at first ,things goes all right ,but after few days ,may be by the duplication of the stale files i installed. in a word ,when i test the wizard form .In the chrome ,the captcha displays pic well,but i fill the right checking words ,in the last post of the form ,it did not post the data,and get another pic for you to validate.
and i found some answer by my previous question ,but i still can not solve it ,the help url is https://github.com/mbi/django-simple-captcha/issus/41 ,and my previous question url is django-simple-captcha-keeps-saying-invalid-captcha .
in it ,i described the detail of my django-simple-captcha.
likewise ,i'm still not know much about the globally and the virturenv, I have the django-simple-captcha uninstalled and reinstalled ,have the django uninstalled and reinstalled ,
...
but none of these worked ,and i do not re-defined the CAPTCHA_OUTPUT_FORMATin my settings.in the chrome ,i tested like
this
<td width="70%" class="text-left">
<img src="/captcha/image/d61b817a32d5aee07a4c2f8ce3cf71ccc7dea85f/" alt="captcha" class="captcha">
<input class="form-control" id="id_xy_assist-captcha_0" name="xy_assist-captcha_0" type="hidden" value="d61b817a32d5aee07a4c2f8ce3cf71ccc7dea85f">
<input class="form-control" id="id_xy_assist-captcha_1" name="xy_assist-captcha_1" type="text">
</td>
and i think this is allright,but in the chrome after all the fields
post ,there is another get captcha image which make this wizard form data can never be saved.and without this captcha field ,everything is right .
and comparing with the issues/41 in the url.
my test of captcha has two Internal Server Error,one for /test/,one for /test-modelform/.
and there is not any captcha directory except this one ?
could any one help me find a way to solve it ?
i am usint python 3.3 ,and i'd like django-simple-captcha reserved,which is really simple.
after hours checking codes and testing ,i found my programming is very poor ,i canot resolve this question ,and since i 'm a newby.
nearly tried all ways ,i solved it by this :
i copy his code to the newest django-simple-captcha's fields.py and reserves the classclass BaseCaptchaTextInput,
but the test in the captcha is not passed ,and i ignore it.
and i think my python's class has not well understand , and have to spend time on it to improve myself.
I've set up django-facebookconnect on my Django-based site, and it works great — login, posting to the user's News Feed, etc. — except for the fact that login fails in Firefox.
When you click the "Connect with Facebook" button, it pops up the window for the user to type in their Facebook login info like normal, but the original page, instead of sitting still, goes to an error page. And the window that pops up is blank
I've traced the problem to facebookconnect's views.py file. The facebook_login function, specifically. The following two lines of that function, even more specifically:
user = authenticate(request=request)
if user is None or not user.is_active:
# generate error message and send user to error page
I've checked, and it turns out that in Firefox, user is None. Clearing the browser's sessions/cookies/cache didn't help, and as I said, the problem doesn't occur in other browsers.
Is this a problem any of you have run into before? A vigorous googling hasn't revealed anything. I'd appreciate any guidance you can offer. Thanks.
Problem solved. For reasons I'm not clear on, moving the facebookconnect JS includes ({% facebook_js %} and {% initialize_facebook_connect %}) to just after the includes for jQuery and my own JS, instead of just before, fixed the problem.
For the record, and so that people might use Google to stumble upon this in the future, the error I'd been getting was "FB.HiddenContainer.get() is null or not an object".
In order to get it working in both Firefox and Chrome i had to keep it both in the header (for chrome) and as the last script on the site (for Firefox).
The error i was getting was:FB.HiddenContainer.get().
Although i keep getting it, it works :)
I had the same thing - driving me mad! Using protoype and scriptaculous from Google's jsapis. Thanks to your post I got it all working by changing my code to:
<script language="JavaScript1.2" type="text/javascript" src="http://www.google.com/jsapi"></script>
<script language="JavaScript1.2" type="text/javascript" >
//<![CDATA[
google.load( "prototype", "1" );
google.load( "scriptaculous", "1" );
//]]>
</script>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script language="JavaScript1.2" type="text/javascript">
//<![CDATA[
FB_RequireFeatures(['Api', 'Base', 'CanvasUtil', 'Common', 'Connect', 'XdComm', 'XFBML'], function()
....
I hope this helps others as much as your post helped me!