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(){ $(document).ready(function(){
$("#featured-webapps").delegate( $("#featured-webapps").delegate(
'.remove', 'click', _pd(function() { '.remove',
deleteFromAppsList($("#categories"), 'click',
$(this).data("id")); _pd(function() {
})); deleteFromAppsList($("#categories"), $(this).data("id"));
$("#featured-webapps").delegate( })
"select.localepicker", "change", _pd(function (e) { );
$('#featured-webapps').delegate(
'select.localepicker',
'change',
_pd(function (e) {
var region = $(e.target); var region = $(e.target);
$.ajax({type: 'POST', $.ajax({
url: region.data("url"), type: 'POST',
data: {"region": region.val(), url: region.data('url'),
"app": region.data("id")}}); 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 categories = $("#categories");
var appslist = $("#featured-webapps"); var appslist = $("#featured-webapps");
var p = $.ajax({type: 'GET', var p = $.ajax({type: 'GET',

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

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

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

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