Create backlog menu helper for creating menu

pull/6827/head
Mark Maglana 15 years ago
parent 85e407fc56
commit 1cb8fa8b53
  1. 1
      app/controllers/backlogs_controller.rb
  2. 31
      app/helpers/backlog_menu_helper.rb
  3. 54
      app/views/backlogs/_backlog.html.erb
  4. 5
      assets/stylesheets/index.css

@ -1,4 +1,5 @@
include StoriesHelper
include BacklogMenuHelper
class BacklogsController < ApplicationController
unloadable

@ -0,0 +1,31 @@
module BacklogMenuHelper
unloadable
def backlog_menu(is_sprint, items = [])
html = %{
<ul class="actions pureCssMenu pureCssMenum">
<li class="pureCssMenui">
<a class="pureCssMenui" href="#"><span class="ui-icon ui-icon-triangle-1-s"></span></a>
<ul class="pureCssMenum">
}
items.each do |item|
item[:condition] = true if item[:condition].nil?
if item[:condition] && ( (is_sprint && item[:for] == :sprint) ||
(!is_sprint && item[:for] == :product) ||
(item[:for] == :both) )
html += %{ <li class="pureCssMenui">#{item[:item]}</li> }
end
end
html += %{
</ul>
</li>
</ul>
}
end
def menu_link(label, options = {})
# options[:class] = "pureCssMenui"
link_to(label, options)
end
end

@ -7,32 +7,36 @@
<div class="end_date datepicker"><%= date_or_nil(backlog.effective_date) %></div>
</div>
<div class="points"><%= backlog.points %></div>
<ul class="actions pureCssMenu pureCssMenum">
<li class="pureCssMenui">
<a class="pureCssMenui" href="#"><span class="ui-icon ui-icon-triangle-1-s"></span></a>
<ul class="pureCssMenum">
<li class="pureCssMenui">
<%= link_to('Stories/Tasks', {
:controller => 'backlogs',
:action => 'select_sprint',
:project_id => @project.id,
:sprint_id => backlog.id },
:class => "pureCssMenui") %>
</li>
<% if @project.wiki %>
<li class="pureCssMenui">
<%= link_to('Wiki', {
:controller => 'backlogs',
:action => 'wiki_page',
:project_id => @project.id,
:sprint_id => backlog.id },
:class => "pureCssMenui") %>
</li>
<% end %>
</ul>
</li>
</ul>
<%- end %>
<%= backlog_menu is_sprint(backlog),
[
{
:item => "<a>New story</a>",
:for => :both
},
{
:item => menu_link('Stories/Tasks', {
:controller => 'backlogs',
:action => 'select_sprint',
:project_id => @project,
:sprint_id => backlog }),
:for => :sprint
},
{
:item => menu_link('Wiki', {
:controller => 'backlogs',
:action => 'wiki_page',
:project_id => @project.id,
:sprint_id => backlog.id }),
:for => :sprint,
:condition => @project.enabled_modules.any? {|m| m.name=="wiki" }
},
{
:item => "<a>Select All</a>",
:for => :both
}
]
%>
</div><!-- class="header" -->
<ul class="stories">
<%= render :partial => "stories/story", :collection => stories(backlog) %>

@ -19,13 +19,10 @@
font-weight:bold;
padding-left:15px;
}
.backlog.product .header .name{
padding-left:0;
}
.backlog .header .actions{
display:block;
position:absolute;
left:7px;
left:6px;
top:6px;
}
.backlog .header .dates{

Loading…
Cancel
Save