Resources for the TIY-Durham Rails course.
Students should be comfortable with the following at the end of this week:
Challenge: Helpers
Starting Point: Tabula Railsa
config.action_controller.action_on_unpermitted_parameters = :raise
node
var
keyworddo..end
vs {}
else if
==
vs ===
1 == "1"
[1, 2, 3] === [1, 2, 3]
… sighvar
lines, or a++
)function sayHi() { alert("Hi"); }
[1, 2, 3].forEach(function (number) { console.log(number * number); });
document.getElementById()
document.getElementsByClassName()
.value
or .value = "default"
.style.color
or .style.color = "blue"
application.js
alert()
on every pageconsole.log()
on every pageonclick=
attributes in HTML tagsapplication.js
.lastElementChild
- it’s sometimes tough to know what’s a function and what’s just a value!.cloneNode(true)
.appendChild(copy)
<script>
tags to run the JavaScript when the page loads.Challenge: Session
javascript:void(0)
addEventListener()
this
event.target
or passing this
as a parameter to an onclick
function.$("selector")
$(event.target)
.attr()
- one or two params.css()
- one or two params.prop()
- for disabled and checked.val()
- zero or one param.closest()
- closest ancestor.filter()
- further refine a selection.find()
- any descendants that match.submit()
- submit a form.children().last().clone()
.append(copied_thing)
$(function())
- this removes the need to have <style>
tags in your HTML.$(...).on("click", function(){...}
- this removes the need for onclick
attributes in our HTML tags.Challenge: Discuss Git Messes
git reset
git rebase
git filter-branch
data-
attributesremote: true
on links and forms.js.erb
files as responses to AJAX callsrender @quote
(if @quote
contains one Quote instance) uses _quote.html.erb
render @quotes
(if @quotes
contains an array of Quote instances) uses _quote.html.erb
many times$.ajax()
$.getScript()