diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 0f28fc3a111e9c09d7b08ac3806de9a68fc776be..1fcedf1ff508f60847da0417126c9b16d6c9efe6 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -24,6 +24,14 @@ class IssuesController < ProjectResourceController format.html # index.html.erb format.js format.atom { render layout: false } + format.print do + if params[:milestone_id] + @milestone = Milestone.find params[:milestone_id] + @issues = @milestone.issues.recent + else + redirect_to project_issues_path(@project), notice: "Milestone not specified." + end + end end end diff --git a/app/roles/issue_commonality.rb b/app/roles/issue_commonality.rb index 3d9074867b70488f50959857786783d97814ef20..449b58071b5c6beeb4fc4e75105fb5c6a70bc44b 100644 --- a/app/roles/issue_commonality.rb +++ b/app/roles/issue_commonality.rb @@ -17,7 +17,7 @@ module IssueCommonality scope :closed, where(closed: true) scope :of_group, ->(group) { where(project_id: group.project_ids) } scope :assigned, ->(u) { where(assignee_id: u.id)} - scope :recent, order("created_at DESC") + scope :recent, order('created_at DESC') delegate :name, :email, diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml index f82ae8bde589c3c80ccd5f5643c45709a1f14105..92fbfee2b1980c315a93972254f46b7609e86dd5 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/issues/_issues.html.haml @@ -6,10 +6,11 @@ .row .span7= paginate @issues, remote: true, theme: "gitlab" .span3.right - %span.cgray.right + %span.cgray.right %span.issue_counter #{@issues.total_count} issues for this filter + - if params[:milestone_id].present? + = link_to 'Print', project_issues_path(@project, :print, milestone_id: params[:milestone_id]), target: '_blank' - else %li %h4.nothing_here_message Nothing to show here - diff --git a/app/views/issues/index.print.haml b/app/views/issues/index.print.haml new file mode 100644 index 0000000000000000000000000000000000000000..56ad1815d91aea8f295fca3755c0b0d0231ae5c0 --- /dev/null +++ b/app/views/issues/index.print.haml @@ -0,0 +1,77 @@ +!!! 5 +%html + %head + %meta{charset: "utf-8"} + %title + GitLab + = " > #{@project.name} | Milestone #{@milestone.title} | Issues" + = favicon_link_tag 'favicon.ico' + = stylesheet_link_tag 'application' + %body + .container + .content + %h2= @project.name + + %h2 Milestone + %table.table.table-bordered.table-hover + %tbody + %tr + %td.span2 + %strong ID + %td + = "##{@milestone.id}" + %tr + %td.span2 + %strong Title + %td + = link_to @milestone.title, project_milestone_path(@project, @milestone) + %tr + %td.span2 + %strong Description + %td + = @milestone.description + %tr + %td.span2 + %strong Expires at + %td + = @milestone.due_date + %tr + %td.span2 + %strong Created at + %td + = @milestone.created_at.to_s(:db) + %tr + %td.span2 + %strong Issue stats + %td + = "Total: #{@issues.size}" + %br + = "Open: #{@issues.opened.size}" + %br + = "Closed: #{@issues.closed.size}" + + %h2 Issues + %table.table.table-bordered.table-hover + %thead + %tr + %th ID + %th Title + %th Assigned to + %th Status + %th Created at + %tbody + - @issues.each do |issue| + %tr + %td.span1 + = "##{issue.id}" + %td + = link_to issue.title, project_issue_path(@project, issue) + %td + - if issue.is_assigned? + = link_to issue.assignee_name, project_issue_path(@project, issue) + - else + — + %td + = issue.closed? ? "closed" : "open" + %td.span2 + = issue.created_at.to_s(:db) diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index d3b1c0921928a73c19640f22a47e7bed8df84046..f89f3adaa502b8ae641a27e0db6fbc788c2ea206 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -8,6 +8,7 @@ %i.icon-plus New Issue = link_to 'Browse Issues', project_issues_path(@milestone.project, milestone_id: @milestone.id), class: "btn edit-milestone-link small grouped" + = link_to 'Overview', project_issues_path(@milestone.project, :print, milestone_id: @milestone.id), target: '_blank', class: "btn edit-milestone-link small grouped" - if can?(current_user, :admin_milestone, @project) = link_to edit_project_milestone_path(@project, @milestone), class: "btn small grouped" do %i.icon-edit diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 3549b8362bb4042339a5f4412d56b70bb87b7a9d..3c90bb325d8dc3c06943119474b9006f65794148 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -5,3 +5,4 @@ # Mime::Type.register_alias "text/html", :iphone Mime::Type.register_alias 'text/plain', :patch +Mime::Type.register_alias 'text/html', :print