Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f23363

Browse files
committed
Autofill new patch description based on selected thread (#30)
It's a bit silly that you have to manually enter something in thedescription, when you just selected a thing with that title from thethread search modal. So this starts auto-filling the description. Thisonly happens when the field is empty, and will strip some commonprefixes like `Re:` and `[PATCH]`.Fixes#16
1 parent4636298 commit0f23363

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

‎media/commitfest/js/commitfest.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function findLatestThreads() {
3232
sel.append(
3333
$("<option/>")
3434
.text(`${i.from}:${i.subj} (${i.date})`)
35+
.data("subject",i.subj)
3536
.val(i.msgid),
3637
);
3738
});
@@ -60,12 +61,18 @@ function browseThreads(attachfunc, closefunc) {
6061
if(!msgid||msgid===""){
6162
msgid=$("#attachThreadList").val();
6263
if(!msgid)return;
64+
subject=$("#attachThreadList option:selected").data("subject");
65+
subject=subject.replace(/\bre:/gi,"");
66+
subject=subject.replace(/\bfwd:/gi,"");
67+
// Strips [PATCH], [POC], etc. prefixes
68+
subject=subject.replace(/\[\w+\]:/gi,"");
69+
subject=subject.replace(/\[\w+\]/gi,"");
6370
}
6471

6572
$("#attachThreadListWrap").addClass("loading");
6673
$("#attachThreadSearchButton").addClass("disabled");
6774
$("#attachThreadButton").addClass("disabled");
68-
if(attachfunc(msgid)){
75+
if(attachfunc(msgid,subject)){
6976
$("#attachModal").modal("hide");
7077
}
7178
$("#attachThreadListWrap").removeClass("loading");
@@ -351,3 +358,22 @@ git fetch commitfest cf/${patchId}
351358
git checkout commitfest/cf/${patchId}
352359
`);
353360
}
361+
362+
/* Build our button callbacks */
363+
$(document).ready(()=>{
364+
$("button.attachThreadButton").each((i,o)=>{
365+
constb=$(o);
366+
b.click(()=>{
367+
$("#attachThreadAttachOnly").val("1");
368+
browseThreads((msgid,subject)=>{
369+
b.prev().val(msgid);
370+
constdescription_field=$("#id_name");
371+
if(description_field.val()===""){
372+
description_field.val(subject);
373+
}
374+
returntrue;
375+
});
376+
returnfalse;
377+
});
378+
});
379+
});

‎pgcommitfest/commitfest/templates/base_form.html

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,5 @@ <h3>Search user</h3>
110110
$('#searchUserSearchField').focus();
111111
});
112112
{%endif%}
113-
114-
/* Build our button callbacks */
115-
$(document).ready(function(){
116-
$('button.attachThreadButton').each(function(i,o){
117-
varb=$(o);
118-
b.click(function(){
119-
$('#attachThreadAttachOnly').val('1');
120-
browseThreads(function(msgid){
121-
b.prev().val(msgid);
122-
returntrue;
123-
});
124-
returnfalse;
125-
});
126-
});
127-
});
128113
</script>
129114
{%endblock%}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp