step_helper.rb
788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module CommunityTrackPlugin::StepHelper
def self.status_descriptions
[_('Closed'), _('Join!'), _('Soon')]
end
def self.status_classes
['step_finished', 'step_active', 'step_waiting']
end
def status_description(step)
CommunityTrackPlugin::StepHelper.status_descriptions[status_index(step)]
end
def status_class(step)
CommunityTrackPlugin::StepHelper.status_classes[status_index(step)]
end
def custom_options_for_article(article)
#no options for step?
nil
end
def link_to_step_tool(step, options={})
if step.tool
link_to step.tool.view_url, options do
yield
end
else
yield
end
end
protected
def status_index(step)
[step.finished?, step.active?, step.waiting?].find_index(true)
end
end