-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ cooked }}
+
+
diff --git a/src/main/frontend/src/entrypoints/create-version.js b/src/main/frontend/src/entrypoints/create-version.js
index 9d66abd73..734b9170a 100644
--- a/src/main/frontend/src/entrypoints/create-version.js
+++ b/src/main/frontend/src/entrypoints/create-version.js
@@ -1,9 +1,13 @@
import { createApp } from 'vue';
import CreateVersion from '@/CreateVersion';
+import { setupI18n } from '@/plugins/i18n';
+const i18n = setupI18n();
createApp(CreateVersion, {
pendingVersion: window.PENDING_VERSION,
ownerName: window.OWNER_NAME,
projectSlug: window.PROJECT_SLUG,
forumSync: window.FORUM_SYNC,
-}).mount('#create-version');
+})
+ .use(i18n)
+ .mount('#create-version');
diff --git a/src/main/frontend/src/entrypoints/project-view.js b/src/main/frontend/src/entrypoints/project-view.js
new file mode 100644
index 000000000..08e579e9e
--- /dev/null
+++ b/src/main/frontend/src/entrypoints/project-view.js
@@ -0,0 +1,6 @@
+import { createApp } from 'vue';
+import ProjectView from '@/ProjectView';
+import { setupI18n } from '@/plugins/i18n';
+
+const i18n = setupI18n();
+createApp(ProjectView).use(i18n).mount('#project-view');
diff --git a/src/main/frontend/src/entrypoints/version-view.js b/src/main/frontend/src/entrypoints/version-view.js
new file mode 100644
index 000000000..903407837
--- /dev/null
+++ b/src/main/frontend/src/entrypoints/version-view.js
@@ -0,0 +1,6 @@
+import { createApp } from 'vue';
+import { setupI18n } from '@/plugins/i18n';
+import VersionView from '@/VersionView';
+
+const i18n = setupI18n();
+createApp(VersionView).use(i18n).mount('#version-view');
diff --git a/src/main/frontend/src/js/channelManage.js b/src/main/frontend/src/js/channelManage.js
deleted file mode 100644
index cbe3f34aa..000000000
--- a/src/main/frontend/src/js/channelManage.js
+++ /dev/null
@@ -1,175 +0,0 @@
-import $ from 'jquery';
-import 'bootstrap/js/dist/popover';
-
-//=====> EXTERNAL CONSTANTS
-
-var PROJECT_OWNER = window.PROJECT_OWNER;
-var PROJECT_SLUG = window.PROJECT_SLUG;
-const DEFAULT_HEX = window.DEFAULT_HEX;
-const CHANNEL_CREATE_ROUTE = window.CHANNEL_CREATE_ROUTE;
-
-//=====> HELPER FUNCTIONS
-
-function rgbToHex(rgb) {
- var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
- delete parts[0];
- for (var i = 1; i <= 3; ++i) {
- parts[i] = parseInt(parts[i]).toString(16);
- if (parts[i].length === 1) {
- parts[i] = '0' + parts[i];
- }
- }
- return '#' + parts.join('');
-}
-
-function getModal() {
- return $('#channel-settings');
-}
-
-export function initChannelDelete(toggle, channelName, versionCount) {
- $(toggle).off('click');
- $(toggle).click(function () {
- var url = '/' + PROJECT_OWNER + '/' + PROJECT_SLUG + '/channels/' + channelName + '/delete';
- var modal = $('#modal-delete');
- modal.find('.modal-footer').find('form').attr('action', url);
- modal.find('.version-count').text(versionCount);
- });
- $('.btn[data-channel-delete]').click(function (e) {
- e.preventDefault();
- var id = $(this).data('channel-id');
- $('#form-delete-' + id)[0].submit();
- });
-}
-window.initChannelDelete = initChannelDelete;
-
-var onCustomSubmit = function (toggle, channelName, channelHex, title, submit, nonReviewed) {
- // Called when a channel is being edited before project creation
- var publishForm = $('#form-publish');
- $('#channel-name').text(channelName).css('background-color', channelHex);
- publishForm.find('.channel-input').val(channelName);
- publishForm.find('.channel-color-input').val(channelHex);
- getModal().modal('hide');
- initChannelManager(toggle, channelName, channelHex, title, null, null, submit, nonReviewed);
-};
-
-export function initChannelManager(toggle, channelName, channelHex, title, call, method, submit, nonReviewed) {
- $(toggle).off('click'); // Unbind previous click handlers
- $(toggle).click(function () {
- var modal = getModal();
- var preview = modal.find('.preview');
- var submitInput = modal.find('input[type="submit"]');
-
- // Update modal attributes
- modal.find('.color-picker').css('color', channelHex);
- modal.find('.modal-title').text(title);
- modal.find('.non-reviewed').prop('checked', nonReviewed);
- modal.find('input[type=submit]').attr('disabled', null);
- preview.css('background-color', channelHex).text(channelName);
-
- // Set input values
- modal.find('.channel-color-input').val(channelHex);
- modal.find('.channel-input').val(channelName);
-
- // Only show preview when there is input
- if (channelName.length > 0) {
- preview.show();
- } else {
- preview.hide();
- }
-
- submitInput.val(submit);
- if (call === null && method === null) {
- // Redirect form submit to client
- submitInput.off('click'); // Unbind existing click handlers
- submitInput.click(function (event) {
- event.preventDefault();
- submitInput.submit();
- });
-
- submitInput.off('submit'); // Unbind existing submit handlers
- submitInput.submit(function (event) {
- event.preventDefault();
- var modal = getModal();
- onCustomSubmit(toggle, modal.find('.channel-input').val(), modal.find('.channel-color-input').val(), title, submit, nonReviewed);
- });
- } else {
- // Set form action
- modal.find('form').attr('action', call).attr('method', method);
- }
- });
-}
-window.initChannelManager = initChannelManager;
-
-function initModal() {
- var modal = getModal();
- // Update the preview within the popover when the name is updated
- modal.find('.channel-input').on('input', function () {
- var val = $(this).val();
- var preview = getModal().find('.preview');
- var submit = getModal().find('input[type=submit]');
- var pattern = /^[a-zA-Z0-9]+$/;
- if (val.length === 0 || !pattern.exec(val)) {
- preview.hide();
- submit.attr('disabled', true);
- } else {
- preview.show().text(val);
- submit.attr('disabled', null);
- }
- });
- initColorPicker();
-}
-
-function initColorPicker() {
- var modal = getModal();
- // Initialize popover to stay opened when hovered over
- var colorPicker = modal.find('.color-picker');
- colorPicker
- .popover({
- html: true,
- trigger: 'manual',
- container: colorPicker.attr('id'),
- placement: 'right',
- sanitize: false,
- content: function () {
- return getModal().find('.popover-color-picker').html();
- },
- })
- .on('mouseenter', function () {
- var _this = this;
- $(this).popover('show');
- $(this)
- .siblings('.popover')
- .on('mouseleave', function () {
- $(_this).popover('hide');
- });
- })
- .on('mouseleave', function () {
- var _this = this;
- setTimeout(function () {
- if (!$('.popover:hover').length) {
- $(_this).popover('hide');
- }
- }, 100);
- });
-
- // Update colors when new color is selected
- $(document).on('click', '.channel-id', function () {
- var color = $(this).css('color');
- var modal = getModal();
- modal.find('.channel-color-input').val(rgbToHex(color));
- modal.find('.color-picker').css('color', color);
- modal.find('.preview').css('background-color', color);
- });
-}
-
-//=====> DOCUMENT READY
-$(function () {
- initModal();
- if (DEFAULT_HEX && CHANNEL_CREATE_ROUTE) {
- initChannelManager('#channel-new', '', DEFAULT_HEX, 'New channel', CHANNEL_CREATE_ROUTE, 'post', 'Create channel', false);
- }
-
- if (window.loadDeleteManager) {
- window.loadDeleteManager();
- }
-});
diff --git a/src/main/frontend/src/js/review.js b/src/main/frontend/src/js/review.js
index 916044f0c..fb401b5ce 100644
--- a/src/main/frontend/src/js/review.js
+++ b/src/main/frontend/src/js/review.js
@@ -1,6 +1,8 @@
import $ from 'jquery';
import { toggleSpinner } from '@/utils';
+$.ajaxSetup(window.ajaxSettings);
+
//=====> DOCUMENT READY
$(function () {
diff --git a/src/main/frontend/src/js/versionCreateChannelNew.js b/src/main/frontend/src/js/versionCreateChannelNew.js
deleted file mode 100644
index 7a18a658e..000000000
--- a/src/main/frontend/src/js/versionCreateChannelNew.js
+++ /dev/null
@@ -1,63 +0,0 @@
-import $ from 'jquery';
-import 'bootstrap/js/dist/modal';
-import { initChannelManager } from '@/js/channelManage';
-
-//=====> EXTERNAL CONSTANTS
-
-var DEFAULT_COLOR = window.DEFAULT_COLOR;
-
-//=====> HELPER FUNCTIONS
-
-function initChannelNew(color) {
- initChannelManager('#channel-new', '', color, 'New channel', null, null, 'Create channel', false);
-}
-
-function getForm() {
- return $('#form-publish');
-}
-
-function getSelect() {
- return $('#select-channel');
-}
-
-function setColorInput(val) {
- getForm().find('.channel-color-input').val(val);
-}
-
-//=====> DOCUMENT READY
-
-$(function () {
- setTimeout(function () {
- initChannelNew(DEFAULT_COLOR);
- }, 200);
-
- getSelect().change(function () {
- setColorInput($(this).find(':selected').data('color'));
- });
-
- // eslint-disable-next-line no-unused-vars
- var onCustomSubmit = function (
- toggle,
- channelName,
- channelHex,
- title, // eslint-disable-line no-unused-vars
- submit, // eslint-disable-line no-unused-vars
- nonReviewed // eslint-disable-line no-unused-vars
- ) {
- // Add new name to select
- var select = getSelect();
- var exists =
- select.find('option').find(function () {
- return $(this).val().toLowerCase() === channelName.toLowerCase();
- }).length !== 0;
-
- if (!exists) {
- setColorInput(channelHex);
- select.find(':selected').removeAttr('selected');
- select.append('
');
- }
-
- $('#channel-settings').modal('hide');
- initChannelNew(DEFAULT_COLOR);
- };
-});
diff --git a/src/main/frontend/src/plugins/i18n.js b/src/main/frontend/src/plugins/i18n.js
new file mode 100644
index 000000000..9120578ca
--- /dev/null
+++ b/src/main/frontend/src/plugins/i18n.js
@@ -0,0 +1,21 @@
+import { createI18n } from 'vue-i18n';
+import en from '@/assets/locales/en.json';
+
+// TODO languages
+
+export function setupI18n(locale = 'en') {
+ const i18n = createI18n({
+ locale,
+ fallbackLocale: 'en',
+ messages: {
+ en,
+ },
+ });
+ setI18nLanguage(i18n, locale);
+ return i18n;
+}
+
+export function setI18nLanguage(i18n, locale) {
+ i18n.global.locale.value = locale;
+ document.querySelector('html').setAttribute('lang', locale);
+}
diff --git a/src/main/frontend/src/scss/_channel.scss b/src/main/frontend/src/scss/_channel.scss
index 337a03737..80c02c968 100644
--- a/src/main/frontend/src/scss/_channel.scss
+++ b/src/main/frontend/src/scss/_channel.scss
@@ -22,9 +22,13 @@
}
.channel-head {
- @include towardsBottomRight(15px, 23px);
- font-size: 20px;
- display: inline-block;
+ font-size: 14px;
+ height: unset;
+ padding: 4px 2px 3px;
+ float: left;
+ position: absolute;
+ left: 100%;
+ bottom: 0.9em;
}
.channel-flat {
diff --git a/src/main/frontend/src/scss/_editor.scss b/src/main/frontend/src/scss/_editor.scss
index d5a33f70b..f3461aa68 100644
--- a/src/main/frontend/src/scss/_editor.scss
+++ b/src/main/frontend/src/scss/_editor.scss
@@ -1,145 +1,5 @@
@import 'utils';
-.page-rendered, .page-edit textarea {
- min-height: 350px;
- margin-bottom: 20px;
- width: 100%;
-}
-
-.page-edit textarea {
- resize: vertical;
-}
-
-.page-rendered {
- @include basic-border();
- @include box-shadow4(0, 1px, 1px, rgba(0, 0, 0, 0.05));
-
- padding: 10px 20px 20px 20px;
- overflow: hidden;
- background-color: white;
- max-width: 100%;
-
- table tr > th { padding: 5px; }
- table tr:nth-child(2n) { background-color: #F5F5F5; }
- h1, h2, h3, h4, h5, h6 { font-weight: bold; }
- img { max-width: 100%; }
-
- table tr > td, .page-rendered table tr > th {
- padding: 10px;
- @include basic-border();
- }
-
- code {
- background-color: #f5f5f5;
- color: black;
- }
-
- a code {
- color: #337ab7;
-
- &:hover {
- text-decoration: underline;
- }
- }
-
- h1, h2 {
- border-bottom: 1px solid $lighter;
- padding-bottom: 5px;
- }
-
- .headeranchor {
- display: none;
- text-decoration: none;
- }
-
- h1:hover, h2:hover, h3:hover {
- .headeranchor {
- display: inline-block;
- font-size: 16px;
- margin-left: -18px;
- width: 18px;
- }
- }
-
- h4:hover, h5:hover, h6:hover {
- .headeranchor {
- display: inline-block;
- font-size: 12px;
- margin-left: -12px;
- width: 12px;
- }
- }
-
-}
-
-button.open:hover {
- background-color: white;
- cursor: default;
- border-color: $light;
-}
-
-.btn-page {
- @include transition6(border-color, ease-in-out, .15s, box-shadow, ease-in-out, .15s);
- border-radius: 4px 0 0 4px;
- padding: 6px;
- z-index: 1000;
-}
-
-.btn-page:focus {
- outline: none;
-}
-
-.btn-edit {
- @include towardsBottomRight(-49px, 20px);
- position: absolute;
-}
-
-.btn-edit-container {
- position: absolute;
- overflow: hidden;
- z-index: -1000;
-}
-
-.btn-edit-container .btn {
- width: 35px;
-}
-
-.btn-preview-container { margin-top: 58px; }
-.btn-save-container { margin-top: 96px; }
-.btn-cancel-container { margin-top: 135px; }
-.btn-delete-container { margin-top: 175px; }
-
-.btn-page-delete {
- color: #c12e2a;
-}
-
-.page-editor-tabs {
- margin-bottom: 15px;
- border: none;
-}
-
-.page-editor-tabs > li > a:hover {
- border-bottom: 1px solid $lighter;
-}
-
-.page-editor-tabs > li > a:hover,
-.page-editor-tabs > li.active > a,
-.page-editor-tabs > li.active > a:hover,
-.page-editor-tabs > li > a:focus,
-.page-editor-tabs > li.active > a:focus {
- background-color: transparent;
- outline: none;
-}
-
-.page-editor-tabs > li.active > a, .page-editor-tabs > li.active > a:hover,
-.page-editor-tabs > li.active > a, .page-editor-tabs > li.active > a,
-.page-editor-tabs > li.active > a, .page-editor-tabs > li.active > a:focus {
- border-top: none;
- border-left: none;
- border-right: none;
- border-bottom: 1px solid black;
-}
-
.btn-card {
background-color: #337ab7;
border: 1px solid #1A619E;
diff --git a/src/main/frontend/src/scss/_utils.scss b/src/main/frontend/src/scss/_utils.scss
index ba799c41f..4d7804a85 100644
--- a/src/main/frontend/src/scss/_utils.scss
+++ b/src/main/frontend/src/scss/_utils.scss
@@ -1,3 +1,5 @@
+@import 'variables';
+
.push-down {
margin-top: 10px;
}
diff --git a/src/main/frontend/yarn.lock b/src/main/frontend/yarn.lock
index a5ba2cc20..c1b7ef1c7 100644
--- a/src/main/frontend/yarn.lock
+++ b/src/main/frontend/yarn.lock
@@ -9672,6 +9672,11 @@ vue-hot-reload-api@^2.3.0:
resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2"
integrity sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==
+vue-i18n@^9.0.0-beta.4:
+ version "9.0.0-beta.4"
+ resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-9.0.0-beta.4.tgz#a6550f6be56fd617a8ab96e26aa305329f06da02"
+ integrity sha512-Ko1pNflNRwmwjVn2S4Oo9BGHzBRVBvBGdBzAKle713DmmFRnB+NnsJisSmwTqB6BtACCvvJdY+xRTjZaobHtew==
+
"vue-loader-v16@npm:vue-loader@^16.0.0-beta.7":
version "16.0.0-beta.8"
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-16.0.0-beta.8.tgz#1f523d9fea8e8c6e4f5bb99fd768165af5845879"
diff --git a/src/main/java/io/papermc/hangar/controller/PagesController.java b/src/main/java/io/papermc/hangar/controller/PagesController.java
index cd8e5262c..a0db54bef 100644
--- a/src/main/java/io/papermc/hangar/controller/PagesController.java
+++ b/src/main/java/io/papermc/hangar/controller/PagesController.java
@@ -1,5 +1,6 @@
package io.papermc.hangar.controller;
+import io.papermc.hangar.controller.forms.PagePreview;
import io.papermc.hangar.db.customtypes.LoggedActionType;
import io.papermc.hangar.db.customtypes.LoggedActionType.ProjectPageContext;
import io.papermc.hangar.db.dao.HangarDao;
@@ -20,8 +21,6 @@ import io.papermc.hangar.service.project.PagesSerivce;
import io.papermc.hangar.service.project.ProjectService;
import io.papermc.hangar.util.Routes;
import io.papermc.hangar.util.StringUtils;
-import org.springframework.boot.configurationprocessor.json.JSONException;
-import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -68,15 +67,8 @@ public class PagesController extends HangarController {
}
@PostMapping(value = "/pages/preview", consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity
showPreview(@RequestBody String raw) throws JSONException {
- JSONObject rawJson;
- try {
- rawJson = new JSONObject(raw);
- rawJson.getString("raw");
- } catch (JSONException e) {
- throw new ResponseStatusException(HttpStatus.BAD_REQUEST);
- }
- return new ResponseEntity<>(markdownService.render(rawJson.getString("raw")), HttpStatus.OK);
+ public ResponseEntity showPreview(@RequestBody PagePreview rawObj) {
+ return ResponseEntity.ok(markdownService.render(rawObj.getRaw()));
}
@GetMapping({"/{author}/{slug}/pages/{page}", "/{author}/{slug}/pages/{page}/{subPage}"})
diff --git a/src/main/java/io/papermc/hangar/controller/forms/PagePreview.java b/src/main/java/io/papermc/hangar/controller/forms/PagePreview.java
new file mode 100644
index 000000000..f1fbeff91
--- /dev/null
+++ b/src/main/java/io/papermc/hangar/controller/forms/PagePreview.java
@@ -0,0 +1,28 @@
+package io.papermc.hangar.controller.forms;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.jetbrains.annotations.NotNull;
+
+public class PagePreview {
+
+ @NotNull
+ private final String raw;
+
+ @JsonCreator
+ public PagePreview(@JsonProperty(value = "raw", required = true) @NotNull String raw) {
+ this.raw = raw;
+ }
+
+ @NotNull
+ public String getRaw() {
+ return raw;
+ }
+
+ @Override
+ public String toString() {
+ return "PagePreview{" +
+ "raw='" + raw + '\'' +
+ '}';
+ }
+}
diff --git a/src/main/java/io/papermc/hangar/db/mappers/PromotedVersionMapper.java b/src/main/java/io/papermc/hangar/db/mappers/PromotedVersionMapper.java
index 465dd06be..43d4cd21f 100644
--- a/src/main/java/io/papermc/hangar/db/mappers/PromotedVersionMapper.java
+++ b/src/main/java/io/papermc/hangar/db/mappers/PromotedVersionMapper.java
@@ -1,12 +1,15 @@
package io.papermc.hangar.db.mappers;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.NullNode;
import io.papermc.hangar.db.customtypes.JSONB;
import io.papermc.hangar.model.TagColor;
import io.papermc.hangar.model.generated.PromotedVersion;
import io.papermc.hangar.model.generated.PromotedVersionTag;
+import io.papermc.hangar.util.StringUtils;
import org.jdbi.v3.core.mapper.ColumnMapper;
import org.jdbi.v3.core.statement.StatementContext;
import org.jetbrains.annotations.Nullable;
@@ -20,6 +23,7 @@ public class PromotedVersionMapper implements ColumnMapper
@Override
public List map(ResultSet rs, int column, StatementContext ctx) throws SQLException {
+ ObjectMapper mapper = new ObjectMapper();
List promotedVersions = new ArrayList<>();
JsonNode jsonNode = ((JSONB) rs.getObject(column)).getJson();
if (!jsonNode.isArray()) {
@@ -29,7 +33,14 @@ public class PromotedVersionMapper implements ColumnMapper
jsons.forEach(json -> {
String version = json.get("version_string").asText();
String tagName = json.get("tag_name").asText();
- String data = stringOrNull(json.get("tag_version"));
+ String data = null;
+ if (json.has("tag_version") && json.get("tag_version").isArray()) {
+ try {
+ data = StringUtils.formatVersionNumbers((List) mapper.treeToValue(json.get("tag_version"), List.class));
+ } catch (JsonProcessingException exception) {
+ exception.printStackTrace();
+ }
+ }
TagColor color = TagColor.getValues()[json.get("tag_color").asInt()];
// TODO a whole bunch
// val displayAndMc = data.map { rawData =>
@@ -88,6 +99,7 @@ public class PromotedVersionMapper implements ColumnMapper
new PromotedVersionTag()
.name(tagName)
.data(data)
+ .displayData(data) // TODO
.color(
new io.papermc.hangar.model.generated.TagColor()
.background(color.getBackground())
diff --git a/src/main/java/io/papermc/hangar/util/TemplateHelper.java b/src/main/java/io/papermc/hangar/util/TemplateHelper.java
index 56fa54647..c7f9c04aa 100644
--- a/src/main/java/io/papermc/hangar/util/TemplateHelper.java
+++ b/src/main/java/io/papermc/hangar/util/TemplateHelper.java
@@ -1,5 +1,8 @@
package io.papermc.hangar.util;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import io.papermc.hangar.config.hangar.HangarConfig;
import io.papermc.hangar.db.model.ProjectsTable;
import org.springframework.beans.factory.annotation.Autowired;
@@ -10,14 +13,17 @@ import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
+import java.util.Map;
@Component
public class TemplateHelper {
+ private final ObjectMapper mapper;
private final HangarConfig hangarConfig;
@Autowired
- public TemplateHelper(HangarConfig hangarConfig) {
+ public TemplateHelper(ObjectMapper mapper, HangarConfig hangarConfig) {
+ this.mapper = mapper;
this.hangarConfig = hangarConfig;
}
@@ -55,4 +61,15 @@ public class TemplateHelper {
public String prettifyDate(OffsetDateTime dateTime) {
return DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).format(dateTime.toLocalDate());
}
+
+ public ArrayNode serializeMap(Map, ?> map) {
+ ArrayNode arrayNode = mapper.createArrayNode();
+ map.forEach((o, o2) -> {
+ ObjectNode objectNode = mapper.createObjectNode();
+ objectNode.set("key", mapper.valueToTree(o));
+ objectNode.set("value", mapper.valueToTree(o2));
+ arrayNode.add(objectNode);
+ });
+ return arrayNode;
+ }
}
diff --git a/src/main/resources/templates/projects/pages/modalPageCreate.ftlh b/src/main/resources/templates/projects/pages/modalPageCreate.ftlh
index c0e4dbc85..192951309 100644
--- a/src/main/resources/templates/projects/pages/modalPageCreate.ftlh
+++ b/src/main/resources/templates/projects/pages/modalPageCreate.ftlh
@@ -2,14 +2,6 @@
<#import "*/utils/hangar.ftlh" as hangar />
<#import "*/utils/csrf.ftlh" as csrf />
-<#--@import ore.OreConfig-->
-<#--@import ore.db.Model-->
-<#--@import ore.models.project.{Page, Project}-->
-<#--@import util.syntax._-->
-<#--@import views.html.helper.CSPNonce-->
-
-<#--@(model: Project, rootPages: Seq[Model[Page]])(implicit messages: Messages, request: RequestHeader, config: OreConfig)-->
-
<#macro pageCreate project, rootPages>
+<#--
<#if editorOpen>
-
">
- ">
+ ">-->
+ ">
#assign>
<@projectView.view p=p sp=sp active="#docs" additionalScripts=scriptsVar>
-
-
-
-
- <@editor.editor
- saveCall=Routes.PAGES_SAVE.getRouteUrl(p.project.ownerName, p.project.slug, projectPage.slug)
- deleteCall=Routes.PAGES_DELETE.getRouteUrl(p.project.ownerName, p.project.slug, projectPage.slug)
- deletable=projectPage.isDeletable
- enabled=canEditPages()
- raw=projectPage.contents
- cooked=markdownService.render(projectPage.contents)
- subject="Page"
- extraFormValue=projectPage.name />
-
-
+
+<#--
+
+ <@editor.editor
+ saveCall=Routes.PAGES_SAVE.getRouteUrl(p.project.ownerName, p.project.slug, projectPage.slug)
+ deleteCall=Routes.PAGES_DELETE.getRouteUrl(p.project.ownerName, p.project.slug, projectPage.slug)
+ deletable=projectPage.isDeletable
+ enabled=canEditPages()
+ raw=projectPage.contents
+ cooked=markdownService.render(projectPage.contents)
+ subject="Page"
+ extraFormValue=projectPage.name />
-
+
<#if p.project.recommendedVersionId??>
-
-
" data-toggle="tooltip"
- data-placement="bottom" class="btn btn-primary">
-
<@spring.message "general.download" />
-
-
-
#if>
@@ -106,13 +108,6 @@ Documentation page within Project overview.
#if>
-<#-- - -->
-<#-- -->
-<#-- ${"Home"}-->
-<#-- -->
-<#--
-->
- <#-- @ftlvariable name="pg" type="io.papermc.hangar.model.viewhelpers.ProjectPage" -->
- <#-- @ftlvariable name="children" type="java.util.List" -->
<#list rootPages as pg, children>
-
<#if children?size gt 0>
@@ -132,7 +127,7 @@ Documentation page within Project overview.
<#if projectPage.parentId?? && projectPage.parentId = pg.id>
- <#-- @ftlvariable name="childPage" type="io.papermc.hangar.model.viewhelpers.ProjectPage" -->
+ <#– @ftlvariable name="childPage" type="io.papermc.hangar.model.viewhelpers.ProjectPage" –>
<#list children as childPage>
-
@@ -146,8 +141,8 @@ Documentation page within Project overview.
-
+
@projectView.view>
diff --git a/src/main/resources/templates/projects/versions/create.ftlh b/src/main/resources/templates/projects/versions/create.ftlh
index 8ce9278da..98392341c 100644
--- a/src/main/resources/templates/projects/versions/create.ftlh
+++ b/src/main/resources/templates/projects/versions/create.ftlh
@@ -15,7 +15,7 @@
window.OWNER_NAME = '${ownerName}';
window.PROJECT_SLUG = '${projectSlug}';
window.PENDING_VERSION = ${mapper.valueToTree(pending)};
- window.CHANNELS = ${channels};
+ window.CHANNELS = ${mapper.valueToTree(channels)};
window.FORUM_SYNC = ${forumSync?c};
window.MAX_CHANNEL_NAME_LEN = ${config.channels.maxNameLen};
window.COLORS = ${mapper.valueToTree(@helper["io.papermc.hangar.model.Color"].getNonTransparentValues())};
diff --git a/src/main/resources/templates/projects/versions/view.ftlh b/src/main/resources/templates/projects/versions/view.ftlh
index a63dc58e7..f363bae33 100644
--- a/src/main/resources/templates/projects/versions/view.ftlh
+++ b/src/main/resources/templates/projects/versions/view.ftlh
@@ -8,14 +8,22 @@
<#assign ReviewState=@helper["io.papermc.hangar.model.generated.ReviewState"] />
<#assign Permission=@helper["io.papermc.hangar.model.Permission"] />
<#assign Visibility=@helper["io.papermc.hangar.model.Visibility"] />
-<@projects.view p=v.p sp=sp active="#versions" noButtons=true>
+<#assign scriptsVar>
+
+ ">
+#assign>
+<@projects.view p=v.p sp=sp active="#versions" noButtons=true additionalScripts=scriptsVar>
#if>
-
- <@editor.editor
- saveCall=Routes.VERSIONS_SAVE_DESCRIPTION.getRouteUrl(v.p.project.ownerName, v.p.project.slug, v.v.versionString)
- enabled=sp.perms(Permission.EditPage)
- raw=v.v.description!""
- cooked=markdownService.render(v.v.description)
- subject="Version"
- />
+
diff --git a/src/main/resources/templates/projects/view.ftlh b/src/main/resources/templates/projects/view.ftlh
index 480edd0db..7ef5f243e 100644
--- a/src/main/resources/templates/projects/view.ftlh
+++ b/src/main/resources/templates/projects/view.ftlh
@@ -9,11 +9,15 @@ Base template for Project overview.
<#assign Permission=@helper["io.papermc.hangar.model.Permission"]>
<#assign FlagReason=@helper["io.papermc.hangar.model.FlagReason"]>
<#-- @ftlvariable name="FlagReason" type="io.papermc.hangar.model.FlagReason" -->
-<#macro view p sp active noButtons=false additionalScripts="" additionalStyling="">
+<#macro view p sp active noButtons=false additionalScripts="">
<#-- @ftlvariable name="p" type="io.papermc.hangar.model.viewhelpers.ProjectData" -->
<#-- @ftlvariable name="sp" type="io.papermc.hangar.model.viewhelpers.ScopedProjectData" -->
<#assign scriptsVar>
${additionalScripts}
- ">
- ">
+ <#--">-->
+ <#--">-->
+ #assign>
+
+ <#assign styleVar>
+
">
#assign>
<#assign metaVar>
@@ -35,7 +43,7 @@ Base template for Project overview.
#assign>
- <@base.base title=(p.project.ownerName + " / " + p.project.name) additionalScripts=scriptsVar additionalStyling=additionalStyling additionalMeta=metaVar>
+ <@base.base title=(p.project.ownerName + " / " + p.project.name) additionalScripts=scriptsVar additionalStyling=styleVar additionalMeta=metaVar>
@@ -224,13 +214,13 @@ Base template for Project overview.