diff --git a/README.md b/README.md index 2bd4394..6aac171 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ -Privacy & Terms plugin for Redmine -================================== +# Privacy & Terms plugin for Redmine [![Rate at redmine.org](https://img.shields.io/badge/rate%20at-redmine.org-blue.svg?style=fla)](https://www.redmine.org/plugins/redmine_privacy_terms) [![Tests](https://github.com/AlphaNodes/redmine_privacy_terms/workflows/Tests/badge.svg)](https://github.com/AlphaNodes/redmine_privacy_terms/actions?query=workflow%3A"Run+Tests) ![Run Linters](https://github.com/AlphaNodes/redmine_privacy_terms/workflows/Run%20Linters/badge.svg) -Features --------- +## Features * Adds https://cookieconsent.insites.com/ support (cookie agreement) * Add terms support, which each user has to accept before using Redmine @@ -12,28 +10,26 @@ Features * multilingual support * API support (if terms are required, API call throw forbitten till user accept terms) -Requirements ------------- +## Requirements * Redmine version >= 5.0 * Redmine Plugin: [additionals](https://github.com/alphanodes/additionals) -* Ruby version >= 2.7 +* Ruby version >= 3.0 -Installation ------------- +## Installation Install ``redmine_privacy_terms`` plugin for `Redmine` cd $REDMINE_ROOT git clone git://github.com/alphanodes/redmine_privacy_terms.git plugins/redmine_privacy_terms git clone git://github.com/alphanodes/additionals.git plugins/additionals - bundle install --without development test + bundle config set --local without 'development test' + bundle install bundle exec rake redmine:plugins:migrate RAILS_ENV=production Restart Redmine (application server) and you should see the plugin show up in the Plugins page. -Usage ------ +## Usage 1. First of all, add a wiki page for the terms and a wiki page with information for those users who reject the agreement. Don't forget to add the macros on the wiki page with the terms which implement the "accept" and "reject" buttons: {{terms_accept}} | {{terms_reject}} @@ -47,9 +43,7 @@ E.g. "my_terms" (used as default), my_terms_de, my_terms_it, etc. If you did not specify wiki pages or projects, terms are not activated. Even if you assing a non-existing wiki page, terms are not activated. If all settings are correct, you'll find a "show" link behind the wiki page text field. - -Configuration -------------- +## Configuration ### Plugin settings @@ -65,8 +59,7 @@ The "Inspect" section displays information on possible data protection problems There is a new permission "Show terms condition" available. Members with this permission can see the terms conditions of other users. A user can always see its own terms condition at his profile (if terms are activated). -Available macros ----------------- +## Available macros ### terms_accept @@ -80,8 +73,7 @@ You can use title parameter, to overwrite button text. Eg. {{terms_reject(title= For multilange support use title_de, title_es, etc.. -Uninstall ---------- +## Uninstall Uninstall ``redmine_privacy_terms`` @@ -90,3 +82,23 @@ Uninstall ``redmine_privacy_terms`` rm -rf plugins/redmine_privacy_terms public/plugin_assets/redmine_privacy_terms Restart Redmine (application server) + +## License + +This plugin is licensed under the terms of GNU/GPL v2. +See [LICENSE](LICENSE) for details. + +## Redmine Copyright + +The redmine_hedgedoc is a plugin extension for Redmine Project Management Software, whose Copyright follows. +Copyright (C) 2006- Jean-Philippe Lang + +Redmine is a flexible project management web application written using Ruby on Rails framework. +More details can be found in the doc directory or on the official website + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/app/controllers/terms_controller.rb b/app/controllers/terms_controller.rb index 2dede77..a7aa18f 100644 --- a/app/controllers/terms_controller.rb +++ b/app/controllers/terms_controller.rb @@ -18,7 +18,7 @@ def reject def reset User.update_all accept_terms_at: nil Setting.plugin_redmine_privacy_terms = RedminePrivacyTerms.send(:settings).merge last_terms_reset: Time.now.utc.to_s - flash[:notice] = l :notice_terms_reset_successfully + flash[:notice] = flash_msg :notice_terms_reset_successfully redirect_to plugin_settings_path(id: 'redmine_privacy_terms', tab: 'tools') end @@ -28,7 +28,7 @@ def check_terms_active if RedminePrivacyTerms.setting? :enable_terms true else - flash[:warning] = l :notice_terms_accepted_not_saved + flash[:warning] = flash_msg :notice_terms_accepted_not_saved redirect_to home_url end end diff --git a/test/unit/i18n_test.rb b/test/unit/i18n_test.rb index 75ea669..3cd72cf 100644 --- a/test/unit/i18n_test.rb +++ b/test/unit/i18n_test.rb @@ -19,22 +19,10 @@ def test_valid_languages end def test_locales_validness - lang_files_count = Rails.root.glob('plugins/redmine_privacy_terms/config/locales/*.yml').size - - assert_equal 2, lang_files_count - - valid_languages.each do |lang| - assert set_language_if_valid(lang) - case lang.to_s - when 'en' - - assert_equal 'Result', l(:field_privacy_terms_result) - when 'de' - - assert_not l(:field_privacy_terms_result) == 'Result', lang - end - end - - set_language_if_valid 'en' + assert_locales_validness plugin: 'redmine_privacy_terms', + file_cnt: 2, + locales: %w[de], + control_string: :field_privacy_terms_result, + control_english: 'Result' end end