You've already forked baupm-core
69 lines
2.1 KiB
Ruby
69 lines
2.1 KiB
Ruby
require 'redmine'
|
|
|
|
class Hooks < Redmine::Hook::ViewListener
|
|
render_on :view_layouts_base_html_head, :partial => 'header', :layout => false
|
|
end
|
|
|
|
Redmine::Plugin.register :baupm_core do
|
|
name 'BauPM Core Plugin'
|
|
url 'https://src.bundespruefstelle.ch/magdev/baupm-core'
|
|
author 'Marco Grätsch'
|
|
author_url 'https://src.bundespruefstelle.ch/magdev'
|
|
description "Common modifications for BauPM"
|
|
version '0.2.2'
|
|
|
|
requires_redmine :version_or_higher => '4.1.0'
|
|
|
|
settings :default => {
|
|
'baupm_background_color' => '#ffffff',
|
|
'baupm_theme_color' => '#575757',
|
|
'baupm_application_title' => 'BauPM',
|
|
'baupm_application_short_title' => 'BauPM',
|
|
'baupm_application_description' => 'Baustellen-Management-System auf Redmine-Basis',
|
|
'baupm_manifest_orientation' => 'portrait',
|
|
'baupm_manifest_display' => 'standalone',
|
|
'baupm_manifest_start_url' => '.',
|
|
'baupm_enable_webapp' => '1'
|
|
}, :partial => 'settings/baupm_settings'
|
|
end
|
|
|
|
Redmine::WikiFormatting::Macros.register do
|
|
desc <<-DESCRIPTION
|
|
Embed video attachments
|
|
|
|
{{video(attachment.mp4)}} show video with default size 640x360
|
|
{{video(attachment.mp4, width=480, height=320)}} show video with size 480x320
|
|
DESCRIPTION
|
|
|
|
macro :video do |obj, args|
|
|
@width = args[1].gsub(/\D/,'') if args[1]
|
|
@height = args[2].gsub(/\D/,'') if args[2]
|
|
@width ||= 640
|
|
@height ||= 360
|
|
attachment = obj.attachments.find_by_filename(args[0]) if obj.respond_to?('attachments')
|
|
|
|
if attachment
|
|
file_url = url_for(
|
|
:only_path => false,
|
|
:controller => 'attachments',
|
|
:action => 'download',
|
|
:id => attachment,
|
|
:filename => attachment.filename
|
|
)
|
|
out = <<END
|
|
<video width="#{@width}" height="#{@height}" playsinline controls class="embedded-video">
|
|
<source src="#{file_url}">
|
|
Your browser does not support the video tag.
|
|
</video>
|
|
END
|
|
else
|
|
file_url = args[0].gsub(/<.*?>/, '').gsub(/<.*>/,'')
|
|
out = <<END
|
|
<iframe width="#{@width}" height="#{@height}" src="#{file_url}" class="embedded-video"></iframe>
|
|
END
|
|
end
|
|
|
|
out.html_safe
|
|
end
|
|
end
|