|
@@ -38,6 +38,18 @@
|
|
type="save-and-close"
|
|
type="save-and-close"
|
|
@clicked="newsId ? update(true) : create(true)"
|
|
@clicked="newsId ? update(true) : create(true)"
|
|
/>
|
|
/>
|
|
|
|
+ <div class="right">
|
|
|
|
+ <span v-if="createdBy">
|
|
|
|
+ By
|
|
|
|
+ <user-id-to-username
|
|
|
|
+ :user-id="createdBy"
|
|
|
|
+ :alt="createdBy"
|
|
|
|
+ :link="true"
|
|
|
|
+ />
|
|
|
|
+ @
|
|
|
|
+ </span>
|
|
|
|
+ {{ formatDate(createdAt) }}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</modal>
|
|
</modal>
|
|
</template>
|
|
</template>
|
|
@@ -46,20 +58,25 @@
|
|
import { mapActions, mapGetters, mapState } from "vuex";
|
|
import { mapActions, mapGetters, mapState } from "vuex";
|
|
import marked from "marked";
|
|
import marked from "marked";
|
|
import Toast from "toasters";
|
|
import Toast from "toasters";
|
|
|
|
+import { format } from "date-fns";
|
|
|
|
|
|
|
|
+import UserIdToUsername from "@/components/UserIdToUsername.vue";
|
|
import SaveButton from "../SaveButton.vue";
|
|
import SaveButton from "../SaveButton.vue";
|
|
import Modal from "../Modal.vue";
|
|
import Modal from "../Modal.vue";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- components: { Modal, SaveButton },
|
|
|
|
|
|
+ components: { Modal, SaveButton, UserIdToUsername },
|
|
props: {
|
|
props: {
|
|
newsId: { type: String, default: "" },
|
|
newsId: { type: String, default: "" },
|
|
sector: { type: String, default: "admin" }
|
|
sector: { type: String, default: "admin" }
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- markdown: "# Example\n## Subheading goes here",
|
|
|
|
- status: "published"
|
|
|
|
|
|
+ markdown:
|
|
|
|
+ "# Header\n ## Sub-Header\n- **So**\n- _Many_\n- ~Points~\n\nOther things you want to say and [link](https://example.com).\n\n### Sub-Sub-Header\n> Oh look, a quote!\n\n`lil code`\n\n```\nbig code\n```\n",
|
|
|
|
+ status: "published",
|
|
|
|
+ createdBy: null,
|
|
|
|
+ createdAt: 0
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -81,9 +98,16 @@ export default {
|
|
if (this.newsId) {
|
|
if (this.newsId) {
|
|
this.socket.dispatch(`news.getNewsFromId`, this.newsId, res => {
|
|
this.socket.dispatch(`news.getNewsFromId`, this.newsId, res => {
|
|
if (res.status === "success") {
|
|
if (res.status === "success") {
|
|
- const { markdown, status } = res.data.news;
|
|
|
|
|
|
+ const {
|
|
|
|
+ markdown,
|
|
|
|
+ status,
|
|
|
|
+ createdBy,
|
|
|
|
+ createdAt
|
|
|
|
+ } = res.data.news;
|
|
this.markdown = markdown;
|
|
this.markdown = markdown;
|
|
this.status = status;
|
|
this.status = status;
|
|
|
|
+ this.createdBy = createdBy;
|
|
|
|
+ this.createdAt = createdAt;
|
|
} else {
|
|
} else {
|
|
new Toast("News with that ID not found.");
|
|
new Toast("News with that ID not found.");
|
|
this.closeModal("editNews");
|
|
this.closeModal("editNews");
|
|
@@ -158,6 +182,9 @@ export default {
|
|
}
|
|
}
|
|
);
|
|
);
|
|
},
|
|
},
|
|
|
|
+ formatDate: unix => {
|
|
|
|
+ return format(unix, "HH:ii:ss dd-MM-yyyy");
|
|
|
|
+ },
|
|
...mapActions("modalVisibility", ["closeModal"]),
|
|
...mapActions("modalVisibility", ["closeModal"]),
|
|
...mapActions("modals/editNews", [
|
|
...mapActions("modals/editNews", [
|
|
"editNews",
|
|
"editNews",
|
|
@@ -172,6 +199,9 @@ export default {
|
|
.edit-news-modal {
|
|
.edit-news-modal {
|
|
.modal-card {
|
|
.modal-card {
|
|
width: 1300px;
|
|
width: 1300px;
|
|
|
|
+ .modal-card-foot .right {
|
|
|
|
+ margin: auto 0 auto auto !important;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|