Commit 65e723234172883514d1f2e00614e326dcbed0a5
1 parent
0834d18f
Exists in
master
and in
29 other branches
Replaced link_to with button class by button
Also: - Removed unused code - Fixed identation (ActionItem2587)
Showing
5 changed files
with
9 additions
and
15 deletions
Show diff stats
app/controllers/public/events_controller.rb
@@ -17,8 +17,6 @@ class EventsController < PublicController | @@ -17,8 +17,6 @@ class EventsController < PublicController | ||
17 | events_in_range = profile.events.by_range((@date - 1.month).at_beginning_of_month .. (@date + 1.month).at_end_of_month) | 17 | events_in_range = profile.events.by_range((@date - 1.month).at_beginning_of_month .. (@date + 1.month).at_end_of_month) |
18 | 18 | ||
19 | @calendar = populate_calendar(@date, events_in_range) | 19 | @calendar = populate_calendar(@date, events_in_range) |
20 | - @previous_calendar = populate_calendar(@date - 1.month, events_in_range) | ||
21 | - @next_calendar = populate_calendar(@date + 1.month, events_in_range) | ||
22 | end | 20 | end |
23 | 21 | ||
24 | def events_by_day | 22 | def events_by_day |
app/controllers/public/search_controller.rb
@@ -114,8 +114,6 @@ class SearchController < PublicController | @@ -114,8 +114,6 @@ class SearchController < PublicController | ||
114 | 114 | ||
115 | events = @searches[@asset][:results] | 115 | events = @searches[@asset][:results] |
116 | @calendar = populate_calendar(@date, events) | 116 | @calendar = populate_calendar(@date, events) |
117 | - @previous_calendar = populate_calendar(@date - 1.month, events) | ||
118 | - @next_calendar = populate_calendar(@date + 1.month, events) | ||
119 | end | 117 | end |
120 | 118 | ||
121 | # keep old URLs workings | 119 | # keep old URLs workings |
app/helpers/dates_helper.rb
@@ -139,7 +139,7 @@ module DatesHelper | @@ -139,7 +139,7 @@ module DatesHelper | ||
139 | previous_month_date = date - 1.month | 139 | previous_month_date = date - 1.month |
140 | 140 | ||
141 | label ||= show_month(previous_month_date.year, previous_month_date.month) | 141 | label ||= show_month(previous_month_date.year, previous_month_date.month) |
142 | - link_to label, {:year => previous_month_date.year, :month => previous_month_date.month}, {:class => 'button icon-back with-text'} | 142 | + button(:back, label, {:year => previous_month_date.year, :month => previous_month_date.month}) |
143 | end | 143 | end |
144 | 144 | ||
145 | def link_to_next_month(year, month, label = nil) | 145 | def link_to_next_month(year, month, label = nil) |
@@ -147,7 +147,7 @@ module DatesHelper | @@ -147,7 +147,7 @@ module DatesHelper | ||
147 | next_month_date = date + 1.month | 147 | next_month_date = date + 1.month |
148 | 148 | ||
149 | label ||= show_month(next_month_date.year, next_month_date.month) | 149 | label ||= show_month(next_month_date.year, next_month_date.month) |
150 | - link_to label, {:year => next_month_date.year, :month => next_month_date.month}, {:class => 'button icon-next with-text'} | 150 | + button(:next, label, {:year => next_month_date.year, :month => next_month_date.month}) |
151 | end | 151 | end |
152 | 152 | ||
153 | def pick_date(object, method, options = {}, html_options = {}) | 153 | def pick_date(object, method, options = {}, html_options = {}) |
app/models/event.rb
@@ -29,26 +29,23 @@ class Event < Article | @@ -29,26 +29,23 @@ class Event < Article | ||
29 | end | 29 | end |
30 | end | 30 | end |
31 | 31 | ||
32 | -named_scope :by_day, lambda { |date| | ||
33 | - { | ||
34 | - :conditions => ['start_date = :date AND end_date IS NULL OR (start_date <= :date AND end_date >= :date)', {:date => date}], | 32 | + named_scope :by_day, lambda { |date| |
33 | + { :conditions => ['start_date = :date AND end_date IS NULL OR (start_date <= :date AND end_date >= :date)', {:date => date}], | ||
35 | :order => 'start_date ASC' | 34 | :order => 'start_date ASC' |
36 | } | 35 | } |
37 | } | 36 | } |
38 | 37 | ||
39 | -named_scope :next_events_from_month, lambda { |date| | 38 | + named_scope :next_events_from_month, lambda { |date| |
40 | date_temp = date.strftime("%Y-%m-%d") | 39 | date_temp = date.strftime("%Y-%m-%d") |
41 | - { | ||
42 | - :conditions => ["start_date >= ?","#{date_temp}"], | 40 | + { :conditions => ["start_date >= ?","#{date_temp}"], |
43 | :limit => 10, | 41 | :limit => 10, |
44 | :order => 'start_date ASC' | 42 | :order => 'start_date ASC' |
45 | } | 43 | } |
46 | } | 44 | } |
47 | 45 | ||
48 | -named_scope :by_month, lambda { |date| | 46 | + named_scope :by_month, lambda { |date| |
49 | date_temp = date.strftime("%Y-%m") | 47 | date_temp = date.strftime("%Y-%m") |
50 | - { | ||
51 | - :conditions => ["EXTRACT(YEAR FROM start_date) = ? AND EXTRACT(MONTH FROM start_date) = ?",date.year,date.month], | 48 | + { :conditions => ["EXTRACT(YEAR FROM start_date) = ? AND EXTRACT(MONTH FROM start_date) = ?",date.year,date.month], |
52 | :limit => 10, | 49 | :limit => 10, |
53 | :order => 'start_date ASC' | 50 | :order => 'start_date ASC' |
54 | } | 51 | } |
lib/noosfero/plugin.rb