• R/O
  • HTTP
  • SSH
  • HTTPS

newslash: 提交

newslash


Commit MetaInfo

修订版3ccfe08832da4503753b27c8c3c538c6678e7b37 (tree)
时间2019-06-17 17:58:24
作者hylom <hylom@user...>
Commiterhylom

Log Message

editor: article editor supports media embed

更改概述

差异

--- a/src/newslash_web/lib/Newslash/Web/Controller/API/Story.pm
+++ b/src/newslash_web/lib/Newslash/Web/Controller/API/Story.pm
@@ -181,6 +181,11 @@ sub post {
181181 # TODO: media related
182182 #$item->{mediaurl};
183183 #$item->{mediatype};
184+ #$item->{media};
185+
186+ if ($item->{media}) {
187+ $params->{media} = $item->{media};
188+ }
184189
185190 # source
186191 if ($item->{source_id}) {
--- a/src/newslash_web/public/js/article-editor.js
+++ b/src/newslash_web/public/js/article-editor.js
@@ -30,6 +30,10 @@ articleEditor.init = function init () {
3030 id: 0,
3131 source_id: 0,
3232 source_type: 0,
33+
34+ mediaurl: "",
35+ mediatype: "",
36+ media: "",
3337 },
3438
3539 message: "",
@@ -82,6 +86,9 @@ articleEditor.init = function init () {
8286 'editor.dept': function watchDept(val, oldVal) {
8387 this.item.dept = val;
8488 },
89+ 'editor.media': function watchMedia(val, oldVal) {
90+ this.item.media = val;
91+ },
8592 'editor.tags_string': _updateTopics,
8693 };
8794
@@ -110,6 +117,7 @@ articleEditor.init = function init () {
110117 this.item.intro_text = _quoteHtml(this.editor.intro_text);
111118 this.item.body_text = _quoteHtml(this.editor.body_text);
112119 this.item.title = _quoteTitle(this.editor.title);
120+ this.item.media = _quoteTitle(this.editor.media);
113121 },
114122 startEdit: function startEdit() {
115123 _startEdit.call(this);
@@ -143,6 +151,8 @@ articleEditor.init = function init () {
143151 this.message = "";
144152 this.item.title = resp.item.title;
145153 this.item.intro_text = resp.item.intro_text;
154+ this.item.body_text = resp.item.body_text;
155+ this.item.media = resp.item.media;
146156 this.item.url = this.editor.url;
147157 this.item.primary_topic = resp.item.topic;
148158 this.updatePrimaryTopicIconURL();
--- a/src/newslash_web/templates/common/article/editor.html.tt2
+++ b/src/newslash_web/templates/common/article/editor.html.tt2
@@ -64,6 +64,13 @@
6464 </label>
6565 </p>
6666
67+ <p v-if="contentType == 'story'">
68+ <label>メディア:
69+ <textarea name="media" v-model="editor.media"
70+ placeholder="埋め込みコンテンツなどをここに記述してください" ></textarea>
71+ </label>
72+ </p>
73+
6774 <p v-if="contentType == 'submission'">
6875 <label>URL(本文がない場合は必須):
6976 <input type="text" name="url" v-model="editor.url" placeholder="重要なURLを1つ(任意)" />
Show on old repository browser