Merge lp:~barry-mcgee/ubuntu-brand-guidelines/search-ui-improvements into lp:ubuntu-brand-guidelines

Proposed by Barry McGee
Status: Merged
Approved by: Graham Bancroft
Approved revision: 49
Merged at revision: 50
Proposed branch: lp:~barry-mcgee/ubuntu-brand-guidelines/search-ui-improvements
Merge into: lp:ubuntu-brand-guidelines
Diff against target: 292 lines (+106/-62)
5 files modified
css/scratch.css (+49/-3)
loop-search-downloads.php (+10/-12)
loop-search-examples.php (+8/-13)
loop-search-guidelines.php (+11/-13)
template-search.php (+28/-21)
To merge this branch: bzr merge lp:~barry-mcgee/ubuntu-brand-guidelines/search-ui-improvements
Reviewer Review Type Date Requested Status
Graham Bancroft (community) Approve
Review via email: mp+285224@code.launchpad.net

Description of the change

## Done

Updated search page to make it clearer to the user where the different search results are coming from.

## Qa
Run code, try and search - make sure layout is not broken.

## Note
It looks like searching for examples is broken. I'll raise another bug for this as it's outside the scope of this bug.

To post a comment you must log in.
Revision history for this message
Graham Bancroft (gbancroft-canonical) wrote :

