Skip to content

Commit

Permalink
Fixed 'delete event' feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
denny committed Sep 25, 2010
1 parent 3d0e266 commit 8696d01
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This file vaguely documents the revision history for ShinyCMS. Newest items
are at the top.


2010-09-25
- Deleting events now works.

2010-09-21
- Added contact email field to events.

Expand Down
3 changes: 1 addition & 2 deletions docs/Features
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ version of ShinyCMS.
* Link to external event website
* Link to external ticket-booking website
* Link to Google Map for event location
* Add new events
* Edit existing events
* Add/Edit/Delete events
* Supply search results to site-wide search

* Shop
Expand Down
3 changes: 2 additions & 1 deletion docs/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ future (short or long term).
- Provide 'add to GCal' link
- Provide 'add to iCal' link
- Provide 'add to Outlook' link
- Delete event
* Add/edit events
- Add event to Facebook via API
- Recurring events
- Per event mailing lists??

Expand Down
14 changes: 13 additions & 1 deletion lib/ShinyCMS/Controller/Events.pm
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ List all events for the back-end
sub list_events : Chained( 'base' ) : PathPart( 'list' ) : Args( 0 ) {
my ( $self, $c ) = @_;

my $events = $self->admin_get_events( $c, 100 );
my $events = $self->admin_get_events( $c, 50 );

$c->stash->{ events } = $events;
}
Expand Down Expand Up @@ -294,6 +294,18 @@ sub edit_event_do : Chained( 'base' ) : PathPart( 'edit-event-do' ) : Args( 1 )
# Check user privs
die unless $c->user->has_role( 'Events Admin' ); # TODO

# Process deletions
if ( defined $c->request->params->{ delete } && $c->request->param( 'delete' ) eq 'Delete' ) {
$c->model( 'DB::Event' )->search({ id => $event_id })->delete;

# Shove a confirmation message into the flash
$c->flash->{ status_msg } = 'Event deleted';

# Bounce to the default page
$c->response->redirect( $c->uri_for( 'list' ) );
return;
}

my $start_date = $c->request->param( 'start_date' ) .' '. $c->request->param( 'start_time' );
my $end_date = $c->request->param( 'end_date' ) .' '. $c->request->param( 'end_time' );

Expand Down
2 changes: 1 addition & 1 deletion root/events/edit_event.tt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $(document).ready(
<p>
<input type="submit" value="Save" />
<input type="reset" value="Reset" />
<input name="delete" type="submit" value="Delete" />
<input name="delete" type="submit" value="Delete" onclick="javascript:return confirm('Are you sure you want to delete this event?')" />
</p>
</form>

0 comments on commit 8696d01

Please sign in to comment.