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

Commit0957e96

Browse files
JelteFpolkerty
authored andcommitted
Change the direction of the dropdowns at the bottom of the patch page.
1 parent5a2ff44 commit0957e96

File tree

7 files changed

+67
-57
lines changed

7 files changed

+67
-57
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A commitfest is a collection of patches and reviews for a project and is part of
66

77
##The Application
88

9-
This is a Django3.2 application backed by PostgreSQL and running on Python 3.x.
9+
This is a Django4.2 application backed by PostgreSQL and running on Python 3.x.
1010

1111
##Getting Started
1212

‎media/commitfest/css/commitfest.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ div.form-group div.controls input.threadpick-input {
3737
display: inline;
3838
}
3939

40+
.dropdown-menu--up {
41+
top: initial;
42+
bottom:100%;
43+
}
4044

4145

4246
/*

‎pgcommitfest/commitfest/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ class Patch(models.Model, DiffableModel):
122122
'reviewers':'reviewers_string',
123123
}
124124

125+
defcurrent_commitfest(self):
126+
returnself.commitfests.order_by('-startdate').first()
127+
125128
# Some accessors
126129
@property
127130
defauthors_string(self):

‎pgcommitfest/commitfest/templates/patch.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ <h4>Annotations</h4>
183183
</tbody>
184184
</table>
185185

186+
{% with dropdown_mode="dropdown-menu--up" %}
186187
{%include "patch_commands.inc"%}
188+
{% endwith %}
187189

188190
{%comment%}commit dialog{%endcomment%}
189191
<divclass="modal fade"id="commitModal"role="dialog">

‎pgcommitfest/commitfest/templates/patch_commands.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
<divclass="btn-group">
55
<aclass="btn btn-default dropdown-toggle"data-toggle="dropdown"href="#">Comment/Review<spanclass="caret"></span></a>
6-
<ulclass="dropdown-menu">
6+
<ulclass="dropdown-menu {{ dropdown_mode }}">
77
<li><ahref="comment/">Comment</a>
88
<li><ahref="review/">Review</a>
99
</ul>
1010
</div>
1111

1212
<divclass="btn-group">
1313
<aclass="btn btn-default dropdown-toggle"data-toggle="dropdown"href="#">Change Status<spanclass="caret"></span></a>
14-
<ulclass="dropdown-menu"role="menu">
14+
<ulclass="dropdown-menu {{ dropdown_mode }}"role="menu">
1515
<lirole="presentation"class="dropdown-header">Open statuses</li>
1616
<lirole="presentation"><ahref="status/review/">Needs review</a></li>
1717
<lirole="presentation"><ahref="status/author/">Waiting on Author</a></li>
@@ -21,20 +21,20 @@
2121
<lirole="presentation"><ahref="close/reject/"onclick="return verify_reject()">Rejected</a></li>
2222
<lirole="presentation"><ahref="close/withdrawn/"onclick="return verify_withdrawn()">Withdrawn</a></li>
2323
<lirole="presentation"><ahref="close/feedback/"onclick="return verify_returned()">Returned with feedback</a></li>
24-
<lirole="presentation"><ahref="close/next/"onclick="return verify_next()">Move to next CF</a></li>
24+
<lirole="presentation"><ahref="close/next/?cfid={{cf.id}}"onclick="return verify_next()">Move to next CF</a></li>
2525
<lirole="presentation"><ahref="close/committed/"onclick="return flagCommitted({%if patch.committer%}'{{patch.committer}}'{%elif is_committer%}'{{user.username}}'{%else%}null{%endif%})">Committed</a></li>
2626
</ul>
2727
</div>
2828

2929
{%if request.user.is_staff%}
3030
<divclass="btn-group">
3131
<aclass="btn btn-default dropdown-toggle"data-toggle="dropdown"href="#">Send private mail<spanclass="caret"></span></a>
32-
<ulclass="dropdown-menu">
32+
<ulclass="dropdown-menu {{ dropdown_mode }}">
3333
<li><ahref="send_email/?authors={{patch.id}}">Send mail to authors</a></li>
3434
<li><ahref="send_email/?reviewers={{patch.id}}">Send mail to reviewers</a></li>
3535
<li><ahref="send_email/?authors={{patch.id}}&reviewers={{patch.id}}">Send mail to authors and reviewers</a></li>
3636
</ul>
3737
</div>
3838
{%endif%}
3939

40-
</div>
40+
</div>

‎pgcommitfest/commitfest/views.py

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ def patch(request, patchid):
374374

375375
@login_required
376376
@transaction.atomic
377-
defpatchform(request,cfid,patchid):
378-
cf=get_object_or_404(CommitFest,pk=cfid)
379-
patch=get_object_or_404(Patch,pk=patchid,commitfests=cf)
377+
defpatchform(request,patchid):
378+
patch=get_object_or_404(Patch,pk=patchid)
379+
cf=patch.current_commitfest()
380380

381381
prevreviewers=list(patch.reviewers.all())
382382
prevauthors=list(patch.authors.all())
@@ -466,21 +466,12 @@ def _review_status_string(reviewstatus):
466466

467467
@login_required
468468
@transaction.atomic
469-
defcomment(request,cfid,patchid,what):
470-
cf=get_object_or_404(CommitFest,pk=cfid)
469+
defcomment(request,patchid,what):
471470
patch=get_object_or_404(Patch,pk=patchid)
471+
cf=patch.current_commitfest()
472472
poc=get_object_or_404(PatchOnCommitFest,patch=patch,commitfest=cf)
473473
is_review= (what=='review')
474474

475-
ifpoc.is_closed:
476-
# We allow modification of patches in closed CFs *only* if it's the
477-
# last CF that the patch is part of. If it's part of another CF, that
478-
# is later than this one, tell the user to go there instead.
479-
lastcf=PatchOnCommitFest.objects.filter(patch=patch).order_by('-commitfest__startdate')[0]
480-
ifpoc!=lastcf:
481-
messages.add_message(request,messages.INFO,"The status of this patch cannot be changed in this commitfest. You must modify it in the one where it's open!")
482-
returnHttpResponseRedirect('..')
483-
484475
ifrequest.method=='POST':
485476
try:
486477
form=CommentForm(patch,poc,is_review,data=request.POST)
@@ -563,17 +554,10 @@ def comment(request, cfid, patchid, what):
563554

564555
@login_required
565556
@transaction.atomic
566-
defstatus(request,cfid,patchid,status):
567-
poc=get_object_or_404(PatchOnCommitFest.objects.select_related(),commitfest__id=cfid,patch__id=patchid)
568-
569-
ifpoc.is_closed:
570-
# We allow modification of patches in closed CFs *only* if it's the
571-
# last CF that the patch is part of. If it's part of another CF, that
572-
# is later than this one, tell the user to go there instead.
573-
lastcf=PatchOnCommitFest.objects.filter(patch__id=patchid).order_by('-commitfest__startdate')[0]
574-
ifpoc!=lastcf:
575-
messages.add_message(request,messages.INFO,"The status of this patch cannot be changed in this commitfest. You must modify it in the one where it's open!")
576-
returnHttpResponseRedirect('/%s/%s/'% (poc.commitfest.id,poc.patch.id))
557+
defstatus(request,patchid,status):
558+
patch=get_object_or_404(Patch.objects.select_related(),pk=patchid)
559+
cf=patch.current_commitfest()
560+
poc=get_object_or_404(PatchOnCommitFest.objects.select_related(),commitfest__id=cf.id,patch__id=patchid)
577561

578562
ifstatus=='review':
579563
newstatus=PatchOnCommitFest.STATUS_REVIEW
@@ -593,22 +577,29 @@ def status(request, cfid, patchid, status):
593577

594578
PatchHistory(patch=poc.patch,by=request.user,what='New status: %s'%poc.statusstring).save_and_notify()
595579

596-
returnHttpResponseRedirect('/%s/%s/'% (poc.commitfest.id,poc.patch.id))
580+
returnHttpResponseRedirect('/patch/%s/'% (poc.patch.id))
597581

598582

599583
@login_required
600584
@transaction.atomic
601-
defclose(request,cfid,patchid,status):
602-
poc=get_object_or_404(PatchOnCommitFest.objects.select_related(),commitfest__id=cfid,patch__id=patchid)
603-
604-
ifpoc.is_closed:
605-
# We allow modification of patches in closed CFs *only* if it's the
606-
# last CF that the patch is part of. If it's part of another CF, that
607-
# is later than this one, tell the user to go there instead.
608-
lastcf=PatchOnCommitFest.objects.filter(patch__id=patchid).order_by('-commitfest__startdate')[0]
609-
ifpoc!=lastcf:
610-
messages.add_message(request,messages.INFO,"The status of this patch cannot be changed in this commitfest. You must modify it in the one where it's open!")
611-
returnHttpResponseRedirect('/%s/%s/'% (poc.commitfest.id,poc.patch.id))
585+
defclose(request,patchid,status):
586+
patch=get_object_or_404(Patch.objects.select_related(),pk=patchid)
587+
cf=patch.current_commitfest()
588+
589+
try:
590+
request_cfid=int(request.GET.get('cfid',''))
591+
exceptValueError:
592+
# int() failed, ignore
593+
request_cfid=None
594+
595+
ifrequest_cfidisnotNoneandrequest_cfid!=cf.id:
596+
# The cfid parameter is only added to the /next/ link. That's the only
597+
# close operation where two people pressing the button at the same time
598+
# can have unintended effects.
599+
messages.error(request,"The patch was moved to a new commitfest by someone else. Please double check if you still want to retry this operation.")
600+
returnHttpResponseRedirect('/%s/%s/'% (cf.id,patch.id))
601+
602+
poc=get_object_or_404(PatchOnCommitFest.objects.select_related(),commitfest__id=cf.id,patch__id=patchid)
612603

613604
poc.leavedate=datetime.now()
614605

@@ -696,8 +687,7 @@ def close(request, cfid, patchid, status):
696687

697688
@login_required
698689
@transaction.atomic
699-
defreviewer(request,cfid,patchid,status):
700-
get_object_or_404(CommitFest,pk=cfid)
690+
defreviewer(request,patchid,status):
701691
patch=get_object_or_404(Patch,pk=patchid)
702692

703693
is_reviewer=request.userinpatch.reviewers.all()
@@ -716,7 +706,6 @@ def reviewer(request, cfid, patchid, status):
716706
@login_required
717707
@transaction.atomic
718708
defcommitter(request,cfid,patchid,status):
719-
get_object_or_404(CommitFest,pk=cfid)
720709
patch=get_object_or_404(Patch,pk=patchid)
721710

722711
committer=list(Committer.objects.filter(user=request.user,active=True))
@@ -741,8 +730,7 @@ def committer(request, cfid, patchid, status):
741730

742731
@login_required
743732
@transaction.atomic
744-
defsubscribe(request,cfid,patchid,sub):
745-
get_object_or_404(CommitFest,pk=cfid)
733+
defsubscribe(request,patchid,sub):
746734
patch=get_object_or_404(Patch,pk=patchid)
747735

748736
ifsub=='un':
@@ -755,6 +743,12 @@ def subscribe(request, cfid, patchid, sub):
755743
returnHttpResponseRedirect("../")
756744

757745

746+
defsend_patch_email(request,patchid):
747+
patch=get_object_or_404(Patch,pk=patchid)
748+
cf=patch.current_commitfest()
749+
returnsend_email(request,cf.id)
750+
751+
758752
@login_required
759753
@transaction.atomic
760754
defsend_email(request,cfid):

‎pgcommitfest/urls.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,32 @@
1919
re_path(r'^(\d+)/$',views.commitfest),
2020
re_path(r'^(open|inprogress|current)/(.*)$',views.redir),
2121
re_path(r'^(?P<cfid>\d+)/activity(?P<rss>\.rss)?/$',views.activity),
22-
re_path(r'^patch/(\d+)/$',views.patch),
2322
re_path(r'^(\d+)/(\d+)/$',views.patch_legacy_redirect),
24-
re_path(r'^(\d+)/(\d+)/edit/$',views.patchform),
23+
re_path(r'^patch/(\d+)/$',views.patch),
24+
re_path(r'^patch/(\d+)/edit/$',views.patchform),
2525
re_path(r'^(\d+)/new/$',views.newpatch),
26-
re_path(r'^(\d+)/(\d+)/status/(review|author|committer)/$',views.status),
27-
re_path(r'^(\d+)/(\d+)/close/(reject|withdrawn|feedback|committed|next)/$',views.close),
28-
re_path(r'^(\d+)/(\d+)/reviewer/(become|remove)/$',views.reviewer),
29-
re_path(r'^(\d+)/(\d+)/committer/(become|remove)/$',views.committer),
30-
re_path(r'^(\d+)/(\d+)/(un)?subscribe/$',views.subscribe),
31-
re_path(r'^(\d+)/(\d+)/(comment|review)/',views.comment),
26+
re_path(r'^patch/(\d+)/status/(review|author|committer)/$',views.status),
27+
re_path(r'^patch/(\d+)/close/(reject|withdrawn|feedback|committed|next)/$',views.close),
28+
re_path(r'^patch/(\d+)/reviewer/(become|remove)/$',views.reviewer),
29+
re_path(r'^patch/(\d+)/committer/(become|remove)/$',views.committer),
30+
re_path(r'^patch/(\d+)/(un)?subscribe/$',views.subscribe),
31+
re_path(r'^patch/(\d+)/(comment|review)/',views.comment),
3232
re_path(r'^(\d+)/send_email/$',views.send_email),
33-
re_path(r'^(\d+)/\d+/send_email/$',views.send_email),
33+
re_path(r'^patch/(\d+)/send_email/$',views.send_patch_email),
3434
re_path(r'^(\d+)/reports/authorstats/$',reports.authorstats),
3535
re_path(r'^search/$',views.global_search),
3636
re_path(r'^ajax/(\w+)/$',ajax.main),
3737
re_path(r'^lookups/user/$',lookups.userlookup),
3838
re_path(r'^thread_notify/$',views.thread_notify),
3939
re_path(r'^cfbot_notify/$',views.cfbot_notify),
4040

41+
# Legacy email POST route. This can be safely removed in a few days from
42+
# the first time this is deployed. It's only puprose is not breaking
43+
# submissions from a previous page lood, during the deploy of the new
44+
# /patch/(\d+) routes. It would be a shame if someone lost their well
45+
# written email because of this.
46+
re_path(r'^\d+/(\d+)/send_email/$',views.send_patch_email),
47+
4148
# Auth system integration
4249
re_path(r'^(?:account/)?login/?$',pgcommitfest.auth.login),
4350
re_path(r'^(?:account/)?logout/?$',pgcommitfest.auth.logout),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp