Fix the delete function so the album tree is updated if an album is deleted. Also delete reference to an undefined variable.
This commit is contained in:
parent
b16d60916f
commit
f0308bf695
@ -203,7 +203,6 @@ class G3Remote {
|
||||
$response = json_decode($response_body);
|
||||
if ($response->status == "OK") {
|
||||
$this->_access_token = $response->token;
|
||||
$this->_identity = $identity;
|
||||
} else {
|
||||
throw new Exception("Remote host failure: {$response->message}");
|
||||
}
|
||||
@ -246,7 +245,6 @@ class G3Remote {
|
||||
public function delete_resource($path) {
|
||||
$request = "{$this->_config["gallery3_site"]}/$path";
|
||||
$headers["X_GALLERY_REQUEST_METHOD"] = "DELETE";
|
||||
Kohana_Log::add("error", "access_token: " . $this->_access_token);
|
||||
if (!empty($this->_access_token)) {
|
||||
$headers["X_GALLERY_REQUEST_KEY"] = $this->_access_token;
|
||||
}
|
||||
@ -262,5 +260,4 @@ class G3Remote {
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
}
|
@ -219,6 +219,14 @@
|
||||
if (data.result == "success") {
|
||||
$("#g-dialog").dialog('close');
|
||||
get_detail(data.path, _set_active_album);
|
||||
if (dialog == "delete_album") {
|
||||
var parent = $("#album_tree li[ref=" + resource_path + "]").parents("li:first");
|
||||
$.get("/g3_client/index.php/g3_client/albums",
|
||||
{path: $(parent).attr("ref")},
|
||||
function(data, textStatus) {
|
||||
$(parent).replaceWith(data);
|
||||
});
|
||||
}
|
||||
} else if (data.result == "fail") {
|
||||
$("#g-dialog").dialog('close');
|
||||
alert(data.message);
|
||||
|
Reference in New Issue
Block a user