github.com/marinho/drone@v0.2.1-0.20140504195434-d3ba962e89a7/pkg/template/pages/user_profile.html (about) 1 {{ define "title" }}{{.User.Name}} ยท Profile{{ end }} 2 3 {{ define "content" }} 4 5 <div class="subhead"> 6 <div class="container"> 7 <ul class="nav nav-tabs pull-right"> 8 <li><a href="/dashboard">Dashboard</a></li> 9 <li class="active"><a href="/account/user/profile">Settings</a></li> 10 </ul> <!-- ./nav --> 11 <h1 class="user"> 12 <img src="{{.User.Image}}"> 13 <span>{{.User.Name}}</span> 14 </h1> 15 </div><!-- ./container --> 16 </div><!-- ./subhead --> 17 18 19 <div class="container"> 20 <div class="row"> 21 22 <div class="col-xs-3"> 23 <ul class="nav nav-pills nav-stacked"> 24 <li class="active"><a href="/account/user/profile">Profile</a></li> 25 <li><a href="/account/user/password">Password</a></li> 26 <li><a href="/account/user/teams">Teams</a></li> 27 <li><a href="/account/user/delete">Delete</a></li> 28 </ul> 29 </div><!-- ./col-xs-3 --> 30 31 <div class="col-xs-9" role="main" style="padding-left:20px;"> 32 <div class="alert">Manage your account Profile.</div> 33 34 <div class="col-xs-5"> 35 <form action="/account/user/profile" method="POST" role="form"> 36 <label>Your Name:</label> 37 <div> 38 <input class="form-control" type="text" name="name" value="{{.User.Name}}" /> 39 </div> 40 <label>Your Email Address:</label> 41 <div> 42 <input class="form-control" type="text" name="email" value="{{.User.Email}}" /> 43 </div> 44 <div class="alert alert-success hide" id="successAlert"></div> 45 <div class="alert alert-error hide" id="failureAlert"></div> 46 <div class="form-actions"> 47 <input class="btn btn-primary" id="submitButton" type="submit" value="Save" data-loading-text="Saving .." /> 48 <a class="btn btn-default" href="/account/user/profile">Cancel</a> 49 </div> 50 </form> 51 </div> 52 <div class="col-xs-7"> 53 <a class="avatar-link" href="https://gravatar.com/" target="_blank"> 54 <img src="{{.User.ImageLarge}}" /> 55 <span>edit gravatar</span> 56 </a> 57 </div> 58 59 </div><!-- ./col-xs-9 --> 60 </div><!-- ./row --> 61 62 </div><!-- ./container --> 63 {{ end }} 64 65 {{ define "script" }} 66 <script> 67 document.forms[0].onsubmit = function(event) { 68 $("#successAlert").hide(); 69 $("#failureAlert").hide(); 70 $('#submitButton').button('loading'); 71 72 var form = event.target; 73 var formData = new FormData(form); 74 xhr = new XMLHttpRequest(); 75 xhr.open('POST', form.action); 76 xhr.onload = function() { 77 if (this.status == 200) { 78 $("#successAlert").text("Your profile information was successfully updated"); 79 $("#successAlert").show().removeClass("hide"); 80 $('#submitButton').button('reset'); 81 } else { 82 $("#failureAlert").text("Failed to update your profile information. " + this.response); 83 $("#failureAlert").show().removeClass("hide"); 84 $('#submitButton').button('reset'); 85 }; 86 }; 87 xhr.send(formData); 88 return false; 89 }; 90 91 $("#saveGeneral").on('click', function () { 92 var data = JSON.stringify({ 93 Name : $("#fullname").val(), 94 Email : $("#email").val() 95 }); 96 97 $.ajax({ 98 url: "/admin?action=profile", 99 context: document.body, 100 type: "PUT", 101 dataType: "json", 102 contentType: "application/json; charset=utf-8", 103 data: data, 104 success: function(data) { 105 $("#successGeneral").text("Your profile information was successfully updated"); 106 $("#successGeneral").show().removeClass("hide"); 107 $('#saveGeneral').button('reset') 108 }, 109 error: function(data) { 110 $("#failureGeneral").text("Failed to update your profile information. " + data.responseText); 111 $("#failureGeneral").show().removeClass("hide"); 112 $('#saveGeneral').button('reset') 113 } 114 }); 115 }); 116 117 $("#savePassword").on('click', function () { 118 $("#successPassword").hide(); 119 $("#failurePassword").hide(); 120 $('#savePassword').button('loading'); 121 122 var data = JSON.stringify({ 123 Password : $("#old_password").val(), 124 PasswordNew : $("#new_password").val() 125 }); 126 127 $.ajax({ 128 url: "/admin?action=password", 129 context: document.body, 130 type: "PUT", 131 dataType: "json", 132 contentType: "application/json; charset=utf-8", 133 data: data, 134 success: function(data) { 135 $("#successPassword").text("Your password was successfully updated"); 136 $("#successPassword").show().removeClass("hide"); 137 $('#savePassword').button('reset'); 138 }, 139 error: function(data) { 140 $("#failurePassword").text("Failed to update your password. " + data.responseText); 141 $("#failurePassword").show().removeClass("hide"); 142 $('#savePassword').button('reset'); 143 } 144 }); 145 }); 146 </script> 147 {{ end }}