The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Index.cshtml 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. @model Teknik.Areas.Profile.ViewModels.ProfileViewModel
  2. @using Teknik.Helpers
  3. <script>
  4. var homeUrl = '@Url.SubRouteUrl("www", "Home.Index")';
  5. var editUserURL = '@Url.SubRouteUrl("profile", "Profile.Action", new { action = "Edit" })';
  6. var deleteUserURL = '@Url.SubRouteUrl("profile", "Profile.Action", new { action = "Delete" })';
  7. </script>
  8. @Scripts.Render("~/bundles/profile")
  9. <div class="container">
  10. @if (!Model.Error)
  11. {
  12. bool OwnProfile = (Model.Username == User.Identity.Name || User.IsInRole("Admin"));
  13. <div class="row">
  14. <div class="col-sm-3@((string.IsNullOrEmpty(Model.About) && !OwnProfile) ? " col-sm-offset-4" : string.Empty)"><h1>@Model.Username</h1></div>
  15. </div>
  16. <div class="row">
  17. <div class="col-sm-3@((string.IsNullOrEmpty(Model.About) && !OwnProfile) ? " col-sm-offset-4" : string.Empty)"><!--left col-->
  18. <ul class="list-group">
  19. <li class="list-group-item text-muted">Profile</li>
  20. <li class="list-group-item text-right"><span class="pull-left"><strong>Joined</strong></span> <time datetime="@Model.LastSeen.ToString("o")">@Model.JoinDate.ToString("MMMM dd, yyyy")</time></li>
  21. @if (OwnProfile && User.Identity.IsAuthenticated)
  22. {
  23. <li class="list-group-item text-right"><span class="pull-left"><strong>Last Seen</strong></span> <time datetime="@Model.LastSeen.ToString("o")">@Model.LastSeen.ToString("MMMM dd, yyyy")</time></li>
  24. }
  25. <li class="list-group-item text-right"><span class="pull-left"><strong>Email</strong></span> <a href="mailto:@Model.Email">@Model.Email</a></li>
  26. <li class="list-group-item text-right"><span class="pull-left"><strong>Blog</strong></span> <a href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = Model.Username })" id="blog_title">@(string.IsNullOrEmpty(Model.BlogTitle) ? string.Format("{0}'s Blog", Model.Username) : Model.BlogTitle)</a></li>
  27. <li class="list-group-item text-right"><span class="pull-left"><strong>Git</strong></span> <a href="@Url.SubRouteUrl("git", "Git.Index", new { username = Model.Username })">Public Repos</a></li>
  28. @if (OwnProfile)
  29. {
  30. <li class="list-group-item text-center"><button type="button" class="btn btn-danger" id="delete_account">Delete Account</button></li>
  31. }
  32. </ul>
  33. @if (!string.IsNullOrEmpty(Model.Website))
  34. {
  35. <div class="panel panel-default">
  36. <div class="panel-heading">Website <i class="fa fa-link fa-1x"></i></div>
  37. <div class="panel-body"><a href="@Model.Website" id="website">@Model.Website</a></div>
  38. </div>
  39. }
  40. @if (!string.IsNullOrEmpty(Model.Quote))
  41. {
  42. <div class="panel panel-default">
  43. <div class="panel-heading">Quote <i class="fa fa-quote-right fa-1x"></i></div>
  44. <div class="panel-body" id="quote">@Model.Quote</div>
  45. </div>
  46. }
  47. </div><!--/col-3-->
  48. <div class="col-sm-9">
  49. @if (!string.IsNullOrEmpty(Model.About) && OwnProfile)
  50. {
  51. <ul class="nav nav-tabs" id="myTab">
  52. @if (!string.IsNullOrEmpty(Model.About))
  53. {
  54. <li @((OwnProfile) ? string.Empty : "class=\"active\"")>
  55. <a href="#about" data-toggle="tab"> About Myself </a>
  56. </li>
  57. }
  58. @if (OwnProfile)
  59. {
  60. <li class="active"><a href="#settings" data-toggle="tab">Settings</a></li>
  61. <li><a href="#privacy" data-toggle="tab">Privacy</a></li>
  62. }
  63. </ul>
  64. }
  65. <div class="tab-content">
  66. @if (!string.IsNullOrEmpty(Model.About))
  67. {
  68. <div class="tab-pane @((!OwnProfile) ? " active" : string.Empty)" id="about">
  69. <div class="col-sm-12" id="markdown_body">@Html.Markdown(@Model.About)</div>
  70. </div><!--/tab-pane-->
  71. }
  72. @if (OwnProfile)
  73. {
  74. <div class="tab-pane active" id="settings">
  75. <form class="form" action="##" method="post" id="updateForm">
  76. <input name="update_userid" id="update_userid" type="hidden" value="@Model.UserID" />
  77. <!-- Profile Settings -->
  78. <div class="row">
  79. <div class="col-sm-12 text-center">
  80. <h3>Profile Settings</h3>
  81. </div>
  82. </div>
  83. <hr>
  84. <div class="row">
  85. <div class="form-group col-sm-4">
  86. <label for="update_password_current"><h4>Current Password</h4></label>
  87. <input class="form-control" name="update_password_current" id="update_password_current" placeholder="current password" title="enter your current password." type="password" />
  88. </div>
  89. <div class="form-group col-sm-4">
  90. <label for="update_password"><h4>New Password</h4></label>
  91. <input class="form-control" name="update_password" id="update_password" placeholder="new password" title="enter your password." type="password" />
  92. </div>
  93. <div class="form-group col-sm-4">
  94. <label for="update_password_confirm"><h4>Verify New Password</h4></label>
  95. <input class="form-control" name="update_password_confirm" id="update_password_confirm" placeholder="new password confirmed" title="enter your password again." type="password" />
  96. </div>
  97. </div>
  98. <div class="row">
  99. <div class="form-group col-sm-6">
  100. <label for="update_website"><h4>Website</h4></label>
  101. <input class="form-control" id="update_website" name="update_website" placeholder="http://www.noneofyourbusiness.com/" title="enter your website" type="text" value="@Model.Website" />
  102. </div>
  103. <div class="form-group col-sm-6">
  104. <label for="update_quote"><h4>Quote</h4></label>
  105. <input class="form-control" id="update_quote" name="update_quote" placeholder="I have a dream!" title="enter a memorable quote" type="text" value="@Model.Quote" maxlength="140" />
  106. </div>
  107. </div>
  108. <div class="row">
  109. <div class="form-group col-sm-12">
  110. <label for="update_about"><h4>About Yourself</h4></label>
  111. <textarea class="form-control" name="update_about" id="update_about" placeholder="I'm awesome" title="enter any information you want to share with the world." data-provide="markdown" rows="10">@Model.About</textarea>
  112. </div>
  113. </div>
  114. <!-- Blog Settings -->
  115. <div class="row">
  116. <div class="col-sm-12 text-center">
  117. <h3>Blog Settings</h3>
  118. </div>
  119. </div>
  120. <hr>
  121. <div class="row">
  122. <div class="form-group col-sm-6">
  123. <label for="update_blog_title"><h4>Title</h4></label>
  124. <input class="form-control" id="update_blog_title" name="update_blog_title" placeholder="click bait" title="enter your blog's title" type="text" value="@Model.BlogTitle" />
  125. </div>
  126. <div class="form-group col-sm-6">
  127. <label for="update_blog_description"><h4>Description</h4></label>
  128. <input class="form-control" id="update_blog_description" name="update_blog_description" placeholder="This blog is not worth reading." title="enter your blog's description" type="text" value="@Model.BlogDescription" />
  129. </div>
  130. </div>
  131. <div class="row">
  132. <div class="form-group col-sm-12">
  133. <br />
  134. <button class="btn btn-lg btn-success" id="update_submit" type="submit"><i class="glyphicon glyphicon-ok-sign"></i> Save</button>
  135. <button class="btn btn-lg" type="reset"><i class="glyphicon glyphicon-repeat"></i> Reset</button>
  136. </div>
  137. </div>
  138. <!-- Upload Settings -->
  139. <!-- Paste Settings -->
  140. </form>
  141. </div><!--/tab-pane-->
  142. <div class="tab-pane" id="privacy">
  143. <div class="row">
  144. <div class="col-sm-12 text-center">
  145. <!-- Privacy Settings Here -->
  146. </div>
  147. </div>
  148. </div>
  149. }
  150. </div><!--/tab-content-->
  151. </div><!--/col-9-->
  152. </div><!--/row-->
  153. }
  154. else
  155. {
  156. <div class="row">
  157. <div class="col-sm-12 text-center">
  158. <h2>Sorry, but I couldn't find that user.</h2>
  159. </div>
  160. </div>
  161. }
  162. </div>