You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/06/11 20:25:36 UTC

[07/12] airavata-php-gateway git commit: AIRAVATA-2316 Add ability to delete phone numbers

AIRAVATA-2316 Add ability to delete phone numbers


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/ab980d46
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/ab980d46
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/ab980d46

Branch: refs/heads/keycloak-integration
Commit: ab980d4685a8c89fe0218dbd0f2639489652a4b7
Parents: 310ea4c
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Feb 24 10:04:23 2017 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Feb 24 10:04:23 2017 -0500

----------------------------------------------------------------------
 app/views/account/user-profile.blade.php               | 13 +++++--------
 .../partials/user-profile-phone-template.blade.php     |  9 +++++++++
 2 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ab980d46/app/views/account/user-profile.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/user-profile.blade.php b/app/views/account/user-profile.blade.php
index e9ebeea..86690c4 100644
--- a/app/views/account/user-profile.blade.php
+++ b/app/views/account/user-profile.blade.php
@@ -47,13 +47,10 @@
                         value="{{{ $userProfile->country }}}"/>
             </div>
         </div>
-        {{-- TODO: need to add delete as well --}}
         <div class="form-group">
             <label class="control-label">Phone Numbers</label>
             @foreach ($userProfile->phones as $phone)
-            <input class="form-control" name="phones[]"
-                    placeholder="Phone number" type="text"
-                    value="{{{ $phone }}}"/>
+                @include('partials/user-profile-phone-template', array('phone' => $phone))
             @endforeach
             <button id="add-phone-button" class="btn btn-default" type="button">Add Phone</button>
         </div>
@@ -64,8 +61,7 @@
 </div>
 
 <div id="new-phone-template" class="hidden">
-    <input class="form-control" name="phones[]"
-            placeholder="Phone number" type="text" />
+    @include('partials/user-profile-phone-template', array('phone' => ''))
 </div>
 
 @stop
@@ -76,8 +72,9 @@
 
     $('#add-phone-button').click(function(e){
         $(this).before($('#new-phone-template').html());
-        e.preventDefault();
-        return false;
+    });
+    $(document).on('click', '.delete-phone-button', function(e){
+        $(this).closest('.input-group').remove();
     });
 </script>
 @stop

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ab980d46/app/views/partials/user-profile-phone-template.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/user-profile-phone-template.blade.php b/app/views/partials/user-profile-phone-template.blade.php
new file mode 100644
index 0000000..6843f57
--- /dev/null
+++ b/app/views/partials/user-profile-phone-template.blade.php
@@ -0,0 +1,9 @@
+
+<div class="input-group">
+    <input class="form-control" name="phones[]"
+        placeholder="Phone number" type="text"
+        value="{{{ $phone or '' }}}" />
+    <span class="input-group-btn">
+        <button class="btn btn-default delete-phone-button" type="button">Delete</button>
+    </span>
+</div>