Skip to content

Commit

Permalink
Bug 592548, authors and license
Browse files Browse the repository at this point in the history
  • Loading branch information
potch committed Oct 9, 2010
1 parent 356042e commit d545531
Show file tree
Hide file tree
Showing 11 changed files with 542 additions and 54 deletions.
21 changes: 14 additions & 7 deletions apps/devhub/forms.py
Expand Up @@ -15,7 +15,7 @@ class AuthorForm(happyforms.ModelForm):

class Meta:
model = AddonUser
exclude = ('addon', 'position')
exclude = ('addon')


class BaseAuthorFormSet(BaseModelFormSet):
Expand Down Expand Up @@ -50,10 +50,12 @@ def LicenseForm(*args, **kw):

class _Form(happyforms.ModelForm):
builtin = forms.TypedChoiceField(choices=cs, coerce=int,
widget=forms.RadioSelect())
widget=forms.RadioSelect(attrs={'class': 'license'}))
name = forms.CharField(widget=TranslationTextInput(),
label="What is your license\'s name?",
required=False, initial=_('Custom License'))
text = forms.CharField(widget=TranslationTextarea(), required=False)
text = forms.CharField(widget=TranslationTextarea(), required=False,
label="Provide the text of your license.")

class Meta:
model = License
Expand Down Expand Up @@ -83,11 +85,16 @@ def save(self, commit=True):

class PolicyForm(happyforms.ModelForm):
"""Form for editing the add-ons EULA and privacy policy."""
has_eula = forms.BooleanField(required=False)
eula = forms.CharField(widget=TranslationTextarea(), required=False)
has_priv = forms.BooleanField(required=False)
has_eula = forms.BooleanField(required=False,
label=_("This add-on has an End User License Agreement"))
eula = forms.CharField(widget=TranslationTextarea(),
required=False,
label="Please specify your add-on\'s End User License Agreement:")
has_priv = forms.BooleanField(required=False,
label=_("This add-on has a Privacy Policy"))
privacy_policy = forms.CharField(widget=TranslationTextarea(),
required=False)
required=False,
label=_('Please specify your add-on\'s privacy policy:'))

class Meta:
model = Addon
Expand Down
84 changes: 76 additions & 8 deletions apps/devhub/templates/devhub/addons/owner.html
Expand Up @@ -10,16 +10,84 @@
{{ dev_breadcrumbs(addon) }}
<h2>{{ title }}</h2>
</header>
<section class="primary" role="main">
<form method="post" action="">
<section id="edit-addon" class="primary" role="main">
<form method="post" class="item" action="">
{{ csrf() }}
<table>{{ user_form|safe }}</table>
{% if version %}
<table>{{ license_form|safe }}</table>
{% endif %}
<table>{{ policy_form|safe }}</table>
<button type="submit">GO GO GO</button>
<div class="item_wrapper">
<table>
{{ user_form.management_form|safe }}
<tr>
<th>Authors</th>
<td>
<ul id="author_list">
{% for form in user_form.forms %}
<li class="{{ 'blank' if loop.last else 'author' }} initial">
<span class="handle">&nbsp;</span>
{{ form.user|safe }}
{{ form.role|safe }}
{{ form.listed|safe }}{{ form.listed.label_tag()|safe }}
{{ form.id|safe }}
<span class="js-hidden delete">{{ form.DELETE|safe }}{{ form.DELETE.label_tag()|safe }}</span>
<span class="js-hidden position">{{ form.position|safe }}</span>
<a href="#" class="remove">x</a>
</li>
{% endfor %}
</td>
</tr>
<tr>
<th>License</th>
<td>
{% if version %}
{{ license_form.builtin|safe }}
{% endif %}
<div class="license-other {{ 'hidden' if not license_form.initial.builtin == license_other_val }}"
data-val="{{ license_other_val }}">
{{ license_form.name.label_tag()|safe }}
{{ license_form.name|safe }}
{{ license_form.text.label_tag()|safe }}
{{ license_form.text|safe }}
</div>
</td>
</tr>
<tr>
<th>{{ _('EULA') }}</th>
<td>
{{ policy_form.has_eula|safe }}
{{ policy_form.has_eula.label_tag()|safe }}
<div class="eula {{ 'hidden' if not policy_form.initial.has_eula }}">
{{ policy_form.eula.label_tag()|safe }}
{{ policy_form.eula|safe }}
</div>
</td>
</tr>
<tr>
<th>{{ _('Privacy Policy') }}</th>
<td>
{{ policy_form.has_priv|safe }}
{{ policy_form.has_priv.label_tag()|safe }}
<div class="priv {{ 'hidden' if not policy_form.initial.has_priv }}">
{{ policy_form.privacy_policy.label_tag()|safe }}
{{ policy_form.privacy_policy|safe }}
</div>
</td>
</tr>
</table>
</div>
<div class="listing-footer"><button type="submit">{{ _('Save Changes') }}</button></div>
</form>
{% with form=user_form.empty_form %}
<div id="user-form-template" class="hidden">
<li class="blank">
<span class="handle">&nbsp;</span>
{{ form.user|safe }}
{{ form.role|safe }}
{{ form.listed|safe }}{{ form.listed.label_tag()|safe }}
<span class="js-hidden">{{ form.DELETE|safe }}{{ form.DELETE.label_tag()|safe }}</span>
<span class="js-hidden position">{{ form.position|safe }}</span>
<a href="#" class="remove">x</a>
</li>
</div>
{% endwith %}
</section>
{% include "devhub/includes/addons_edit_nav.html" %}
{% endblock %}
2 changes: 1 addition & 1 deletion apps/devhub/views.py
Expand Up @@ -159,7 +159,7 @@ def addons_owner(request, addon_id, addon):
return jingo.render(request, 'devhub/addons/owner.html',
dict(addon=addon, user_form=user_form, version=version,
license_form=version and license_form, license_urls=license_urls,
policy_form=policy_form))
policy_form=policy_form, license_other_val=License.OTHER))


