Module: RuoteKit::Helpers::NavigationHelpers
- Defined in:
- lib/ruote-kit/helpers/navigation_helpers.rb
Instance Method Summary collapse
- #link_to(object, *args) ⇒ Object
- #link_to_expression(expression) ⇒ Object
- #link_to_process(status) ⇒ Object
- #link_to_workitem(workitem) ⇒ Object
- #navigate_to(text, path) ⇒ Object
- #pluralize(number, word) ⇒ Object
Instance Method Details
#link_to(object, *args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ruote-kit/helpers/navigation_helpers.rb', line 23 def link_to( object, *args ) case object when Ruote::ProcessStatus link_to_process( object ) when Ruote::Workitem link_to_workitem( object ) when String "<a href=\"#{args.first}\">#{object}</a>" end end |
#link_to_expression(expression) ⇒ Object
46 47 48 49 50 |
# File 'lib/ruote-kit/helpers/navigation_helpers.rb', line 46 def link_to_expression( expression ) path = "/_ruote/expressions/#{expression.fei.wfid}/#{expression.fei.expid}" "<a href=\"#{path}\">GET #{path}</a>" end |
#link_to_process(status) ⇒ Object
40 41 42 43 44 |
# File 'lib/ruote-kit/helpers/navigation_helpers.rb', line 40 def link_to_process( status ) path = "/_ruote/processes/#{status.wfid}" "<a href=\"#{path}\">GET #{path}</a>" end |
#link_to_workitem(workitem) ⇒ Object
34 35 36 37 38 |
# File 'lib/ruote-kit/helpers/navigation_helpers.rb', line 34 def link_to_workitem( workitem ) path = "/_ruote/workitems/#{workitem.fei.wfid}/#{workitem.fei.expid}" "<a href=\"#{path}\">GET #{path}</a>" end |
#navigate_to(text, path) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/ruote-kit/helpers/navigation_helpers.rb', line 5 def navigate_to( text, path ) css_classes = [] css_classes << 'first' if @first.nil? @first = true css_classes << 'active' if path.split('/')[2] == request.path.split('/')[2] "<li class=\"#{css_classes.join(' ')}\"><a href=\"#{ path }\">#{text}</a></li>" end |
#pluralize(number, word) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/ruote-kit/helpers/navigation_helpers.rb', line 15 def pluralize( number, word ) if number > 1 word << 's' end return [ number, word ].join(' ') end |