Search form markup and style

This commit is contained in:
sarven 2009-01-24 00:58:12 +00:00
parent 57ba50c4c8
commit 18eb40c988
4 changed files with 77 additions and 32 deletions

View File

@ -8,6 +8,7 @@
* @package Laconica * @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca> * @author Evan Prodromou <evan@controlyourself.ca>
* @author Robin Millette <millette@controlyourself.ca> * @author Robin Millette <millette@controlyourself.ca>
* @author Sarven Capadisli <csarven@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://laconi.ca/ * @link http://laconi.ca/
* *
@ -90,7 +91,7 @@ class NoticesearchAction extends SearchAction
} }
if ($cnt > 0) { if ($cnt > 0) {
$terms = preg_split('/[\s,]+/', $q); $terms = preg_split('/[\s,]+/', $q);
$this->elementStart('ul', array('id' => 'notices')); $this->elementStart('ul', array('class' => 'notices'));
for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) { for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
if ($notice->fetch()) { if ($notice->fetch()) {
$this->showNotice($notice, $terms); $this->showNotice($notice, $terms);
@ -147,23 +148,26 @@ class NoticesearchAction extends SearchAction
return; return;
} }
// XXX: RDFa // XXX: RDFa
$this->elementStart('li', array('class' => 'notice_single', $this->elementStart('li', array('class' => 'hentry notice',
'id' => 'notice-' . $notice->id)); 'id' => 'notice-' . $notice->id));
$this->elementStart('div', 'entry-title');
$this->elementStart('span', 'vcard author');
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$this->elementStart('a', array('href' => $profile->profileurl)); $this->elementStart('a', array('href' => $profile->profileurl));
$this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
'class' => 'avatar stream', 'class' => 'avatar photo',
'width' => AVATAR_STREAM_SIZE, 'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE,
'alt' => 'alt' =>
($profile->fullname) ? $profile->fullname : ($profile->fullname) ? $profile->fullname :
$profile->nickname)); $profile->nickname));
$this->element('span', 'nickname fn', $profile->nickname);
$this->elementEnd('a'); $this->elementEnd('a');
$this->element('a', array('href' => $profile->profileurl, $this->elementEnd('span');
'class' => 'nickname'),
$profile->nickname);
// FIXME: URL, image, video, audio // FIXME: URL, image, video, audio
$this->elementStart('p', array('class' => 'content')); $this->elementStart('p', array('class' => 'entry-content'));
if ($notice->rendered) { if ($notice->rendered) {
$this->raw($this->highlight($notice->rendered, $terms)); $this->raw($this->highlight($notice->rendered, $terms));
} else { } else {
@ -173,20 +177,52 @@ class NoticesearchAction extends SearchAction
$this->raw($this->highlight(common_render_content($notice->content, $notice), $terms)); $this->raw($this->highlight(common_render_content($notice->content, $notice), $terms));
} }
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('div');
$noticeurl = common_local_url('shownotice', array('notice' => $notice->id)); $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
$this->elementStart('p', 'time'); $this->elementStart('div', 'entry-content');
$this->element('a', array('class' => 'permalink', $this->elementStart('dl', 'timestamp');
'href' => $noticeurl, $this->element('dt', null, _('Published'));
'title' => common_exact_date($notice->created)), $this->elementStart('dd', null);
common_date_string($notice->created)); $this->elementStart('a', array('rel' => 'bookmark',
'href' => $noticeurl));
$dt = common_date_iso8601($notice->created);
$this->element('abbr', array('class' => 'published',
'title' => $dt),
common_date_string($notice->created));
$this->elementEnd('a');
$this->elementEnd('dd');
$this->elementEnd('dl');
$this->elementEnd('div');
$this->elementStart('div', 'notice-options');
if ($notice->reply_to) { if ($notice->reply_to) {
$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to)); $replyurl = common_local_url('shownotice',
$this->text(' ('); array('notice' => $this->notice->reply_to));
$this->element('a', array('class' => 'inreplyto', $this->elementStart('dl', 'response');
'href' => $replyurl), $this->element('dt', null, _('To'));
_('in reply to...')); $this->elementStart('dd');
$this->text(')'); $this->element('a', array('href' => $replyurl,
'rel' => 'in-reply-to'),
_('in reply to'));
$this->elementEnd('dd');
$this->elementEnd('dl');
} }
$reply_url = common_local_url('newnotice',
array('replyto' => $profile->nickname));
$this->elementStart('dl', 'notice_reply');
$this->element('dt', null, _('Reply to this notice'));
$this->elementStart('dd');
$this->elementStart('a', array('href' => $reply_url,
'title' => _('Reply to this notice')));
$this->text(_('Reply'));
$this->element('span', 'notice_id', $notice->id);
$this->elementEnd('a');
$this->elementEnd('dd');
$this->elementEnd('dl');
$this->elementStart('a', $this->elementStart('a',
array('href' => common_local_url('newnotice', array('href' => common_local_url('newnotice',
array('replyto' => $profile->nickname)), array('replyto' => $profile->nickname)),
@ -194,10 +230,8 @@ class NoticesearchAction extends SearchAction
'title' => _('reply'), 'title' => _('reply'),
'class' => 'replybutton')); 'class' => 'replybutton'));
$this->hidden('posttoken', common_session_token()); $this->hidden('posttoken', common_session_token());
$this->raw('&rarr;');
$this->elementEnd('a'); $this->elementEnd('a');
$this->elementEnd('p'); $this->elementEnd('div');
$this->elementEnd('li'); $this->elementEnd('li');
} }

View File

@ -114,17 +114,21 @@ class SearchAction extends Action
$q = $this->trimmed('q'); $q = $this->trimmed('q');
$page = $this->trimmed('page', 1); $page = $this->trimmed('page', 1);
$this->elementStart('form', array('method' => 'get', $this->elementStart('form', array('method' => 'get',
'id' => 'login', 'id' => 'form_search',
'class' => 'form_settings',
'action' => common_local_url($this->trimmed('action')))); 'action' => common_local_url($this->trimmed('action'))));
$this->elementStart('p'); $this->elementStart('fieldset');
$this->element('legend', null, _('Search site'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
if (!isset($config['site']['fancy']) || !$config['site']['fancy']) { if (!isset($config['site']['fancy']) || !$config['site']['fancy']) {
$this->hidden('action', $this->trimmed('action')); $this->hidden('action', $this->trimmed('action'));
} }
$this->input('q', '', $q); $this->input('q', 'Keyword(s)', $q);
$this->text(' ');
$this->submit('search', 'Search'); $this->submit('search', 'Search');
$this->elementEnd('li');
$this->elementEnd('p'); $this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
if ($q) { if ($q) {
$this->showResults($q, $page); $this->showResults($q, $page);

View File

@ -82,7 +82,7 @@ class SearchGroupNav extends Widget
$this->out->menuItem(common_local_url('noticesearch', $args), _('Notice'), $this->out->menuItem(common_local_url('noticesearch', $args), _('Notice'),
_('Find content of notices'), $action_name == 'noticesearch', 'nav_search_notice'); _('Find content of notices'), $action_name == 'noticesearch', 'nav_search_notice');
$this->out->menuItem(common_local_url('groupsearch', $args), _('Group'), $this->out->menuItem(common_local_url('groupsearch', $args), _('Group'),
_('Find groups on this site'), $action_name == 'groupsearch', 'nav_search_notice'); _('Find groups on this site'), $action_name == 'groupsearch', 'nav_search_group');
$this->action->elementEnd('ul'); $this->action->elementEnd('ul');
} }
} }

View File

@ -151,7 +151,8 @@ font-weight:bold;
#editgroup legend, #editgroup legend,
#form_tag_user legend, #form_tag_user legend,
#form_remote_subscribe legend, #form_remote_subscribe legend,
#form_openid_login legend { #form_openid_login legend,
#form_search legend {
display:none; display:none;
} }
@ -181,7 +182,8 @@ width:90%;
#form_login p.form_guide, #form_login p.form_guide,
#form_register #settings_rememberme p.form_guide, #form_register #settings_rememberme p.form_guide,
#form_openid_login #settings_rememberme p.form_guide, #form_openid_login #settings_rememberme p.form_guide,
#settings_twitter_remove p.form_guide { #settings_twitter_remove p.form_guide,
#form_search ul.form_data #q {
margin-left:0; margin-left:0;
} }
@ -192,6 +194,11 @@ border-radius:4px;
padding:0 7px; padding:0 7px;
} }
#form_search .submit {
margin-left:11px;
}
address { address {
float:left; float:left;
@ -627,11 +634,11 @@ border-radius:4px;
.entity_tags ul { .entity_tags ul {
list-style-type:none; list-style-type:none;
display:inline;
} }
.entity_tags li { .entity_tags li {
display:inline; display:inline;
margin-right:1em; margin-right:4px;
float:left;
} }
.aside .section { .aside .section {