Youtube macro has been added
This commit is contained in:
parent
4940e322c7
commit
86eda9b9ba
12
README.md
12
README.md
@ -77,6 +77,13 @@ Macro to get current date, year, month, day
|
||||
{{current_weekday}} := current weekday
|
||||
{{current_weeknumber}} := current week number (The week starts with Monday)
|
||||
|
||||
### Youtube macros
|
||||
|
||||
{youtube(wvsboPUjrGc)}} := youtube video with video wvsboPUjrGc (iframe) and default size 640x360
|
||||
{{youtube(wvsboPUjrGc,853,480)}} := youtube video with size 853x480
|
||||
{{youtube(wvsboPUjrGc,853,480,1)}} := youtube video with size 853x480 and autoplay
|
||||
{{youtube(wvsboPUjrGc,,,1)}} := youtube video with size 853x480 and autoplay
|
||||
|
||||
|
||||
### Custom help URL
|
||||
|
||||
@ -88,6 +95,11 @@ Note: Redmine must be restarted after changing "Custom Help URL"</tt> value befo
|
||||
|
||||
## Changelog
|
||||
|
||||
### 0.4.8
|
||||
|
||||
- added youtube macro
|
||||
- project guide subject can be defined for project overview page
|
||||
|
||||
### 0.4.7
|
||||
|
||||
- added jump to top link
|
||||
|
@ -1,14 +1,16 @@
|
||||
<%
|
||||
|
||||
wiki_skeletal = ''
|
||||
|
||||
wiki_skeletal << Setting.plugin_redmine_tweaks['project_wiki_skeletal']
|
||||
|
||||
if wiki_skeletal != ''
|
||||
skeletal_title = ''
|
||||
wiki_skeletal << Setting.plugin_redmine_tweaks['project_wiki_skeletal'].to_s
|
||||
skeletal_title << Setting.plugin_redmine_tweaks['project_wiki_skeletal_title'].to_s
|
||||
unless wiki_skeletal.empty?
|
||||
%>
|
||||
|
||||
<div class="box">
|
||||
<h3><%= l(:label_project_wiki_skeletal) %></h3>
|
||||
<% unless skeletal_title.empty? %>
|
||||
<h3><%= l(:label_project_wiki_skeletal) %></h3>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= textilizable(wiki_skeletal).html_safe %>
|
||||
</p>
|
||||
|
@ -16,6 +16,11 @@
|
||||
<em class="info"><%= l(:project_wiki_skeletal_info) %></em>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_project_wiki_skeletal_title)) %>
|
||||
<%= text_field_tag('settings[project_wiki_skeletal_title]', @settings['project_wiki_skeletal_title'], :size => 60) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_global_sidebar)) %>
|
||||
<%= text_area_tag 'settings[global_sidebar]', @settings[:global_sidebar], :class => 'wiki-edit', :rows => 10 %>
|
||||
|
@ -27,6 +27,7 @@ de:
|
||||
label_new_ticket_message: "Hinweistext für neue Tickets"
|
||||
new_ticket_message_info: "Ein Hinweis, der beim Erstellen neuer Tickets angezeigt wird. Es kann beispielsweise auf Akzeptanztests oder Richtlinien zum Erstellen der Tickets hingewiesen werden. Dieser Einstellung ist projektübergreifend und ist in allen Projekten aktiv."
|
||||
label_project_wiki_skeletal: "Projektwegweiser"
|
||||
label_project_wiki_skeletal_title: "Projektwegweiser Titel"
|
||||
project_wiki_skeletal_info: "Hier kann ein Text hinterlegt werden, der auf der Übersichtsprojektseite angezeigt wird. Verweisen Sie beispielsweise auf bestimmte Wiki Seiten, welche projektübergreifend vorhanden sind/sein sollten. Ziel sollte eine Standardisierung in den Projekten und eine einheitliche Wiki-Struktur sein."
|
||||
label_global_sidebar: "Projektübergreifender Sidebar Inhalt"
|
||||
global_sidebar_info: "Hier kann für die Sidebar ein projektübergreifender Text hinterlegt werden. Der hier hinterlegte Sidebar Inhalt wird auf der Projektübersichtsseite, auf den Ticketseiten und den Wikiseiten angezeigt."
|
||||
|
@ -27,6 +27,7 @@ en:
|
||||
label_new_ticket_message: "Note for new tickets"
|
||||
new_ticket_message_info: "A note will be shown to everyone who wants to add a new ticket. For example you can enter acceptance tests or ticket rules here. These settings are used project wide."
|
||||
label_project_wiki_skeletal: "Project guide"
|
||||
label_project_wiki_skeletal_title: "Project guide title"
|
||||
project_wiki_skeletal_info: "Here you can add your text, which will be shown on the project overview page. For example you can link to a wiki page, which is/should be project wide available to every team member. The aim is to reach a better project standard and to maintain a unique wiki structure."
|
||||
label_global_sidebar: "Global sidebar"
|
||||
global_sidebar_info: "Enter a project wide available text message here. This sidebar text will be displayed at the project overview, the ticket pages and the wiki pages."
|
||||
|
15
init.rb
15
init.rb
@ -1,16 +1,12 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
require 'redmine'
|
||||
|
||||
require_dependency 'redmine_tweaks/hooks'
|
||||
require_dependency 'redmine_tweaks/project_macros'
|
||||
require_dependency 'redmine_tweaks/user_macros'
|
||||
require_dependency 'redmine_tweaks/date_macros'
|
||||
|
||||
Redmine::Plugin.register :redmine_tweaks do
|
||||
name 'Redmine Tweaks'
|
||||
author 'AlphaNodes GmbH'
|
||||
description 'Wiki and content extensions'
|
||||
version '0.4.7'
|
||||
version '0.4.8'
|
||||
author_url 'http://alphanodes.com/'
|
||||
url 'http://github.com/alexandermeindl/redmine_tweaks'
|
||||
|
||||
@ -23,6 +19,7 @@ Redmine::Plugin.register :redmine_tweaks do
|
||||
'disabled_modules' => nil,
|
||||
'account_login_bottom' => '',
|
||||
'new_ticket_message' => 'Don\'t forget to define acceptance criteria!',
|
||||
'project_wiki_skeletal_title' => 'Project guide',
|
||||
'project_wiki_skeletal' => 'Go to admin area and define a nice wiki text here as a fixed skeletal for all projects.',
|
||||
'global_sidebar' => '',
|
||||
'global_wiki_sidebar' => '',
|
||||
@ -80,9 +77,15 @@ if ActiveRecord::Base.connection.table_exists?(:settings)
|
||||
unless WikiController.included_modules.include? RedmineTweaks::WikiControllerPatch
|
||||
WikiController.send(:include, RedmineTweaks::WikiControllerPatch)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
require 'settings_helper'
|
||||
SettingsHelper.send :include, RedmineTweaksHelper
|
||||
end
|
||||
|
||||
ActionDispatch::Reloader.to_prepare do
|
||||
require_dependency 'redmine_tweaks/project_macros'
|
||||
require_dependency 'redmine_tweaks/user_macros'
|
||||
require_dependency 'redmine_tweaks/date_macros'
|
||||
require_dependency 'redmine_tweaks/youtube_macros'
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
# Copyright (C) 2013,214 AlphaNodes GmbH
|
||||
|
||||
require_dependency 'redmine/info'
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
|
||||
require 'redmine'
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
module RedmineTweaks
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
@ -9,22 +7,14 @@ module RedmineTweaks
|
||||
desc <<-EOHELP
|
||||
Display current dates. Examples:
|
||||
|
||||
!{{current_year}}
|
||||
current year
|
||||
!{{current_month}}
|
||||
current month
|
||||
!{{current_day}}
|
||||
current day
|
||||
!{{current_day}}
|
||||
current day
|
||||
!{{current_hour}}
|
||||
current hour
|
||||
!{{current_minute}}
|
||||
current minute
|
||||
!{{current_weekday}}
|
||||
current weekday
|
||||
!{{current_weeknumber}}
|
||||
current week number (1 - 52) The week starts with Monday
|
||||
{{current_year}} current year
|
||||
{{current_month}} current month
|
||||
{{current_day}} current day
|
||||
{{current_day}} current day
|
||||
{{current_hour}} current hour
|
||||
{{current_minute}} current minute
|
||||
{{current_weekday}} current weekday
|
||||
{{current_weeknumber}} current week number (1 - 52) The week starts with Monday
|
||||
EOHELP
|
||||
|
||||
macro :current_year do |obj, args|
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
module RedmineTweaks
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
module RedmineTweaks
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
|
||||
require 'redmine'
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
module RedmineTweaks
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
@ -9,11 +7,12 @@ module RedmineTweaks
|
||||
desc <<-EOHELP
|
||||
Display projects. Examples:
|
||||
|
||||
!{{list_projects}}
|
||||
{{list_projects}}
|
||||
...List all project, which I am member of
|
||||
|
||||
!{{list_projects(My project list)}}
|
||||
{{list_projects(My project list)}}
|
||||
...List all project with title "My project list", which I am member of
|
||||
|
||||
EOHELP
|
||||
|
||||
macro :list_projects do |obj, args|
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
|
||||
require 'redmine'
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
module RedmineTweaks
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
@ -9,20 +7,21 @@ module RedmineTweaks
|
||||
desc <<-EOHELP
|
||||
Display users. Examples:
|
||||
|
||||
!{{list_users}}
|
||||
{{list_users}}
|
||||
...List all users for all projects
|
||||
|
||||
!{{list_users(123)}}
|
||||
{{list_users(123)}}
|
||||
...A box showing all members for the project 123
|
||||
|
||||
!{{list_users(the-identifier)}}
|
||||
{{list_users(the-identifier)}}
|
||||
...A box showing all members for the project with the identifier of 'the-identifier'
|
||||
|
||||
!{{list_users('My project name')}}
|
||||
{{list_users('My project name')}}
|
||||
...A box showing all members for the project named 'My project name'
|
||||
|
||||
!{{list_users('My project name', Manager)}}
|
||||
{{list_users('My project name', Manager)}}
|
||||
...A box showing all managers for the project named 'My project name'
|
||||
|
||||
EOHELP
|
||||
|
||||
macro :list_users do |obj, args|
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
begin
|
||||
require_dependency 'application'
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013 AlphaNodes GmbH
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
begin
|
||||
require_dependency 'application'
|
||||
|
47
lib/redmine_tweaks/youtube_macros.rb
Executable file
47
lib/redmine_tweaks/youtube_macros.rb
Executable file
@ -0,0 +1,47 @@
|
||||
# Redmine Tweaks plugin for Redmine
|
||||
# Copyright (C) 2013,2014 AlphaNodes GmbH
|
||||
|
||||
module RedmineTweaks
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
|
||||
desc <<-EOHELP
|
||||
Youtube macro to include youtube video.
|
||||
|
||||
Syntax:
|
||||
|
||||
{{youtube(<video key>,[<width>,<height>,<autoplay>])}}
|
||||
|
||||
Examples:
|
||||
|
||||
{{youtube(KMU0tzLwhbE)}} show video with default size 640x360
|
||||
{{youtube(KMU0tzLwhbE,853,480)}} show video with user defined size
|
||||
{{youtube(KMU0tzLwhbE,853,480,1)}} show video with user defined size and autoplay video
|
||||
|
||||
EOHELP
|
||||
|
||||
# Register youtube macro
|
||||
macro :youtube do |youtube_wiki_content, args|
|
||||
h = 360
|
||||
w = 640
|
||||
if args.length >= 1
|
||||
v = args[0]
|
||||
|
||||
unless args[1].nil? || args[1].empty? || args[2].nil? || args[2].empty?
|
||||
w = args[1]
|
||||
h = args[2]
|
||||
end
|
||||
|
||||
unless args[3].nil? || args[3] == 1
|
||||
src = "//www.youtube.com/embed/" + v + "?autoplay=1"
|
||||
else
|
||||
src = "//www.youtube-nocookie.com/embed/" + v
|
||||
end
|
||||
|
||||
content_tag(:iframe, '', :width=>w, :height=>h, :src=>src, :frameborder=>0, :allowfullscreen=>"true" )
|
||||
else
|
||||
out = "<pre>Error in youtube macro. The correct usage is {{youtube(<video key>,[<width>,<height>])}}.</pre>"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user