Skip to content
Snippets Groups Projects
Commit 1a46b222 authored by Дмитрий Коваленок's avatar Дмитрий Коваленок
Browse files

generating redmine_omniauth_google plugin skeleton

parent 1000eee7
No related branches found
No related tags found
No related merge requests found
= redmine_omniauth_google
Description goes here
# English strings go here for Rails i18n
en:
my_label: "My label"
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
Redmine::Plugin.register :redmine_omniauth_google do
name 'Redmine Omniauth Google plugin'
author 'Author name'
description 'This is a plugin for Redmine'
version '0.0.1'
url 'http://example.com/path/to/plugin'
author_url 'http://example.com/about'
end
# Load the Redmine helper
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
redmine_time_limit @ 695323b7
Subproject commit 695323b738ff53b744f014f0b01b85f14f729760
<p>
<label>Mode</label>
<%= select_tag 'settings[mode]', options_for_select([nil, 'nginx'], @settings['mode']), :onchange => "$$('.xsendfile').invoke('hide'); if (this.value) { $('xsendfile_' + this.value).show(); }" %>
</p>
<div id="xsendfile_nginx" class="xsendfile wiki" style="<% if @settings['mode'] != 'nginx' %>display: none;<% end %>">
This should be added to nginx config:
<pre>
location /xsendfile/ {
alias <%= Attachment.storage_path %>/;
internal;
}</pre>
</div>
require 'redmine'
require 'xsendfile_patch'
ActionController::DataStreaming.send(:include, XsendfilePatch)
Redmine::Plugin.register :redmine_xsendfile do
name 'XSendfile plugin'
author 'Just Lest'
description ''
version '0.0.1'
settings :default => {'mode' => nil},
:partial => 'settings/xsendfile_settings'
end
module XsendfilePatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :send_file, :xsendfile
end
end
module InstanceMethods
def send_file_with_xsendfile(path, options = {})
if params[:controller] == 'attachments'
case Setting.plugin_redmine_xsendfile['mode']
when 'nginx'
options[:length] ||= File.size(path)
options[:filename] ||= File.basename(path) unless options[:url_based_filename]
send_file_headers! options
@performed_render = false
xsendfile_path = path.gsub(/^#{Regexp.quote(Attachment.storage_path)}/, '/xsendfile')
logger.info "Sending X-Accel-Redirect header #{xsendfile_path}" if logger
head options[:status], 'X-Accel-Redirect' => xsendfile_path
else
send_file_without_xsendfile(path, options)
end
else
send_file_without_xsendfile(path, options)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment