Skip to content

Commit

Permalink
Do thorough touch-ups on all catalog pages except search
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored and asmecher committed Oct 28, 2015
1 parent fbe97b8 commit 4e18c72
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 95 deletions.
55 changes: 50 additions & 5 deletions plugins/themes/default/styles/components.less
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,45 @@

// List of monographs
.cmp_monographs_list {
margin-left: -@double;
margin-right: -@double;
margin-left: -@base;
margin-right: -@base;

> .title {
font-size: @font-bump;
line-height: @triple;
padding: 0 @base;
}

.obj_monograph_summary {
padding: @double;
border-bottom: @bg-border;
padding: @double @base;
}

@media(min-width: @screen-tablet) {
position: relative;
margin-top: @triple * 2;
margin-left: -@double;
margin-right: -@double;
border-top: @bg-border;

> .title {
position: absolute;
top: -15px;
left: @double;
margin: 0;
padding: 0 @base;
background: @lift;
color: @text-light;
}

.obj_monograph_summary {
padding: @triple;
border-bottom: @bg-border;
}

.row:last-child .obj_monograph_summary:last-child,
> .obj_monograph_summary:last-child { // if last is a featured monograph
border-bottom: none;
}
}

@media(min-width: @screen-desktop) {
Expand Down Expand Up @@ -214,16 +247,28 @@

&:first-child {
padding-right: @triple;
border-top: none;
border-right: @bg-border;
}

}

.obj_monograph_summary + .obj_monograph_summary {
padding-left: @triple;
margin-left: -1px; // ensure right/left borders overlap
border-left: @bg-border;
}

.obj_monograph_summary.is_featured {
float: none;
width: 100%;
border-right: none;
border-left: none;
border-bottom: @bg-border;

&:last-child {
border-bottom: none;
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions plugins/themes/default/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@import "main.less";
@import "pages/about.less";
@import "pages/announcements.less";
@import "pages/catalogCategory.less";
@import "pages/index.less";
@import "pages/login.less";
@import "pages/lostPassword.less";
Expand Down
12 changes: 11 additions & 1 deletion plugins/themes/default/styles/objects/monograph_summary.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
.obj_monograph_summary {
.pkp_helpers_clear;

.featured {
display: inline-block;
margin-bottom: @base;
border-bottom: @bg-border;
font-size: @font-sml;
line-height: @line-sml;
color: @text-light;
}

.cover {
display: block;

Expand All @@ -29,8 +38,9 @@
}

.title {
display: block;
font-size: @font-base;
line-height: @line-base;
line-height: 25px;
}

.author {
Expand Down
55 changes: 55 additions & 0 deletions plugins/themes/default/styles/pages/catalogCategory.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* @file plugins/themes/default/styles/pages/catalogCategory.less
*
* Copyright (c) 2014-2015 Simon Fraser University Library
* Copyright (c) 2003-2015 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @brief Styles applying to a category page in the catalog
* @link templates/frontend/pages/catalogCategory.tpl
*/
.page_catalog_category {

.subcategories {

ul {
&:extend(.pkp_unstyled_list);
}

li {
padding-top: @half;
padding-bottom: @half;
}

a {
text-decoration: none;
}

@media(min-width: @screen-tablet) {
position: relative;
margin-top: @triple * 2;
margin-left: -@double;
margin-right: -@double;
padding: @triple;
border-top: @bg-border;
border-bottom: @bg-border;

h3 {
position: absolute;
top: -15px;
left: @double;
margin: 0;
padding-left: @base;
padding-right: @base;
line-height: @triple;
background: @lift;
color: @text-light;
}
}

@media(min-width: @screen-desktop) {
margin-left: -@triple;
margin-right: -@triple;
}
}
}
30 changes: 26 additions & 4 deletions templates/frontend/components/monographList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,41 @@
* @brief Display a list of monographs.
*
* @uses $monographs array List of monographs to display
* @uses $featured array Optional list of monograph IDs to feature in the list
* @uses $titleKey string Optional translation key for a title for the list
*}
<div class="cmp_monographs_list">
{foreach name="monographListLoop" from=$monographs item=monograph}
{if $smarty.foreach.monographListLoop.iteration is odd by 1}

{* Optional title *}
{if $titleKey}
<h3 class="title">
{translate key=$titleKey}
</h3>
{/if}

{* Show featured items first *}
{if $featured && count($featured) > 0}
{foreach from=$featured key=id item=array_key}
{include file="frontend/objects/monograph_summary.tpl" monograph=$monographs[$id] isFeatured=1}
{/foreach}
{/if}

{assign var=counter value=1}
{foreach name="monographListLoop" from=$monographs item=monograph key=key}
{if is_array($featured) && array_key_exists($key, $featured)}
{php}continue;{/php}
{/if}
{if $counter is odd by 1}
<div class="row">
{/if}
{include file="frontend/objects/monograph_summary.tpl" monograph=$monograph}
{if $smarty.foreach.monographListLoop.iteration is even by 1}
{if $counter is even by 1}
</div>
{/if}
{assign var=counter value=$counter+1}
{/foreach}
{* Close .row if we have an odd number of titles *}
{if count($monographs) > 0 && $smarty.foreach.monographListLoop.iteration is odd by 1}
{if $counter > 1 && $counter is even by 1}
</div>
{/if}
</div>
8 changes: 7 additions & 1 deletion templates/frontend/objects/monograph_summary.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@
* @brief Display a summary view of a monograph for display in lists
*
* @uses $monograph Monograph The monograph to be displayed
* @uses $isFeatured bool Is this a featured monograph?
*}
<div class="obj_monograph_summary">
<div class="obj_monograph_summary{if $isFeatured} is_featured{/if}">
<a href="{url page="catalog" op="book" path=$monograph->getId()}" class="cover">
<img alt="{translate key="catalog.coverImageTitle" monographTitle=$monograph->getLocalizedFullTitle()|strip_tags|escape}" src="{url router=$smarty.const.ROUTE_COMPONENT component="submission.CoverHandler" op="thumbnail" submissionId=$monograph->getId() random=$monograph->getId()|uniqid}" />
</a>
{* {if $isFeatured}
<div class="featured">
Featured
</div>
{/if} *}
<a href="{url router=$smarty.const.ROUTE_PAGE page="catalog" op="book" path=$monograph->getId()}" class="title">
{$monograph->getLocalizedFullTitle()}
</a>
Expand Down
19 changes: 4 additions & 15 deletions templates/frontend/pages/catalog.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,14 @@

{* No published titles *}
{if !$publishedMonographs|@count}
<h3>
{translate key="catalog.allBooks"}
</h3>
<p>{translate key="catalog.noTitles"}</p>

{* Monograph List *}
{else}
<div class="cmp_monographs_list">
{foreach name="monographLoop" from=$publishedMonographs item=monograph}
{if $smarty.foreach.monographLoop.iteration is odd by 1}
<div class="row">
{/if}
{include file="frontend/objects/monograph_summary.tpl" monograph=$monograph}
{if $smarty.foreach.monographLoop.iteration is even by 1}
</div>
{/if}
{/foreach}
{* Close .row if we have an odd number of titles *}
{if $smarty.foreach.monographLoop.iteration is odd by 1}
</div>
{/if}
</div>
{include file="frontend/components/monographList.tpl" monographs=$publishedMonographs}
{/if}

</div><!-- .page -->
Expand Down
43 changes: 8 additions & 35 deletions templates/frontend/pages/catalogCategory.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @uses $newReleasesMonographs array List of new monographs in this category
* @uses $parentCategory Category Parent category if one exists
* @uses $subcategories array List of subcategories if they exist
* @uses $alreadyShown array Array of monograph IDs which have already been
* displayed. These IDs are excluded from later sections.
*}
{include file="common/frontend/header.tpl" pageTitleTranslated=$category->getLocalizedTitle()}

Expand Down Expand Up @@ -54,54 +56,25 @@
</li>
{/iterate}
</ul>
<nav>
</nav>
{/if}

{* No published titles in this category *}
{if empty($publishedMonographs)}
<h3>
{translate key="catalog.allBooks"}
</h3>
<p>{translate key="catalog.noTitlesSection"}</p>

{else}

{* Featured monographs *}
{if !empty($featuredMonographIds)}
<h3>
{translate key="catalog.featuredBooks"}
</h3>
<div class="cmp_monographs_list featured">
{assign var="counter" value=1}
{foreach from=$featuredMonographIds item=featuredMonographId}
{if array_key_exists($featuredMonographId, $publishedMonographs)}
{if $counter is odd by 1}
<div class="row">
{/if}
{include file="frontend/objects/monograph_summary.tpl" monograph=$publishedMonographs[$featuredMonographId]}
{if $counter is even by 1}
</div>
{/if}
{assign var=counter value=$counter+1}
{/if}
{/foreach}
{* Close .row if we have an odd number of titles *}
{if $counter > 1 && $counter is even by 1}
</div>
{/if}
</div>
{/if}

{* New releases *}
{if !empty($newReleasesMonographs)}
<h3>
{translate key="catalog.newReleases"}
</h3>
{include file="frontend/components/monographList.tpl" monographs=$newReleasesMonographs}
{include file="frontend/components/monographList.tpl" monographs=$newReleasesMonographs titleKey="catalog.newReleases"}
{/if}

{* All monographs *}
<h3>
{translate key="catalog.allBooks"}
</h3>
{include file="frontend/components/monographList.tpl" monographs=$publishedMonographs}
{include file="frontend/components/monographList.tpl" monographs=$publishedMonographs featured=$featuredMonographIds titleKey="catalog.allBooks"}

{/if}

Expand Down
36 changes: 2 additions & 34 deletions templates/frontend/pages/catalogSeries.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,13 @@

{else}

{* Featured monographs *}
{if !empty($featuredMonographIds)}
<h3>
{translate key="catalog.featuredBooks"}
</h3>
<div class="cmp_monographs_list featured">
{assign var="counter" value=1}
{foreach from=$featuredMonographIds item=featuredMonographId}
{if array_key_exists($featuredMonographId, $publishedMonographs)}
{if $counter is odd by 1}
<div class="row">
{/if}
{include file="frontend/objects/monograph_summary.tpl" monograph=$publishedMonographs[$featuredMonographId]}
{if $counter is even by 1}
</div><!-- .row -->
{/if}
{assign var=counter value=$counter+1}
{/if}
{/foreach}
{* Close .row if we have an odd number of titles *}
{if $counter > 1 && $counter is even by 1}
</div><!-- .row final -->
{/if}
</div><!-- .cmp_monographs_list -->
{/if}

{* New releases *}
{if !empty($newReleasesMonographs)}
<h3>
{translate key="catalog.newReleases"}
</h3>
{include file="frontend/components/monographList.tpl" monographs=$newReleasesMonographs}
{include file="frontend/components/monographList.tpl" monographs=$newReleasesMonographs titleKey="catalog.newReleases"}
{/if}

{* All monographs *}
<h3>
{translate key="catalog.allBooks"}
</h3>
{include file="frontend/components/monographList.tpl" monographs=$publishedMonographs}
{include file="frontend/components/monographList.tpl" monographs=$publishedMonographs featured=$featuredMonographIds titleKey="catalog.allBooks"}

{/if}

Expand Down

0 comments on commit 4e18c72

Please sign in to comment.