bootstrapify delete dialog

This commit is contained in:
MinRK 2013-06-11 11:14:10 -07:00
parent d1416665dc
commit b2d9b9beb8
4 changed files with 24 additions and 33 deletions

View File

@ -1411,9 +1411,7 @@ ul.icons-ul{list-style-type:none;text-indent:-0.7142857142857143em;margin-left:2
.list_container>div:last-child{border:none;}
.list_item:hover .list_item{background-color:#ddd;}
.list_container>div>span,.list_container>div>div{padding:8px;}
.cluster_list_item>a{}
.notebook_item a{text-decoration:none;}
.action_col{}
.list_item a{text-decoration:none;}
input.nbname_input{height:15px;}
.highlight_text{color:blue;}
#project_name>.breadcrumb{padding:0px;margin-bottom:0px;background-color:transparent;font-weight:bold;}

View File

@ -213,7 +213,7 @@ var IPython = (function (IPython) {
NotebookList.prototype.add_delete_button = function (item) {
var new_buttons = $('<span/>').addClass("btn-group pull-right");
var notebooklist = this;
var delete_button = $("<button/>").text("Delete").addClass("btn btn-mini").
var delete_button = $("<button/>").text("Delete").addClass("btn btn-mini btn-danger").
click(function (e) {
// $(this) is the button that was clicked.
var that = $(this);
@ -222,31 +222,28 @@ var IPython = (function (IPython) {
var parent_item = that.parents('div.list_item');
var nbname = parent_item.data('nbname');
var notebook_id = parent_item.data('notebook_id');
var dialog = $('<div/>');
dialog.html('Are you sure you want to permanently delete the notebook: ' + nbname + '?');
parent_item.append(dialog);
dialog.dialog({
resizable: false,
modal: true,
title: "Delete notebook",
var message = 'Are you sure you want to permanently delete the notebook: ' + nbname + '?';
IPython.dialog.modal({
title : "Delete notebook",
body : message,
buttons : {
"Delete": function () {
var settings = {
processData : false,
cache : false,
type : "DELETE",
dataType : "json",
success : function (data, status, xhr) {
parent_item.remove();
}
};
var url = notebooklist.baseProjectUrl() + 'notebooks/' + notebook_id;
$.ajax(url, settings);
$(this).dialog('close');
Delete : {
class: "btn-danger",
click: function() {
var settings = {
processData : false,
cache : false,
type : "DELETE",
dataType : "json",
success : function (data, status, xhr) {
parent_item.remove();
}
};
var url = notebooklist.baseProjectUrl() + 'notebooks/' + notebook_id;
$.ajax(url, settings);
}
},
"Cancel": function () {
$(this).dialog('close');
}
Cancel : {}
}
});
return false;

View File

@ -60,11 +60,7 @@
}
.cluster_list_item > a {
/* color: @textColor !important;*/
}
.notebook_item a {
.list_item a {
text-decoration: none;
}
@ -78,7 +74,6 @@
}
.action_col {
/* text-align: right;*/
}
input.nbname_input {

View File

@ -85,6 +85,7 @@ data-read-only={{read_only}}
{% block script %}
{{super()}}
<script src="{{static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("tree/js/notebooklist.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("tree/js/clusterlist.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("tree/js/main.js") }}" type="text/javascript" charset="utf-8"></script>