Fossil SCM
Remove the new Stash button from /forumnew, where it is unhelpful.
Commit
e9e4c4fabea8c42dddfa505c9a933b656871cfd2798ef7c5cb4c8938b60c9e97
Parent
378b3c30c16c0f2…
1 file changed
+7
-5
+7
-5
| --- src/fossil.page.forumpost.js | ||
| +++ src/fossil.page.forumpost.js | ||
| @@ -90,17 +90,18 @@ | ||
| 90 | 90 | post, this is the full JSON-format artifact of the forum post |
| 91 | 91 | the being-edited post, as returned by /ajax/artifact.json. |
| 92 | 92 | |
| 93 | 93 | opt.status: optional current status tag value for opt.edit, |
| 94 | 94 | if known. This is used for pre-selecting a status value. |
| 95 | + | |
| 96 | + opt.hideStash[bool=false]: if true, the "Stash" button does not | |
| 97 | + get added. Intended for use with /forumnew. | |
| 95 | 98 | */ |
| 96 | 99 | constructor(opt){ |
| 97 | 100 | opt = this.#opt = F.nu({ |
| 98 | - // todo: defaults once we determine the options | |
| 99 | - // inReplyTo: hash | |
| 100 | - // fpid: hash | |
| 101 | - draftKey: undefined | |
| 101 | + draftKey: undefined, | |
| 102 | + hideStash: false | |
| 102 | 103 | }, opt); |
| 103 | 104 | opt.isNewThread = !opt.inReplyTo && !opt.edit; |
| 104 | 105 | if( opt.draftKey ){ |
| 105 | 106 | this.#draft = F.nu(F.storage.getJSON(opt.draftKey, {})); |
| 106 | 107 | } |
| @@ -174,11 +175,11 @@ | ||
| 174 | 175 | e.button.submit = D.attr( |
| 175 | 176 | D.button("Submit"), |
| 176 | 177 | 'title', |
| 177 | 178 | 'Save any edits to the server. Not permitted until Preview has been used.' |
| 178 | 179 | ); |
| 179 | - if( this.#draft ){ | |
| 180 | + if( this.#draft && !opt.hideStash ){ | |
| 180 | 181 | e.button.stash = D.attr( |
| 181 | 182 | D.button( |
| 182 | 183 | "Stash", e=>this.close() |
| 183 | 184 | /* This could be called Close, but that would semantically |
| 184 | 185 | collide with the Close [this post] button. All "Stash" |
| @@ -1054,10 +1055,11 @@ | ||
| 1054 | 1055 | if( plugInEditor && eForumNew ){ |
| 1055 | 1056 | /* /forumnew and /forume1 */ |
| 1056 | 1057 | const fpe = new F.ForumPostEditor({ |
| 1057 | 1058 | draftKey: 'draft-forumnew', |
| 1058 | 1059 | hiddenFields: eForumNew.querySelectorAll('input[type=hidden]'), |
| 1060 | + hideStash: true, | |
| 1059 | 1061 | ondiscard: ()=>{ |
| 1060 | 1062 | window.location = F.repoUrl('forum'); |
| 1061 | 1063 | }, |
| 1062 | 1064 | onsubmit: (fpe, response)=>{ |
| 1063 | 1065 | window.location = F.repoUrl('forumpost/'+response.uuid); |
| 1064 | 1066 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -90,17 +90,18 @@ | |
| 90 | post, this is the full JSON-format artifact of the forum post |
| 91 | the being-edited post, as returned by /ajax/artifact.json. |
| 92 | |
| 93 | opt.status: optional current status tag value for opt.edit, |
| 94 | if known. This is used for pre-selecting a status value. |
| 95 | */ |
| 96 | constructor(opt){ |
| 97 | opt = this.#opt = F.nu({ |
| 98 | // todo: defaults once we determine the options |
| 99 | // inReplyTo: hash |
| 100 | // fpid: hash |
| 101 | draftKey: undefined |
| 102 | }, opt); |
| 103 | opt.isNewThread = !opt.inReplyTo && !opt.edit; |
| 104 | if( opt.draftKey ){ |
| 105 | this.#draft = F.nu(F.storage.getJSON(opt.draftKey, {})); |
| 106 | } |
| @@ -174,11 +175,11 @@ | |
| 174 | e.button.submit = D.attr( |
| 175 | D.button("Submit"), |
| 176 | 'title', |
| 177 | 'Save any edits to the server. Not permitted until Preview has been used.' |
| 178 | ); |
| 179 | if( this.#draft ){ |
| 180 | e.button.stash = D.attr( |
| 181 | D.button( |
| 182 | "Stash", e=>this.close() |
| 183 | /* This could be called Close, but that would semantically |
| 184 | collide with the Close [this post] button. All "Stash" |
| @@ -1054,10 +1055,11 @@ | |
| 1054 | if( plugInEditor && eForumNew ){ |
| 1055 | /* /forumnew and /forume1 */ |
| 1056 | const fpe = new F.ForumPostEditor({ |
| 1057 | draftKey: 'draft-forumnew', |
| 1058 | hiddenFields: eForumNew.querySelectorAll('input[type=hidden]'), |
| 1059 | ondiscard: ()=>{ |
| 1060 | window.location = F.repoUrl('forum'); |
| 1061 | }, |
| 1062 | onsubmit: (fpe, response)=>{ |
| 1063 | window.location = F.repoUrl('forumpost/'+response.uuid); |
| 1064 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -90,17 +90,18 @@ | |
| 90 | post, this is the full JSON-format artifact of the forum post |
| 91 | the being-edited post, as returned by /ajax/artifact.json. |
| 92 | |
| 93 | opt.status: optional current status tag value for opt.edit, |
| 94 | if known. This is used for pre-selecting a status value. |
| 95 | |
| 96 | opt.hideStash[bool=false]: if true, the "Stash" button does not |
| 97 | get added. Intended for use with /forumnew. |
| 98 | */ |
| 99 | constructor(opt){ |
| 100 | opt = this.#opt = F.nu({ |
| 101 | draftKey: undefined, |
| 102 | hideStash: false |
| 103 | }, opt); |
| 104 | opt.isNewThread = !opt.inReplyTo && !opt.edit; |
| 105 | if( opt.draftKey ){ |
| 106 | this.#draft = F.nu(F.storage.getJSON(opt.draftKey, {})); |
| 107 | } |
| @@ -174,11 +175,11 @@ | |
| 175 | e.button.submit = D.attr( |
| 176 | D.button("Submit"), |
| 177 | 'title', |
| 178 | 'Save any edits to the server. Not permitted until Preview has been used.' |
| 179 | ); |
| 180 | if( this.#draft && !opt.hideStash ){ |
| 181 | e.button.stash = D.attr( |
| 182 | D.button( |
| 183 | "Stash", e=>this.close() |
| 184 | /* This could be called Close, but that would semantically |
| 185 | collide with the Close [this post] button. All "Stash" |
| @@ -1054,10 +1055,11 @@ | |
| 1055 | if( plugInEditor && eForumNew ){ |
| 1056 | /* /forumnew and /forume1 */ |
| 1057 | const fpe = new F.ForumPostEditor({ |
| 1058 | draftKey: 'draft-forumnew', |
| 1059 | hiddenFields: eForumNew.querySelectorAll('input[type=hidden]'), |
| 1060 | hideStash: true, |
| 1061 | ondiscard: ()=>{ |
| 1062 | window.location = F.repoUrl('forum'); |
| 1063 | }, |
| 1064 | onsubmit: (fpe, response)=>{ |
| 1065 | window.location = F.repoUrl('forumpost/'+response.uuid); |
| 1066 |