fixed #953
This commit is contained in:
parent
21b5f7932f
commit
95de299e6e
2 changed files with 22 additions and 15 deletions
|
|
@ -137,8 +137,6 @@ class AspectsController < ApplicationController
|
||||||
else
|
else
|
||||||
flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name
|
flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_with @aspect
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_contact_visibility
|
def toggle_contact_visibility
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ var AspectEdit = {
|
||||||
|
|
||||||
$("#manage_aspect_zones").find(".delete").live("click", AspectEdit.deletePerson);
|
$("#manage_aspect_zones").find(".delete").live("click", AspectEdit.deletePerson);
|
||||||
$(".aspect h3").live('focus', AspectEdit.changeName);
|
$(".aspect h3").live('focus', AspectEdit.changeName);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
startDrag: function() {
|
startDrag: function() {
|
||||||
|
|
@ -116,27 +117,35 @@ var AspectEdit = {
|
||||||
id = $this.closest(".aspect").attr("data-guid"),
|
id = $this.closest(".aspect").attr("data-guid"),
|
||||||
link = "/aspects/" + id;
|
link = "/aspects/" + id;
|
||||||
|
|
||||||
|
//cleanup
|
||||||
|
$this.text($.trim($this.text()));
|
||||||
|
|
||||||
$this.keyup(function() {
|
$this.keypress(function(e) {
|
||||||
if (e.which == 13) {
|
if (e.which == 13) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$this.blur();
|
$this.blur();
|
||||||
|
|
||||||
//save changes
|
|
||||||
$.ajax({
|
|
||||||
type: "PUT",
|
|
||||||
url: link,
|
|
||||||
data: {
|
|
||||||
"aspect": {
|
|
||||||
"name" : $this.text()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//length limit
|
||||||
|
if ($this.text().length >= 20) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
//update all other aspect links
|
//update all other aspect links
|
||||||
$("#aspect_nav li[data-guid='" + id + "'] a").text($this.text());
|
$("#aspect_nav li[data-guid='" + id + "'] a").text($this.text());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this.blur(function() {
|
||||||
|
//save changes
|
||||||
|
$.ajax({
|
||||||
|
type: "PUT",
|
||||||
|
url: link,
|
||||||
|
data: {
|
||||||
|
"aspect": {
|
||||||
|
"name" : $this.text()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deletePerson: function() {
|
deletePerson: function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue