From 3404aebda95c78a98e477c120354f20891f55c7b Mon Sep 17 00:00:00 2001 From: raylu Date: Sat, 16 Jul 2011 21:27:12 -0700 Subject: search page styling --- controllers/SearchController.php | 11 +++++------ views/elements/search.html.php | 2 +- views/layouts/default.html.php | 2 +- views/search/anime.html.php | 1 + views/search/index.html.php | 36 ++++++++++++++++++++++++++---------- webroot/css/base.css | 16 ++++++++++++---- webroot/css/home.css | 2 +- webroot/css/search.css | 28 ++++++++++++++++++++++++++++ 8 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 webroot/css/search.css diff --git a/controllers/SearchController.php b/controllers/SearchController.php index 805b981..0052992 100644 --- a/controllers/SearchController.php +++ b/controllers/SearchController.php @@ -11,16 +11,15 @@ class SearchController extends \lithium\action\Controller { public function index() { if (isset($this->request->query['q'])) { - $q = '/' . $this->request->query['q'] . '/i'; - $conditions = array('title' => array('like' => $q)); - $limit = 10; - + $q = $this->request->query['q']; + $conditions = array('title' => array('like' => "/$q/i")); + $limit = 7; $anime = Anime::find('all', compact('conditions', 'limit')); $manga = Manga::find('all', compact('conditions', 'limit')); $kdrama = Kdrama::find('all', compact('conditions', 'limit')); - - return compact('anime', 'manga', 'kdrama'); + + return compact('q', 'anime', 'manga', 'kdrama'); } } diff --git a/views/elements/search.html.php b/views/elements/search.html.php index 7169083..4910620 100644 --- a/views/elements/search.html.php +++ b/views/elements/search.html.php @@ -1,4 +1,4 @@ -form->create(null, array('method' => 'get')); ?> +form->create(null, array('method' => 'get', 'class' => 'search')); ?> form->text('q'); ?> form->select('type', array('' => 'All', 'anime' => 'Anime', diff --git a/views/layouts/default.html.php b/views/layouts/default.html.php index bfb04d9..9464d80 100644 --- a/views/layouts/default.html.php +++ b/views/layouts/default.html.php @@ -62,7 +62,7 @@ use \lithium\security\Auth; '; ?> - form->create(null, array('url' => '/search/', 'class' => 'search', 'method' => 'get')); ?> + form->create(null, array('url' => '/search/', 'class' => 'navsearch', 'method' => 'get')); ?> form->text('q', array('placeholder' => 'Search...')); ?> form->end(); ?> diff --git a/views/search/anime.html.php b/views/search/anime.html.php index 94acb84..7fbb6d8 100644 --- a/views/search/anime.html.php +++ b/views/search/anime.html.php @@ -1,6 +1,7 @@ styles($this->html->style('pagination')); $this->styles($this->html->style('table')); +$this->styles($this->html->style('search')); ?> _render('element', 'search') ?> diff --git a/views/search/index.html.php b/views/search/index.html.php index a05f269..f8889e2 100644 --- a/views/search/index.html.php +++ b/views/search/index.html.php @@ -1,15 +1,31 @@ styles($this->html->style('table')); +$this->styles($this->html->style('search')); ?> -

Anime

+_render('element', 'search') ?> + +

Anime

+
_render('element', 'animetable', compact('anime')) ?> -html->link("More", array('controller' => 'search', - 'action' => 'anime')); ?> -

Manga

-html->link("More", array('controller' => 'search', - 'action' => 'anime')); ?> - -

K Drama

-html->link("More", array('controller' => 'search', - 'action' => 'anime')); ?> +

+More +

+ +

Manga

+
+

results

+ 0): ?> +

+More +

+ + +

K-Drama

+
+

results

+ 0): ?> +

+More +

+ diff --git a/webroot/css/base.css b/webroot/css/base.css index 2e69090..29fd2c3 100644 --- a/webroot/css/base.css +++ b/webroot/css/base.css @@ -36,6 +36,7 @@ h2.ribbon { clear: left; left: -67px; top: -33px; + margin-bottom: -20px; z-index: -1; } @@ -231,7 +232,7 @@ p { -webkit-border-radius:20px; } -.search { +form.navsearch { float: right; margin-top: 5px; } @@ -250,13 +251,12 @@ form input, form textarea { -webkit-border-radius: 3px; } input[type="button"], input[type="submit"], button { + padding: 6px 5px; /* looks high in FF at inherited 7 5 */ + line-height: 18px; /* looks small in webkit at 6 5 */ cursor: pointer; display: inline-block; font-weight: 700; outline: none; - width: auto; - text-align: center; - vertical-align: middle; background: #ddd; color: #444; text-shadow: 0 -1px 0 #eee; @@ -267,6 +267,14 @@ input[type="button"], input[type="submit"], button { input[type="button"]:hover, input[type="submit"]:hover, button:hover { background: #eee; } +form select { + padding: 6px 5px; + border: 1px solid #ccc; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + background-color: #eee; +} div#login { text-align: center; diff --git a/webroot/css/home.css b/webroot/css/home.css index 74f3b14..beafe88 100644 --- a/webroot/css/home.css +++ b/webroot/css/home.css @@ -12,7 +12,7 @@ div#sg_left { left: 0; bottom: -1px; width: 3%; - background: -moz-linear-gradient(left, rgba(255,255,255,1), rgba(255,255,255,0)); + background: -moz-linear-gradient(left, rgba(255,255,255,1), rgba(255,255,255,0)); background: -webkit-linear-gradient(left, rgba(255,255,255,1), rgba(255,255,255,0)); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffffff00', GradientType=1); z-index: 1; diff --git a/webroot/css/search.css b/webroot/css/search.css new file mode 100644 index 0000000..ff9907e --- /dev/null +++ b/webroot/css/search.css @@ -0,0 +1,28 @@ +form.search { + text-align: center; +} +form.search input[type="text"] { + width: 700px; +} +p.more { + text-align: center; + margin: 15px; +} +p.more a { + padding: 7px 10px; + border: 1px solid #aaa; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + background: #ddd; + background: -moz-linear-gradient(top, #ddd, #bbb); + background: -webkit-linear-gradient(top, rgba(255,255,255,1), rgba(255,255,255,0)); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffffff00', GradientType=1); + color: #111; +} +p.more a:hover { + background: #eee; + background: -moz-linear-gradient(top, #eee, #ccc); + background: -webkit-linear-gradient(top, rgba(255,255,255,1), rgba(255,255,255,0)); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffffff00', GradientType=1); +} -- cgit v1.2.3