Feature #31373 » feature-31373.patch
app/helpers/application_helper.rb | ||
---|---|---|
298 | 298 |
link_to(name, "#", :onclick => onclick) |
299 | 299 |
end |
300 | 300 | |
301 |
def link_to_previous_month(year, month, options={}) |
|
302 |
target_year, target_month = if month == 1 |
|
303 |
[year - 1, 12] |
|
304 |
else |
|
305 |
[year, month - 1] |
|
306 |
end |
|
307 | ||
308 |
name = if target_month == 12 |
|
309 |
"#{month_name(target_month)} #{target_year}" |
|
310 |
else |
|
311 |
"#{month_name(target_month)}" |
|
312 |
end |
|
313 | ||
314 |
# \xc2\xab(utf-8) = « |
|
315 |
link_to_month(("\xc2\xab " + name), target_year, target_month, options) |
|
316 |
end |
|
317 | ||
318 |
def link_to_next_month(year, month, options={}) |
|
319 |
target_year, target_month = if month == 12 |
|
320 |
[year + 1, 1] |
|
321 |
else |
|
322 |
[year, month + 1] |
|
323 |
end |
|
324 | ||
325 |
name = if target_month == 1 |
|
326 |
"#{month_name(target_month)} #{target_year}" |
|
327 |
else |
|
328 |
"#{month_name(target_month)}" |
|
329 |
end |
|
330 | ||
331 |
# \xc2\xbb(utf-8) = » |
|
332 |
link_to_month((name + " \xc2\xbb"), target_year, target_month, options) |
|
333 |
end |
|
334 | ||
335 |
def link_to_month(link_name, year, month, options={}) |
|
336 |
link_to(link_name, {:params => request.query_parameters.merge(:year => year, :month => month)}, options) |
|
337 |
end |
|
338 | ||
301 | 339 |
# Used to format item titles on the activity view |
302 | 340 |
def format_activity_title(text) |
303 | 341 |
text |
app/helpers/calendars_helper.rb | ||
---|---|---|
20 | 20 |
module CalendarsHelper |
21 | 21 |
include Redmine::Utils::DateCalculation |
22 | 22 | |
23 |
def link_to_previous_month(year, month, options={}) |
|
24 |
target_year, target_month = if month == 1 |
|
25 |
[year - 1, 12] |
|
26 |
else |
|
27 |
[year, month - 1] |
|
28 |
end |
|
29 | ||
30 |
name = if target_month == 12 |
|
31 |
"#{month_name(target_month)} #{target_year}" |
|
32 |
else |
|
33 |
"#{month_name(target_month)}" |
|
34 |
end |
|
35 | ||
36 |
# \xc2\xab(utf-8) = « |
|
37 |
link_to_month(("\xc2\xab " + name), target_year, target_month, options) |
|
38 |
end |
|
39 | ||
40 |
def link_to_next_month(year, month, options={}) |
|
41 |
target_year, target_month = if month == 12 |
|
42 |
[year + 1, 1] |
|
43 |
else |
|
44 |
[year, month + 1] |
|
45 |
end |
|
46 | ||
47 |
name = if target_month == 1 |
|
48 |
"#{month_name(target_month)} #{target_year}" |
|
49 |
else |
|
50 |
"#{month_name(target_month)}" |
|
51 |
end |
|
52 | ||
53 |
# \xc2\xbb(utf-8) = » |
|
54 |
link_to_month((name + " \xc2\xbb"), target_year, target_month, options) |
|
55 |
end |
|
56 | ||
57 |
def link_to_month(link_name, year, month, options={}) |
|
58 |
link_to(link_name, {:params => request.query_parameters.merge(:year => year, :month => month)}, options) |
|
59 |
end |
|
60 | ||
61 | 23 |
def calendar_day_css_classes(calendar, day) |
62 | 24 |
css = day.month==calendar.month ? +'even' : +'odd' |
63 | 25 |
css << " today" if User.current.today == day |
app/views/gantts/show.html.erb | ||
---|---|---|
70 | 70 |
</div> |
71 | 71 | |
72 | 72 |
<p class="contextual"> |
73 |
<%= gantt_zoom_link(@gantt, :in) %> |
|
74 |
<%= gantt_zoom_link(@gantt, :out) %> |
|
73 |
<span> |
|
74 |
<%= gantt_zoom_link(@gantt, :in) %> |
|
75 |
<%= gantt_zoom_link(@gantt, :out) %> |
|
76 |
</span> |
|
77 |
<span> |
|
78 |
<%= link_to_previous_month(@gantt.year_from, @gantt.month_from, :accesskey => accesskey(:previous)) %> | <%= link_to_next_month(@gantt.year_from, @gantt.month_from, :accesskey => accesskey(:next)) %> |
|
79 |
</span> |
|
75 | 80 |
</p> |
76 | 81 | |
77 | 82 |
<p class="buttons"> |
test/functional/gantts_controller_test.rb | ||
---|---|---|
47 | 47 |
assert_select 'fieldset#filters.collapsible' |
48 | 48 |
assert_select 'fieldset#options' |
49 | 49 |
end |
50 |
assert_select 'p.contextual' |
|
50 |
assert_select 'p.contextual' do |
|
51 |
prev_month, next_month = User.current.today.prev_month, User.current.today.next_month |
|
52 |
assert_select 'a[accesskey="p"][href=?]', project_gantt_path(:project_id => 1, :month => prev_month.month, :year => prev_month.year) |
|
53 |
assert_select 'a[accesskey="n"][href=?]', project_gantt_path(:project_id => 1, :month => next_month.month, :year => next_month.year) |
|
54 |
end |
|
51 | 55 |
assert_select 'p.buttons' |
52 | 56 |
end |
53 | 57 |
end |
- « Previous
- 1
- 2
- Next »