This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lookup tool for websites (bug 1161865)
- Loading branch information
Showing
18 changed files
with
251 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Changing Websites:Review to Websites:* and removing duplicate Stats:View. | ||
UPDATE groups SET rules='Apps:*,Websites:*,Users:Edit,Stats:View,AdminTools:View,AccountLookup:View,AppLookup:View,Lookup:View' WHERE name='Staff'; | ||
UPDATE groups SET rules=CONCAT(rules, ',WebsiteLookup:View') WHERE name IN ('Staff', 'Support Staff', 'Carriers and Operators'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h1> | ||
{{ _('Website Lookup results for') }} | ||
<a href="{{ website.get_url_path() }}" | ||
title="{{ _('Website Detail') }}">{{ website.name }}</a> | ||
({{ website.pk }}) | ||
</h1> | ||
|
||
<section class="column-a"> | ||
<img src="{{ website.get_icon_url(64) }}"> | ||
<nav class="shortcuts" role="navigation"> | ||
<ul> | ||
{# TODO: Add "Edit Listing" for admins/staff (bug 1161867) #} | ||
</ul> | ||
</nav> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<section class="island"> | ||
<form method="post" class="lookup-search-form" id="website-search-form"> | ||
{{ csrf() }} | ||
<label> | ||
{{ _('Website Lookup') }} | ||
</label> | ||
<input type="search" id="website-search" name="q" autocomplete="off"> | ||
<input type="hidden" id="website-lang" name="lang" autocomplete="off" value="{{ request.LANG|default('en-US') }}"> | ||
<button>{{ _('Search') }}</button> | ||
<ul id="website-search-suggestions" class="search-suggestions" | ||
data-src="{{ url('lookup.website_search') }}"></ul> | ||
</form> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{% extends 'lookup/base.html' %} | ||
|
||
{% block breadcrumbs %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
{% include 'lookup/includes/website_search.html' %} | ||
|
||
<section class="island c transaction-lookup"> | ||
{{ website_header(website, 'summary') }} | ||
|
||
<section class="column-b"> | ||
<dl> | ||
<dt>{{ _('Title') }}</dt> | ||
<dd>{{ website.title }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Name - Short Name') }}</dt> | ||
<dd>{{ website.name }} - {{ website.short_name }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Description') }}</dt> | ||
<dd>{{ website.description }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('URL') }}</dt> | ||
<dd>{{ website.url }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Mobile URL') }}</dt> | ||
<dd>{{ website.mobile_url }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Keywords') }}</dt> | ||
<dd>{{ website.keywords_list|join(', ') }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Preferred Regions') }}</dt> | ||
<dd>{{ website.get_preferred_regions(sort_by='name')|map(attribute='name')|join(', ') }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Categories') }}</dt> | ||
<dd>{{ website.categories|categories_names|join(', ') }}</dd> | ||
</dl> | ||
<dl> | ||
<dt>{{ _('Status') }}</dt> | ||
<dd> | ||
{{ mkt.STATUS_CHOICES[website.status] }} | ||
{% if website.is_disabled %} | ||
({{ _('disabled') }}) | ||
{% endif %} | ||
</dd> | ||
</dl> | ||
</section> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.core.urlresolvers import reverse | ||
|
||
from nose.tools import eq_ | ||
|
||
from mkt.lookup.serializers import WebsiteLookupSerializer | ||
from mkt.site.tests import ESTestCase | ||
from mkt.websites.indexers import WebsiteIndexer | ||
from mkt.websites.utils import website_factory | ||
|
||
|
||
class TestWebsiteLookupSerializer(ESTestCase): | ||
|
||
def setUp(self): | ||
self.website = website_factory() | ||
self.refresh('website') | ||
|
||
def serialize(self): | ||
obj = WebsiteIndexer.search().filter( | ||
'term', id=self.website.pk).execute().hits[0] | ||
return WebsiteLookupSerializer(obj).data | ||
|
||
def test_basic(self): | ||
data = self.serialize() | ||
eq_(data['id'], self.website.id) | ||
eq_(data['name'], {'en-US': self.website.name}) | ||
eq_(data['url'], | ||
reverse('lookup.website_summary', args=[self.website.id])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.