From ba2a246951e5ab9884b0969a6955bae14d6c772d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 16 Mar 2011 17:13:34 -0400 Subject: [PATCH] slightly better formatting on events --- plugins/Event/EventPlugin.php | 60 ++++++++++++++++++++++++++--------- plugins/Event/event.css | 9 ++++++ 2 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 plugins/Event/event.css diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index 4159641d08..1a43bac348 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -297,7 +297,7 @@ class EventPlugin extends MicroappPlugin } // @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(); $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); @@ -336,7 +336,7 @@ class EventPlugin extends MicroappPlugin assert(!empty($event)); assert(!empty($profile)); - $out->elementStart('div', 'vevent'); // VEVENT IN + $out->elementStart('div', 'vevent event'); // VEVENT IN $out->elementStart('h3'); // VEVENT/H3 IN @@ -351,39 +351,63 @@ class EventPlugin extends MicroappPlugin $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 $out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN - $out->element('abbr', array('class' => 'dtstart', - 'title' => common_date_iso8601($event->start_time)), - common_exact_date($event->start_time)); - $out->text(' - '); - $out->element('span', array('class' => 'dtend', - 'title' => common_date_iso8601($event->end_time)), - common_exact_date($event->end_time)); - $out->elementEnd('div'); // VEVENT/EVENT-TIMES OUT - if (!empty($event->description)) { - $out->element('div', 'description', $event->description); + $out->element('strong', null, _('Time:')); + + $out->element('abbr', array('class' => 'dtstart', + 'title' => common_date_iso8601()), + $startDate . ' ' . $startTime); + $out->text(' - '); + if ($startDate == $endDate) { + $out->element('span', array('class' => 'dtend', + 'title' => common_date_iso8601($event->end_time)), + $endTime); + } else { + $out->element('span', array('class' => 'dtend', + 'title' => common_date_iso8601($event->end_time)), + $endDate . ' ' . $endTime); } + $out->elementEnd('div'); // VEVENT/EVENT-TIMES OUT + 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(); - $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'), count($rsvps[RSVP::POSITIVE]), count($rsvps[RSVP::NEGATIVE]), count($rsvps[RSVP::POSSIBLE]))); + $out->elementEnd('div'); $user = common_current_user(); if (!empty($user)) { $rsvp = $event->getRSVP($user->getProfile()); - common_log(LOG_DEBUG, "RSVP is: " . ($rsvp ? $rsvp->id : 'none')); if (empty($rsvp)) { $form = new RSVPForm($event, $out); @@ -440,4 +464,10 @@ class EventPlugin extends MicroappPlugin { $action->inlineScript('$(document).ready(function() { $("#startdate").datepicker(); $("#enddate").datepicker(); });'); } + + function onEndShowStyles($action) + { + $action->cssLink($this->path('event.css')); + return true; + } } diff --git a/plugins/Event/event.css b/plugins/Event/event.css new file mode 100644 index 0000000000..a922bb5791 --- /dev/null +++ b/plugins/Event/event.css @@ -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; } +