kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
5.1 KiB
148 lines
5.1 KiB
11 years ago
|
#-- copyright
|
||
|
# OpenProject Backlogs Plugin
|
||
|
#
|
||
11 years ago
|
# Copyright (C)2013-2014 the OpenProject Foundation (OPF)
|
||
11 years ago
|
# Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda
|
||
|
# Copyright (C)2010-2011 friflaj
|
||
|
# Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns
|
||
|
# Copyright (C)2009-2010 Mark Maglana
|
||
|
# Copyright (C)2009 Joe Heck, Nate Lowrie
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or modify it under
|
||
|
# the terms of the GNU General Public License version 3.
|
||
|
#
|
||
|
# OpenProject Backlogs is a derivative work based on ChiliProject Backlogs.
|
||
|
# The copyright follows:
|
||
|
# Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj
|
||
|
# Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
#
|
||
|
# See doc/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
|
|
||
14 years ago
|
module RbMasterBacklogsHelper
|
||
|
include Redmine::I18n
|
||
|
|
||
14 years ago
|
def render_backlog_menu(backlog)
|
||
6 years ago
|
# associated javascript defined in taskboard.js
|
||
9 years ago
|
content_tag(:div, class: 'menu') do
|
||
14 years ago
|
[
|
||
6 years ago
|
content_tag(:div, '', class: "menu-trigger icon-context icon-pulldown icon-small"),
|
||
9 years ago
|
content_tag(:ul, class: 'items') do
|
||
9 years ago
|
backlog_menu_items_for(backlog).map { |item|
|
||
6 years ago
|
content_tag(:li, item, class: 'item')
|
||
9 years ago
|
}.join.html_safe
|
||
14 years ago
|
end
|
||
12 years ago
|
].join.html_safe
|
||
15 years ago
|
end
|
||
|
end
|
||
|
|
||
14 years ago
|
def backlog_menu_items_for(backlog)
|
||
14 years ago
|
items = common_backlog_menu_items_for(backlog)
|
||
|
|
||
|
if backlog.sprint_backlog?
|
||
14 years ago
|
items.merge!(sprint_backlog_menu_items_for(backlog))
|
||
14 years ago
|
end
|
||
|
|
||
14 years ago
|
menu = []
|
||
11 years ago
|
[:new_story, :stories_tasks, :task_board, :burndown, :cards, :wiki, :configs, :properties].each do |key|
|
||
14 years ago
|
menu << items[key] if items.keys.include?(key)
|
||
|
end
|
||
|
|
||
|
menu
|
||
14 years ago
|
end
|
||
|
|
||
|
def common_backlog_menu_items_for(backlog)
|
||
14 years ago
|
items = {}
|
||
14 years ago
|
|
||
14 years ago
|
items[:new_story] = content_tag(:a,
|
||
|
l('backlogs.add_new_story'),
|
||
9 years ago
|
href: '#',
|
||
|
class: 'add_new_story')
|
||
14 years ago
|
|
||
14 years ago
|
items[:stories_tasks] = link_to(l(:label_stories_tasks),
|
||
9 years ago
|
controller: '/rb_queries',
|
||
|
action: 'show',
|
||
|
project_id: @project,
|
||
|
sprint_id: backlog.sprint)
|
||
14 years ago
|
|
||
11 years ago
|
if @export_card_config_meta[:count] > 0
|
||
|
items[:configs] = export_export_cards_link(backlog)
|
||
11 years ago
|
end
|
||
14 years ago
|
|
||
11 years ago
|
if current_user.allowed_to?(:manage_versions, @project)
|
||
|
items[:properties] = properties_link(backlog)
|
||
|
end
|
||
|
|
||
14 years ago
|
items
|
||
14 years ago
|
end
|
||
14 years ago
|
|
||
11 years ago
|
def export_export_cards_link(backlog)
|
||
|
if @export_card_config_meta[:count] == 1
|
||
|
link_to(l(:label_backlogs_export_card_export),
|
||
9 years ago
|
controller: '/rb_export_card_configurations',
|
||
|
action: 'show',
|
||
|
project_id: @project,
|
||
|
sprint_id: backlog.sprint,
|
||
|
id: @export_card_config_meta[:default],
|
||
|
format: :pdf)
|
||
11 years ago
|
else
|
||
11 years ago
|
export_modal_link(backlog)
|
||
11 years ago
|
end
|
||
|
end
|
||
|
|
||
11 years ago
|
def properties_link(backlog)
|
||
|
back_path = backlogs_project_backlogs_path(@project)
|
||
|
|
||
9 years ago
|
version_path = edit_version_path(backlog.sprint, back_url: back_path)
|
||
11 years ago
|
|
||
|
link_to(l(:'backlogs.properties'), version_path)
|
||
|
end
|
||
|
|
||
11 years ago
|
def export_modal_link(backlog, options = {})
|
||
|
path = backlogs_project_sprint_export_card_configurations_path(@project.id, backlog.sprint.id)
|
||
11 years ago
|
html_id = "modal_work_package_#{SecureRandom.hex(10)}"
|
||
9 years ago
|
link_to(l(:label_backlogs_export_card_export), path, options.merge(id: html_id, :'data-modal' => ''))
|
||
11 years ago
|
end
|
||
|
|
||
14 years ago
|
def sprint_backlog_menu_items_for(backlog)
|
||
14 years ago
|
items = {}
|
||
14 years ago
|
|
||
14 years ago
|
items[:task_board] = link_to(l(:label_task_board),
|
||
9 years ago
|
controller: '/rb_taskboards',
|
||
|
action: 'show',
|
||
|
project_id: @project,
|
||
|
sprint_id: backlog.sprint)
|
||
14 years ago
|
|
||
14 years ago
|
if backlog.sprint.has_burndown?
|
||
14 years ago
|
items[:burndown] = content_tag(:a,
|
||
|
l('backlogs.show_burndown_chart'),
|
||
9 years ago
|
href: '#',
|
||
|
class: 'show_burndown_chart')
|
||
14 years ago
|
end
|
||
|
|
||
9 years ago
|
if @project.module_enabled? 'wiki'
|
||
14 years ago
|
items[:wiki] = link_to(l(:label_wiki),
|
||
9 years ago
|
controller: '/rb_wikis',
|
||
|
action: 'edit',
|
||
|
project_id: @project,
|
||
|
sprint_id: backlog.sprint)
|
||
14 years ago
|
end
|
||
|
|
||
|
items
|
||
|
end
|
||
15 years ago
|
end
|