@dev_required
Expand Down
110 changes: 73 additions & 37 deletions media/css/zamboni/developers.css
Expand Up @@ -49,12 +49,12 @@
width: 130px;
vertical-align: top;
padding: 8px 20px 8px 0;
border-top: 1px dashed #ADD0DC;
border-top: 1px dotted #ADD0DC;
}

#edit-addon table td {
padding: 8px 0;
border-top: 1px dashed #ADD0DC;
border-top: 1px dotted #ADD0DC;
}

#edit-addon table, #edit-addon tbody {
Expand All @@ -72,7 +72,8 @@
height: 75px;
}

#edit-addon .help {
#edit-addon .help,
#edit-addon .remove {
-moz-border-radius: 20px;
-webkit-border-radius :20px;
border-radius: 20px;
Expand All @@ -89,6 +90,14 @@
width: 18px;
}

#edit-addon .remove {
cursor: pointer;
line-height: 16px;
float: right;
margin-top: 2px;
}

#edit-addon .remove:hover,
#edit-addon tr:hover .help {
background-color: #CCC;
}
Expand Down Expand Up @@ -210,7 +219,7 @@
font-size: 1.1em;
}
.item-group {
border-top: 1px dashed #aecfda;
border-top: 1px dotted #aecfda;
margin-top: 0.5em;
padding-top: 0.5em;
}
Expand Down Expand Up @@ -322,6 +331,66 @@ h3 a.subscribe-feed:hover {

/* @end */

/* @group Ownership */
#author_list .email-autocomplete {
width: 220px;
padding-right:20px;
}
#author_list {
padding-top: 4px;
}
#author_list li {
padding: 8px 0;
border-bottom: 1px dotted #ADD0DC;
}
#author_list .blank {
border: 0;
}
#author_list li > label,
#author_list li > input,
#author_list li > select {
margin-right: .5em;
}
#author_list .handle {
width: 20px;
height: 16px;
display: inline-block;
cursor: move;
background: url(../../img/zamboni/icons/icon-draggable.png) no-repeat 0 center;
}
#author_list .blank * {
display: none;
}
#author_list .blank .email-autocomplete {
display: inline;
margin-left: 23px;
}
input.invalid {
background: url(../../img/zamboni/notifications.png) no-repeat 229px -160px;
}
input.valid {
background: url(../../img/zamboni/notifications.png) no-repeat 226px -367px;
}
.license-other input {
margin-bottom: 1em;
}
#edit-addon .priv label,
#edit-addon .eula label,
#edit-addon .license-other label {
font-weight: bold;
margin-bottom: .5em;
}
#edit-addon .priv,
#edit-addon .eula,
#edit-addon .license-other {
margin: 16px 0 0 32px;
}
.eula label,
.priv label {
font-weight: bold;
}
/* @end */

/* @group Recent Activity */
.secondary-feed {
padding: 1em 0 0 1em;
Expand All @@ -343,39 +412,6 @@ h3 a.subscribe-feed:hover {
.inactive-1 { color: red; }
/* @end */

/* @group Tables */

table {
border-bottom: 1px solid #666;
}

caption {
font-weight: bold;
padding-bottom: 0.539em; /* 7px */
font-size:1.231em; /* 16px */
}

thead th {
border-top: 1px solid #666;
border-bottom: 3px solid #666;
padding-top: 0;
padding-bottom: 0.539em; /* 7px */
}

tbody {
border-top: 3px solid #666; /* not rendered in IE6/7 */
}

tbody tr th, tbody tr td {
border-top: 1px solid #ddd;
}

th, td {
text-align: left;
padding: 0.308em 0.537em 0.214em 0.231em; /* 4px 7px 3px 7px */
}

/* @end */

/* @group Header and main navigation bar */
.section {
Expand Down
Binary file added media/img/zamboni/icon-valid.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/img/zamboni/icons/icon-draggable.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/img/zamboni/notifications.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d545531

Please sign in to comment.