-
Notifications
You must be signed in to change notification settings - Fork 0
/
hellopanels.html
139 lines (108 loc) · 3.41 KB
/
hellopanels.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Hello Panels</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/bootstrap-editable.css">
<script type='text/javascript' src='js/jquery-2.1.1.js'></script>
<script type='text/javascript' src="js/jquery.mockjax.js"></script>
<script type='text/javascript' src="js/bootstrap.js"></script>
<script type='text/javascript' src="js/bootstrap-editable.js"></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
var $template = $(".template");
var $task_template = $(".task-template");
$(".btn-add-panel").on("click", function () {
var $newPanel = $template.clone();
$("#accordion").append($newPanel.fadeIn());
// make all items having class 'edit' editable
// make all items having class 'edit' editable
$('.edit').editable({
type: 'text',
pk: 1,
url: '/post',
});
$newPanel.find(".btn-add-task").on("click", function(){
var $newTask = $task_template.clone();
var $parentDiv = this.parentNode;
var $div = $(this).prev();
$div.append($newTask.fadeIn());
$('.edit').editable({
type: 'text',
pk: 1,
url: '/post',
});
});
});
});
//]]>
</script>
<script type='text/javascript'>//<![CDATA[
$(function(){
// setting defaults for the editable
$.fn.editable.defaults.mode = 'inline';
$.fn.editable.defaults.showbuttons = true;
$.fn.editable.defaults.url = '/post';
$.fn.editable.defaults.type = 'text';
// make all items having class 'edit' editable
$('.edit').editable({
type: 'text',
pk: 1,
url: '/post',
name: 'panel'
});
//ajax emulation
$.mockjax({
url: '/post',
responseTime: 100,
response: function(settings) {
console.log('done!');
}
});
});//]]>
</script>
<style type='text/css'>
body {
padding: 10px;
}
.template {
display:none;
}
</style>
</head>
<body role="document">
Sprint #2 - Nov 19, 2014 - Dec 19, 2014
<div class="container theme-showcase" role="main">
<div class="panel-group" id="accordion">
<div class="col-sm-4 template">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title edit">Panel title</h3>
</div>
<div class="panel-body">
<div class="panel-group" id="tasks">
<div class="panel panel-success task-template">
<div class="panel-heading">
<h3 class="panel-title edit">Task title</h3>
</div>
<div class="panel-body edit">
Task content
</div>
</div>
</div>
<button type="button" class="btn btn-success btn-add-task">Add a task</button>
</div>
</div>
</div>
</div>
<br />
<button class="btn btn-lg btn-primary btn-add-panel"> <i class="glyphicon glyphicon-plus"></i> Add a panel</button>
</div>
</body></html>