Feature #559 » ro559-add_workflow_graphviz_graph-r4574.patch
| app/helpers/workflows_helper.rb (working copy) | ||
|---|---|---|
| 16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | 17 | |
| 18 | 18 |
module WorkflowsHelper |
| 19 |
def generate_workflow_graph(role, tracker) |
|
| 20 |
edges = role.workflows.inject("") do |edge, workflow|
|
|
| 21 |
workflow.tracker_id == tracker.id ? "#{edge}#{workflow.old_status}->#{workflow.new_status};" : edge
|
|
| 22 |
end |
|
| 23 |
|
|
| 24 |
"http://chart.apis.google.com/chart?cht=gv&chl=digraph{#{CGI.escape(edges.gsub(/ /, '_').toutf8)}}&chs=547x547"
|
|
| 25 |
end |
|
| 19 | 26 |
end |
| app/views/workflows/edit.rhtml (working copy) | ||
|---|---|---|
| 71 | 71 |
<% end %> |
| 72 | 72 | |
| 73 | 73 |
<% html_title(l(:label_workflow)) -%> |
| 74 | ||
| 75 |
<%= image_tag(generate_workflow_graph(@role, @tracker)) if @role %> |
|