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 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. @model Teknik.Areas.Profile.ViewModels.ProfileViewModel
  2. <script>
  3. var editUserURL = '@Url.SubRouteUrl("profile", "Profile.Action", new { action = "Edit" })';
  4. var deleteUserURL = '@Url.SubRouteUrl("profile", "Profile.Action", new { action = "Delete" })';
  5. </script>
  6. @Scripts.Render("~/bundles/profile")
  7. @{
  8. bool OwnProfile = (Model.Username == User.Identity.Name);
  9. }
  10. <div class="container">
  11. @if (Model != null)
  12. {
  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> @Model.JoinDate.ToString("MMMM dd, yyyy")</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> @Model.LastSeen.ToString("MMMM dd, yyyy")</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. @if (!string.IsNullOrEmpty(Model.BlogTitle))
  27. {
  28. <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">@Model.BlogTitle</a></li>
  29. }
  30. <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>
  31. @if (OwnProfile)
  32. {
  33. <li class="list-group-item text-center"><button type="button" class="btn btn-danger" id="delete_account">Delete Account</button></li>
  34. }
  35. </ul>
  36. @if (!string.IsNullOrEmpty(Model.Website))
  37. {
  38. <div class="panel panel-default">
  39. <div class="panel-heading">Website <i class="fa fa-link fa-1x"></i></div>
  40. <div class="panel-body"><a href="@Model.Website" id="website">@Model.Website</a></div>
  41. </div>
  42. }
  43. @if (!string.IsNullOrEmpty(Model.Quote))
  44. {
  45. <div class="panel panel-default">
  46. <div class="panel-heading">Quote <i class="fa fa-quote-right fa-1x"></i></div>
  47. <div class="panel-body" id="quote">@Model.Quote</div>
  48. </div>
  49. }
  50. </div><!--/col-3-->
  51. <div class="col-sm-9">
  52. @if (!string.IsNullOrEmpty(Model.About) && OwnProfile)
  53. {
  54. <ul class="nav nav-tabs" id="myTab">
  55. @if (!string.IsNullOrEmpty(Model.About))
  56. {
  57. <li @((OwnProfile) ? string.Empty : "class=\"active\"")>
  58. <a href="#about" data-toggle="tab"> About Myself </a>
  59. </li>
  60. }
  61. @if (OwnProfile)
  62. {
  63. <li class="active"><a href="#settings" data-toggle="tab">Settings</a></li>
  64. <li><a href="#privacy" data-toggle="tab">Privacy</a></li>
  65. }
  66. </ul>
  67. }
  68. <div class="tab-content">
  69. @if (!string.IsNullOrEmpty(Model.About))
  70. {
  71. <div class="tab-pane @((!OwnProfile) ? " active" : string.Empty)" id="about">
  72. <script>
  73. $(document).ready(function () {
  74. var converter = new Markdown.getSanitizingConverter();
  75. @if (!string.IsNullOrEmpty(Model.BlogTitle))
  76. {
  77. <text>
  78. // Blog Title Conversion
  79. var old_html = $("#blog_title").text();
  80. var new_html = converter.makeHtml(old_html);
  81. $("#blog_title").html(new_html);
  82. </text>
  83. }
  84. @if (!string.IsNullOrEmpty(Model.Website))
  85. {
  86. <text>
  87. // Website Conversion
  88. var old_html = $("#website").text();
  89. var new_html = converter.makeHtml(old_html);
  90. $("#website").html(new_html);
  91. </text>
  92. }
  93. @if (!string.IsNullOrEmpty(Model.Quote))
  94. {
  95. <text>
  96. // Quote Conversion
  97. var old_html = $("#quote").text();
  98. var new_html = converter.makeHtml(old_html);
  99. $("#quote").html(new_html);
  100. </text>
  101. }
  102. @if (!string.IsNullOrEmpty(Model.About))
  103. {
  104. <text>
  105. // About Conversion
  106. var old_about = $("#markdown_body").text();
  107. var new_about = converter.makeHtml(old_about);
  108. $("#markdown_body").html(new_about);
  109. </text>
  110. }
  111. });
  112. </script>
  113. <div class="col-sm-12" id="markdown_body">@Model.About</div>
  114. </div><!--/tab-pane-->
  115. }
  116. @if (OwnProfile)
  117. {
  118. <div class="tab-pane active" id="settings">
  119. <form class="form" action="##" method="post" id="updateForm">
  120. <input name="update_userid" id="update_userid" type="hidden" value="@Model.UserID" />
  121. <!-- Profile Settings -->
  122. <div class="row">
  123. <div class="col-sm-12 text-center">
  124. <h3>Profile Settings</h3>
  125. </div>
  126. </div>
  127. <hr>
  128. <div class="row">
  129. <div class="form-group col-sm-4">
  130. <label for="update_password_current"><h4>Current Password</h4></label>
  131. <input class="form-control" name="update_password_current" id="update_password_current" placeholder="current password" title="enter your current password." type="password" />
  132. </div>
  133. <div class="form-group col-sm-4">
  134. <label for="update_password"><h4>New Password</h4></label>
  135. <input class="form-control" name="update_password" id="update_password" placeholder="new password" title="enter your password." type="password" />
  136. </div>
  137. <div class="form-group col-sm-4">
  138. <label for="update_password_confirm"><h4>Verify New Password</h4></label>
  139. <input class="form-control" name="update_password_confirm" id="update_password_confirm" placeholder="new password confirmed" title="enter your password again." type="password" />
  140. </div>
  141. </div>
  142. <div class="row">
  143. <div class="form-group col-sm-6">
  144. <label for="update_website"><h4>Website</h4></label>
  145. <input class="form-control" id="update_website" name="update_website" placeholder="http://www.noneofyourbusiness.com/" title="enter your website" type="text" value="@Model.Website" />
  146. </div>
  147. <div class="form-group col-sm-6">
  148. <label for="update_quote"><h4>Quote</h4></label>
  149. <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" />
  150. </div>
  151. </div>
  152. <div class="row">
  153. <div class="form-group col-sm-12">
  154. <label for="update_about"><h4>About Yourself</h4></label>
  155. <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>
  156. </div>
  157. </div>
  158. <!-- Blog Settings -->
  159. <div class="row">
  160. <div class="col-sm-12 text-center">
  161. <h3>Blog Settings</h3>
  162. </div>
  163. </div>
  164. <hr>
  165. <div class="row">
  166. <div class="form-group col-sm-6">
  167. <label for="update_blog_title"><h4>Title</h4></label>
  168. <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" />
  169. </div>
  170. <div class="form-group col-sm-6">
  171. <label for="update_blog_description"><h4>Description</h4></label>
  172. <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" />
  173. </div>
  174. </div>
  175. <div class="row">
  176. <div class="form-group col-sm-12">
  177. <br />
  178. <button class="btn btn-lg btn-success" id="update_submit" type="submit"><i class="glyphicon glyphicon-ok-sign"></i> Save</button>
  179. <button class="btn btn-lg" type="reset"><i class="glyphicon glyphicon-repeat"></i> Reset</button>
  180. </div>
  181. </div>
  182. </form>
  183. </div><!--/tab-pane-->
  184. <div class="tab-pane" id="privacy">
  185. <div class="row">
  186. <div class="col-sm-12 text-center">
  187. <iframe style="border: 0; width: 100%;" src="https://stats.teknik.io/index.php?module=CoreAdminHome&action=optOut&language=en"></iframe>
  188. </div>
  189. </div>
  190. </div>
  191. }
  192. </div><!--/tab-content-->
  193. </div><!--/col-9-->
  194. </div><!--/row-->
  195. }
  196. else
  197. {
  198. <div class="row">
  199. <div class="col-sm-12 text-center">
  200. <h2>Sorry, but I couldn't find that user.</h2>
  201. </div>
  202. </div>
  203. }
  204. </div>