AIRAVATA-2152 Implement remove button for CR picker
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/8f0cc363 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/8f0cc363 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/8f0cc363 Branch: refs/heads/develop Commit: 8f0cc3631e39f735228b1901ec860cca74ac9526 Parents: 9544427 Author: Marcus Christie <[email protected]> Authored: Thu Oct 20 16:00:02 2016 -0400 Committer: Marcus Christie <[email protected]> Committed: Fri Oct 28 15:04:31 2016 -0400 ---------------------------------------------------------------------- app/views/account/user-compute-resources.blade.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8f0cc363/app/views/account/user-compute-resources.blade.php ---------------------------------------------------------------------- diff --git a/app/views/account/user-compute-resources.blade.php b/app/views/account/user-compute-resources.blade.php index 4d451ba..4b9330a 100644 --- a/app/views/account/user-compute-resources.blade.php +++ b/app/views/account/user-compute-resources.blade.php @@ -31,6 +31,8 @@ button.add-user-cr { <button class="btn btn-default add-user-cr"> <span class="glyphicon glyphicon-plus"></span> Add a Compute Resource Account </button> + <div id="add-user-compute-resource-block-container"> + </div> <div class="panel-group" id="accordion"> @foreach( (array)$userResourceProfile->userComputeResourcePreferences as $indexUserCRP => $user_crp ) <div class="panel panel-default"> @@ -79,8 +81,7 @@ button.add-user-cr { <option value="{{ $cr->computeResourceId}}">{{ $cr->hostName }}</option> @endforeach </select> - <!-- TODO: implement the remove behavior --> - <span class="input-group-addon remove-cr" style="cursor:pointer;">x</span> + <span class="input-group-addon remove-user-cr" style="cursor:pointer;">x</span> </div> <div class="user-cr-pref-space form-horizontal"></div> </form> @@ -126,17 +127,20 @@ button.add-user-cr { $('.add-user-cr').on('click', function(){ - $(this).after( $(".add-user-compute-resource-block").html() ); + $('#add-user-compute-resource-block-container').append( $(".add-user-compute-resource-block").html() ); }); $(".remove-user-compute-resource").click( function(){ $(".remove-user-cr-name").html( $(this).data("cr-name") ); $(".remove-user-crId").val( $(this).data("cr-id") ); }); -$("body").on("change", "#user-cr-select", function(){ +$("#add-user-compute-resource-block-container").on("change", "#user-cr-select", function(){ crId = $(this).val(); //This is done as Jquery creates problems when using period(.) in id or class. crId = crId.replace(/\./g,"_"); - $(".user-cr-pref-space").html($("#cr-" + crId).html()); + $("#add-user-compute-resource-block-container .user-cr-pref-space").html($("#cr-" + crId).html()); +}); +$("#add-user-compute-resource-block-container").on("click", ".remove-user-cr", function(){ + $("#add-user-compute-resource-block-container").empty(); }); /* making datetimepicker work for reservation start and end date kept in user-compute-resource-preferences blade*/
