slightly better formatting on events

This commit is contained in:
Evan Prodromou 2011-03-16 17:13:34 -04:00
parent 47cd5f311c
commit ba2a246951
2 changed files with 54 additions and 15 deletions

View File

@ -297,7 +297,7 @@ class EventPlugin extends MicroappPlugin
} }
// @fixme we have to start the name/avatar and open this div // @fixme we have to start the name/avatar and open this div
$out->elementStart('div', array('class' => 'event-info entry-content')); // EVENT-INFO.ENTRY-CONTENT IN $out->elementStart('div', array('class' => 'event-info')); // EVENT-INFO.ENTRY-CONTENT IN
$profile = $notice->getProfile(); $profile = $notice->getProfile();
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE); $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
@ -336,7 +336,7 @@ class EventPlugin extends MicroappPlugin
assert(!empty($event)); assert(!empty($event));
assert(!empty($profile)); assert(!empty($profile));
$out->elementStart('div', 'vevent'); // VEVENT IN $out->elementStart('div', 'vevent event'); // VEVENT IN
$out->elementStart('h3'); // VEVENT/H3 IN $out->elementStart('h3'); // VEVENT/H3 IN
@ -351,39 +351,63 @@ class EventPlugin extends MicroappPlugin
$out->elementEnd('h3'); // VEVENT/H3 OUT $out->elementEnd('h3'); // VEVENT/H3 OUT
$startDate = strftime("%x", $event->start_time);
$startTime = strftime("%R", $event->start_time);
$endDate = strftime("%x", $event->end_time);
$endTime = strftime("%R", $event->end_time);
// FIXME: better dates // FIXME: better dates
$out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN $out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN
$out->element('strong', null, _('Time:'));
$out->element('abbr', array('class' => 'dtstart', $out->element('abbr', array('class' => 'dtstart',
'title' => common_date_iso8601($event->start_time)), 'title' => common_date_iso8601()),
common_exact_date($event->start_time)); $startDate . ' ' . $startTime);
$out->text(' - '); $out->text(' - ');
if ($startDate == $endDate) {
$out->element('span', array('class' => 'dtend', $out->element('span', array('class' => 'dtend',
'title' => common_date_iso8601($event->end_time)), 'title' => common_date_iso8601($event->end_time)),
common_exact_date($event->end_time)); $endTime);
$out->elementEnd('div'); // VEVENT/EVENT-TIMES OUT } else {
$out->element('span', array('class' => 'dtend',
if (!empty($event->description)) { 'title' => common_date_iso8601($event->end_time)),
$out->element('div', 'description', $event->description); $endDate . ' ' . $endTime);
} }
$out->elementEnd('div'); // VEVENT/EVENT-TIMES OUT
if (!empty($event->location)) { if (!empty($event->location)) {
$out->element('div', 'location', $event->location); $out->elementStart('div', 'event-location');
$out->element('strong', null, _('Location: '));
$out->element('span', 'location', $event->location);
$out->elementEnd('div');
}
if (!empty($event->description)) {
$out->elementStart('div', 'event-description');
$out->element('strong', null, _('Description: '));
$out->element('span', 'description', $event->description);
$out->elementEnd('div');
} }
$rsvps = $event->getRSVPs(); $rsvps = $event->getRSVPs();
$out->element('div', 'event-rsvps', $out->elementStart('div', 'event-rsvps');
$out->element('strong', null, _('Attending: '));
$out->element('span', 'event-rsvps',
sprintf(_('Yes: %d No: %d Maybe: %d'), sprintf(_('Yes: %d No: %d Maybe: %d'),
count($rsvps[RSVP::POSITIVE]), count($rsvps[RSVP::POSITIVE]),
count($rsvps[RSVP::NEGATIVE]), count($rsvps[RSVP::NEGATIVE]),
count($rsvps[RSVP::POSSIBLE]))); count($rsvps[RSVP::POSSIBLE])));
$out->elementEnd('div');
$user = common_current_user(); $user = common_current_user();
if (!empty($user)) { if (!empty($user)) {
$rsvp = $event->getRSVP($user->getProfile()); $rsvp = $event->getRSVP($user->getProfile());
common_log(LOG_DEBUG, "RSVP is: " . ($rsvp ? $rsvp->id : 'none'));
if (empty($rsvp)) { if (empty($rsvp)) {
$form = new RSVPForm($event, $out); $form = new RSVPForm($event, $out);
@ -440,4 +464,10 @@ class EventPlugin extends MicroappPlugin
{ {
$action->inlineScript('$(document).ready(function() { $("#startdate").datepicker(); $("#enddate").datepicker(); });'); $action->inlineScript('$(document).ready(function() { $("#startdate").datepicker(); $("#enddate").datepicker(); });');
} }
function onEndShowStyles($action)
{
$action->cssLink($this->path('event.css'));
return true;
}
} }

9
plugins/Event/event.css Normal file
View File

@ -0,0 +1,9 @@
.event-tags li { display: inline; }
.event-mentions li { display: inline; }
.event-avatar { float: left; }
.event-notice-count { float: right; }
.event-info { float: left; }
.event-title { margin-left: 0px; }
#content .event .entry-title { margin-left: 0px; }
#content .event .entry-content { margin-left: 0px; }