fix watch/unwatch buttons

This commit is contained in:
Lee Lawlor
2014-07-30 14:33:08 -04:00
parent 4dca3df391
commit 122696796b
9 changed files with 135 additions and 39 deletions

View File

@ -46,28 +46,23 @@
<script type="text/javascript">
$('#watch').click(function() {
$.update(
'/channels/<%= @channel.id %>/watch',
// data to send
{
flag: this.checked
},
// if post was successful
function (response) {
if ($("#watch").attr("checked")) {
$("#watchText").text("Un-watch");
}
else {
$("#watchText").text("Watch");
}
}
);
});
$('#watch').click(function() {
var checked = this.checked;
$.update(
'/channels/<%= @channel.id %>/watch',
{ flag: checked },
function (response) {
if (checked) {
$("#watchText").text("Un-watch");
} else {
$("#watchText").text("Watch");
}
}
);
});
$(function () {
$(document).on('page:load ready', function() {
$(".timeago").timeago();
if(document.location.hash!='') {

View File

@ -20,28 +20,26 @@
</div>
</div>
<script type="text/javascript">
$('#watch').click(function() {
$.update(
'/channels/<%= @channel.id %>/watch',
{
flag: this.checked
},
function (response) {
if ($("#watch").attr("checked")) {
$("#watchText").text("Un-watch");
}
else {
$("#watchText").text("Watch");
}
}
);
});
$('#watch').click(function() {
var checked = this.checked;
$.update(
'/channels/<%= @channel.id %>/watch',
{ flag: checked },
function (response) {
if (checked) {
$("#watchText").text("Un-watch");
} else {
$("#watchText").text("Watch");
}
}
);
});
$("#devInfoLink").click(function() {
$("#devInfo").dialog("open") ;
});
$(function () {
$(document).on('page:load ready', function() {
$("#devInfo").dialog({
autoOpen:false,
resizable:false,