├── doc
└── images
│ ├── access-quick-replies.png
│ └── managing-quick-replies.png
├── app
├── views
│ └── replies
│ │ ├── preview.html.erb
│ │ ├── index.html.erb
│ │ ├── _create.html.erb
│ │ ├── edit.html.erb
│ │ ├── _form.html.erb
│ │ └── _list.html.erb
├── models
│ └── reply.rb
└── controllers
│ └── replies_controller.rb
├── config
├── routes.rb
└── locales
│ ├── en.yml
│ ├── ru.yml
│ └── fr.yml
├── assets
├── stylesheets
│ └── replies.css
└── javascripts
│ └── replies.js
├── test
├── fixtures
│ └── replies.yml
├── test_helper.rb
└── functional
│ └── replies_controller_test.rb
├── db
└── migrate
│ ├── 001_create_replies.rb
│ └── 002_add_is_public_to_replies_table.rb
├── lib
├── redmine_quick_replies
│ ├── hooks
│ │ └── add_replies_link.rb
│ └── patches
│ │ ├── user_patch.rb
│ │ └── wiki_formatting_patch.rb
└── redmine_quick_replies.rb
├── init.rb
├── CHANGELOG.md
├── LICENSE
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
└── README.md
/doc/images/access-quick-replies.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eXolnet/redmine_quick_replies/HEAD/doc/images/access-quick-replies.png
--------------------------------------------------------------------------------
/doc/images/managing-quick-replies.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eXolnet/redmine_quick_replies/HEAD/doc/images/managing-quick-replies.png
--------------------------------------------------------------------------------
/app/views/replies/preview.html.erb:
--------------------------------------------------------------------------------
1 | <% if @body %>
2 |
4 |
<%= f.text_field :name, :required => true, :size => 60 %>
5 |
6 | <% if User.current.allowed_to_manage_public_replies? %>
7 |
<%= f.check_box :is_public %>
8 | <% end %>
9 |
10 |
<%= f.text_area :body, :required => true, :cols => 60, :rows => 7, :label => :label_reply, :class => 'reply-edit', :placeholder => l(:label_leave_comment), :id => 'reply_body', :style => 'width: 97%;' %>
11 |
12 |
13 | <% if Redmine::VERSION.to_s >= '4.0' %>
14 | <%= wikitoolbar_for 'reply_body', preview_reply_path %>
15 | <% else %>
16 | <%= wikitoolbar_for 'reply_body' %>
17 | <% end %>
18 |
--------------------------------------------------------------------------------
/init.rb:
--------------------------------------------------------------------------------
1 | require 'redmine'
2 |
3 | REDMINE_QUICK_REPLIES_VERSION = '1.5.0'
4 |
5 | Redmine::Plugin.register :redmine_quick_replies do
6 | name 'Quick Replies'
7 | author 'eXolnet'
8 | description 'Save time by creating quick replies that could be reused in any WYSIWYG editors.'
9 | version REDMINE_QUICK_REPLIES_VERSION
10 | url 'https://github.com/eXolnet/redmine_quick_replies'
11 | author_url 'https://www.exolnet.com'
12 |
13 | requires_redmine :version_or_higher => '5.0'
14 |
15 | permission :create_replies, replies: [:index, :create, :edit, :update, :destroy], require: :loggedin
16 | permission :manage_public_replies, {}
17 | end
18 |
19 | require File.dirname(__FILE__) + '/lib/redmine_quick_replies'
20 |
--------------------------------------------------------------------------------
/config/locales/fr.yml:
--------------------------------------------------------------------------------
1 | # French strings go here for Rails i18n
2 | fr:
3 | activerecord:
4 | attributes:
5 | reply:
6 | body: "Réponse"
7 | label_quick_replies: "Réponses rapides"
8 | label_no_quick_reply: "Vous n'avez pas de réponse rapide enregistrée."
9 | label_new_quick_reply: "Nouvelle réponse rapide"
10 | label_edit_quick_reply: "Modifier la réponse rapide"
11 | label_reply: Réponse
12 | notice_reply_successful_create: "La réponse rapide a été créée avec succès."
13 | notice_reply_successful_update: "La réponse rapide a été modifiée avec succès."
14 | notice_reply_successful_delete: "La réponse rapide a été supprimée avec succès."
15 | text_reply_destroy_confirmation: "Voulez-vous vraiment supprimer cette réponse rapide?"
--------------------------------------------------------------------------------
/lib/redmine_quick_replies/patches/user_patch.rb:
--------------------------------------------------------------------------------
1 | require_dependency 'user'
2 |
3 | module RedmineQuickReplies
4 | module Patches
5 | module UserPatch
6 | def self.included(base) # :nodoc:
7 | base.send(:include, InstanceMethods)
8 | end
9 |
10 | module InstanceMethods
11 | def allowed_to_create_replies?
12 | allowed_to?(:create_replies, nil, global: true)
13 | end
14 |
15 | def allowed_to_manage_public_replies?
16 | allowed_to?(:manage_public_replies, nil, global: true)
17 | end
18 | end
19 | end
20 | end
21 | end
22 |
23 | unless User.included_modules.include?(RedmineQuickReplies::Patches::UserPatch)
24 | User.send(:include, RedmineQuickReplies::Patches::UserPatch)
25 | end
26 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4 |
5 | ## v1.3.1
6 |
7 | ### Updated
8 |
9 | * Update how the plugin patch wiki_formatting for better compatibility with other plugins
10 |
11 | ## v1.3.0
12 |
13 | ### Added
14 |
15 | * Allow public replies to be created
16 | * Add french translations
17 |
18 | ## v1.2.0
19 |
20 | ### Added
21 |
22 | * Add support for Redmine 4.1
23 |
24 | ## v1.1.0
25 |
26 | ### Added
27 |
28 | * Add support for Redmine 4
29 | * Explain how to use the plugin in the README
30 |
31 | ### Changed
32 |
33 | * Order quick replies in alphabetical order
34 | * Truncate quick replies with too long name
35 |
36 | ### Fixed
37 |
38 | * Hide quick replies button if none are available
39 |
40 | ## v1.0.0
41 |
42 | 🎉 Initial release!
--------------------------------------------------------------------------------
/lib/redmine_quick_replies/patches/wiki_formatting_patch.rb:
--------------------------------------------------------------------------------
1 | module RedmineQuickReplies
2 | module Patches
3 | module WikiFormattingPatch
4 | extend ActiveSupport::Concern
5 |
6 | included do
7 | prepend InstanceOverwriteMethods
8 | end
9 |
10 | module InstanceOverwriteMethods
11 | def heads_for_wiki_formatter
12 | super
13 |
14 | return if @heads_for_wiki_redmine_quick_replies_included
15 |
16 | content_for :header_tags do
17 | replies = Reply.visible.sorted.to_json
18 |
19 | o = javascript_tag("redmine_quick_replies = " + replies + ";")
20 | o << javascript_include_tag('replies', :plugin => 'redmine_quick_replies')
21 | o << stylesheet_link_tag('replies', :plugin => 'redmine_quick_replies')
22 | o.html_safe
23 | end
24 |
25 | @heads_for_wiki_redmine_quick_replies_included = true
26 | end
27 | end
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/lib/redmine_quick_replies.rb:
--------------------------------------------------------------------------------
1 | require File.dirname(__FILE__) + '/redmine_quick_replies/hooks/add_replies_link'
2 |
3 | require File.dirname(__FILE__) + '/redmine_quick_replies/patches/user_patch'
4 | require File.dirname(__FILE__) + '/redmine_quick_replies/patches/wiki_formatting_patch'
5 |
6 | module RedmineQuickReplies
7 | class << self
8 | def setup
9 | Redmine::WikiFormatting::format_names.each do |format|
10 | unless Redmine::WikiFormatting::helper_for(format).included_modules.include? RedmineQuickReplies::Patches::WikiFormattingPatch
11 | Redmine::WikiFormatting::helper_for(format).send(:include, RedmineQuickReplies::Patches::WikiFormattingPatch)
12 | end
13 | end
14 | end
15 | end
16 | end
17 |
18 | if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
19 | Rails.application.config.after_initialize do
20 | RedmineQuickReplies.setup
21 | end
22 | else
23 | Rails.configuration.to_prepare do
24 | RedmineQuickReplies.setup
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/app/views/replies/_list.html.erb:
--------------------------------------------------------------------------------
1 | <% unless replies.empty? %>
2 |