parent
ed32ab24c1
commit
37ad0ab3ce
@ -0,0 +1,3 @@ |
||||
# Changelog |
||||
|
||||
* `#1476` Migration Rails3 Export |
@ -0,0 +1,9 @@ |
||||
# OpenProject XLS Export Plugin |
||||
|
||||
Export issue lists as Excel spreadsheets (.xls). This plugin adds a link below each issue list which allows downloading the list as Excel spreadsheet. |
||||
|
||||
Support for exporting cost entries and cost reports is not yet migrated to Rails 3 and disabled. |
||||
|
||||
# Issue Tracker |
||||
|
||||
https://www.openproject.org/projects/export/issues |
@ -1,9 +0,0 @@ |
||||
= Additional Formats |
||||
|
||||
This plugin provides additional formats for exporting. |
||||
A printable html view for issues lists and an excel builder |
||||
used for issue exports and optionally (as a soft dependency) |
||||
for the cost reports of the redmine_costs plugin. |
||||
|
||||
== Required gems |
||||
spreadsheet (>= 0.6.4.1) |
@ -1,3 +0,0 @@ |
||||
<% if params[:action] == "index" or params[:action] == "all" %> |
||||
<%= link_to l(:print_with_description), :controller => 'issues', :action => 'printable', :project_id => @project %><br /> |
||||
<% end %> |
@ -1,47 +0,0 @@ |
||||
<% form_tag({}) do -%> |
||||
<%= hidden_field_tag 'back_url', url_for(params) %> |
||||
<table class="list issues printable"> |
||||
<thead><tr> |
||||
<%= sort_header_tag('id', :caption => '#', :default_order => 'desc') %> |
||||
<% @columns.each do |column| %> |
||||
<%= column_header(column) %> |
||||
<% end %> |
||||
</tr></thead> |
||||
<% previous_group = false %> |
||||
<tbody> |
||||
<% issues.each do |issue| -%> |
||||
<% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %> |
||||
<% reset_cycle %> |
||||
<tr class="group open"> |
||||
<td colspan="<%= @columns.size + 1 %>"> |
||||
<span class="expander" onclick="toggleRowGroup(this); return false;"> </span> |
||||
<%= group.blank? ? 'None' : column_content(@query.group_by_column, issue) %> <span class="count">(<%= @issue_count_by_group[group] %>)</span> |
||||
</td> |
||||
</tr> |
||||
<% previous_group = group %> |
||||
<% end %> |
||||
<tr class="issue_columns <%= issue.css_classes %>"> |
||||
<td><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> |
||||
<% @columns.each do |column| -%> |
||||
<%= content_tag 'td', |
||||
case column.name |
||||
when :done_ratio |
||||
number_to_percentage(column.value(issue), :precision => 0) |
||||
else |
||||
column_content(column, issue) |
||||
end, |
||||
:class => column.name %> |
||||
<%- end %> |
||||
</tr> |
||||
<tr class="issue_description"> |
||||
<td colspan="<%= @columns.size + 1 %>"> |
||||
<p><strong><%=h issue.subject %></strong></p> |
||||
<div class="wiki"> |
||||
<%= textilizable issue, :description, :attachments => issue.attachments %> |
||||
</div> |
||||
</td> |
||||
</tr> |
||||
<% end -%> |
||||
</tbody> |
||||
</table> |
||||
<% end -%> |
@ -1,33 +0,0 @@ |
||||
<h2><%= @query.new_record? ? l(:label_issue_plural) : h(@query.name) %></h2> |
||||
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> |
||||
|
||||
<%= error_messages_for 'query' %> |
||||
<% if @query.valid? %> |
||||
<table> |
||||
<tr> |
||||
<td><strong><%= l(:label_filter_plural) %>:</strong></td> |
||||
<td><%= FilterSettingsHelper.filter_settings(@query).join(", ") %></td> |
||||
</tr> |
||||
<% if group_by_settings = FilterSettingsHelper.group_by_setting(@query) %> |
||||
<tr> |
||||
<td><strong><%= l(:field_group_by) %>:</strong></td> |
||||
<td><%= group_by_settings %></td> |
||||
</tr> |
||||
<% end %> |
||||
</table> |
||||
|
||||
<% if @issues.empty? %> |
||||
<p class="nodata"><%= l(:label_no_data) %></p> |
||||
<% else %> |
||||
<style type='text/css'> |
||||
#main-menu { display: none; } |
||||
#content { margin-left: 0; } |
||||
</style> |
||||
|
||||
<p><%= link_to l(:button_back), :project_id => @project, :action => 'index' %></p> |
||||
|
||||
<%= render :partial => 'issues/list_printable', :locals => {:issues => @issues, :query => @query} %> |
||||
|
||||
<p><%= link_to l(:button_back), :project_id => @project, :action => 'index' %></p> |
||||
<% end %> |
||||
<% end %> |
@ -1,24 +0,0 @@ |
||||
table.printable, |
||||
table.printable tr, |
||||
table.printable td { |
||||
border: 0 none; |
||||
} |
||||
|
||||
table.printable tr th { |
||||
background-color: #fff; |
||||
border-bottom: 2px solid #000; |
||||
} |
||||
|
||||
table.printable tr.issue_description { |
||||
margin-bottom: 4px; |
||||
} |
||||
|
||||
table.printable tr.issue_description td { |
||||
border-bottom: 1px solid #000; |
||||
padding-bottom: 1em; |
||||
} |
||||
|
||||
#main.nosidebar #content { |
||||
/* Fix for custom themes */ |
||||
width: auto; |
||||
} |
@ -1,4 +0,0 @@ |
||||
ActionController::Routing::Routes.draw do |map| |
||||
map.connect 'projects/:project_id/issues/printable', :controller => 'issues', :action => 'printable' |
||||
map.connect 'issues/printable', :controller => 'issues', :action => 'printable' |
||||
end |
@ -1,30 +0,0 @@ |
||||
require 'redmine' |
||||
|
||||
Redmine::Plugin.register :redmine_additional_formats do |
||||
name 'Redmine Additional Formats plugin' |
||||
author 'Holger Just, Tim Felgentreff @ finnlabs' |
||||
author_url 'http://finn.de/team#h.just' |
||||
description 'This plugin provides additional formats for exporting, like a printable view for issue lists and an excel builder for issue exports' |
||||
version '0.4.2' |
||||
|
||||
requires_redmine :version_or_higher => '0.9' |
||||
requires_redmine_plugin :redmine_reporting, :version_or_higher => '0.1' |
||||
|
||||
Redmine::AccessControl.permission(:view_issues).actions << "issues/printable" |
||||
end |
||||
|
||||
require 'dispatcher' |
||||
Dispatcher.to_prepare do |
||||
# Controller Patches |
||||
require_dependency 'printable_issues/issues_controller_patch' |
||||
require_dependency 'xls_report/issues_controller_patch' |
||||
require_dependency 'xls_report/cost_reports_controller_patch' |
||||
|
||||
# Initialization |
||||
Mime::Type.register('application/vnd.ms-excel', :xls, %w(application/vnd.ms-excel)) unless defined? Mime::XLS |
||||
end |
||||
|
||||
# Hooks |
||||
require 'additional_formats/filename_helper' |
||||
require 'different_formats/issue_hook' |
||||
require 'xls_report/cost_report_hook' |
@ -0,0 +1,5 @@ |
||||
module OpenProject |
||||
module XlsExport |
||||
require "open_project/xls_export/engine" |
||||
end |
||||
end |
@ -0,0 +1,32 @@ |
||||
module OpenProject::XlsExport |
||||
class Engine < ::Rails::Engine |
||||
engine_name :openproject_xls_export |
||||
|
||||
include OpenProject::Plugins::ActsAsOpEngine |
||||
|
||||
register_plugin 'OpenProject XLS Export', |
||||
'openproject-xls_export', |
||||
:author_url => 'http://finn.de/', |
||||
:requires_openproject => '>= 3.0.0pre11' |
||||
|
||||
assets %w(excel_export.css) |
||||
|
||||
patches [:IssuesController] |
||||
# disabled since not yet migrated: :CostReportsController |
||||
|
||||
initializer 'xls_export.register_hooks' do |
||||
# don't use require_dependency to not reload hooks in development mode |
||||
|
||||
# disabled since not yet migrated |
||||
# require 'open_project/xls_export/hooks/cost_report_hook.rb' |
||||
|
||||
require 'open_project/xls_export/hooks/issue_hook.rb' |
||||
end |
||||
|
||||
initializer 'xls_export.register_mimetypes' do |
||||
Mime::Type.register('application/vnd.ms-excel', |
||||
:xls, |
||||
%w(application/vnd.ms-excel)) unless defined? Mime::XLS |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,5 @@ |
||||
module OpenProject |
||||
module XlsExport |
||||
VERSION = "1.0.0" |
||||
end |
||||
end |
@ -0,0 +1 @@ |
||||
require 'open_project/xls_export' |
@ -1,55 +0,0 @@ |
||||
require_dependency 'issues_controller' |
||||
|
||||
module PrintableIssues |
||||
module IssuesControllerPatch |
||||
def self.included(base) # :nodoc: |
||||
base.send(:include, InstanceMethods) |
||||
|
||||
base.class_eval do |
||||
before_filter :find_optional_project, |
||||
:only => self.filter_chain.select{|f| f.method == :find_optional_project}[0].options[:only] + [:printable] |
||||
|
||||
before_filter :authorize, |
||||
:except => self.filter_chain.select{|f| f.method == :authorize}[0].options[:except] + [:printable] |
||||
|
||||
accept_key_auth :printable |
||||
end |
||||
end |
||||
|
||||
module InstanceMethods |
||||
def printable |
||||
retrieve_query |
||||
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
||||
if @query.respond_to? :sortable_columns |
||||
sort_update(@query.sortable_columns) |
||||
else |
||||
sort_update({'id' => "#{Issue.table_name}.id"}.merge(@query.available_columns.inject({}) {|h, c| h[c.name.to_s] = c.sortable; h})) |
||||
end |
||||
|
||||
if @query.valid? |
||||
limit = Setting.issues_export_limit.to_i |
||||
|
||||
@issue_count = @query.issue_count |
||||
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], |
||||
:limit => limit, |
||||
:offset => 0, |
||||
:order => sort_clause) |
||||
@issue_count_by_group = @query.issue_count_by_group |
||||
|
||||
@columns = @query.columns.reject{|c| %w(subject).include? c.name.to_s} |
||||
|
||||
respond_to do |format| |
||||
format.html { render :template => 'issues/printable.rhtml', :layout => !request.xhr? } |
||||
end |
||||
else |
||||
# Send html if the query is not valid |
||||
render(:template => 'issues/printable.rhtml', :layout => !request.xhr?) |
||||
end |
||||
rescue ActiveRecord::RecordNotFound |
||||
render_404 |
||||
end |
||||
end |
||||
end |
||||
end |
||||
|
||||
IssuesController.send(:include, PrintableIssues::IssuesControllerPatch) |
@ -0,0 +1,22 @@ |
||||
# encoding: UTF-8 |
||||
$:.push File.expand_path("../lib", __FILE__) |
||||
|
||||
require 'open_project/xls_export/version' |
||||
# Describe your gem and declare its dependencies: |
||||
Gem::Specification.new do |s| |
||||
s.name = "openproject-xls_export" |
||||
s.version = OpenProject::XlsExport::VERSION |
||||
s.authors = "Finn GmbH" |
||||
s.email = "info@finn.de" |
||||
s.homepage = "http://www.finn.de" |
||||
s.summary = 'OpenProject plugin for exporting issue lists as Excel spreadsheets' |
||||
s.description = 'Export issue lists as Excel spreadsheets (.xls). Support for exporting |
||||
cost entries and cost reports is not yet migrated to Rails 3 and disabled.' |
||||
s.license = "GPLv3" |
||||
|
||||
s.files = Dir["{app,config,db,lib}/**/*"] + %w(CHANGELOG.md README.md) |
||||
|
||||
s.add_dependency "rails", "~> 3.2.14" |
||||
s.add_dependency "spreadsheet", "~>0.6.0" |
||||
s.add_dependency "openproject-plugins", "~> 1.0.0" |
||||
end |
Loading…
Reference in new issue