Skip to content

Commit

Permalink
Add remove button to detail view.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalus committed Sep 17, 2016
1 parent 812edd0 commit 5d58356
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/main/resources/js/segrada.js
Expand Up @@ -314,6 +314,25 @@ function escapeHTML(myString) {
e.preventDefault();
});

$('.sg-control-confirm', part).click(function (e) {
var $this = $(this);

if (confirm($this.attr('data-confirm'))) {
var target = $('#' + $this.attr('data-target'));
target.addClass("sg-disabled");

// AJAX call
$.get($this.attr('href'), function (data) {
target.fadeOut('slow', function () {
target.remove(); // remove after finishing fading out
});
}).fail(function() {
alert("ERROR");
});
}
e.preventDefault();
});

// *******************************************************
// load tab contents dynamically
$('.sg-replace-content', part).on('shown.bs.tab', function (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/templates/color/index.html
Expand Up @@ -33,7 +33,7 @@ <h4 class="sg-control-header"><i class="fa fa-tint"></i> <span th:text="#{list.c
<div class="sg-data-icon-bar" role="group" aria-label="Actions" th:strip-whitespace="shallow">
<a class="sg-data-icon sg-data-add" href="#" th:title="#{Show}" th:href="@{/color/show/{uid}(uid=${entity.uid})}"><i class="fa fa-eye"></i></a>
<a th:if="${identity.hasEditAccess(entity, 'COLOR')}" class="sg-data-icon sg-data-add" href="#" th:title="#{Edit}" th:href="@{/color/edit/{uid}(uid=${entity.uid})}"><i class="fa fa-pencil"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, 'COLOR')}" class="sg-data-icon sg-control-confirm" href="#" th:title="#{Delete}" th:href="@{/color/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, 'COLOR')}" class="sg-data-icon" href="#" th:title="#{Delete}" th:href="@{/color/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
</div>
</td>
</tr>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/WEB-INF/templates/partials/common.html
Expand Up @@ -42,6 +42,7 @@ <h3>Common header box</h3>
<div th:fragment="headerboxright (type,base,entity,access)" class="sg-headbox-right">
<a href="#" type="button" class="close sg-data-close" aria-label="Close" th:title="#{Close}" th:attr="aria-label=#{Close}"><i class="fa fa-times"></i></a>
<a th:if="${identity.hasEditAccess(entity, access)}" href="#" th:href="@{/{base}/edit/{uid}(base=${base},uid=${entity.uid})}" type="button" class="sg-data-add sg-data-icon" aria-label="Edit" th:title="#{Edit}" th:attr="aria-label=#{Edit}"><i class="fa fa-pencil"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, access)}" class="sg-data-icon sg-control-confirm" href="#" th:title="#{Delete}" th:href="@{/{base}/delete/{uid}/0(base=${base},uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}, data-target=${base + '-' + entity.uid}"><i class="fa fa-times-circle-o"></i></a>
<a th:if="${graphUrl and identity.hasAccess('GRAPH')}" href="#" th:href="${graphUrl}" type="button" class="sg-graph-update sg-data-icon" aria-label="Graph" th:title="#{AddToGraph}" th:attr="aria-label=#{AddToGraph}"><i class="fa fa-share"></i></a>
<span class="sg-headbox-info" th:text="${type}">Type</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/templates/pictogram/index.html
Expand Up @@ -33,7 +33,7 @@ <h4 class="sg-control-header"><i class="fa fa-university"></i> <span th:text="#{
<div class="sg-data-icon-bar" role="group" aria-label="Actions" th:strip-whitespace="shallow">
<a class="sg-data-icon sg-data-add" href="#" th:title="#{Show}" th:href="@{/pictogram/show/{uid}(uid=${entity.uid})}"><i class="fa fa-eye"></i></a>
<a th:if="${identity.hasEditAccess(entity, 'PICTOGRAM')}" class="sg-data-icon sg-data-add" href="#" th:title="#{Edit}" th:href="@{/pictogram/edit/{uid}(uid=${entity.uid})}"><i class="fa fa-pencil"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, 'PICTOGRAM')}" class="sg-data-icon sg-control-confirm" href="#" th:title="#{Delete}" th:href="@{/pictogram/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, 'PICTOGRAM')}" class="sg-data-icon" href="#" th:title="#{Delete}" th:href="@{/pictogram/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/templates/user/index.html
Expand Up @@ -35,7 +35,7 @@ <h4 class="sg-control-header"><i class="fa fa-user"></i> <span th:text="#{list.u
<div class="sg-data-icon-bar" role="group" aria-label="Actions" th:strip-whitespace="shallow">
<a class="sg-data-icon sg-data-add" href="#" th:title="#{Show}" th:href="@{/user/show/{uid}(uid=${entity.uid})}"><i class="fa fa-eye"></i></a>
<a th:if="${identity.hasAccess('ADMIN')}" class="sg-data-icon sg-data-add" href="#" th:title="#{Edit}" th:href="@{/user/edit/{uid}(uid=${entity.uid})}"><i class="fa fa-pencil"></i></a>
<a th:if="${identity.hasAccess('ADMIN')}" class="sg-data-icon sg-control-confirm" href="#" th:title="#{Delete}" th:href="@{/user/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
<a th:if="${identity.hasAccess('ADMIN')}" class="sg-data-icon" href="#" th:title="#{Delete}" th:href="@{/user/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/templates/user_group/index.html
Expand Up @@ -33,7 +33,7 @@ <h4 class="sg-control-header"><i class="fa fa-users"></i> <span th:text="#{list.
<div class="sg-data-icon-bar" role="group" aria-label="Actions" th:strip-whitespace="shallow">
<a class="sg-data-icon sg-data-add" href="#" th:title="#{Show}" th:href="@{/user_group/show/{uid}(uid=${entity.uid})}"><i class="fa fa-eye"></i></a>
<a th:if="${identity.hasEditAccess(entity, 'ADMIN')}" class="sg-data-icon sg-data-add" href="#" th:title="#{Edit}" th:href="@{/user_group/edit/{uid}(uid=${entity.uid})}"><i class="fa fa-pencil"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, 'ADMIN')}" th:unless="${entity.special}" class="sg-data-icon sg-control-confirm" href="#" th:title="#{Delete}" th:href="@{/user_group/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
<a th:if="${identity.hasDeleteAccess(entity, 'ADMIN')}" th:unless="${entity.special}" class="sg-data-icon" href="#" th:title="#{Delete}" th:href="@{/user_group/delete/{uid}/0(uid=${entity.uid})}" th:attr="data-confirm=${#messages.msg('ReallyDelete', entity.title)}"><i class="fa fa-times-circle-o"></i></a>
</div>
</td>
</tr>
Expand Down

0 comments on commit 5d58356

Please sign in to comment.