This commit is contained in:
Matt Basta 2012-08-09 15:57:32 -07:00 коммит произвёл Allen Short
Родитель 4467b4139f
Коммит e42e0711d2
3 изменённых файлов: 39 добавлений и 21 удалений

Просмотреть файл

@ -63,18 +63,30 @@ function appslistXHR(verb, data) {
$(document).ready(function(){
$("#featured-webapps").delegate(
'.remove', 'click', _pd(function() {
deleteFromAppsList($("#categories"),
$(this).data("id"));
}));
$("#featured-webapps").delegate(
"select.localepicker", "change", _pd(function (e) {
'.remove',
'click',
_pd(function() {
deleteFromAppsList($("#categories"), $(this).data("id"));
})
);
$('#featured-webapps').delegate(
'select.localepicker',
'change',
_pd(function (e) {
var region = $(e.target);
$.ajax({type: 'POST',
url: region.data("url"),
data: {"region": region.val(),
"app": region.data("id")}});
}));
$.ajax({
type: 'POST',
url: region.data('url'),
data: {
'region':
_(region.children('option'))
.filter(function(opt) {return opt.selected})
.map(function(sopt) {return sopt.value}),
'app': region.data('id')
}
});
})
);
var categories = $("#categories");
var appslist = $("#featured-webapps");
var p = $.ajax({type: 'GET',

Просмотреть файл

@ -10,8 +10,15 @@ class FeaturedApp(models.Model):
app = models.ForeignKey(Webapp, null=False)
category = models.ForeignKey(Category, null=True)
is_sponsor = models.BooleanField(default=False)
class Meta:
db_table = 'zadmin_featuredapp'
class FeaturedAppRegionExclusion(models.Model):
featured_app = models.ForeignKey(FeaturedApp, null=False)
region = models.PositiveIntegerField(default=mkt.regions.WORLDWIDE.id,
db_index=True)
class Meta:
db_table = 'zadmin_featuredapp'
db_table = 'zadmin_featuredapp_regionexclusion'

Просмотреть файл

@ -18,17 +18,16 @@
{% endif %}
</td>
<td>{% if row.is_sponsor %}Sponsored{% else %}Not sponsored{% endif %}</td>
<td><select class="localepicker"
data-url="{{ url('zadmin.set_region_ajax') }}"
data-id="{{ row.pk }}">
{% for locName, loc in regions %}
<td>
<select class="localepicker" multiple
data-url="{{ url('zadmin.set_region_ajax') }}"
data-id="{{ row.pk }}">
{%- for locName, loc in regions -%}
<option value="{{ loc.slug }}"
{%- if loc.slug == row.region -%}
selected="selected"
{%- endif -%}
>{{ loc.name }}</option>
{%- if loc.slug == row.region %} selected{%- endif -%}
>{{ loc.name }}</option>
{%- endfor -%}
</select>
</select>
</td>
</tr>
</table>