PageRenderTime 24ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/JabbR/Views/Account/index.cshtml

https://bitbucket.org/v_jli/jean0306case1346
Razor | 166 lines | 163 code | 3 blank | 0 comment | 1 complexity | d92b341a2fbd032d3f46c3f123f75ffc MD5 | raw file
Possible License(s): MIT
  1. @using JabbR
  2. @using JabbR.ViewModels
  3. @model ProfilePageViewModel
  4. @{
  5. var userModel = Model;
  6. var gravatar = String.Format("https://secure.gravatar.com/avatar/{0}?s=48&d=mm", userModel.Hash);
  7. var passwordUrl = userModel.HasPassword ? Url.Content("~/account/changepassword") : Url.Content("~/account/newpassword");
  8. }
  9. <!DOCTYPE html>
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <title>JabbR</title>
  13. <link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" />
  14. <link href="@Url.Content("~/Chat.css")" rel="stylesheet" />
  15. </head>
  16. <body>
  17. <section id="page" role="application">
  18. <header id="heading" role="heading">
  19. <div class="banner" role="banner">
  20. <h1>Jabb</h1>
  21. <div class="jabbrLogo" id="logo"></div>
  22. <div>
  23. Powered by <a href="https://github.com/SignalR/SignalR" target="_blank">SignalR</a>
  24. </div>
  25. </div>
  26. <div style="clear: both"></div>
  27. </header>
  28. <div class="container">
  29. <div class="row" style="padding-top: 75px;">
  30. @Html.AlertMessages()
  31. <div class="span4 user-details-sidenav">
  32. <div class="user-details">
  33. <img class="gravatar" src="@gravatar" style="float: left;" />
  34. <div class="details">
  35. <span class="name">@userModel.Name</span>
  36. </div>
  37. </div>
  38. <ul id="accountmenu" class="nav nav-list">
  39. <li class="active"><a href="#profile" data-toggle="tab"><i class="icon-chevron-right"></i>Profile</a></li>
  40. <li><a href="#changeUsername" data-toggle="tab"><i class="icon-chevron-right"></i>Username</a></li>
  41. <li><a href="#changePassword" data-toggle="tab"><i class="icon-chevron-right"></i>Password</a></li>
  42. @if(userModel.SocialDetails.ConfiguredProviders.Any())
  43. {
  44. <li><a href="#identityProviders" data-toggle="tab"><i class="icon-chevron-right"></i>Identity Providers</a></li>
  45. }
  46. </ul>
  47. </div>
  48. <div class="span8 tab-content">
  49. <div class="account-details tab-pane active" id="profile">
  50. <div class="account-details-header">
  51. <h1>Profile</h1>
  52. </div>
  53. <div class="account-details-body">
  54. <form class="form-horizontal">
  55. <div class="control-group">
  56. <label class="control-label" for="note">Note</label>
  57. <div class="controls">
  58. <label class="control-label label-align-left">@(userModel.Note ?? "-")</label>
  59. </div>
  60. </div>
  61. <div class="control-group">
  62. <label class="control-label" for="country">Country</label>
  63. <div class="controls">
  64. <label class="control-label label-align-left">@(userModel.Country ?? "-") <span class="flag flag-@userModel.Flag"></span></label>
  65. </div>
  66. </div>
  67. </form>
  68. </div>
  69. </div>
  70. <div class="account-details tab-pane hide" id="changeUsername">
  71. <div class="account-details-header">
  72. <h1>Username</h1>
  73. </div>
  74. <div class="account-details-body">
  75. <form class="form-horizontal" action="@Url.Content("~/account/changeusername")#changeUsername" method="POST">
  76. @Html.ValidationSummary()
  77. <div class="control-group">
  78. <label class="control-label" for="username">Username</label>
  79. <div class="controls">
  80. @Html.TextBox("username", "input-xlarge", "Username")
  81. </div>
  82. </div>
  83. <div class="control-group">
  84. <label class="control-label" for="confirmUsername">Confirm Username</label>
  85. <div class="controls">
  86. @Html.TextBox("confirmUsername", "input-xlarge", "Confirm Username")
  87. </div>
  88. </div>
  89. <div class="control-group">
  90. <div class="controls">
  91. <input type="submit" class="btn" value="Change Username" />
  92. </div>
  93. </div>
  94. @Html.AntiForgeryToken()
  95. </form>
  96. </div>
  97. </div>
  98. <div class="account-details tab-pane hide" id="changePassword">
  99. <div class="account-details-header">
  100. <h1>Password</h1>
  101. </div>
  102. <div class="account-details-body">
  103. <form class="form-horizontal" action="@passwordUrl#changePassword" method="POST">
  104. @Html.ValidationSummary()
  105. @if(userModel.HasPassword)
  106. {
  107. <div class="control-group">
  108. <label class="control-label" for="oldPassword">Current Password</label>
  109. <div class="controls">
  110. @Html.Password("oldPassword", "input-xlarge", "Current Password")
  111. </div>
  112. </div>
  113. }
  114. <div class="control-group">
  115. <label class="control-label" for="password">Password</label>
  116. <div class="controls">
  117. @Html.Password("password", "input-xlarge", "Password")
  118. </div>
  119. </div>
  120. <div class="control-group">
  121. <label class="control-label" for="confirmPassword">Confirm Password</label>
  122. <div class="controls">
  123. @Html.Password("confirmPassword", "input-xlarge", "Confirm Password")
  124. </div>
  125. </div>
  126. <div class="control-group">
  127. <div class="controls">
  128. <input type="submit" class="btn" value="Change Password" />
  129. </div>
  130. </div>
  131. @Html.AntiForgeryToken()
  132. </form>
  133. </div>
  134. </div>
  135. <div class="account-details tab-pane hide" id="identityProviders">
  136. <div class="account-details-header">
  137. <h1>Identity Providers</h1>
  138. </div>
  139. <div class="account-details-body">
  140. @Html.Partial("_social", @userModel.SocialDetails)
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </section>
  147. <script src="@Url.Content("~/Scripts/jquery-1.9.0.min.js")"></script>
  148. <script src="@Url.Content("~/Scripts/bootstrap.min.js")"></script>
  149. <script type="text/javascript">
  150. (function ($) {
  151. // set the selected tab based on the hash
  152. var currentSection = document.location.hash || "#profile";
  153. $('a[href="'+currentSection+'"]').tab('show');
  154. // always set the hash when we change tabs
  155. $('a[data-toggle="tab"]').on('shown', function(e) {
  156. document.location.hash = e.target.hash;
  157. });
  158. // make sure errors look pretty and bootstrap-y
  159. $('input.error').closest('.control-group').addClass('error');
  160. }(jQuery));
  161. </script>
  162. </body>
  163. </html>