More Related Content
Javascript and jQuery for Mobile jQuery - Javascript para quem não sabe Javascript Modernizerを用いたHTML5Webサイトの構築 Palestra sobre MongoDB com PHP no PHP'n'Rio Drupal 8. Movement towards. Susikov Sergey Crea un tema compatibile con le ultime novità WordPress What's hot (20)
jQuery - Write less, do more! Domótica. Test de conocimientos How to Win the Heart of CSS Boys Peek inside the fantastical Ukrainian Village home and studio of artists Jare... Viewers also liked (9)
Japanese zeke presentation Japanese zeke presentation Hannah Reilly Foundation Portfolio Evaluation PowerPoint 우주 배경 복사와 우주 거대 구조 ICON 2010 3D 게임에서 색차 방식의 3D 입체 영상 구현하기 JS for Rails developers
- 7. # view
<%= form_for Comment.new, :remote => true do |form| %>
# controller
def create
@comment = @post.comments.create(params[:commnet])
end
# create.js.erb
$('comments.new').before('<%=j render @comment %>');
$('comments.new').val('');
- 11. <a href="#" onclick="alert('Hello world!'); return false;">
Click Here
</a>
<script type="text/javascript"charset="UTF-8">
$(function () {
$('#alert').click(function () {
alert(this.data('message'));
return false;
})
});
</script>
<a href="#" id="alert" data-message="Hello from UJS">Click Here</a>
- 16. <a href="#" id="alert" data-message="Hello from UJS">
Click Here
</a>
<a href="/posts/8" data-confirm="Are you sure?" data-method="delete">
Destroy
</a>
- 17. <a href="#" id="alert" data-message="Hello from UJS">
Click Here
</a>
<a href="/posts/8" data-confirm="Are you sure?" data-method="delete">
Destroy
</a>
<form action="/products" data-remote="true" method="get">
- 18. <% content_for :head do %>
<%= javascript_include_tag 'my_super_plugin' %>
<script type="text/javascript" charset="UTF-8">
$(document).ready(function() {
$('form[data-autosubmit=true]').autoSubmit();
})
</script>
<% end %>
<%= yield :head %>
- 21. <%= div_for(@person, :class => "foo") %>
<div id="person_123" class="person foo">
<%= content_tag_for(:li, @person) do %>
<li id="person_123" class="person">
- 22. <%= div_for(@person, :class => "foo") %>
<div id="person_123" class="person foo">
<%= content_tag_for(:li, @person) do %>
<li id="person_123" class="person">
dom_id(Post.find(45)) # => "post_45"
dom_id(Post.new) # => "new_post"
dom_id(Post.find(45), :edit) # => "edit_post_45"
dom_class(post) # => "post"
dom_class(Person) # => "person"
- 24. var js = {
namespace1: {
function1: function() {
alert('Call me!');
}
}
}
- 28. JQuery UI Plugin
• опции по умолчанию
• приватные и публичные методы
• конструктор и деструктор
- 32. $(document).ready ->
$('form[data-autosubmit=true]').autoSubmit()
js =
namespace:
test: ->
alert 'test'
js.namespace.test();
- 33. $(document).ready ->
$('form[data-autosubmit=true]').autoSubmit()
js =
namespace:
test: ->
alert 'test'
js.namespace.test();
$('comments.new').before '<%=j render @comment %>'
$('comments.new').val ''
- 35. //= require jquery
//= require my_super_plugin
# my_super_plugin
//= require validation
//= require defaults