From 0a7dd8f580bab2d6c08990884ff0acfa7f931747 Mon Sep 17 00:00:00 2001 From: Alexander Meindl <alex@alphanodes.com> Date: Wed, 12 Sep 2018 16:04:39 +0200 Subject: [PATCH] Working on help menu #3226 --- CHANGELOG.rst | 3 +- app/controllers/macros_controller.rb | 7 ++ app/helpers/additionals_fontawesome_helper.rb | 46 ++++++++ app/helpers/additionals_menu_helper.rb | 95 +++++++++++++++ app/views/additionals/_body_bottom.html.slim | 5 + .../additionals/settings/_macros.html.slim | 4 - app/views/macros/show.html.slim | 11 ++ assets/stylesheets/additionals.css | 45 +++++++ config/routes.rb | 4 + lib/additionals/helpers.rb | 110 ------------------ .../patches/application_controller_patch.rb | 44 +++---- lib/additionals/wiki_macros/calendar_macro.rb | 14 +-- .../wiki_macros/cryptocompare_macro.rb | 6 +- lib/additionals/wiki_macros/date_macro.rb | 20 ++-- lib/additionals/wiki_macros/fa_macro.rb | 48 ++++---- lib/additionals/wiki_macros/gmap_macro.rb | 12 +- .../wiki_macros/group_users_macro.rb | 12 +- lib/additionals/wiki_macros/iframe_macro.rb | 16 +-- lib/additionals/wiki_macros/issue_macro.rb | 48 ++++---- .../wiki_macros/last_updated_at_macro.rb | 8 +- .../wiki_macros/last_updated_by_macro.rb | 4 +- lib/additionals/wiki_macros/member_macro.rb | 30 ++--- .../wiki_macros/meteoblue_macro.rb | 12 +- .../wiki_macros/new_issue_macro.rb | 28 ++--- lib/additionals/wiki_macros/project_macro.rb | 20 ++-- .../wiki_macros/recently_updated_macro.rb | 16 +-- lib/additionals/wiki_macros/reddit_macro.rb | 4 +- .../wiki_macros/redmine_issue_macro.rb | 4 +- .../wiki_macros/redmine_wiki_macro.rb | 4 +- .../wiki_macros/slideshare_macro.rb | 14 +-- .../wiki_macros/tradingview_macro.rb | 6 +- lib/additionals/wiki_macros/twitter_macro.rb | 4 +- lib/additionals/wiki_macros/vimeo_macro.rb | 14 +-- lib/additionals/wiki_macros/youtube_macro.rb | 14 +-- 34 files changed, 408 insertions(+), 324 deletions(-) create mode 100644 app/controllers/macros_controller.rb create mode 100644 app/helpers/additionals_fontawesome_helper.rb create mode 100644 app/helpers/additionals_menu_helper.rb delete mode 100644 app/views/additionals/settings/_macros.html.slim create mode 100644 app/views/macros/show.html.slim diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 38e1bd9a..088c59ac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ Changelog ========= -2.0.14 +2.0.14 - not tagged ++++++ - Change status is now compatible with redmine_agile @@ -10,6 +10,7 @@ Changelog - compatibility with plugin redmine_sudo and redmine_base_deface - FontAwesome wiki macro has been added (called fa) - Redmine.org issue and wiki page macro has been added +- Show macro list to all logged users at /help/macros 2.0.13 ++++++ diff --git a/app/controllers/macros_controller.rb b/app/controllers/macros_controller.rb new file mode 100644 index 00000000..990c868a --- /dev/null +++ b/app/controllers/macros_controller.rb @@ -0,0 +1,7 @@ +class MacrosController < ApplicationController + before_action :require_login + + def show + @available_macros = Redmine::WikiFormatting::Macros.available_macros.sort + end +end diff --git a/app/helpers/additionals_fontawesome_helper.rb b/app/helpers/additionals_fontawesome_helper.rb new file mode 100644 index 00000000..39dc0e5c --- /dev/null +++ b/app/helpers/additionals_fontawesome_helper.rb @@ -0,0 +1,46 @@ +module AdditionalsFontawesomeHelper + def fontawesome_info_url + s = [] + s << l(:label_set_icon_from) + s << link_to('https://fontawesome.com/icons?m=free', 'https://fontawesome.com/icons?m=free', class: 'external') + safe_join(s, ' ') + end + + # name = TYPE-FA_NAME, eg. fas_car + # fas_cloud-upload-alt + # far_id-card + # fab_font-awesome + # options = class + # pre_text + # post_text + # title + def font_awesome_icon(name, options = {}) + info = AdditionalsFontAwesome.value_info(name) + return '' if info.blank? + + post_text = '' + options['aria-hidden'] = 'true' + options[:class] = if options[:class].present? + info[:classes] + ' ' + options[:class] + else + info[:classes] + end + + s = [] + if options[:pre_text].present? + s << options[:pre_text] + s << ' ' + options.delete(:pre_text) + end + if options[:post_text].present? + post_text = options[:post_text] + options.delete(:post_text) + end + s << content_tag('span', '', options) + if post_text.present? + s << ' ' + s << post_text + end + safe_join(s) + end +end diff --git a/app/helpers/additionals_menu_helper.rb b/app/helpers/additionals_menu_helper.rb new file mode 100644 index 00000000..3abac91c --- /dev/null +++ b/app/helpers/additionals_menu_helper.rb @@ -0,0 +1,95 @@ +module AdditionalsMenuHelper + def handle_top_menu_item(menu_name, item) + Redmine::MenuManager.map(:top_menu).delete(menu_name.to_sym) if Redmine::MenuManager.map(:top_menu).exists?(menu_name.to_sym) + + html_options = {} + html_options[:class] = 'external' if item[:url].include? '://' + html_options[:title] = item[:title] if item[:title].present? + + menu_options = { parent: item[:parent].present? ? item[:parent].to_sym : nil, + html: html_options } + + menu_options[:if] = menu_options[:if] if menu_options[:if].present? + + menu_options[:caption] = if item[:symbol].present? && item[:name].present? + font_awesome_icon(item[:symbol], post_text: item[:name]) + elsif item[:symbol].present? + font_awesome_icon(item[:symbol]) + elsif item[:name].present? + item[:name].to_s + end + + if item[:last].present? && item[:last] + menu_options[:last] = true + elsif item[:before].present? + menu_options[:before] = item[:before] + elsif item[:after].present? + menu_options[:after] = item[:after] + else + menu_options[:before] = :help + end + + Redmine::MenuManager.map(:top_menu).push(menu_name, item[:url], menu_options) + end + + def additionals_custom_top_menu_item(num, user_roles) + menu_name = 'custom_menu' + num.to_s + item = { + url: Additionals.settings[menu_name + '_url'], + name: Additionals.settings[menu_name + '_name'], + title: Additionals.settings[menu_name + '_title'], + roles: Additionals.settings[menu_name + '_roles'] + } + if item[:name].blank? || item[:url].blank? || item[:roles].nil? + Redmine::MenuManager.map(:top_menu).delete(menu_name.to_sym) if Redmine::MenuManager.map(:top_menu).exists?(menu_name.to_sym) + return + end + + show_entry = false + item[:roles].each do |role| + if user_roles.empty? && role.to_i == Role::BUILTIN_ANONYMOUS + show_entry = true + break + elsif User.current.logged? && role.to_i == Role::BUILTIN_NON_MEMBER + # if user is logged in and non_member is active in item, + # always show it + show_entry = true + break + end + + user_roles.each do |user_role| + if role.to_i == user_role.id.to_i + show_entry = true + break + end + end + break if show_entry == true + end + + if show_entry + handle_top_menu_item(menu_name, item) + elsif Redmine::MenuManager.map(:top_menu).exists?(menu_name.to_sym) + Redmine::MenuManager.map(:top_menu).delete(menu_name.to_sym) + end + end + + def additionals_help_menu_items + pages = [{ title: 'Redmine Guide', url: Redmine::Info.help_url }, + { title: 'FontAwesome Icons', url: 'https://fontawesome.com/icons?d=gallery&m=free' }, + { title: 'Additionals manual', url: 'https://additionals.readthedocs.io/en/latest/manual/' }] + + if User.current.admin? + pages << { title: 'Redmine Changelog', url: 'https://www.redmine.org/projects/redmine/wiki/Changelog_3_4' } + pages << { title: 'Redmine Upgrade', url: 'https://www.redmine.org/projects/redmine/wiki/RedmineUpgrade' } + pages << { title: 'Redmine Security Advisories', url: 'https://www.redmine.org/projects/redmine/wiki/Security_Advisories' } + end + + s = [] + pages.each_with_index do |p, idx| + html_options = { class: 'help_item_' + idx.to_s } + s << content_tag(:li, + link_to(p[:title], p[:url], html_options)) + end + safe_join(s) + end +end diff --git a/app/views/additionals/_body_bottom.html.slim b/app/views/additionals/_body_bottom.html.slim index 7b47834b..28c4f22b 100644 --- a/app/views/additionals/_body_bottom.html.slim +++ b/app/views/additionals/_body_bottom.html.slim @@ -2,3 +2,8 @@ - if footer.present? .additionals-footer = textilizable(footer) +- if @additionals_help_items.present? + javascript: + $(function() { + $('a.help').parent().append("<ul class=\"menu-children\">#{escape_javascript(@additionals_help_items)}</ul>"); + }); diff --git a/app/views/additionals/settings/_macros.html.slim b/app/views/additionals/settings/_macros.html.slim deleted file mode 100644 index c52bdcd6..00000000 --- a/app/views/additionals/settings/_macros.html.slim +++ /dev/null @@ -1,4 +0,0 @@ -.info = t(:label_top_macros_help_html) -br -.box - = textilizable('{{macro_list}}').html_safe diff --git a/app/views/macros/show.html.slim b/app/views/macros/show.html.slim new file mode 100644 index 00000000..9bb27440 --- /dev/null +++ b/app/views/macros/show.html.slim @@ -0,0 +1,11 @@ +h2 = l(:label_settings_macros) + " (#{@available_macros.count})" + +.info = t(:label_top_macros_help_html) +br +.box + - @available_macros.each do |macro, options| + .macro-box + .macro-title + = macro.to_s + .macro-desc + pre = options[:desc] diff --git a/assets/stylesheets/additionals.css b/assets/stylesheets/additionals.css index 3f3b8956..58917b90 100644 --- a/assets/stylesheets/additionals.css +++ b/assets/stylesheets/additionals.css @@ -244,3 +244,48 @@ a.external.redmine-link { background-position: 0% 40%; padding-left: 13px; } + +div.macro-box { + margin-bottom: 15px; +} + +div.macro-title { + font-weight: bold; +} + +div.macro-desc { +} + +#top-menu li:hover ul.menu-children, +#top-menu li ul.menu-children.visible { display: block; } + +#top-menu .menu-children { + display: none; + position: absolute; + width: inherit; + z-index: 45; + background-color: #fff; + box-shadow: 2px 2px 14px #000; + top: 17px; + font-size: 110%; +} + +#top-menu .menu-children li { + float: left; + clear: both; + width: 100%; +} + +#top-menu .menu-children li a { + display: block; + color: #555; + padding: 5px 10px; + background-color: #fff; + font-weight: normal; + margin-right: 0; +} + +#top-menu .menu-children li a:hover { + color: #fff; + background-color: #759fcf; +} diff --git a/config/routes.rb b/config/routes.rb index f7b7b9bb..7dfa306f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,3 +7,7 @@ resources :issues, only: [] do resource 'assign_to_me', only: %i[update], controller: 'additionals_assign_to_me' resource 'change_status', only: %i[update], controller: 'additionals_change_status' end + +scope '/help' do + resource :macros, only: :show +end diff --git a/lib/additionals/helpers.rb b/lib/additionals/helpers.rb index 97f77188..1ea7c5dc 100644 --- a/lib/additionals/helpers.rb +++ b/lib/additionals/helpers.rb @@ -48,7 +48,6 @@ module Additionals tabs << { name: 'menu', partial: 'additionals/settings/menu', label: :label_settings_menu } end tabs << { name: 'web', partial: 'additionals/settings/web_apis', label: :label_web_apis } - tabs << { name: 'macros', partial: 'additionals/settings/macros', label: :label_settings_macros } tabs end @@ -195,70 +194,6 @@ module Additionals view_roles end - def additionals_custom_top_menu_item(num, user_roles) - menu_name = 'custom_menu' + num.to_s - item = { - url: Additionals.settings[menu_name + '_url'], - name: Additionals.settings[menu_name + '_name'], - title: Additionals.settings[menu_name + '_title'], - roles: Additionals.settings[menu_name + '_roles'] - } - if item[:name].blank? || item[:url].blank? || item[:roles].nil? - Redmine::MenuManager.map(:top_menu).delete(menu_name.to_sym) if Redmine::MenuManager.map(:top_menu).exists?(menu_name.to_sym) - return - end - - show_entry = false - item[:roles].each do |role| - if user_roles.empty? && role.to_i == Role::BUILTIN_ANONYMOUS - show_entry = true - break - elsif User.current.logged? && role.to_i == Role::BUILTIN_NON_MEMBER - # if user is logged in and non_member is active in item, - # always show it - show_entry = true - break - end - - user_roles.each do |user_role| - if role.to_i == user_role.id.to_i - show_entry = true - break - end - end - break if show_entry == true - end - - if show_entry - handle_top_menu_item(menu_name, item) - elsif Redmine::MenuManager.map(:top_menu).exists?(menu_name.to_sym) - Redmine::MenuManager.map(:top_menu).delete(menu_name.to_sym) - end - end - - def handle_top_menu_item(menu_name, item) - Redmine::MenuManager.map(:top_menu).delete(menu_name.to_sym) if Redmine::MenuManager.map(:top_menu).exists?(menu_name.to_sym) - - html_options = {} - html_options[:class] = 'external' if item[:url].include? '://' - html_options[:title] = item[:title] if item[:title].present? - - title = if item[:symbol].present? && item[:name].present? - font_awesome_icon(item[:symbol], post_text: item[:name]) - elsif item[:symbol].present? - font_awesome_icon(item[:symbol]) - else - item[:name].to_s - end - - Redmine::MenuManager.map(:top_menu).push menu_name, - item[:url], - parent: item[:parent].present? ? item[:parent].to_sym : nil, - caption: title, - html: html_options, - before: :help - end - def bootstrap_datepicker_locale s = '' locale = User.current.language.presence || ::I18n.locale @@ -375,51 +310,6 @@ module Additionals safe_join(s) end - def fontawesome_info_url - s = [] - s << l(:label_set_icon_from) - s << link_to('https://fontawesome.com/icons?m=free', 'https://fontawesome.com/icons?m=free', class: 'external') - safe_join(s, ' ') - end - - # name = TYPE-FA_NAME, eg. fas_car - # fas_cloud-upload-alt - # far_id-card - # fab_font-awesome - # options = class - # pre_text - # post_text - # title - def font_awesome_icon(name, options = {}) - info = AdditionalsFontAwesome.value_info(name) - return '' if info.blank? - - post_text = '' - options['aria-hidden'] = 'true' - options[:class] = if options[:class].present? - info[:classes] + ' ' + options[:class] - else - info[:classes] - end - - s = [] - if options[:pre_text].present? - s << options[:pre_text] - s << ' ' - options.delete(:pre_text) - end - if options[:post_text].present? - post_text = options[:post_text] - options.delete(:post_text) - end - s << content_tag('span', '', options) - if post_text.present? - s << ' ' - s << post_text - end - safe_join(s) - end - def options_for_menu_select(active) options_for_select({ l(:button_hide) => '', l(:label_top_menu) => 'top', diff --git a/lib/additionals/patches/application_controller_patch.rb b/lib/additionals/patches/application_controller_patch.rb index be596ac3..083d3611 100644 --- a/lib/additionals/patches/application_controller_patch.rb +++ b/lib/additionals/patches/application_controller_patch.rb @@ -6,6 +6,14 @@ module Additionals base.class_eval do alias_method :user_setup_without_additionals, :user_setup alias_method :user_setup, :user_setup_with_additionals + + helper :additionals_menu + helper :additionals_fontawesome + + include AdditionalsMenuHelper + include AdditionalsFontawesomeHelper + include ActionView::Helpers::TagHelper + include ActionView::Helpers::UrlHelper end end @@ -14,41 +22,17 @@ module Additionals user_setup_without_additionals return unless User.current.try(:hrm_user_type_id).nil? - additionals_menu_item_delete(:help) - unless Additionals.setting?(:remove_help) - custom_url = Additionals.settings[:custom_help_url] - if custom_url.present? - additionals_menu_item_add(:help, custom_url) - else - additionals_menu_item_add(:help) - end - end - if Additionals.setting?(:remove_mypage) - additionals_menu_item_delete(:my_page) + Redmine::MenuManager.map(:top_menu).delete(:my_page) if Redmine::MenuManager.map(:top_menu).exists?(:my_page) else - additionals_menu_item_add(:my_page) + handle_top_menu_item(:my_page, url: my_path, after: :home, if: proc { User.current.logged? }) end - end - def additionals_menu_item_delete(item) - Redmine::MenuManager.map(:top_menu).delete(item) if Redmine::MenuManager.map(:top_menu).exists?(item) - end - - def additionals_menu_item_add(item, custom_url = nil) - return if Redmine::MenuManager.map(:top_menu).exists?(item) - - case item - when :help - url = custom_url.presence || Redmine::Info.help_url - Redmine::MenuManager.map(:top_menu).push :help, url, html: { class: 'external' }, last: true - when :my_page - Redmine::MenuManager.map(:top_menu).push :my_page, - { controller: 'my', action: 'page' }, - after: :home, - if: proc { User.current.logged? } + if Additionals.setting?(:remove_help) + Redmine::MenuManager.map(:top_menu).delete(:help) if Redmine::MenuManager.map(:top_menu).exists?(:help) else - raise 'unknow top menu item' + handle_top_menu_item(:help, url: '#', symbol: 'fas_question', last: true) + @additionals_help_items = additionals_help_menu_items end end end diff --git a/lib/additionals/wiki_macros/calendar_macro.rb b/lib/additionals/wiki_macros/calendar_macro.rb index c733fb2b..603185f7 100644 --- a/lib/additionals/wiki_macros/calendar_macro.rb +++ b/lib/additionals/wiki_macros/calendar_macro.rb @@ -3,15 +3,15 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display calendar (only works on wiki pages) + Display calendar (only works on wiki pages) - Examples: + Examples: - {{calendar}} show calendar for current date - {{calendar(year=2014,month=6)}} show calendar for Juni in year 2014 - {{calendar(show_weeks=true)}} show calendar with week numbers - {{calendar(select=2015-07-12 2015-07-31, show_weeks=true)}} preselect dates and show week numbers - {{calendar(select=2016-03-13:2016-03-27)}} preselect dates between 2016/3/13 and 2016/3/27 + {{calendar}} show calendar for current date + {{calendar(year=2014,month=6)}} show calendar for Juni in year 2014 + {{calendar(show_weeks=true)}} show calendar with week numbers + {{calendar(select=2015-07-12 2015-07-31, show_weeks=true)}} preselect dates and show week numbers + {{calendar(select=2016-03-13:2016-03-27)}} preselect dates between 2016/3/13 and 2016/3/27 DESCRIPTION macro :calendar do |_obj, args| diff --git a/lib/additionals/wiki_macros/cryptocompare_macro.rb b/lib/additionals/wiki_macros/cryptocompare_macro.rb index e56d89b5..2c9e5d12 100644 --- a/lib/additionals/wiki_macros/cryptocompare_macro.rb +++ b/lib/additionals/wiki_macros/cryptocompare_macro.rb @@ -4,9 +4,9 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Create CryptoCompare information. - {{cryptocompare(options)}} - see https://additionals.readthedocs.io/en/latest/macros/#cryptocompare + Create CryptoCompare information. + {{cryptocompare(options)}} + see https://additionals.readthedocs.io/en/latest/macros/#cryptocompare DESCRIPTION macro :cryptocompare do |_obj, args| diff --git a/lib/additionals/wiki_macros/date_macro.rb b/lib/additionals/wiki_macros/date_macro.rb index 5f46c457..7ba2dcef 100644 --- a/lib/additionals/wiki_macros/date_macro.rb +++ b/lib/additionals/wiki_macros/date_macro.rb @@ -3,18 +3,18 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display current dates. + Display current dates. - Examples: + 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 DESCRIPTION macro :current_year do |_obj, _args| diff --git a/lib/additionals/wiki_macros/fa_macro.rb b/lib/additionals/wiki_macros/fa_macro.rb index a869d84d..7e905666 100644 --- a/lib/additionals/wiki_macros/fa_macro.rb +++ b/lib/additionals/wiki_macros/fa_macro.rb @@ -3,34 +3,34 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Show Font Awesome icon. + Show Font Awesome icon. - Syntax: + Syntax: - {{fa(ICON [, class=CLASS, title=TITLE, text=TEXT size=SIZE, color=COLOR)}} - ICON of fontawesome icon, eg. fa-adjust - CLASS = additional css classes - TITLE = mouseover title - TEXT = Text to show - LINK = Link icon and text (if specified) to this URL - COLOR = css color code + {{fa(ICON [, class=CLASS, title=TITLE, text=TEXT size=SIZE, color=COLOR)}} + ICON of fontawesome icon, eg. fa-adjust + CLASS = additional css classes + TITLE = mouseover title + TEXT = Text to show + LINK = Link icon and text (if specified) to this URL + COLOR = css color code - Examples: + Examples: - {{fa(adjust)}} - ...show fontawesome icon "fas fa-adjust" - {{fa(adjust, class=fa-inverse)}} - ...show fontawesome icon "fas fa-stack" and inverse - {{fa(adjust, size=4x)}} - ...show fontawesome icon "fas fa-adjust" with size 4x - {{fa(fas_adjust, title=Show icon)}} - ...show fontawesome icon "fas fa-adjust" with title "Show icon" - {{fa(fab_angellist)}} - ...Show fontawesome icon "fab fa-angellist" - {{fa(adjust, link=https=//www.redmine.org))}} - ...Show fontawesome icon "fas fa-adjust" and link it to https://www.redmine.org - {{fa(adjust, link=https=//www.redmine.de, name=Go to Redmine.org))}} - ...Show fontawesome icon "fas fa-adjust" with name "Go to Redmine.org" and link it to https://www.redmine.org + {{fa(adjust)}} + ...show fontawesome icon "fas fa-adjust" + {{fa(adjust, class=fa-inverse)}} + ...show fontawesome icon "fas fa-stack" and inverse + {{fa(adjust, size=4x)}} + ...show fontawesome icon "fas fa-adjust" with size 4x + {{fa(fas_adjust, title=Show icon)}} + ...show fontawesome icon "fas fa-adjust" with title "Show icon" + {{fa(fab_angellist)}} + ...Show fontawesome icon "fab fa-angellist" + {{fa(adjust, link=https=//www.redmine.org))}} + ...Show fontawesome icon "fas fa-adjust" and link it to https://www.redmine.org + {{fa(adjust, link=https=//www.redmine.de, name=Go to Redmine.org))}} + ...Show fontawesome icon "fas fa-adjust" with name "Go to Redmine.org" and link it to https://www.redmine.org DESCRIPTION macro :fa do |_obj, args| diff --git a/lib/additionals/wiki_macros/gmap_macro.rb b/lib/additionals/wiki_macros/gmap_macro.rb index 956c09a2..9be3c959 100644 --- a/lib/additionals/wiki_macros/gmap_macro.rb +++ b/lib/additionals/wiki_macros/gmap_macro.rb @@ -3,17 +3,17 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display a google map. Examples: + Display a google map. Examples: - Syntax: + Syntax: - {{gmap([q=QUERY, mode=MODE, width=216, height=368])}} + {{gmap([q=QUERY, mode=MODE, width=216, height=368])}} - Examples: + Examples: - {{gmap(Munich)}} Google maps with Munich + {{gmap(Munich)}} Google maps with Munich - {{gmap(mode=directions, origin=Munich+Rosenheimerstr, destination=Arco)}} Direction from Munich to Arco + {{gmap(mode=directions, origin=Munich+Rosenheimerstr, destination=Arco)}} Direction from Munich to Arco DESCRIPTION macro :gmap do |_obj, args| diff --git a/lib/additionals/wiki_macros/group_users_macro.rb b/lib/additionals/wiki_macros/group_users_macro.rb index b43e0ec0..19ebcdb8 100644 --- a/lib/additionals/wiki_macros/group_users_macro.rb +++ b/lib/additionals/wiki_macros/group_users_macro.rb @@ -3,16 +3,16 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display users of group. + Display users of group. - Syntax: + Syntax: - {{group_users(GROUP_NAME}} + {{group_users(GROUP_NAME}} - Examples: + Examples: - {{group_users(Team)}} - ...List all users in user group "Team" (with the current user permission) + {{group_users(Team)}} + ...List all users in user group "Team" (with the current user permission) DESCRIPTION macro :group_users do |_obj, args| diff --git a/lib/additionals/wiki_macros/iframe_macro.rb b/lib/additionals/wiki_macros/iframe_macro.rb index 928d1f26..3621e5f7 100644 --- a/lib/additionals/wiki_macros/iframe_macro.rb +++ b/lib/additionals/wiki_macros/iframe_macro.rb @@ -3,19 +3,19 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Include iframe + Include iframe - Syntax: + Syntax: - {{iframe(<url> [, width=100%, height=485)}} + {{iframe(<url> [, width=100%, height=485)}} - Examples: + Examples: - show iframe of URL https://www.google.com/ - {{iframe(https://www.google.com/)}} + show iframe of URL https://www.google.com/ + {{iframe(https://www.google.com/)}} - show iframe of URL https://www.google.com/ and show link to it - {{iframe(https://www.google.com/, with_link: true)}} + show iframe of URL https://www.google.com/ and show link to it + {{iframe(https://www.google.com/, with_link: true)}} DESCRIPTION macro :iframe do |_obj, args| diff --git a/lib/additionals/wiki_macros/issue_macro.rb b/lib/additionals/wiki_macros/issue_macro.rb index 931769a5..62e6d8c4 100644 --- a/lib/additionals/wiki_macros/issue_macro.rb +++ b/lib/additionals/wiki_macros/issue_macro.rb @@ -3,34 +3,34 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Create a link to issue with the subject of this issue. + Create a link to issue with the subject of this issue. - Syntax: + Syntax: - {{issue(URL [, format=USER_FORMAT, id=ID, note_id=NOTE_ID)}} - URL is URL to issue - USER_FORMATS - - text - - short - - link (default) - - full - ID is issue - NOTE_ID is note id, if you want to display it + {{issue(URL [, format=USER_FORMAT, id=ID, note_id=NOTE_ID)}} + URL is URL to issue + USER_FORMATS + - text + - short + - link (default) + - full + ID is issue + NOTE_ID is note id, if you want to display it - Examples: + Examples: - {{issue(1)}} - ...Link to issue with id and subject - {{issue(http://myredmine.url/issues/1)}} - ...Link to issue with id and subject - {{issue(http://myredmine.url/issues/1#note-3)}} - ...Link to issue with id and subject and display comment 3 - {{issue(1, format=short)}} - ...Link to issue with subject (without id) - {{issue(1, format=text)}} - ...Display subject name - {{issue(1, format=full)}} - ...Link to issue with track, issue id and subject + {{issue(1)}} + ...Link to issue with id and subject + {{issue(http://myredmine.url/issues/1)}} + ...Link to issue with id and subject + {{issue(http://myredmine.url/issues/1#note-3)}} + ...Link to issue with id and subject and display comment 3 + {{issue(1, format=short)}} + ...Link to issue with subject (without id) + {{issue(1, format=text)}} + ...Display subject name + {{issue(1, format=full)}} + ...Link to issue with track, issue id and subject DESCRIPTION macro :issue do |_obj, args| diff --git a/lib/additionals/wiki_macros/last_updated_at_macro.rb b/lib/additionals/wiki_macros/last_updated_at_macro.rb index 17f67ab9..57d09886 100644 --- a/lib/additionals/wiki_macros/last_updated_at_macro.rb +++ b/lib/additionals/wiki_macros/last_updated_at_macro.rb @@ -3,10 +3,10 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Displays a date that updated the page. - {{last_updated_at}} - {{last_updated_at(project_name, wiki_page)}} - {{last_updated_at(project_identifier, wiki_page)}} + Displays a date that updated the page. + {{last_updated_at}} + {{last_updated_at(project_name, wiki_page)}} + {{last_updated_at(project_identifier, wiki_page)}} DESCRIPTION macro :last_updated_at do |obj, args| diff --git a/lib/additionals/wiki_macros/last_updated_by_macro.rb b/lib/additionals/wiki_macros/last_updated_by_macro.rb index 5c8d43e3..9d7461b3 100644 --- a/lib/additionals/wiki_macros/last_updated_by_macro.rb +++ b/lib/additionals/wiki_macros/last_updated_by_macro.rb @@ -3,8 +3,8 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Displays a user who updated the page. - {{last_updated_by}} + Displays a user who updated the page. + {{last_updated_by}} DESCRIPTION macro :last_updated_by do |obj, args| diff --git a/lib/additionals/wiki_macros/member_macro.rb b/lib/additionals/wiki_macros/member_macro.rb index cbd71ba6..c7cba5d9 100644 --- a/lib/additionals/wiki_macros/member_macro.rb +++ b/lib/additionals/wiki_macros/member_macro.rb @@ -3,29 +3,29 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display members. + Display members. - Syntax: + Syntax: - {{members([PROJECT_NAME, title=My members list, role=ROLE)]}} + {{members([PROJECT_NAME, title=My members list, role=ROLE)]}} - PROJECT_NAME can be project identifier, project name or project id + PROJECT_NAME can be project identifier, project name or project id - Examples: + Examples: - {{members}} - ...List all members for all projects (with the current user permission) + {{members}} + ...List all members for all projects (with the current user permission) - {{members(the-identifier)}} - ...A box showing all members for the project with the identifier of 'the-identifier' + {{members(the-identifier)}} + ...A box showing all members for the project with the identifier of 'the-identifier' - {{members(the-identifier, role=Manager)}} - ...A box showing all members for the project with the identifier of 'the-identifier', which - have the role "Manager" + {{members(the-identifier, role=Manager)}} + ...A box showing all members for the project with the identifier of 'the-identifier', which + have the role "Manager" - {{members(the-identifier, title=My user list)}} - ...A box showing all members for the project with the identifier of 'the-identifier' and with - box title "My user list" + {{members(the-identifier, title=My user list)}} + ...A box showing all members for the project with the identifier of 'the-identifier' and with + box title "My user list" DESCRIPTION macro :members do |_obj, args| diff --git a/lib/additionals/wiki_macros/meteoblue_macro.rb b/lib/additionals/wiki_macros/meteoblue_macro.rb index 991f6b55..8f84ce6c 100644 --- a/lib/additionals/wiki_macros/meteoblue_macro.rb +++ b/lib/additionals/wiki_macros/meteoblue_macro.rb @@ -3,17 +3,17 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display current weather from meteoblue service. Examples: + Display current weather from meteoblue service. Examples: - Syntax: + Syntax: - {{meteoblue(<location> [, days=INT, width=216, height=368, color=BOOL])}} + {{meteoblue(<location> [, days=INT, width=216, height=368, color=BOOL])}} - Examples: + Examples: - {{meteoblue(münchen_deutschland_2867714)}} weather for Munich + {{meteoblue(münchen_deutschland_2867714)}} weather for Munich - {{meteoblue(münchen_deutschland_2867714, days=6, color=false)}} weather for Munich of the next 6 days without color + {{meteoblue(münchen_deutschland_2867714, days=6, color=false)}} weather for Munich of the next 6 days without color DESCRIPTION macro :meteoblue do |_obj, args| diff --git a/lib/additionals/wiki_macros/new_issue_macro.rb b/lib/additionals/wiki_macros/new_issue_macro.rb index a1df0908..4c207fac 100644 --- a/lib/additionals/wiki_macros/new_issue_macro.rb +++ b/lib/additionals/wiki_macros/new_issue_macro.rb @@ -3,26 +3,26 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Create a link for "New issue" for the current user. + Create a link for "New issue" for the current user. - Syntax: + Syntax: - {{new_issue([PROJECT_NAME, name=Custom name]}} + {{new_issue([PROJECT_NAME, name=Custom name]}} - PROJECT_NAME can be project identifier, project name or project id. + PROJECT_NAME can be project identifier, project name or project id. - If no PROJECT_NAME is specified, first project is used, which the current user - has permission to create an issue. + If no PROJECT_NAME is specified, first project is used, which the current user + has permission to create an issue. - Examples: + Examples: - {{new_issue}} - ...Link to create new issue in first available project - {{new_issue(the-identifier)}} - ...Link to create new issue in project with the identifier of 'the-identifier' - {{new_issue(the-identifier, title=New issue for broken displays)}} - ...Link to create new issue in project with the identifier of 'the-identifier' - and the name 'New issue for broken displays' + {{new_issue}} + ...Link to create new issue in first available project + {{new_issue(the-identifier)}} + ...Link to create new issue in project with the identifier of 'the-identifier' + {{new_issue(the-identifier, title=New issue for broken displays)}} + ...Link to create new issue in project with the identifier of 'the-identifier' + and the name 'New issue for broken displays' DESCRIPTION macro :new_issue do |_obj, args| diff --git a/lib/additionals/wiki_macros/project_macro.rb b/lib/additionals/wiki_macros/project_macro.rb index ac98c83d..12bb1382 100644 --- a/lib/additionals/wiki_macros/project_macro.rb +++ b/lib/additionals/wiki_macros/project_macro.rb @@ -3,22 +3,22 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Display projects. + Display projects. - Syntax: + Syntax: - {{projects([title=My project list, with_create_issue=BOOL])}} + {{projects([title=My project list, with_create_issue=BOOL])}} - Examples: + Examples: - {{projects}} - ...List all project, which I am member of + {{projects}} + ...List all project, which I am member of - {{projects(title=My project list)}} - ...List all project with title "My project list", which I am member of + {{projects(title=My project list)}} + ...List all project with title "My project list", which I am member of - {{projects(with_create_issue=true)}} - ...List all project with link to create new issue, which I am member of + {{projects(with_create_issue=true)}} + ...List all project with link to create new issue, which I am member of DESCRIPTION macro :projects do |_obj, args| diff --git a/lib/additionals/wiki_macros/recently_updated_macro.rb b/lib/additionals/wiki_macros/recently_updated_macro.rb index 8f655c4c..e4bfae6b 100644 --- a/lib/additionals/wiki_macros/recently_updated_macro.rb +++ b/lib/additionals/wiki_macros/recently_updated_macro.rb @@ -3,17 +3,17 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Displays a list of pages that were updated recently. - {{recently_updated}} - {{recently_updated([days])}} + Displays a list of pages that were updated recently. + {{recently_updated}} + {{recently_updated([days])}} - Examples: + Examples: - {{recently_updated}} - ...List last updated pages (of the last 5 days) + {{recently_updated}} + ...List last updated pages (of the last 5 days) - {{recently_updated(15)}} - ...List last updated pages of the last 15 days + {{recently_updated(15)}} + ...List last updated pages of the last 15 days DESCRIPTION macro :recently_updated do |obj, args| diff --git a/lib/additionals/wiki_macros/reddit_macro.rb b/lib/additionals/wiki_macros/reddit_macro.rb index 1dfa9e1e..dc85173f 100644 --- a/lib/additionals/wiki_macros/reddit_macro.rb +++ b/lib/additionals/wiki_macros/reddit_macro.rb @@ -3,8 +3,8 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Creates link to reddit. - {{reddit(name)}} + Creates link to reddit. + {{reddit(name)}} DESCRIPTION macro :reddit do |_obj, args| diff --git a/lib/additionals/wiki_macros/redmine_issue_macro.rb b/lib/additionals/wiki_macros/redmine_issue_macro.rb index 253c479c..cf8e26a2 100644 --- a/lib/additionals/wiki_macros/redmine_issue_macro.rb +++ b/lib/additionals/wiki_macros/redmine_issue_macro.rb @@ -3,8 +3,8 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Creates link to redmine.org issue. - {{redmine_issue(1448)}} + Creates link to redmine.org issue. + {{redmine_issue(1448)}} DESCRIPTION macro :redmine_issue do |_obj, args| diff --git a/lib/additionals/wiki_macros/redmine_wiki_macro.rb b/lib/additionals/wiki_macros/redmine_wiki_macro.rb index fed7e5fa..0aa25528 100644 --- a/lib/additionals/wiki_macros/redmine_wiki_macro.rb +++ b/lib/additionals/wiki_macros/redmine_wiki_macro.rb @@ -3,8 +3,8 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Creates link to redmine.org wiki page. - {{redmine_wiki(Installing Redmine)}} + Creates link to redmine.org wiki page. + {{redmine_wiki(Installing Redmine)}} DESCRIPTION macro :redmine_wiki do |_obj, args| diff --git a/lib/additionals/wiki_macros/slideshare_macro.rb b/lib/additionals/wiki_macros/slideshare_macro.rb index 506b8714..38dbb521 100644 --- a/lib/additionals/wiki_macros/slideshare_macro.rb +++ b/lib/additionals/wiki_macros/slideshare_macro.rb @@ -3,17 +3,17 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Slideshare macro to include Slideshare slide. + Slideshare macro to include Slideshare slide. - Syntax: + Syntax: - {{slideshare(<key> [, width=595, height=485, slide=SLIDE])}} + {{slideshare(<key> [, width=595, height=485, slide=SLIDE])}} - Examples: + Examples: - {{slideshare(57941706)}} show slideshare slide with default size 595x485 - {{slideshare(57941706, width=514, height=422)}} show slide with user defined size - {{slideshare(57941706, slide=5)}} start with slide (page) 5 + {{slideshare(57941706)}} show slideshare slide with default size 595x485 + {{slideshare(57941706, width=514, height=422)}} show slide with user defined size + {{slideshare(57941706, slide=5)}} start with slide (page) 5 DESCRIPTION macro :slideshare do |_obj, args| diff --git a/lib/additionals/wiki_macros/tradingview_macro.rb b/lib/additionals/wiki_macros/tradingview_macro.rb index b8c9eb4d..8bcb232a 100644 --- a/lib/additionals/wiki_macros/tradingview_macro.rb +++ b/lib/additionals/wiki_macros/tradingview_macro.rb @@ -4,9 +4,9 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Creates Tradingview chart - {{tradingview(options)}} - see https://additionals.readthedocs.io/en/latest/macros/#tradingview + Creates Tradingview chart + {{tradingview(options)}} + see https://additionals.readthedocs.io/en/latest/macros/#tradingview DESCRIPTION macro :tradingview do |_obj, args| diff --git a/lib/additionals/wiki_macros/twitter_macro.rb b/lib/additionals/wiki_macros/twitter_macro.rb index 6c7146d5..b6df33b2 100644 --- a/lib/additionals/wiki_macros/twitter_macro.rb +++ b/lib/additionals/wiki_macros/twitter_macro.rb @@ -3,8 +3,8 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Creates link to twitter account page or topic. - {{twitter(name)}} + Creates link to twitter account page or topic. + {{twitter(name)}} DESCRIPTION macro :twitter do |_obj, args| diff --git a/lib/additionals/wiki_macros/vimeo_macro.rb b/lib/additionals/wiki_macros/vimeo_macro.rb index 22384cd3..aebf9c03 100644 --- a/lib/additionals/wiki_macros/vimeo_macro.rb +++ b/lib/additionals/wiki_macros/vimeo_macro.rb @@ -3,17 +3,17 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Vimeo macro to include vimeo video. + Vimeo macro to include vimeo video. - Syntax: + Syntax: - {{vimeo(<video key> [, width=640, height=360, autoplay=BOOL])}} + {{vimeo(<video key> [, width=640, height=360, autoplay=BOOL])}} - Examples: + Examples: - {{vimeo(142849533)}} show video with default size 640x360 - {{vimeo(142849533, width=853, height=480)}} show video with user defined size - {{vimeo(142849533, autoplay=true)}} autoplay video + {{vimeo(142849533)}} show video with default size 640x360 + {{vimeo(142849533, width=853, height=480)}} show video with user defined size + {{vimeo(142849533, autoplay=true)}} autoplay video DESCRIPTION macro :vimeo do |_obj, args| diff --git a/lib/additionals/wiki_macros/youtube_macro.rb b/lib/additionals/wiki_macros/youtube_macro.rb index 5a8481d9..2e90c618 100644 --- a/lib/additionals/wiki_macros/youtube_macro.rb +++ b/lib/additionals/wiki_macros/youtube_macro.rb @@ -3,17 +3,17 @@ module Additionals module WikiMacros Redmine::WikiFormatting::Macros.register do desc <<-DESCRIPTION - Youtube macro to include youtube video. + Youtube macro to include youtube video. - Syntax: + Syntax: - {{youtube(<video key> [, width=640, height=360, autoplay=BOOL])}} + {{youtube(<video key> [, width=640, height=360, autoplay=BOOL])}} - Examples: + Examples: - {{youtube(KMU0tzLwhbE)}} show video with default size 640x360 - {{youtube(KMU0tzLwhbE, width=853, height=480)}} show video with user defined size - {{youtube(KMU0tzLwhbE, autoplay=true)}} autoplay video + {{youtube(KMU0tzLwhbE)}} show video with default size 640x360 + {{youtube(KMU0tzLwhbE, width=853, height=480)}} show video with user defined size + {{youtube(KMU0tzLwhbE, autoplay=true)}} autoplay video DESCRIPTION macro :youtube do |_obj, args|