Skip to content

Instantly share code, notes, and snippets.

@malgorath
Created May 10, 2016 19:06
Show Gist options
  • Save malgorath/ca52236584eb5110c397472dc25d883f to your computer and use it in GitHub Desktop.
Save malgorath/ca52236584eb5110c397472dc25d883f to your computer and use it in GitHub Desktop.
Openproject "plugin" I am attempting to create for the first time. Line 13 is where I would like the current project_id from the session variable to print but its not working that way.
<%
p_id = nil
wp_id = nil
%>
<div class="page-header">
<a href="/" class="btn btn-default pull-right">&lt;&lt; Return to OpenProject</a>
<h1 class="">Todo Tasks List</h1>
</div>
<% if notice %>
<div class="well well-danger"><%= notice %></div>
<% end %>
Project ID:
<%= session['@workpackages']['project_id'] %><br />
<div class="text-right">
<%= link_to new_todolist_path, class: "btn btn-success" do %>
<i class="glyphicon glyphicon-plus"></i>&nbsp;Add New Task
<% end %>
</div>
<table class="table" border="0" style="border: 0;">
<tbody>
<% @todolists.each do |todolist| %>
<tr>
<% @projects.each do |p| %>
<% if p.id != p_id or p_id.nil? %>
<% p_id = p.id %>
<td colspan="4" >
<span class="label label-default" style="font-size: 28px; font-weight: bolder"><%= p %></span>
</td>
<% end %>
<table class="table table-hover table-striped" border="0" style="border: 0px;">
<% if wp_id != todolist.work_package_id or wp_id.nil? %>
<% wp_id = todolist.work_package_id %>
<tr>
<td colspan="4"><span style="padding-left: 20px;"></span>
<span class="label label-info" style="font-size: 20px; font-weight: bolder; background-color: #2E2F30;">
<%= @workpackages[@workpackages.find_index{|a| a.id == todolist.work_package_id}] %>
</span>
</td>
</tr>
<% end %>
<% if todolist.finished %>
<tr class="text-success">
<% else %>
<tr class="text-danger">
<% end %>
<td colspan="3" style="padding-left: 50px;"><%= todolist.id %>. <%= todolist.title %>
<% if todolist.wiki_link != nil and todolist.wiki_link != "" %>
<span style="padding-left: 20px; "></span>
<a href="<%= todolist.wiki_link %>" class="label label-info" style="font-size: 20px; font-weight: bolder;" target="_blank">Wiki</a>
<% end %>
</td>
<td class="text-right">
<% if todolist.due %>
<%= todolist.due.strftime('%Y-%m-%d %H:%M') %>
<% end %>
</td>
</tr>
<tr>
<td colspan="3" style="padding-left: 50px;">
<input type="checkbox" onclick="location.href='/todolist/finishtodolist/<%= todolist.id %>'"
<% if todolist.finished %>
checked >
<span class="text-primary" ><%= todolist.finished.strftime('%Y-%m-%d %H:%M') %></span>
<% else %>
>
<span class="text-warning" >&nbsp;Not Finished&nbsp;</span>
<% end %>
</td>
<td class="text-right">
<%= link_to todolist, class: "btn-sm btn-primary" do %>
<span class="glyphicon glyphicon-sunglasses"></span>
<% end %>
<%= link_to edit_todolist_path(todolist), class: "btn-sm btn-warning" do %>
<i class="glyphicon glyphicon-pencil"></i>
<% end %>
<%= link_to todolist, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn-sm btn-danger" do %>
<i class="glyphicon glyphicon-trash"></i>
<% end %>
</td>
</tr>
<% end %>
</table>
<% end %>
</tr>
</tbody>
</table>
<br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment