RailsCasts Pro episodes are now free!

Learn more or hide this

Kaz Walker's Profile

GitHub User: KazW

Site: www.printtopeer.com

Comments by Kaz Walker

Avatar

I couldn't get the following to work:

javascript
$('document').on 'click', '.edit_task input[type=checkbox]', ->
    $(this).parent('form').submit()

I had to use:

javascript
$('document').on 'click', 'input[type=checkbox].edit_task', ->
    $(this).parent('form').submit()

This was on jQuery 2.1.4 with Firefox 17.0.1 and Chrome 24.0.1312.52-beta on Linux.

Avatar

Thanks for the great screencast, but I'm not sure why you write off StartSSL as "isn't for serious use". StartSSL uses all the same algorithms as the bigger providers and even uses better ones in certain cases (eg. connections will default to 256-bit instead of the usual 128-bit), plus they enforce better security practices than most providers (eg. you must use an SSL client certificate to login, there's no username/password).

To top it off, the free certificates are even insured for up to $10,000 in damages, with paid ones providing more insurance.

Thanks again for the very useful screencast, but you should do a bit more research before saying something "isn't for serious use", as your opinion carries much weight for many individuals. :-)

Avatar

Yep... https://github.com/leonkenneth/jquery-tokeninput-bootstrap-theme

I think it was built for an older version of bootstrap, I had to set the appropriate widths to 200px for it to look just right. My issues could also be simple_form related, so I'm not sure.

Avatar

In order for this to work you have to use the following syntax:

javascript
$("#article_project_tokens").tokenInput($("#article_project_tokens").data("token-source"), {
  prePopulate: $("#article_project_tokens").data("pre"),
  preventDuplicates: true
});

Not sure why this is the case. The preventDuplicates option is just to show for extra options that a comma is needed (but it is super useful).

Avatar

Great episode, but shouldn't the token source be based on a path or url function like this?

javascript
$("#article_co_author_tokens").tokenInput $("#article_co_author_tokens").data("token-source")
  prePopulate: $("#article_co_author_tokens").data("pre")
ruby
f.input :co_author_tokens, label: false, input_html: {data: {token_source: search_usernames_path, pre: @article.co_authors.only(:id,:username).map(&:attributes).to_json}}

Please note this is from a project that uses Mongoid and SimpleForm.

Avatar

I used your previous snippet and modified it, This should help you out.

$("#article_project_tokens").tokenInput($("#article_project_tokens").data("token-source"), {
crossDomain: false,
prePopulate: $("#article_project_tokens").data("pre"),
theme: "piplanet",
preventDuplicates: true,
tokenLimit: 10,
queryParam: "query",
minChars: 4,
hintText: "Start typing a project's name..."
});

<%= f.input :project_tokens, label: false, input_html: {data: {token_source: search_project_names_path, pre: @article.projects.only(:id,:name).map(&:attributes).to_json}} %>

You'll probably have to change this, it was written in an app that uses Mongoid.