2 /*******************************************************************************
3 * Copyright (c) 2012-2013 University of Stuttgart.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * and the Apache License 2.0 which both accompany this distribution,
7 * and are available at http://www.eclipse.org/legal/epl-v10.html
8 * and http://www.apache.org/licenses/LICENSE-2.0
11 * Oliver Kopp - initial API and implementation and/or initial documentation
12 * Yves Schubert - switch to bootstrap 3
13 *******************************************************************************/
15 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
17 <div class="modal fade" id="addStateDiag">
18 <div class="modal-dialog">
19 <div class="modal-content">
20 <div class="modal-header">
21 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
22 <h4 class="modal-title">Add State</h4>
24 <div class="modal-body">
25 <form id="addPropertyForm" enctype="multipart/form-data" method="post">
28 State: <input name="state" id="state" type="text" />
33 <div class="modal-footer">
34 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
35 <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="createState();">Add</button>
42 <button class="rightbutton btn btn-danger btn-xs" type="button" onclick="deleteOnServerAndInTable(propertiesTableInfo, 'InstanceState', 'instancestates/');">Remove</button>
43 <button class="rightbutton btn btn-primary btn-xs" type="button" onclick="$('#addStateDiag').modal('show');">Add</button>
45 <table cellpadding="0" cellspacing="0" border="0" class="display" id="propertiesTable">
52 <c:forEach var="t" items="${it.instanceStates}">
62 var propertiesTableInfo = {
63 id: '#propertiesTable'
66 require(["winery-support"], function(ws) {
67 ws.initTable(propertiesTableInfo);
70 function createState() {
72 url: "instancestates/",
75 data: $('#addPropertyForm').serialize(),
76 error: function(jqXHR, textStatus, errorThrown) {
77 vShowError("Could not add instancestate: " + errorThrown + "<br/>" + jqXHR.responseText);
79 success: function(data, textStatus, jqXHR) {
80 var dataToAdd = [$('#state').val()];
81 propertiesTableInfo.table.fnAddData(dataToAdd);
82 $('#addStateDiag').modal('hide');