urls.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. {{define "urls.html" -}}
  2. {{template "header.html" . -}}
  3. {{template "sidebar.html" . -}}
  4. <div class="pusher">
  5. {{template "admin-left-menu.html" . -}}
  6. {{template "admin-top-menu.html" . -}}
  7. <div id="admin-right-content" class="ui basic segment">
  8. <div class="ui grid stackable padded">
  9. <div class="column">
  10. <table class="ui celled striped table">
  11. <thead>
  12. <tr>
  13. <th colspan="3">
  14. <form id="form-search-url" action="/admin/urls" method="get">
  15. <div class="ui labeled action input">
  16. <div class="ui label">{{.prefix}}</div>
  17. <input name="url" type="text" value="{{.url}}" placeholder="短链接">
  18. </div>
  19. <button class="ui teal right labeled icon button" type="submit"><i class="search icon"></i>查询</button>
  20. <a class="ui teal right labeled icon button" href="/admin/urls"><i class="undo alternate icon"></i>重置</a>
  21. </form>
  22. </th>
  23. <th colspan="7"><button id="btn-new-shorturl-modal" class="ui primary button">新建短链接</button></th>
  24. </tr>
  25. <tr>
  26. <th>短链接</th>
  27. <th class="center aligned collapsing">生成时间</th>
  28. <th>备注信息</th>
  29. <th>打开方式</th>
  30. <th class="center aligned collapsing">是否有效</th>
  31. <th class="center aligned">目标链接</th>
  32. <th class="center aligned">操作</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. {{range .shortUrls}}
  37. <tr {{if not .Valid}}class="negative"{{end}}>
  38. <td class="collapsing"><a href="{{$.prefix}}{{.ShortUrl}}" target="_blank">{{.ShortUrl}}</a></td>
  39. <td class="center aligned collapsing">{{.CreatedAt | date "2006-01-02 15:04:05"}}</td>
  40. <td>{{.Memo.String}}</td>
  41. <td>
  42. {{if eq 0 .OpenType}}
  43. 不限制
  44. {{else if eq 1 .OpenType}}
  45. 微信内打开
  46. {{else if eq 2 .OpenType}}
  47. 钉钉内打开
  48. {{else if eq 3 .OpenType}}
  49. iPhone 打开
  50. {{else if eq 4 .OpenType}}
  51. Android 打开
  52. {{else if eq 5 .OpenType}}
  53. iPad 打开
  54. {{else if eq 6 .OpenType}}
  55. Safari 浏览器
  56. {{else if eq 7 .OpenType}}
  57. Chrome 浏览器
  58. {{else if eq 8 .OpenType}}
  59. Firefox 浏览器
  60. {{else}}
  61. 不确定
  62. {{end}}
  63. </td>
  64. <td class="center aligned">{{.Valid}}</td>
  65. <td class="center aligned collapsing"><a href="{{.DestUrl}}" target="_blank">打开链接</a></td>
  66. <td class="center aligned">
  67. {{if .Valid}}
  68. <a href="javascript:enable_url('{{.ShortUrl}}',false)">禁用</a>
  69. {{else}}
  70. <a href="javascript:enable_url('{{.ShortUrl}}',true)">开启</a>
  71. {{end}}
  72. | <a href="javascript:copy_url('{{$.prefix}}{{.ShortUrl}}')">复制</a>
  73. | <a href="javascript:delete_url('{{.ShortUrl}}')">删除</a>
  74. | <a href="/admin/stats?url={{.ShortUrl}}" target="_blank">统计数据</a></td>
  75. </tr>
  76. {{end}}
  77. </tbody>
  78. <tfoot>
  79. <tr>
  80. <th colspan="10" class="center aligned">
  81. {{if not .first_page}}
  82. <a class="ui small labeled icon button" href="/admin/urls?url={{.url}}&page={{sub .page 1}}"><i class="arrow alternate circle left outline icon"></i>上一页</a>
  83. {{end}}
  84. {{if not .last_page}}
  85. <a class="ui small labeled icon button" href="/admin/urls?url={{.url}}&page={{add .page 1}}"><i class="arrow alternate circle right outline icon"></i>下一页</a>
  86. {{end}}
  87. </th>
  88. </tr>
  89. </tfoot>
  90. </table>
  91. </div>
  92. </div><!--end fo grid-->
  93. </div><!--end of segment-->
  94. </div><!--end of pusher-->
  95. <div id="new-shorturl-modal" class="ui modal">
  96. <i class="close icon"></i>
  97. <div class="header">新建短链接</div>
  98. <div class="content">
  99. <div class="description">
  100. <div class="ui form">
  101. <div class="field">
  102. <label>目标链接</label>
  103. <textarea id="input_dest_url" name="dest_url" rows="1"></textarea>
  104. </div>
  105. <div class="field">
  106. <label>打开方式</label>
  107. <select id="input_open_type" name="open_type" class="ui search dropdown" name="open_type">
  108. <option value="0">不限制</option>
  109. <option value="1">微信内打开</option>
  110. <option value="2">钉钉内打开</option>
  111. <option value="3">iPhone 打开</option>
  112. <option value="4">Android 打开</option>
  113. <option value="5">iPad 打开</option>
  114. <option value="6">Safari 浏览器</option>
  115. <option value="7">Chrome 浏览器</option>
  116. <option value="8">Firefox 浏览器</option>
  117. </select>
  118. </div>
  119. <div class="field">
  120. <label>备注</label>
  121. <textarea id="input_demo" name="memo" rows="2"></textarea>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="actions">
  127. <div class="ui black deny button">
  128. 放弃
  129. </div>
  130. <div id="btn-gen-short-url" class="ui primary right labeled icon button">
  131. 确认新建
  132. <i class="checkmark icon"></i>
  133. </div>
  134. </div>
  135. </div>
  136. {{end -}}