Lgtm +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'css/scratch.css'
2--- css/scratch.css 2016-01-27 10:34:32 +0000
3+++ css/scratch.css 2016-02-05 17:57:30 +0000
4@@ -310,8 +310,6 @@
5 */
6 .loop-results {
7 margin-left: 0;
8-
9- border-top: 1px dotted #aea79f;
10 }
11 .loop-results li {
12 font-size: 13px;
13@@ -328,6 +326,12 @@
14 .loop-results li.loop-error {
15 width: auto;
16 }
17+
18+.loop-error {
19+ font-size: .825rem;
20+ color: #888;
21+}
22+
23 /* END loop results */
24
25 #loop-examples .loop-results li a:first-child,
26@@ -404,6 +408,48 @@
27 #form-filter-search input[type='submit']:hover {
28 background: url('../img/button-form-filter-search.png') 0 0 no-repeat transparent;
29 }
30+
31+
32+.search-section {
33+ margin-bottom: 3rem;
34+}
35+
36+.search-results {
37+ border-top: 0;
38+}
39+
40+.search-result {
41+ margin-bottom: 1rem;
42+ padding-bottom: 1rem;
43+}
44+
45+.search-result-title {
46+ margin-bottom: .25rem;
47+}
48+
49+.search-result-link {
50+ display: block;
51+ margin-bottom: .5rem;
52+ font-size: .825rem;
53+}
54+
55+.search-result-last-updated {
56+ display: block;
57+ margin-bottom: .5rem;
58+ font-size: .825rem;
59+ color: #888;
60+}
61+
62+
63+.search-result-link a:hover {
64+ text-decoration: none;
65+}
66+
67+.search-result-subtitle {
68+ margin-bottom: 2rem;
69+}
70+
71+
72 /* END search styles */
73
74 /*
75@@ -837,7 +883,7 @@
76 }
77
78 .cookie-policy .link-cta {
79- background-image: url(../img/icons/close-orange.svg);
80+ background-image: url(https://assets.ubuntu.com/v1/3f057022-close-orange.svg);
81 background-repeat: no-repeat;
82 color: #fff;
83 float: right;
84
85=== modified file 'loop-search-downloads.php'
86--- loop-search-downloads.php 2014-10-21 16:38:46 +0000
87+++ loop-search-downloads.php 2016-02-05 17:57:30 +0000
88@@ -1,24 +1,22 @@
89+<ul class="loop-results search-downloads clearfix">
90+<h2 class="search-result-subtitle">Results in Downloads:</h2>
91 <?php
92-// Get posts
93-$args = array();
94+
95 $args['post_type'] = 'downloads';
96-if (!empty($search)) {
97- $args['s'] = $search;
98-}
99 $query = new WP_Query($args);
100-?>
101-<ul class="loop-results search-downloads clearfix">
102-<?php
103+
104 if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
105 // Get post attachments
106 $args = array();
107 $args['post_type'] = 'attachment';
108 $args['post_parent'] = $post->ID;
109 $attachments = get_posts($args);
110+?>
111+<?php
112 foreach ($attachments as $attachment) :
113 if ($attachment->ID != get_post_thumbnail_id($post->ID)) :
114 ?>
115- <li>
116+ <div class="search-result">
117 <a href="<?php echo wp_get_attachment_url($attachment->ID, false); ?>"<?php $terms = (wp_get_post_terms($post->ID, 'metadata')); foreach ($terms as $term) : if ($term->slug == 'colour-white') : echo ' class="colour-white"'; endif; endforeach; ?>>
118 <?php if (preg_match('/image/i', $attachment->post_mime_type)) : ?>
119 <img src="<?php echo wp_get_attachment_thumb_url($attachment->ID); ?>" width="66" height="66" title="<?php echo $attachment->post_excerpt; ?>" alt="<?php echo $attachment->post_excerpt; ?>" />
120@@ -34,15 +32,15 @@
121 <a href="<?php echo wp_get_attachment_url($attachment->ID, false); ?>">
122 Download <?php echo getPostAttachmentExtension($attachment->post_mime_type) . ' (' . getPostAttachmentFilesize(get_attached_file($attachment->ID)) . ')'; ?>
123 </a>
124- </li>
125+ </div>
126 <?php
127 endif;
128 endforeach;
129 endwhile;
130 else :
131 ?>
132- <li class="loop-error">Sorry, no results have been found</li>
133+ <span class="loop-error">Sorry, no results in Downloads have been found.</span>
134 <?php
135 endif;
136 ?>
137-</ul>
138\ No newline at end of file
139+</ul>
140
141=== modified file 'loop-search-examples.php'
142--- loop-search-examples.php 2014-10-21 16:38:46 +0000
143+++ loop-search-examples.php 2016-02-05 17:57:30 +0000
144@@ -1,36 +1,31 @@
145+<h2 class="search-result-subtitle">Results in Examples:</h2>
146+<ul class="loop-results search-examples clearfix">
147 <?php
148-// Get posts
149-$args = array();
150+
151 $args['post_type'] = 'examples';
152-if (!empty($search)) {
153- $args['s'] = $search;
154-}
155 $query = new WP_Query($args);
156-?>
157-<ul class="loop-results search-examples clearfix">
158-<?php
159+
160 if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
161 // Get post attachments
162 $args = array();
163 $args['post_type'] = 'attachment';
164 $args['post_parent'] = $post->ID;
165 $attachments = get_posts($args);
166-echo 'HELLO';
167 foreach ($attachments as $attachment) :
168 ?>
169- <li>
170+ <div class="search-result">
171 <a class="pretty-photo" href="<?php echo wp_get_attachment_url($attachment->ID, false); ?>">
172 <img src="<?php echo wp_get_attachment_thumb_url($attachment->ID); ?>" width="66" height="66" title="<?php echo $attachment->post_excerpt; ?>" alt="<?php echo $attachment->post_excerpt; ?>" />
173 </a>
174 <?php echo $attachment->post_excerpt; ?>
175- </li>
176+ </div>
177 <?php
178 endforeach;
179 endwhile;
180 else :
181 ?>
182- <li class="loop-error">Sorry, no results have been found</li>
183+ <span class="loop-error">Sorry, no results in examples have been found.</span>
184 <?php
185 endif;
186 ?>
187-</ul>
188\ No newline at end of file
189+</ul>
190
191=== modified file 'loop-search-guidelines.php'
192--- loop-search-guidelines.php 2014-10-21 16:38:46 +0000
193+++ loop-search-guidelines.php 2016-02-05 17:57:30 +0000
194@@ -1,23 +1,21 @@
195+<h2 class="search-result-subtitle">Results in Guidelines:</h2>
196 <?php
197-// Get posts
198-$args = array();
199+
200 $args['post_type'] = 'page';
201-if (!empty($search)) {
202- $args['s'] = $search;
203-}
204 $query = new WP_Query($args);
205-?>
206-<ul class="loop-results search-guidelines">
207-<?php
208-if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
209-?>
210- <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?> &rsaquo;</a></li>
211+
212+if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
213+ <div class="search-result">
214+ <h3 class="search-result-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?> &rsaquo;</a></h3>
215+ <span class="search-result-link"><a href="<?php the_permalink(); ?>"><?php the_permalink(); ?></a></span>
216+ <span class="search-result-last-updated">Last updated: <?php the_modified_time('F jS, Y');?></span>
217+ </div>
218+
219 <?php
220 endwhile;
221 else :
222 ?>
223- <li class="loop-error">Sorry, no results have been found</li>
224+ <span class="loop-error">Sorry, no results in guidelines have been found.</span>
225 <?php
226 endif;
227 ?>
228-</ul>
229\ No newline at end of file
230
231=== modified file 'template-search.php'
232--- template-search.php 2014-10-21 16:38:46 +0000
233+++ template-search.php 2016-02-05 17:57:30 +0000
234@@ -4,30 +4,37 @@
235 */
236 $template_body_id = 'search';
237 $template_body_class = 'search';
238+$args = array();
239+if (!empty($search)) {
240+ $args['s'] = $search;
241+}
242 ?>
243
244 <?php get_header(); ?>
245-<div class="row no-border">
246+<div class="row no-border search-results">
247 <div class="twelve-col">
248- <h1>Your search:</h1>
249- </div>
250-
251- <div class="four-col">
252- <h2>Guidelines</h2>
253-
254- <?php get_template_part('loop', 'search-guidelines'); ?>
255- </div>
256-
257- <div class="four-col">
258- <h2>Examples</h2>
259-
260- <?php get_template_part('loop', 'search-examples'); ?>
261- </div>
262-
263- <div class="four-col last-col">
264- <h2>Downloads</h2>
265-
266- <?php get_template_part('loop', 'search-downloads'); ?>
267- </div>
268+ <h1>Your search for: "<?php echo $search ?>"</h1>
269+ </div>
270+
271+
272+ <section class="search-section twelve-col">
273+ <?php
274+ get_template_part('loop', 'search-guidelines');
275+ ?>
276+ </section>
277+
278+ <section class="search-section twelve-col">
279+ <?php
280+ get_template_part('loop', 'search-examples');
281+ ?>
282+ </section>
283+
284+ <section class="search-section last-col">
285+ <?php
286+ get_template_part('loop', 'search-downloads');
287+ ?>
288+ </section>
289+
290+
291 </div>
292 <?php get_footer(); ?>

Subscribers

People subscribed via source and target branches