Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 50d7eafe

Přidáno uživatelem Tomáš Šimandl před více než 6 roky(ů)

Added remove confirmation dialog

Zobrazit rozdíly:

sources/src/main/webapp/uploadFiles.jsp
53 53
						<c:forEach items="${diagramsPrivate}" var="diagram">
54 54
							<li>
55 55
								<a href="${HOME_URL}graph?diagramId=${diagram.id}">${diagram.name}</a>
56
								<button class="removeDiagramButton" data-id="${diagram.id}"><img src="images/button_cancel.png" alt="odstranit"></a>
56
								<button class="removeDiagramButton" data-name="${diagram.name}" data-id="${diagram.id}"><img src="images/button_cancel.png" alt="odstranit"></button>
57 57
							</li>
58 58
						</c:forEach>
59 59
					</ul>
......
75 75

  
76 76
		<script>
77 77
			$('.removeDiagramButton').click(function(e) {
78
				$.ajax({
79
					'type': 'delete',
80
					'url': 'api/remove-diagram?diagram_id=' + $(this).data('id'),
81
					'success': function() {
82
						location.reload(true);
83
					},
84
					'error': function(xhr) {
85
						switch (xhr.status) {
86
							case 401:
87
								alert('You are either not logged in or not an owner of this diagram.');
88
								break;
89
							default:
90
								alert('Something went wrong.');
91
						}
92
					},
93
				});
78

  
79
			    if(confirm('Are you want to delete ' + $(this).data('name') + '?')) {
80
                    $.ajax({
81
                        'type': 'delete',
82
                        'url': 'api/remove-diagram?diagram_id=' + $(this).data('id'),
83
                        'success': function () {
84
                            location.reload(true);
85
                        },
86
                        'error': function (xhr) {
87
                            switch (xhr.status) {
88
                                case 401:
89
                                    alert('You are either not logged in or not an owner of this diagram.');
90
                                    break;
91
                                default:
92
                                    alert('Something went wrong.');
93
                            }
94
                        },
95
                    });
96
                }
94 97
			});
95 98
		</script>
96 99
	</body>

Také k dispozici: Unified diff