aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-23 18:35:48 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-23 18:35:48 +0100
commit1a636d2c97368bc4c4019f4ddcff991ec5eccbce (patch)
treeb8101b2739ddfed34f3f80b5c89fa15de5470739 /views
parentf9bab2fc3dcef0b452782de662ee7739a547079a (diff)
Added events viewer
* Fixes #1286 * Version bump
Diffstat (limited to 'views')
-rw-r--r--views/_events_calendar.haml11
-rw-r--r--views/_events_calendar_day.haml14
-rw-r--r--views/_events_calendar_week.haml2
-rw-r--r--views/_events_form.haml13
-rw-r--r--views/_navbar.haml2
l---------views/events.haml1
-rw-r--r--views/events_calendar.haml11
-rw-r--r--views/events_list.haml18
8 files changed, 71 insertions, 1 deletions
diff --git a/views/_events_calendar.haml b/views/_events_calendar.haml
new file mode 100644
index 0000000..a0ec12b
--- /dev/null
+++ b/views/_events_calendar.haml
@@ -0,0 +1,11 @@
+%table#events_table
+ %tr
+ %th Monday
+ %th Tuesday
+ %th Wednesday
+ %th Thursday
+ %th Friday
+ %th Saturday
+ %th Sunday
+ = partial("events_calendar_week", :collection => @events_by_week )
+
diff --git a/views/_events_calendar_day.haml b/views/_events_calendar_day.haml
new file mode 100644
index 0000000..9682b56
--- /dev/null
+++ b/views/_events_calendar_day.haml
@@ -0,0 +1,14 @@
+%td{:class => (@today.month % 2 == 0 ? "even" : "odd")}
+ %p.event_date
+ %a{:href => "/events/list/#{@today.strftime("%Y-%m-%d")}?#{request.query_string}"}
+ = @today.strftime(((@today - 1.day).month != @today.month) ? "%d %b" : "%d")
+ =partial("history", :collection => events_calendar_day.first(10))
+ %p
+ - if events_calendar_day.length > 10
+ There are
+ = events_calendar_day.length - 10
+ more events to display.
+ - if events_calendar_day.length > 0
+ %a{:href => "/events/list/#{@today.strftime("%Y-%m-%d")}?#{request.query_string}"}
+ Show the whole day.
+ - @today += 1.day
diff --git a/views/_events_calendar_week.haml b/views/_events_calendar_week.haml
new file mode 100644
index 0000000..dd3bb6a
--- /dev/null
+++ b/views/_events_calendar_week.haml
@@ -0,0 +1,2 @@
+%tr
+ = partial("events_calendar_day", :collection => events_calendar_week)
diff --git a/views/_events_form.haml b/views/_events_form.haml
new file mode 100644
index 0000000..8eb9112
--- /dev/null
+++ b/views/_events_form.haml
@@ -0,0 +1,13 @@
+%form{:method => "GET", :action => ""}
+ %label{:for => "subject"}
+ Subject
+ %input{:type => "text", :id => "subject", :name => "alert[subject]", :value => (params["alert"] ? params["alert"]["subject"]: "") }
+ %label{:for => "source"}
+ Source
+ %input{:type => "text", :id => "subject", :name => "alert[source]", :value => (params["alert"] ? params["alert"]["source"] : "") }
+ - Mauve::History.all(:fields => [:type], :unique => true).collect{|h| h.type}.each do |history_type|
+ %label{:for => "history_"+history_type}
+ = history_type.capitalize
+ %input{:type => "checkbox", :name => "history[type][]", :value => "#{history_type}", :checked => (params["history"] && params["history"]["type"].is_a?(Array) ? params["history"]["type"].include?(history_type) : false) }
+ %input{:type => "submit", :value => "Go!"}
+
diff --git a/views/_navbar.haml b/views/_navbar.haml
index aa2b5f5..8b16c55 100644
--- a/views/_navbar.haml
+++ b/views/_navbar.haml
@@ -18,6 +18,8 @@
Cleared (
%span#count_cleared><= @alerts_cleared.length
)
+ %li{:class => [ request.path_info =~ /^\/events/ && "nav_selected"]}
+ %a{:href => '/events/calendar'} Events
%li
%a{:href => '/logout'} Log out
%br
diff --git a/views/events.haml b/views/events.haml
deleted file mode 120000
index 3b8d2e2..0000000
--- a/views/events.haml
+++ /dev/null
@@ -1 +0,0 @@
-not_implemented.haml \ No newline at end of file
diff --git a/views/events_calendar.haml b/views/events_calendar.haml
new file mode 100644
index 0000000..e3cec5e
--- /dev/null
+++ b/views/events_calendar.haml
@@ -0,0 +1,11 @@
+%h2
+ Events Calendar
+
+%p
+ %a{:href => "/events/calendar/#{(@month-31.days).strftime("%Y-%m")}?"+request.query_string}
+ &larr; Previous Month
+ = @month.strftime("%b %Y")
+ %a{:href => "/events/calendar/#{(@month+31.days).strftime("%Y-%m")}?"+request.query_string}
+ Next month &rarr;
+= partial('events_form')
+= partial('events_calendar')
diff --git a/views/events_list.haml b/views/events_list.haml
new file mode 100644
index 0000000..008b667
--- /dev/null
+++ b/views/events_list.haml
@@ -0,0 +1,18 @@
+%h2
+ Events List
+%p
+ %a{:href => "/events/list/#{(@start-1.day-10).strftime("%Y-%m-%d")}?"+request.query_string}
+ &larr; Previous day
+ = @start.strftime("%Y-%m-%d")
+ %a{:href => "/events/list/#{(@start+1.day+10).strftime("%Y-%m-%d")}?"+request.query_string}
+ Next day &rarr;
+ |
+ %a{:href => "/events/calendar/#{@start.strftime("%Y-%m")}?"+request.query_string}
+ Calendar view
+= partial('events_form')
+- if @events.length > 0
+ = partial('history', :collection => @events)
+- else
+ %p
+ %strong
+ No events for today.