view-page.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <!DOCTYPE html>
  2. <html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/layout}">
  3. <head>
  4. <title>View Page</title>
  5. <link rel="stylesheet" href="/node_modules/blueimp-gallery/css/blueimp-gallery.css" />
  6. <!-- <link rel="stylesheet" href="url(/libs/highlightjs/9.15.10/styles/monokai-sublime.css" /> -->
  7. <link rel="stylesheet" href="/src/css/view-page.css" />
  8. <script src="/node_modules/blueimp-gallery/js/blueimp-gallery.js"></script>
  9. <script src="/src/js/view-page.js" defer></script>
  10. <meta th:if="${preview != null && preview == false}" property="og:title" th:content="${previewTitle}">
  11. <meta th:if="${preview != null && preview == false}" property="og:description" th:content="${previewDescription}">
  12. <meta th:if="${preview != null && preview == false}" property="og:url" th:content="${previewUrl}">
  13. <meta th:if="${preview != null && preview == false}" property="og:image" th:content="${previewImage}">
  14. </head>
  15. <body>
  16. <div layout:fragment="content">
  17. <input type="hidden" id="userId" th:value="${user == null ? '' : user.id}" />
  18. <input type="hidden" id="pageId" th:value="${pageId}" />
  19. <input type="hidden" id="pageState" th:value="${pageState}" />
  20. <input type="hidden" id="preview" th:value="${preview}" />
  21. <div class="ui active dimmer" id="pageLoader">
  22. <div class="ui text blue elastic loader">Loading</div>
  23. </div>
  24. <div id="app" v-if="page.details != null">
  25. <div :style="getBackgroundImageStyle()">
  26. <br />
  27. <div class="ui container">
  28. <div class="ui yellow raised padded circular segment" v-if="preview">
  29. <h2>Live Preview</h2>
  30. <p>
  31. This is a preview of your store page and is a visual representation of how the page will look on the store. This page is not visible to
  32. the public. All areas marked in <span style="color: red;">red</span> <b>must be present</b> before your page will be considered for
  33. approval.
  34. </p>
  35. </div>
  36. <br />
  37. <div class="ui stackable grid">
  38. <div class="row">
  39. <div class="ten wide column">
  40. <!-- Screenshots and Youtube Videos -->
  41. <div id="gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel blueimp-gallery-controls">
  42. <div class="slides"></div>
  43. <h3 class="title"></h3>
  44. <a class="prev">‹</a>
  45. <a class="next">›</a>
  46. <a class="play-pause"></a>
  47. <ol class="indicator"></ol>
  48. </div>
  49. <div id="carousel-links">
  50. <a v-if="getArrayLength(page.mediaLinks.imageIds) > 0 && page.mediaLinks.imageIds.split(',').length > 0" v-for="imgId in page.mediaLinks.imageIds.split(',')" :href="'/image/' + imgId">
  51. </a>
  52. <a v-if="getArrayLength(page.mediaLinks.videoIds) > 0 && page.mediaLinks.videoIds.split(',').length > 0" v-for="vidId in page.mediaLinks.videoIds.split(',')" :data-youtube="vidId" :href="'https://www.youtube.com/watch/' + vidId"
  53. type="text/html"></a>
  54. </div>
  55. <span v-if="getArrayLength(page.mediaLinks.imageIds) === 0" style="color: red;">At least one image is required.</span>
  56. <!-- END Screenshots and Youtube Videos -->
  57. <br />
  58. <div class="ui divider"></div>
  59. <!-- Short Description -->
  60. <p v-if="page.details.shortDescription.length > 0">{{ page.details.shortDescription }}</p>
  61. <p style="color: red;" v-if="page.details.shortDescription.length == 0">No short description specified.</p>
  62. <!-- END: Short Description -->
  63. <div class="ui divider"></div>
  64. <!-- Gradle Partial Script -->
  65. <div v-if="(page.softwareType == 'OpenSource' || page.softwareType == 'Sponsored')">
  66. <div v-if="getArrayLength(page.buildData.hostedDependencies) > 0">
  67. <h4 class="ui header">Add this software to your project</h4>
  68. <div v-if="">
  69. <div style="background:#222; color: #ccc; border-radius: 5px; padding: 10px;">
  70. <code>
  71. repositories {
  72. <div v-for="(repository, index) in page.buildData.repositories.split(',')">
  73. <span>&nbsp;&nbsp;&nbsp;&nbsp;{{ repository }}</span>
  74. </div>
  75. }
  76. <br /><br />
  77. dependencies {<br />
  78. <div v-for="dependency in page.buildData.hostedDependencies.split(',')">
  79. <span>&nbsp;&nbsp;&nbsp;&nbsp;{{ dependency.replace("$VERSION", page.versionData.version) }}</span>
  80. </div>
  81. }
  82. </code>
  83. </div>
  84. <div class="ui divider"></div>
  85. </div>
  86. <div v-if="pageData.dependsOn.length > 0" v-for="storePage in pageData.dependsOn">
  87. Depends on:
  88. <span class="tooltip" data-title="Internal Store Page" data-content="This link is safe to click.">
  89. <a :href="'/' + storePage.id"><i class="green store icon"></i>
  90. {{ storePage.details.title }}
  91. </a>
  92. </span>
  93. <div class="ui divider"></div>
  94. </div>
  95. </div>
  96. <div v-else>
  97. <p>
  98. This software is not available on any hosted repository service.
  99. To use this software you must build it from
  100. <a :href="page.openSourceData.gitRepository" target="_blank">source</a>.
  101. </p>
  102. </div>
  103. </div>
  104. <!-- END: Gradle Partial Script -->
  105. <!-- Description: Markdown Rendered -->
  106. <p>
  107. <div id="page-content-div"></div>
  108. </p>
  109. <p style="color: red;" v-if="page.details.description.length == 0">
  110. No Description Specified.
  111. </p>
  112. <!-- END: Description: Markdown Rendered -->
  113. <br />
  114. <div class="ui divider"></div>
  115. <!-- Forks of the parent repository -->
  116. <div v-if="pageData.forks.length > 0">
  117. <h4>Other Software Forking This Repository</h4>
  118. <div class="ui horizontal list">
  119. <div class="item" v-for="fork in pageData.forks">
  120. <img class="ui avatar image" :src="'/image/' + fork.owner.avatarId" />
  121. <div class="content">
  122. <div class="header">
  123. <a :href="'/' + fork.id">{{ fork.details.title }}</a>
  124. </div>
  125. by {{ fork.owner.username }}
  126. </div>
  127. </div>
  128. </div>
  129. <div class="ui divider"></div>
  130. </div>
  131. <div v-else>
  132. There are no forks of this repository listed on the store.
  133. </div>
  134. <!-- END: Forks of the parent repository -->
  135. <div class="ui divider"></div>
  136. <!-- Pages that depend on this page -->
  137. <div v-if="pageData.addons.length > 0">
  138. <h2>Projects Using This Software</h2>
  139. <div class="ui horizontal list">
  140. <div class="item" v-for="addon in pageData.addons">
  141. <img class="ui avatar image" :src="'/image/' + addon.owner.avatarId" />
  142. <div class="content">
  143. <div class="header">
  144. <a :href="'/' + addon.id">{{ addon.details.title }}</a>
  145. </div>
  146. by {{ addon.owner.username }}
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <div v-else>
  152. There are no projects listed on the store that use this software.
  153. </div>
  154. <!-- END: Pages that depend on this page -->
  155. </div>
  156. <div class="six wide column">
  157. <!-- Title -->
  158. <h2 class="ui dividing header">
  159. <a class="tooltip" v-if="page.softwareType == 'Opensource' && page.openSourceData.isFork" :href="page.openSourceData.forkRepository" target="_blank" data-content="This project is a fork of an existing project.">
  160. <i class="random icon"></i>
  161. </a>
  162. <span>{{ page.details.title }}</span>
  163. </h2>
  164. <!-- END Title -->
  165. <table class="ui very basic compact table">
  166. <tr>
  167. <td class="collapsing">
  168. <!-- Author -->
  169. <a :href="'/user/profile/' + page.owner.id">
  170. <img class="ui avatar image" :src="'/image/' + page.owner.avatarId" />
  171. <span>{{ page.owner.username }}</span>
  172. </a>
  173. <!-- END Author -->
  174. </td>
  175. <td class="right aligned">
  176. <!-- Rating -->
  177. <span v-if="preview"><i>Not available in preview</i></span>
  178. <span v-if="!preview" class="ui star rating tiny disabled tooltip" id="assetStarRating" :data-content="page.rating.ratingCount + ' reviews'">
  179. <i class="star icon" :class="page.rating.averageRating >= 1 ? 'yellow' : 'black'"></i>
  180. <i class="star icon" :class="page.rating.averageRating >= 2 ? 'yellow' : 'black'"></i>
  181. <i class="star icon" :class="page.rating.averageRating >= 3 ? 'yellow' : 'black'"></i>
  182. <i class="star icon" :class="page.rating.averageRating >= 4 ? 'yellow' : 'black'"></i>
  183. <i class="star icon" :class="page.rating.averageRating >= 5 ? 'yellow' : 'black'"></i>
  184. </span>
  185. <span v-if="!preview">{{ page.rating.averageRating.toFixed(1) }}</span>
  186. |
  187. {{ reviewData.length }} Reviews
  188. <!-- END: Rating -->
  189. </td>
  190. </tr>
  191. </table>
  192. <div class="ui divider"></div>
  193. <table class="ui very basic compact table">
  194. <tr>
  195. <td>Created</td>
  196. <td class="right aligned">
  197. {{ millisToDate(page.dateCreated) }}
  198. </td>
  199. </tr>
  200. <tr v-if="page.dateCreated !==page.dateUpdated">
  201. <td>Last updated</td>
  202. <td class="right aligned">
  203. {{ millisToDate(page.dateUpdated) }}
  204. </td>
  205. </tr>
  206. <tr>
  207. <td>
  208. Latest Version
  209. </td>
  210. <td class="right aligned">
  211. {{ page.versionData.version }}
  212. </td>
  213. </tr>
  214. <tr>
  215. <td>Release State</td>
  216. <td class="right aligned">
  217. <div class="ui label" :class="page.versionData.state == 'Release' ? 'green' : 'grey'">
  218. {{ page.versionData.state }}
  219. </div>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td>Engine Compatibility</td>
  224. <td class="right aligned">
  225. <span v-if="page.versionData.engineCompatibility.length > 0">{{ page.versionData.engineCompatibility }}</span>
  226. <span v-else>3.1 and above</span>
  227. </td>
  228. </tr>
  229. <tr v-if="page.externalLinks.publisherWebsite != null && page.externalLinks.publisherWebsite.length > 0">
  230. <td><i class="external alternate icon"></i>Publisher Website</td>
  231. <td class="right aligned">
  232. <a :href="page.externalLinks.publisherWebsite" target="_blank"><i class="external alternate icon"></i>Visit Publisher</a>
  233. </td>
  234. </tr>
  235. <tr v-if="page.externalLinks.docsWebsite != null && page.externalLinks.docsWebsite.length > 0">
  236. <td><i class="book icon"></i>Documentation</td>
  237. <td class="right aligned">
  238. <a :href="page.externalLinks.docsWebsite" target="_blank"><i class="book icon"></i>Documentation</a>
  239. </td>
  240. </tr>
  241. <tr>
  242. <td><i class="code branch icon"></i>Git Repository</td>
  243. <td class="right aligned">
  244. <a v-if="(page.softwareType == 'OpenSource' || page.softwareType == 'Sponsored') && page.openSourceData.gitRepository.length > 0" :href="page.openSourceData.gitRepository" target="_blank" id="viewOnGithubButton"><i
  245. class="github icon"></i>View on Github</a>
  246. <span v-if="(page.softwareType == 'OpenSource' || page.softwareType == 'Sponsored') && page.openSourceData.gitRepository.length == 0" class="ui red label tag-item"><i class="github icon"></i>No Git Repository</span>
  247. </td>
  248. </tr>
  249. <tr v-if="page.externalLinks.hubLink != null && page.externalLinks.hubLink.length > 0">
  250. <td><i class="external alternate icon"></i>Community Hub Thread</td>
  251. <td class="right aligned">
  252. <a :href="page.externalLinks.hubLink" target="_blank">View Hub Thread</a>
  253. </td>
  254. </tr>
  255. </table>
  256. <div class="ui divider"></div>
  257. <!-- Software Type and Licenses -->
  258. <div v-if="page.softwareType == 'OpenSource' || page.softwareType == 'Sponsored'">
  259. <p>This software is <b><span class="ui green text">Open Source</span></b> under the following licenses:</p>
  260. <div class="ui segments">
  261. <div class="ui inverted segment">
  262. <i class="code icon"></i><b><span class="ui yellow text">Source Code:</span></b>
  263. <span v-if="page.openSourceData.softwareLicense">{{ page.openSourceData.softwareLicense.name }}</span>
  264. <span v-else style="color: red;">No software license selected.</span>
  265. </div>
  266. <div class="ui segment">
  267. <p v-if="page.openSourceData.softwareLicense">
  268. {{ page.openSourceData.softwareLicense.desc }}
  269. </p>
  270. <p v-else style="color: red;">
  271. No software license selected.
  272. </p>
  273. </div>
  274. </div>
  275. <div class="ui segments">
  276. <div class="ui inverted segment">
  277. <i class="photo video icon"></i><b><span class="ui yellow text">Media:</span></b>
  278. <span v-if="page.openSourceData.mediaLicense">{{ page.openSourceData.mediaLicense.name }}</span>
  279. <span v-else style="color: red;">No media license selected.</span>
  280. </div>
  281. <div class="ui segment">
  282. <p v-if="page.openSourceData.mediaLicense">
  283. {{ page.openSourceData.mediaLicense.desc }}
  284. </p>
  285. <p v-else style="color: red;">
  286. No media license selected.
  287. </p>
  288. </div>
  289. </div>
  290. <p>
  291. <small><b>This is not legal advice. Always consult a professional.</b></small>
  292. </p>
  293. </div>
  294. <div class="ui pink segment" v-if="page.softwareType == 'Paid'">
  295. <p>In order to use this software you must purchase a copy.</p>
  296. </div>
  297. <div class="ui segment" v-if="page.softwareType == 'Sponsored'">
  298. <p>
  299. This software is <span class="ui yellow text">completely free</span>, however if you wish to
  300. <span class="ui pink text">sponsor the author</span> you may make a one-time payment to them using the button below. Sponsoring is
  301. completely optional, but is a great way give your thanks and encourage them to continue development!
  302. </p>
  303. </div>
  304. <div class="ui segment" v-if="page.softwareType == 'Sponsored' || page.softwareType == 'Paid'">
  305. <p>
  306. <!-- Price / Buy Button -->
  307. <button class="ui pink button">
  308. <span v-if="page.softwareType == 'Sponsored'">Optional:</span>
  309. <span v-if="page.softwareType == 'Paid'">Purchase:</span>
  310. &nbsp;&nbsp;$<span>{{ page.paymentData.price.toFixed(2) }}</span>
  311. </button>
  312. <!-- END: Price / Buy Button -->
  313. </p>
  314. </div>
  315. <!-- END: Software Type and Licenses -->
  316. <div class="ui divider"></div>
  317. <!-- Tags -->
  318. <h3 class="ui header">Related Keywords</h3>
  319. <div class="ui black labels" v-if="page.details.tags.length > 0">
  320. <a class="ui label" :href="'/search/?tag=' + encodeURI(tag)" v-for="tag in page.details.tags.split(',')">
  321. {{ tag }}
  322. </a>
  323. </div>
  324. <span v-if="page.details.tags.length == 0" class="ui label">No Tags Specified</span>
  325. <!-- END Tags -->
  326. </div>
  327. </div>
  328. </div>
  329. <div class="ui divider"></div>
  330. <!-- REVIEWS / COMMENTS -->
  331. <div>
  332. <div class="ui comments" style="max-width: 100% !important;" v-if="preview == false">
  333. <h2 class="ui header">
  334. Reviews
  335. <button class="ui green button right floated tooltip" v-if="userId.length > 0" id="writeReviewButton" :disabled="userId == page.owner.id" @click="showWriteReviewModal()">
  336. <i class="pencil alternate icon"></i>Write Review
  337. </button>
  338. </h2>
  339. <div class="ui info message" v-if="userId == page.owner.id">
  340. You cannot review software on pages that belong to you.
  341. </div>
  342. <div class="ui warning message" v-if="userId == null">
  343. You must be logged in to write a review.
  344. </div>
  345. <div class="ui message" th:if="${user != null}" v-if="reviewData.length == 0">
  346. There are no reviews yet. Be the first!
  347. </div>
  348. <div class="comment" v-for="(review, index) in reviewData">
  349. <a class="ui circular image avatar">
  350. <img v-bind:src="'/image/' + review.user.avatarId" />
  351. </a>
  352. <div class="content">
  353. <a class="author">{{ review.user.name == null ? review.user.username : review.user.name }}</a>
  354. <div class="metadata">
  355. <span v-if="review.dateCreated === review.dateUpdated" class="date">{{ millisToDate(review.dateCreated) }}</span>
  356. <span v-else class="date">(edited) {{ millisToDate(review.dateUpdated) }}</span>
  357. <button v-on:click="editReview(index)" id="editReviewButton" class="ui black mini icon button tooltip" :data="index" v-if="userId == review.user.id" data-content="Edit your review">
  358. <i class="edit outline icon"></i>
  359. </button>
  360. <button v-on:click="deleteReview(index)" id="deleteReviewButton" class="ui red mini icon button tooltip" :data="index" v-if="userId == review.user.id" data-content="Permanently delete your review">
  361. <i class="trash alternate outline icon"></i>
  362. </button>
  363. </div>
  364. <div class="text">
  365. <div class="ui star rating small disabled">
  366. <i class="yellow star icon" v-for="index in review.rating"></i>
  367. <i class="black star icon" v-for="index in (5 - review.rating)"></i>
  368. </div>
  369. <p style="white-space: pre-line;">
  370. {{ review.content }}
  371. </p>
  372. </div>
  373. </div>
  374. </div>
  375. <!-- Write Review Modal -->
  376. <div class="ui modal" id="writeReviewModal">
  377. <div class="header">
  378. Write A Review
  379. </div>
  380. <div class="content">
  381. <div class="ui form">
  382. <input type="hidden" :value="pageId" name="pageId" />
  383. <div class="field">
  384. <label>Please leave a rating!</label>
  385. <input type="hidden" value="" id="reviewRatingVal" />
  386. <div class="ui yellow star rating" id="reviewRating"></div>
  387. </div>
  388. <div class="field">
  389. <label>Review</label>
  390. <textarea rows="5" id="newReviewContent"></textarea>
  391. </div>
  392. </div>
  393. </div>
  394. <div class="actions">
  395. <button class="ui green ok button">
  396. Submit Review
  397. </button>
  398. <button class="ui red cancel button">
  399. Cancel
  400. </button>
  401. </div>
  402. </div>
  403. <!-- Delete Review Modal -->
  404. <div class="ui modal" id="deleteReviewModal">
  405. <div class="header">
  406. Write A Review
  407. </div>
  408. <div class="content"><b>Warning:</b> This action cannot be un-done. Are you sure you wish to delete your review?<br /></div>
  409. <div class="actions">
  410. <button class="ui green ok button">
  411. Yes, Delete My Review
  412. </button>
  413. <button class="ui red cancel button">
  414. Cancel
  415. </button>
  416. </div>
  417. </div>
  418. <!-- Edit Review modal -->
  419. <div class="ui modal" id="editReviewModal">
  420. <div class="header">
  421. Edit Your Review
  422. </div>
  423. <div class="content">
  424. <div class="ui form">
  425. <input type="hidden" :value="pageId" name="pageId" />
  426. <div class="field">
  427. <label>Please leave a rating!</label>
  428. <input type="hidden" value="" id="edit_reviewRatingVal" />
  429. <div class="ui yellow star rating" id="edit_reviewRating"></div>
  430. </div>
  431. <div class="field">
  432. <label>Review</label>
  433. <textarea rows="5" id="edit_newReviewContent"></textarea>
  434. </div>
  435. </div>
  436. </div>
  437. <div class="actions">
  438. <button class="ui green ok button">
  439. Submit Review
  440. </button>
  441. <button class="ui red cancel button">
  442. Cancel
  443. </button>
  444. </div>
  445. </div>
  446. </div>
  447. </div>
  448. </div>
  449. <br /><br />
  450. </div> <!-- END background DIV -->
  451. </div> <!-- END App -->
  452. </div> <!-- END Fragment Content -->
  453. </body>
  454. </html>