polish Marketplace homepage (bug 757588)

This commit is contained in:
Chris Van 2012-05-27 19:46:54 -07:00
Родитель a155ec0461
Коммит 5931d81abd
15 изменённых файлов: 434 добавлений и 85 удалений

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

@ -4,7 +4,7 @@
// Colors below should be one-time use only.
border-top: 1px solid #c2c8cc;
border-bottom: 1px solid #bdc2c5;
.gradient-two-color(rgba(176,186,192, 0.33), rgba(187,195,199, 0.33));
.header-dark-gradient;
color: @text;
margin-bottom: 24px;
.light-text-shadow;
@ -48,8 +48,8 @@
&.dark {
.box-shadow(inset 0 1px 2px rgba(0,0,0,.15));
.grain;
background-color: darken(#404f5a,3%);
border-top: darken(#404f5a, 5%) 1px solid;
background-color: darken(@header-dark-bg, 3%);
border-top: darken(@header-dark-bg, 5%) 1px solid;
border-bottom: darken(@bg, 30%) 1px solid;
margin-bottom: 0;
color: @white;

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

@ -2,7 +2,7 @@
#site-header {
.border-box;
background: #394C58 url(../../img/mkt/grain.png);
background: @grain-src @navy-gray;
height: 82px;
h1, form {
line-height: 30px;
@ -20,6 +20,7 @@
}
form {
float: right;
position: relative;
}
.menu-button {
height: 28px;
@ -256,22 +257,26 @@
}
}
.featured.slider {
background-image: url(../../img/mkt/grain.png),
background-image: @grain-src,
linear-gradient(#394C58, #60747F);
background-image: url(../../img/mkt/grain.png),
background-image: @grain-src,
-moz-linear-gradient(#394C58, #60747F);
background-image: url(../../img/mkt/grain.png),
background-image: @grain-src,
-webkit-linear-gradient(#394C58, #60747F);
background-image: url(../../img/mkt/grain.png),
background-image: @grain-src,
-webkit-gradient(linear, left bottom, left top, from(#60747F), to(#394C58));
}
#site-header {
height: 53px;
height: 50px;
h1 {
padding: 1px 0 0;
padding: 3px 7px 0 0;
a {
height: 43px;
width: 50px;
}
}
.menu-button {
margin-top: 14px;
margin-top: 17px;
}
nav #flyout {
right: 0;
@ -285,5 +290,13 @@
right: 7px;
}
}
#search {
float: left;
margin: 14px 0 0;
}
#search-q {
.width(5);
.max-width(3);
}
}
}

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

@ -7,7 +7,7 @@
.home {
/* Cover the box-shadow from #page */
#site-header:after {
background: url(../../img/mkt/grain.png) #394C58;
background: @grain-src @navy-gray;
content: "";
display: block;
height: 4px;
@ -19,15 +19,15 @@
}
.homepage-promo {
background-image: url(../../img/mkt/grain.png),
linear-gradient(#394C58, #60747F);
background-image: url(../../img/mkt/grain.png),
-moz-linear-gradient(#394C58, #60747F);
background-image: url(../../img/mkt/grain.png),
-webkit-linear-gradient(#394C58, #60747F);
background-image: url(../../img/mkt/grain.png),
-webkit-gradient(linear, left bottom, left top, from(#60747F), to(#394C58));
/*.gradient-two-color(#394C58, #60747F);*/
background-image: @grain-src,
linear-gradient(@navy-gray, @header-bg);
background-image: @grain-src,
-moz-linear-gradient(@navy-gray, @header-bg);
background-image: @grain-src,
-webkit-linear-gradient(@navy-gray, @header-bg);
background-image: @grain-src,
-webkit-gradient(linear, left bottom, left top, from(@header-bg), to(@navy-gray));
/*.gradient-two-color(@navy-gray, @header-bg);*/
min-height: 320px;
overflow: hidden;
color: @white;
@ -59,6 +59,11 @@
}
}
/* Hide narrow-specific stuff. (For "Popular" and "New" tabbed sections.) */
.narrow {
display: none;
}
@media (max-width: @10col) {
.homepage-promo {
div {
@ -74,10 +79,9 @@
.home {
#site-header:after,
.homepage-promo,
.popular,
.categories,
.promo-slider p,
h2 {
.featured h2 {
display: none;
}
.featured {
@ -127,15 +131,10 @@
}
#search {
// TODO: Expose search results when clicking on magnifying-glass icon.
#search-q {
display: none;
}
button {
background: none;
}
#find {
.border-radius(15px);
background-color: darken(@navy-gray, 20%);
display: none;
height: 18px;
margin-top: 3px;
position: relative;
@ -167,4 +166,20 @@
}
}
}
/* Show narrow-specific stuff. */
.wide {
display: none;
}
.narrow {
display: block;
}
/* Toggle tabbed content. */
[data-group], .narrow[data-group] {
display: none;
}
[data-shown], .narrow[data-shown] {
display: block;
}
}

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

@ -29,6 +29,7 @@
// Colors
@link: #2d87ca;
@link-bright: #5be;
@link-dark: darken(@link, 10%);
@faded-link: fadeOut(@link, 50%);
@shadow-blue: #98B2C9;
@border-blue: #C9DDF2;
@ -46,12 +47,16 @@
@medium-gray: #666;
@gray: #888;
@note-gray: #999;
@bg-gray: #bbb;
@light-gray: #ccc;
@faint-gray: #eee;
@barely-gray: #fcfcfc;
@white: #fff;
@bg: #dee3e6;
@pale-bg: #eff1f3;
@header-bg: #60747f;
@header-dark-bg: #404f5a;
@tab-bg: rgb(123,137,144);
@yellow: #ffe;
@gold: darken(@yellow, 75%);
@ -65,12 +70,14 @@
// Mixins
@grain-src: url(../../img/mkt/grain.png);
.grain() {
background-image: url(../../img/mkt/grain.png);
background-image: @grain-src;
}
@arrow-src: url(../../img/mkt/arrows/plain.png);
.arrow() {
background: url(../../img/mkt/arrows/plain.png) no-repeat;
background: @arrow-src no-repeat;
}
.light-text-shadow() {
@ -207,3 +214,13 @@
.hsprite-pos(@pos, @spacing, @offset:0) {
background-position: (@spacing * @pos * -1 + @offset) + 0px 0;
}
// Depressed button/link styles
.depressed() {
.box-shadow(inset 0 8px 20px 6px rgba(0,0,0,.1),
inset 0 0 1px 1px rgba(0,0,0,.1));
}
.header-dark-gradient() {
.gradient-two-color(rgba(176,186,192,.33), rgba(187,195,199,.33));
}

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

@ -1,5 +1,30 @@
@import 'lib';
.item-arrows() {
&:after {
.arrow;
content: "";
display: block;
opacity: .7;
position: absolute;
top: 15px;
right: 10px;
height: 18px;
width: 18px;
}
&:hover,
&:active {
background: @faint-gray;
.box-shadow(none);
&:after {
opacity: 1;
}
}
&:active {
.depressed;
}
}
.promo-grid, .slider {
h3 {
font-size: 18px;
@ -26,13 +51,14 @@
.light-text-shadow;
background: fadeOut(@light-gray, 50%);
display: block;
height: 100px;
height: 64px;
padding: 10px 10px 10px 90px;
position: relative;
text-decoration: none;
&:hover {
background: @faint-gray;
.box-shadow(0 1px 2px fadeOut(@black, 50%));
color: darken(@text, 10%);
}
&:active {
background: @light-gray;
@ -46,13 +72,18 @@
top: 10px;
left: 10px;
}
.author {
h3, .author {
.ellipsis;
padding-bottom: 1px;
}
.author {
display: block;
margin: 5px 0;
font-style: normal;
}
.price {
position: absolute;
bottom: 7px;
font-size: 15px;
line-height: 17px;
font-weight: bold;
@ -65,3 +96,167 @@
padding: 10px 90px 10px 10px;
}
}
@media (max-width: @4col) {
#page > section.popular {
padding-left: 0;
padding-right: 0;
}
.popular {
&.tabbed {
background: @grain-src @header-bg;
&:after {
background: @bg;
border-top: 1px solid @medium-gray;
height: 6px;
content: "";
display: block;
position: relative;
top: -5px;
z-index: 2;
}
}
.tabnav {
float: left;
position: relative;
width: 100%;
span, span:before {
background: @tab-bg;
}
span {
color: @faint-gray;
cursor: pointer;
float: left;
font-size: 17px;
line-height: 19px;
margin: 0;
padding: 10px;
position: relative;
text-shadow: .5px .5px 0 @text;
z-index: 2;
width: 70px;
&:before {
.border-radius(0 25px 0 0);
content: "";
display: block;
float: right;
position: absolute;
top: 0;
right: -40px;
height: 100%;
width: 40px;
}
&:after {
.border-radius(20px 0 0 30px);
border: 10px solid @tab-bg;
border-width: 30px 10px 5px;
border-color: transparent transparent @tab-bg @tab-bg;
content: "";
display: block;
float: right;
position: absolute;
bottom: -2px;
right: -50px;
height: 0;
width: 0;
z-index: 0;
}
&[data-shown] {
color: @text;
font-weight: bold;
outline: none;
text-shadow: .5px .5px 0 @white;
z-index: 3;
&:after {
border-color: transparent transparent @bg @bg;
}
}
&[data-shown],
&[data-shown]:before {
background: @bg;
}
+ span {
padding-left: 55px;
&[data-shown] {
margin-left: 45px;
padding-left: 10px;
}
}
}
}
}
.view-more a {
.item-arrows;
background: @faint-gray;
border-top: 1px solid @light-gray;
display: block;
font-weight: 600;
font-size: 14px;
line-height: 16px;
opacity: .8;
padding: 15px 10px;
position: relative;
&:hover {
opacity: 1;
}
}
.promo-grid {
h3 {
font-size: 14px;
line-height: 16px;
margin: 0;
text-shadow: .2px .2px 0 @barely-gray;
}
.author {
color: @gray;
margin: 0;
}
a:hover {
.author {
color: @medium-gray;
}
}
.price {
font-size: 13px;
bottom: 7px;
}
ul {
background: @bg;
margin: 0 0 -9px;
position: relative;
top: -9px;
z-index: 3;
}
li {
.border-box;
border-bottom: 1px solid @light-gray;
float: none;
margin: 0;
width: 100%;
+ li {
border-top: 1px solid @faint-gray;
}
&:last-child {
border-bottom: 0;
}
&:nth-child(2n) {
a {
background: none;
}
}
img {
top: 5px;
}
a {
background: fadeOut(@light-gray, 75%);
padding: 10px 40px 0 100px;
.item-arrows;
}
}
}
.html-rtl .promo-grid {
li a {
padding: 10px 100px 10px 40px;
}
}
}

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

@ -28,8 +28,7 @@ a {
body {
color: @text;
overflow-x: hidden;
background-color: @pale-bg;
background-image: url(../../img/mkt/grain.png);
background: @grain-src @pale-bg;
}
.balloon {
@ -147,22 +146,31 @@ body {
.grain;
padding: 16px;
text-align: center;
.account {
width: auto;
.logout {
text-transform: lowercase;
}
}
.footer-links {
margin: 15px auto;
a:before {
content: "\00b7";
display: inline-block;
margin: 0 5px 0 3px;
color: @gray;
}
a:hover:before {
text-decoration: none;
}
a:first-child:before {
content: none;
}
+ .button {
margin: 8px 0 2px;
a {
&:before {
content: "\00b7";
display: inline-block;
margin: 0 5px 0 3px;
color: @gray;
}
&:first-child:before {
content: none;
}
&:hover,
&:hover:before {
text-decoration: none;
}
&:hover {
color: @link-dark;
}
}
}
}
@ -192,23 +200,51 @@ body {
padding-right: 10px;
}
}
#search {
display: none;
}
#site-footer {
padding: 15px 0;
background: @grain-src @pale-bg;
padding: 0;
.account {
.box-shadow(inset 0 1px 2px rgba(0,0,0,.15));
.header-dark-gradient;
background: @grain-src darken(@header-dark-bg, 3%);
border-top: @navy-gray 1px solid;
color: @white;
padding: 15px 0;
text-shadow: 0 1px 0 rgba(0,0,0,.5);
&.authenticated {
a {
color: lighten(@link-bright, 10%);
&:hover {
color: lighten(@link-bright, 25%);
}
}
}
}
.footer-links {
background: @grain-src @pale-bg;
margin: 0;
text-align: left;
a {
background: @bg;
border-bottom: 1px solid @light-gray;
border-top: 1px solid @white;
display: block;
padding: 10px;
font-size: 18px;
border-bottom: 1px solid black;
padding: 7px 10px;
font-size: 16px;
&:first-child {
border-top: 1px solid black;
border-top-color: @navy-gray;
}
&:last-child {
border-bottom-color: @note-gray;
}
&:before {
content: none;
display: none;
}
&:hover {
background: rgba(255,255,255,.5);
}
&:active {
.depressed;
}
}
}
@ -253,6 +289,7 @@ body {
@media (max-width: @4col) {
#page {
.box-shadow(none);
margin-top: 0;
}
}

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

@ -50,7 +50,7 @@
right: 0;
bottom: 0;
margin: auto;
background: url(../../img/mkt/arrows/plain-lrg-go.png) 0 0 no-repeat;
background: url(../../img/mkt/arrows/plain-lrg-go.png) no-repeat;
}
&:hover:after {
background-position: 0 -19px;
@ -124,6 +124,9 @@
vertical-align: top;
width: 264px;
.img {
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: contain;
width: 264px;
height: 184px;
display: block;
@ -257,8 +260,16 @@
}
@media (max-width: @4col) {
.promo-slider ul li {
margin-right: 11px;
.promo-slider ul {
a:after {
bottom: 5px;
right: 5px;
}
li {
margin-right: 11px;
}
}
.featured.slider {
border-bottom: 0;
}
}

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

@ -55,7 +55,7 @@
bottom: -5px;
left: 0;
visibility: hidden;
z-index: 2;
z-index: 3;
.width(3);
&.visible {
opacity: 1;
@ -80,7 +80,7 @@
position: absolute;
top: -5px;
right: 13px;
z-index: 3;
z-index: 4;
width: 12px;
}
}
@ -98,7 +98,7 @@
display: block;
position: relative;
text-decoration: none;
z-index: 4;
z-index: 5;
&:after {
clear: both;
content: ".";

21
media/js/mkt/home.js Normal file
Просмотреть файл

@ -0,0 +1,21 @@
(function() {
z.page.on('fragmentloaded', function() {
var $nav = $('.tabnav');
if ($nav.length) {
// Clicking on "Popular" or "New" toggles its respective tab.
$nav.on('click', '[data-show]', function() {
var $this = $(this),
group = $this.data('show');
// The previously selected tab + section are no longer "shown."
z.page.find('[data-shown]').removeAttr('data-shown');
// Mark the new section as "shown."
z.page.find(format('[data-group={0}]', group)).attr('data-shown', true);
// Mark the tab as "shown."
$this.attr('data-shown', true);
});
}
});
})();

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

@ -85,7 +85,6 @@ z.page.on('fragmentloaded', function() {
return;
}
$('.categories h3').linefit();
$('.promo-grid h3').lineclamp(2);
$('.slider').each(function() {
var currentPage,
$this = $(this),

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

@ -210,6 +210,9 @@ JS = {
# Account settings.
'js/mkt/account.js',
# Homepage.
'js/mkt/home.js',
# Detail page.
'js/mkt/detail.js',
'js/mkt/lightbox.js',

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

@ -27,14 +27,41 @@
{{ featured|promo_slider(feature=True) }}
</section>
{% if popular %}
<section id="home-popular" class="popular full">
<section class="popular tabbed narrow full">
<div>
<div class="tabnav c">
<span data-show="popular" data-shown class="popular">{{ _('Popular') }}</span>
<span data-show="new" class="new">{{ _('New') }}</span>
</div>
</div>
</section>
<section id="home-popular" class="popular tabbed wide full">
<div>
<h2><a href="{{ url('browse.apps')|urlparams(sort='popular') }}">
{{ _('Popular') }}</a></h2>
</div>
</section>
<section class="popular slider full">
{{ popular|promo_slider }}
<section data-group="popular" data-shown class="popular grid full">
{{ popular|promo_grid }}
</section>
<section data-group="popular" data-shown class="narrow popular view-more full">
<div>
<a href="{{ url('browse.apps')|urlparams(sort='popular') }}">
{{ _('View more') }}</a>
</div>
</section>
<section class="hidden">
<h2><a href="{{ url('browse.apps')|urlparams(sort='created') }}">
{{ _('New') }}</a></h2>
</section>
<section data-group="new" class="narrow popular grid full">
{{ latest|promo_grid }}
</section>
<section data-group="new" class="narrow popular view-more full">
<div>
<a href="{{ url('browse.apps')|urlparams(sort='created') }}">
{{ _('View more') }}</a>
</div>
</section>
{% endif %}
{{ category_slider() }}

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

@ -3,13 +3,16 @@ import jingo
from mkt.webapps.models import Webapp
# TODO: Cache this soooo hard.
def home(request):
"""The home page."""
if not getattr(request, 'can_view_consumer', True):
return jingo.render(request, 'home/home_walled.html')
featured = Webapp.featured('home')[:3]
featured = Webapp.featured('home')[:6]
popular = Webapp.popular()[:6]
latest = Webapp.latest()[:6]
return jingo.render(request, 'home/home.html', {
'featured': featured,
'popular': popular
'popular': popular,
'latest': latest
})

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

@ -62,18 +62,18 @@
{% block sitefooter %}
<footer id="site-footer">
{% if logged %}
signed in as
{% if request.can_view_consumer %}
<a href="{{ request.user.get_profile().get_url_path() }}">
{{ request.amo_user.email }}</a>
<div class="account{{ ' authenticated' if logged }}">
{% if logged %}
{% trans profile_url=request.user.get_profile().get_url_path(),
user=request.amo_user.email %}
signed in as <a href="{{ profile_url }}">{{ user }}</a>
{% endtrans %}
<a href="{{ url('users.logout') }}" class="logout">
({{ _('Log Out') }})</a>
{% else %}
{{ request.amo_user.email }}
<a class="button browserid" href="#">{{ _('Log in / Register') }}</a>
{% endif %}
<a href="{{ url('users.logout') }}">(log out)</a>
{% else %}
<a class="button browserid" href="#">{{ _('Log in / Register') }}</a>
{% endif %}
</div>
<nav class="footer-links">
{% if logged %}
{% for link in tools_links %}

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

@ -296,13 +296,21 @@ class Webapp(Addon):
else:
return cls.objects.none()
@classmethod
def from_search(cls):
return cls.search().filter(type=amo.ADDON_WEBAPP,
status=amo.STATUS_PUBLIC,
is_disabled=False)
@classmethod
def popular(cls):
"""Elastically grab the most popular apps."""
return (cls.search().filter(type=amo.ADDON_WEBAPP,
status=amo.STATUS_PUBLIC,
is_disabled=False)
.order_by('-weekly_downloads'))
return cls.from_search().order_by('-weekly_downloads')
@classmethod
def latest(cls):
"""Elastically grab the most recent apps."""
return cls.from_search().order_by('-created')
# Pull all translated_fields from Addon over to Webapp.