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

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