module OpenProject::Backlogs::Hooks class LayoutHook < Redmine::Hook::ViewListener include RbCommonHelper # this ought to be view_issues_sidebar_queries_bottom, but # the entire queries toolbar is disabled if you don't have # custom queries def view_issues_sidebar_planning_bottom(context={ }) locals = {} locals[:sprints] = context[:project] ? Sprint.open_sprints(context[:project]) : [] locals[:project] = context[:project] locals[:sprint] = nil locals[:webcal] = (context[:request].ssl? ? 'webcals' : 'webcal') return '' unless locals[:project] return '' if locals[:project].blank? return '' unless locals[:project].module_enabled?('backlogs') user = User.find_by_id(context[:request].session[:user_id]) locals[:key] = user ? user.api_key : nil q = context[:request].session[:query] if q && q[:filters] sprint = q[:filters]['fixed_version_id'] if sprint && sprint[:operator] == '=' && sprint[:values].size == 1 locals[:sprint] = Sprint.find_by_id(sprint[:values][0]) end end context[:controller].send(:render_to_string, { :partial => 'shared/view_issues_sidebar', :locals => locals }) end def view_issues_show_details_bottom(context = {}) return '' unless context[:issue].project.module_enabled? 'backlogs' return '' if context[:from] == 'Backlogs::IssueView::FieldsParagraph' issue = context[:issue] snippet = '' if issue.is_story? snippet += %Q{
) snippet << %(
' snippet << context[:form].text_field(:story_points, :size => 3) snippet << '
' if issue.descendants.length != 0 unless Backlogs::Compatibility.using_jquery? snippet << javascript_include_tag_backlogs('lib/jquery.js') end snippet << javascript_tag(<<-JS) (function($) { $(document).ready(function() { $('#issue_estimated_hours').attr('disabled', 'disabled'); $('#issue_remaining_hours').attr('disabled', 'disabled'); $('#issue_done_ratio').attr('disabled', 'disabled'); $('#issue_start_date').parent().hide(); $('#issue_due_date').parent().hide(); }); }(jQuery)) JS end end snippet << '' snippet << context[:form].text_field(:remaining_hours, :size => 3) snippet << ' ' snippet << l(:field_hours) snippet << '
' params = context[:controller].params if issue.is_story? && params[:copy_from] snippet << "" snippet << "#{check_box_tag('link_to_original', params[:copy_from], true)}
" snippet << ""
snippet << "#{radio_button_tag('copy_tasks', 'open:' + params[:copy_from], true)} #{l(:rb_label_copy_tasks_open)}
"
snippet << "#{radio_button_tag('copy_tasks', 'none', false)} #{l(:rb_label_copy_tasks_none)}
"
snippet << "#{radio_button_tag('copy_tasks', 'all:' + params[:copy_from], false)} #{l(:rb_label_copy_tasks_all)}