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

Commitbc3d891

Browse files
authored
Check package only benefits as well (python#1670)
A package only benefit's checkbox is rendered in the HTML with thedisabled attribute. Because of that, the click event wasn't beingtriggered by the browser. This fix turn off and on this attribute sothe click event can happen.
1 parente4a3d88 commitbc3d891

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

‎static/js/sponsors/applicationForm.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@ $(document).ready(function(){
1717

1818
checkboxesContainer.find(':checkbox').each(function(){
1919
$(this).prop('checked',false);
20+
letpackageOnlyBenefit=$(this).attr("package_only");
21+
if(packageOnlyBenefit)$(this).attr("disabled",true);
2022
});
2123

2224
letpackageInfo=$("#package_benefits_"+package);
2325
packageInfo.children().each(function(){
2426
letbenefit=$(this).html()
25-
checkboxesContainer.find(`[value=${benefit}]`).trigger("click");
27+
letbenefitInput=checkboxesContainer.find(`[value=${benefit}]`);
28+
letpackageOnlyBenefit=benefitInput.attr("package_only");
29+
benefitInput.removeAttr("disabled");
30+
benefitInput.trigger("click");
2631
});
2732

2833
leturl=$("#cost_container").attr("calculate_cost_url");
@@ -38,7 +43,12 @@ $(document).ready(function(){
3843
if(costLabel.html()!="Updating cost...")costLabel.html("Submit your application and we'll get in touch...");
3944

4045
letactive=checkboxesContainer.find(`[value=${benefit}]`).prop("checked");
41-
if(!active)return;
46+
if(!active){
47+
letpackageOnlyBenefit=$(this).attr("package_only");
48+
if(packageOnlyBenefit)$(this).attr("disabled",true);
49+
return;
50+
}
51+
4252

4353
$(`#conflicts_with_${benefit}`).children().each(function(){
4454
letconflictId=$(this).html();

‎templates/sponsors/sponsorship_benefits_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h3 class="title">{{ field.label }}</h3>
4848
{% for benefit in field.field.queryset %}
4949
<liclass="{% cycle '' 'highlight' %}">
5050
<labelfor="id_{{field.name}}_{{ forloop.counter0 }}"title="{{ benefit.unavailability_message }}">
51-
<inputid="id_{{field.name}}_{{ forloop.counter0 }}"name="{{ field.name }}"type="checkbox"value="{{ benefit.id }}"{%ifbenefit.unavailability_message%}disabled{%endif%}{%ifbenefit.idinfield.initial%}checked{%endif%}>
51+
<inputid="id_{{field.name}}_{{ forloop.counter0 }}"name="{{ field.name }}"type="checkbox"value="{{ benefit.id }}"{%ifbenefit.unavailability_message%}disabled{%endif%}{%ifbenefit.idinfield.initial%}checked{%endif%}{%ifbenefit.package_only%}package_only='true'{%endif%}>
5252
{{ benefit.name }}
5353
{% if benefit.new %}<spanclass="fa fa-asterisk"></span>{% endif %}
5454
{% if benefit.package_only %}<iclass="fa fa-cubes"></i>{% endif %}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp