Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix redmine 5.x compatibility #3

Open
wants to merge 3 commits into
base: features
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/controllers/xls_export_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'xlse_asset_helpers'
require_dependency 'xls_export'
require_relative '../../lib/xlse_asset_helpers'
require_relative '../../lib/xls_export'
begin
require 'zip/zip'
rescue LoadError
Expand Down Expand Up @@ -44,11 +44,11 @@ def index
redirect_to :controller => 'issues', :action => 'index', :project_id => @project
end
end
@settings=XLSE_AssetHelpers::settings
@settings=XlseAssetHelpers::settings
end

def export_current
@settings=XLSE_AssetHelpers::settings
@settings=XlseAssetHelpers::settings
@issues_export_offset=params[:issues_export_offset].to_i || 0
if retrieve_xls_export_data(@settings)
export_name = get_xls_export_name(@settings)
Expand Down Expand Up @@ -100,7 +100,7 @@ def retrieve_xls_export_data(settings=nil)
@issues = query_issues(export_offset, limit)
# @issue_count_by_group = @query.issue_count_by_group
# end of original code
@settings=XLSE_AssetHelpers::settings unless settings
@settings=XlseAssetHelpers::settings unless settings
end
return true
end
Expand Down
8 changes: 4 additions & 4 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require 'redmine'
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
require 'xlse_asset_helpers'
require_relative 'lib/xlse_asset_helpers'
begin
require 'zip/zip'
rescue LoadError
ActionController::Base::logger.info 'XLS export controller: rubyzip gem not available'
end

unless Redmine::Plugin.registered_plugins.keys.include?(XLSE_AssetHelpers::PLUGIN_NAME)
Redmine::Plugin.register XLSE_AssetHelpers::PLUGIN_NAME do
unless Redmine::Plugin.registered_plugins.keys.include?(XlseAssetHelpers::PLUGIN_NAME)
Redmine::Plugin.register XlseAssetHelpers::PLUGIN_NAME do
name 'Issues XLS export'
author 'Vitaly Klimov'
author_url 'mailto:vitaly.klimov@snowbirdgames.com'
Expand Down Expand Up @@ -43,7 +43,7 @@
requires_redmine :version_or_higher => '3.2.0'
end

require 'xls_export_hooks'
require_relative 'lib/xls_export_hooks'
end

Mime::Type.register('application/vnd.ms-excel', :xls, %w(application/vnd.ms-excel)) unless defined?(Mime::XLS)
Expand Down
5 changes: 4 additions & 1 deletion lib/xls_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def strip_html(str, options)
end
end

module XlsExport
end

module Redmine
module Export
module XLS
Expand Down Expand Up @@ -218,7 +221,7 @@ def init_row(row, query, first)

def insert_issue_id(row, issue)
issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
row << Spreadsheet::Link.new(URI.escape(issue_url), issue.id.to_s)
row << Spreadsheet::Link.new(ERB::Util.url_encode(issue_url), issue.id.to_s)
format_link = Spreadsheet::Format.new :color => :blue, :underline => :single
row.set_format(row.size - 1, format_link)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/xls_export_hooks.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'xlse_asset_helpers'
require_relative 'xlse_asset_helpers'

class XLSExportHook < Redmine::Hook::ViewListener
class XlsExportHooks < Redmine::Hook::ViewListener
def view_issues_index_bottom(context={})
if context[:query].valid? && !context[:issues].empty?
ret_str =''
ret_str << stylesheet_link_tag("xls_export.css", :plugin => XLSE_AssetHelpers::PLUGIN_NAME, :media => "screen")
ret_str << stylesheet_link_tag("xls_export.css", :plugin => XlseAssetHelpers::PLUGIN_NAME, :media => "screen")
ret_str << '<p class="other-formats">' << l(:label_plugin_xlse_export_format)
ret_str << content_tag('span', link_to(l(:label_plugin_xlse_export_format_quick),
hook_url_for({ :controller => 'xls_export', :action => 'export_current', :project_id => context[:project] }),
Expand Down
2 changes: 1 addition & 1 deletion lib/xlse_asset_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module XLSE_AssetHelpers
module XlseAssetHelpers

PLUGIN_NAME = File.expand_path('../../*', __FILE__).match(/.*\/(.*)\/\*$/)[1].to_sym

Expand Down