Commit 65e723234172883514d1f2e00614e326dcbed0a5

Authored by Daniela Feitosa
1 parent 0834d18f

Replaced link_to with button class by button

Also:
- Removed unused code
- Fixed identation

(ActionItem2587)
app/controllers/public/events_controller.rb
... ... @@ -17,8 +17,6 @@ class EventsController < PublicController
17 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 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 20 end
23 21  
24 22 def events_by_day
... ...
app/controllers/public/search_controller.rb
... ... @@ -114,8 +114,6 @@ class SearchController < PublicController
114 114  
115 115 events = @searches[@asset][:results]
116 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 117 end
120 118  
121 119 # keep old URLs workings
... ...
app/helpers/dates_helper.rb
... ... @@ -139,7 +139,7 @@ module DatesHelper
139 139 previous_month_date = date - 1.month
140 140  
141 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 143 end
144 144  
145 145 def link_to_next_month(year, month, label = nil)
... ... @@ -147,7 +147,7 @@ module DatesHelper
147 147 next_month_date = date + 1.month
148 148  
149 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 151 end
152 152  
153 153 def pick_date(object, method, options = {}, html_options = {})
... ...
app/models/event.rb
... ... @@ -29,26 +29,23 @@ class Event < Article
29 29 end
30 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 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 39 date_temp = date.strftime("%Y-%m-%d")
41   - {
42   - :conditions => ["start_date >= ?","#{date_temp}"],
  40 + { :conditions => ["start_date >= ?","#{date_temp}"],
43 41 :limit => 10,
44 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 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 49 :limit => 10,
53 50 :order => 'start_date ASC'
54 51 }
... ...
lib/noosfero/plugin.rb
  1 +require 'noosfero'
1 2 include ActionView::Helpers::AssetTagHelper
2 3  
3 4 class Noosfero::Plugin
... ...