The next generation of the Teknik Services. Written in ASP.NET. Fork for blog tags.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

PasteItem.cshtml 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. @model Teknik.Areas.Vault.ViewModels.PasteItemViewModel
  2. @using Teknik.Utilities
  3. @using Teknik.Pygments
  4. @{
  5. // Transform content into HTML
  6. if (!Highlighter.Lexers.ToList().Exists(l => l.Aliases.Contains(Model.Paste.Syntax)))
  7. {
  8. Model.Paste.Syntax = "text";
  9. }
  10. Highlighter highlighter = new Highlighter();
  11. // Add a space in front of the content due to bug with pygment (No idea why yet)
  12. Model.Paste.Content = highlighter.HighlightToHtml(" " + Model.Paste.Content, Model.Paste.Syntax, Model.Config.PasteConfig.SyntaxVisualStyle, generateInlineStyles: true, fragment: true);
  13. }
  14. <div class="panel panel-default">
  15. <div class="panel-heading">
  16. <div class="row">
  17. <div class="col-sm-10 text-left">
  18. <h4><b>@((string.IsNullOrEmpty(Model.Title)) ? "Paste" : Model.Title)</b> <small>Pasted on <time datetime="@Model.Paste.DatePosted.ToString("s")">@Model.Paste.DatePosted.ToString("dddd, MMMM d, yyyy") at @Model.Paste.DatePosted.ToString("h:mm:ss tt")</time> - Format: <b id="syntaxLanguage">@Model.Paste.Syntax</b></small></h4>
  19. </div>
  20. <div class="col-sm-2 text-right">
  21. <h4><small><a href="@Url.SubRouteUrl("p", "Paste.View", new { url = Model.Paste.Url })" target="_blank">Direct Link</a></small></h4>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="panel-body">
  26. <div class="row">
  27. <div class="col-sm-12 pull-left">
  28. <div class="btn-group" role="group">
  29. <a role="button" class="btn btn-default" href="@Url.SubRouteUrl("p", "Paste.Simple", new { url = Model.Paste.Url })" target="_blank">Simple</a>
  30. <a role="button" class="btn btn-default" href="@Url.SubRouteUrl("p", "Paste.Raw", new { url = Model.Paste.Url })" target="_blank">Raw</a>
  31. <a role="button" class="btn btn-default" href="@Url.SubRouteUrl("p", "Paste.Download", new { url = Model.Paste.Url })">Download</a>
  32. </div>
  33. </div>
  34. </div>
  35. <br />
  36. <div class="row paste-item">
  37. <div class="col-sm-12 paste-content hideContent">
  38. @if (!string.IsNullOrEmpty(Model.Paste.HashedPassword))
  39. {
  40. <p class="text-center">Password Required</p>
  41. }
  42. else
  43. {
  44. @Html.Raw(Model.Paste.Content)
  45. }
  46. </div>
  47. <div class="show-more">
  48. <button class="btn btn-default btn-sm" id="show-more-button">Show More</button>
  49. </div>
  50. </div>
  51. </div>
  52. @if (!string.IsNullOrEmpty(Model.Description))
  53. {
  54. <div class="panel-footer">
  55. <p>@Model.Description</p>
  56. </div>
  57. }
  58. </div>