Last active
November 10, 2015 07:51
-
-
Save sakadon/a950106d19e21f5a9595 to your computer and use it in GitHub Desktop.
railsでriotjsをセットアップする+riotjsからjsonをとってくる(via jQuery.get) ref: http://qiita.com/sakadon/items/c6d291c1798e18b739a5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require riot | |
//= require riot_rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bundle install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'riot_js-rails' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fuck | |
javascript: | |
riot.mount('fuck', 'テスト' | |
dataRequest: $.get("http://api.randomuser.me/?results=3") | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
riot.tag('large_categories', '<h2>{opts.header}</h2> <ol> <li each="{list}"> {user.name.first} </li> </ol>', function(opts) { | |
var self = this; | |
this.list = []; | |
opts.dataRequest.done( function(data){ | |
self.list = data.results; | |
self.update(this.list) | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fuck> | |
<h2>{opts.header}<h2> | |
<ol> | |
<li each={list}> | |
{user.name.first} | |
</li> | |
</ol> | |
<script> | |
var self = this; | |
this.list = []; | |
opts.dataRequest.done( function(data){ | |
self.list = data.results; | |
self.update(this.list) | |
}) | |
</script> | |
</fuck> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment