diff --git a/.github/workflows/redmine_plugin.yml b/.github/workflows/redmine_plugin.yml index c43d5c9..221b5aa 100644 --- a/.github/workflows/redmine_plugin.yml +++ b/.github/workflows/redmine_plugin.yml @@ -11,21 +11,22 @@ jobs: fail-fast: false matrix: mat_env: + - '3.3 redmica/redmica@v3.1.0' + - '3.3 redmica/redmica@v3.0.4' + - '3.2 redmica/redmica@v2.4.2' - '3.2 redmica/redmica@v2.3.2' - '3.1 redmica/redmica@v2.2.3' - '3.0 redmica/redmica@v2.2.3' - '2.7 redmica/redmica@v2.2.3' - - '3.2 redmine/redmine@5.1.0' - - '3.1 redmine/redmine@5.0.6' - - '3.0 redmine/redmine@5.0.6' + - '3.3 redmine/redmine@6.0.1' + - '3.2 redmine/redmine@5.1.4' + - '3.1 redmine/redmine@5.0.10' + - '3.0 redmine/redmine@5.0.10' - '2.7 redmine/redmine@4.2.11' - '2.6 redmine/redmine@4.2.11' - - '2.6 redmine/redmine@4.1.7' - - '2.6 redmine/redmine@4.0.9' - - '2.5 redmine/redmine@4.0.9' experimental: [false] include: - - mat_env: '3.2 redmica/redmica@master' + - mat_env: '3.3 redmica/redmica@master' experimental: true steps: - run: | @@ -43,11 +44,11 @@ jobs: ruby-version: ${{ env.RUBY_VERSION }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: ./${{ env.PLUGIN_NAME }} - name: Set up Redmine - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.REDMINE_REPOSITORY }} ref: ${{ env.REDMINE_REF }} @@ -56,7 +57,7 @@ jobs: - name: Copy the plugin files to plugin directory run: cp -pr ./${{ env.PLUGIN_NAME }} ./redmine/plugins/${{ env.PLUGIN_NAME }} - name: Create redmine/config/database.yml - uses: DamianReeves/write-file-action@v1.2 + uses: DamianReeves/write-file-action@v1.3 with: path: ./redmine/config/database.yml contents: | @@ -64,20 +65,20 @@ jobs: adapter: sqlite3 database: db/redmine_test.db - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ./redmine/vendor/bundle key: ${{ runner.os }}-gems-${{ hashFiles('./redmine/**/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-gems- - - name: uninitialized constant Nokogiri::HTML4 Issue HACK ref. https://qiita.com/Mattani/items/c4bcc95a72b69d1c0489 - uses: DamianReeves/write-file-action@v1.2 + - name: "'LoadError: cannot load such file -- blankslate' Issue HACK ref. https://www.redmine.org/issues/40802#note-11" + uses: DamianReeves/write-file-action@v1.3 with: path: ./redmine/Gemfile.local contents: | - gem 'loofah', '~> 2.20.0' - if: contains(fromJSON('["2.6 redmine/redmine@4.1.7", "2.6 redmine/redmine@4.0.9", "2.5 redmine/redmine@4.0.9"]'), matrix.mat_env) + gem 'builder', '~> 3.2.4' + if: contains(fromJSON('["3.2 redmica/redmica@v2.4.2", "3.2 redmica/redmica@v2.3.2", "3.1 redmica/redmica@v2.2.3", "3.0 redmica/redmica@v2.2.3", "2.7 redmica/redmica@v2.2.3", "2.6 redmine/redmine@4.1.7", "2.6 redmine/redmine@4.0.9", "2.5 redmine/redmine@4.0.9", "2.6 redmine/redmine@4.2.11", "2.7 redmine/redmine@4.2.11"]'), matrix.mat_env) - name: Before script run: | diff --git a/README.rdoc b/README.rdoc index 64279eb..5b6d9a6 100644 --- a/README.rdoc +++ b/README.rdoc @@ -24,6 +24,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/cat-in == License -MIT License. -See the 'LICENSE.md' file. +* Codes: MIT License. +* Legacy Icons: famfamfam-silk: {CC-By-2.5}[https://creativecommons.org/licenses/by/2.5/] by Mark James http://www.famfamfam.com/lab/icons/silk/ +* Vector Icons: {Tabler Icons}[https://tabler.io/]: MIT License diff --git a/app/controllers/scheduling_polls_controller.rb b/app/controllers/scheduling_polls_controller.rb index 246f95c..ac0c3bc 100644 --- a/app/controllers/scheduling_polls_controller.rb +++ b/app/controllers/scheduling_polls_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true class SchedulingPollsController < ApplicationController - unloadable + unloadable if respond_to?(:unloadable) before_action :set_scheduling_poll, :only => [:edit, :update, :show, :vote] before_action :set_scheduling_poll_by_issue_id, :only => [:show_by_issue] diff --git a/app/helpers/scheduling_polls_helper.rb b/app/helpers/scheduling_polls_helper.rb index 151b617..f580d36 100644 --- a/app/helpers/scheduling_polls_helper.rb +++ b/app/helpers/scheduling_polls_helper.rb @@ -46,4 +46,14 @@ def render_date_related_parameter_of_issue(issue) s.html_safe end + if defined? IconsHelper # redmine >= 6.0 + include IconsHelper + def scheduling_icon_with_label(icon_name, label_text, icon_only: false, size: 18, css_class: nil) + label_classes = ["icon-label"] + label_classes << "hidden" if icon_only + plugin = 'redmine_scheduling_poll' + sprite_icon(icon_name, size: size, css_class: css_class, plugin: plugin) + content_tag(:span, label_text, class: label_classes.join(' ')) + end + end + end diff --git a/app/models/scheduling_poll.rb b/app/models/scheduling_poll.rb index 48f505c..71b8b1e 100644 --- a/app/models/scheduling_poll.rb +++ b/app/models/scheduling_poll.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SchedulingPoll < ActiveRecord::Base - unloadable +class SchedulingPoll < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base) + unloadable if respond_to?(:unloadable) belongs_to :issue has_many :scheduling_poll_items, :dependent => :destroy diff --git a/app/models/scheduling_poll_item.rb b/app/models/scheduling_poll_item.rb index 0d9dc41..a493a49 100644 --- a/app/models/scheduling_poll_item.rb +++ b/app/models/scheduling_poll_item.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SchedulingPollItem < ActiveRecord::Base - unloadable +class SchedulingPollItem < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base) + unloadable if respond_to?(:unloadable) belongs_to :scheduling_poll has_many :scheduling_votes, :dependent => :destroy diff --git a/app/models/scheduling_vote.rb b/app/models/scheduling_vote.rb index aa5fe25..6a243c9 100644 --- a/app/models/scheduling_vote.rb +++ b/app/models/scheduling_vote.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SchedulingVote < ActiveRecord::Base - unloadable +class SchedulingVote < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base) + unloadable if respond_to?(:unloadable) belongs_to :user belongs_to :scheduling_poll_item diff --git a/app/views/scheduling_polls/_form.html.erb b/app/views/scheduling_polls/_form.html.erb index abac286..7d86e4d 100644 --- a/app/views/scheduling_polls/_form.html.erb +++ b/app/views/scheduling_polls/_form.html.erb @@ -22,7 +22,13 @@ - <%= link_to_function l(:label_add_scheduling_poll_item), "scheduling_polls_add_item(\"#{escape_javascript(add_item_tmpl)}\")", :class => 'icon icon-add', :id => 'scheduling_poll_add_item_link' %> + <% if defined? scheduling_icon_with_label %><%# redmine >= 6.0 %> + <%= link_to_function(scheduling_icon_with_label('add', l(:label_add_scheduling_poll_item)), + "scheduling_polls_add_item(\"#{escape_javascript(add_item_tmpl)}\")", + :class => 'icon icon-add', :id => 'scheduling_poll_add_item_link') %> + <% else %> + <%= link_to_function l(:label_add_scheduling_poll_item), "scheduling_polls_add_item(\"#{escape_javascript(add_item_tmpl)}\")", :class => 'icon icon-add', :id => 'scheduling_poll_add_item_link' %> + <% end %> @@ -33,6 +39,7 @@ <%= f.submit l(:label_update_scheduling_poll_items) %> +<% include_calendar_headers_tags %> <%= javascript_tag < 0)? false : true; } if (enable) { - $("form .scheduling_poll_item_text:not([disabled]):not([readonly])").datepicker({ + $("form .scheduling_poll_item_text:not([disabled]):not([readonly])").datepicker($.extend(datepickerOptions, { dateFormat: '#{Setting.plugin_redmine_scheduling_poll["scheduling_poll_item_date_format"]}', - showOn: 'button', buttonImageOnly: true, - buttonImage: '#{path_to_image('/images/calendar.png')}', - showButtonPanel: true, showWeek: true, showOtherMonths: true, - selectOtherMonths: true, changeMonth: true, changeYear: true - }); + showOn: 'button', buttonImageOnly: true + })); } else { $("form .scheduling_poll_item_text").datepicker("destroy"); } diff --git a/app/views/scheduling_polls/_scheduling_poll_item_form.html.erb b/app/views/scheduling_polls/_scheduling_poll_item_form.html.erb index 2a9c4d5..4f903b5 100644 --- a/app/views/scheduling_polls/_scheduling_poll_item_form.html.erb +++ b/app/views/scheduling_polls/_scheduling_poll_item_form.html.erb @@ -9,13 +9,28 @@ <%= f_item.hidden_field :position, :value => f_item.index %> - <%= link_to_function image_tag('2uparrow.png', :alt => l(:label_sort_highest), :plugin => 'redmine_scheduling_poll'), - "scheduling_poll_move_item_position(-2, #{f_item.index})", :title => l(:label_sort_highest) %> - <%= link_to_function image_tag('1uparrow.png', :alt => l(:label_sort_higher), :plugin => 'redmine_scheduling_poll'), - "scheduling_poll_move_item_position(-1, #{f_item.index})", :title => l(:label_sort_higher) %> - <%= link_to_function image_tag('1downarrow.png', :alt => l(:label_sort_lower), :plugin => 'redmine_scheduling_poll'), - "scheduling_poll_move_item_position(+1, #{f_item.index})", :title => l(:label_sort_lower) %> - <%= link_to_function image_tag('2downarrow.png', :alt => l(:label_sort_lowest), :plugin => 'redmine_scheduling_poll'), - "scheduling_poll_move_item_position(+2, #{f_item.index})", :title => l(:label_sort_lowest) %> + <% if defined? scheduling_icon_with_label %><%# redmine >= 6.0 %> + <%= link_to_function(scheduling_icon_with_label('arrows-up', l(:label_sort_highest)), + "scheduling_poll_move_item_position(-2, #{f_item.index})", :title => l(:label_sort_highest), + :class => 'icon-only icon-arrows-up') %> + <%= link_to_function(scheduling_icon_with_label('arrow-up', l(:label_sort_higher)), + "scheduling_poll_move_item_position(-1, #{f_item.index})", :title => l(:label_sort_higher), + :class => 'icon-only icon-arrow-up') %> + <%= link_to_function(scheduling_icon_with_label('arrow-down', l(:label_sort_lower)), + "scheduling_poll_move_item_position(+1, #{f_item.index})", :title => l(:label_sort_lower), + :class => 'icon-only icon-arrow-down') %> + <%= link_to_function(scheduling_icon_with_label('arrows-down', l(:label_sort_lowest)), + "scheduling_poll_move_item_position(+2, #{f_item.index})", :title => l(:label_sort_lowest), + :class => 'icon-only icon-arrows-down') %> + <% else %> + <%= link_to_function image_tag('2uparrow.png', :alt => l(:label_sort_highest), :plugin => 'redmine_scheduling_poll'), + "scheduling_poll_move_item_position(-2, #{f_item.index})", :title => l(:label_sort_highest) %> + <%= link_to_function image_tag('1uparrow.png', :alt => l(:label_sort_higher), :plugin => 'redmine_scheduling_poll'), + "scheduling_poll_move_item_position(-1, #{f_item.index})", :title => l(:label_sort_higher) %> + <%= link_to_function image_tag('1downarrow.png', :alt => l(:label_sort_lower), :plugin => 'redmine_scheduling_poll'), + "scheduling_poll_move_item_position(+1, #{f_item.index})", :title => l(:label_sort_lower) %> + <%= link_to_function image_tag('2downarrow.png', :alt => l(:label_sort_lowest), :plugin => 'redmine_scheduling_poll'), + "scheduling_poll_move_item_position(+2, #{f_item.index})", :title => l(:label_sort_lowest) %> + <% end %> diff --git a/app/views/scheduling_polls/show.html.erb b/app/views/scheduling_polls/show.html.erb index a096542..6642711 100644 --- a/app/views/scheduling_polls/show.html.erb +++ b/app/views/scheduling_polls/show.html.erb @@ -11,7 +11,12 @@
- <%= link_to l(:label_edit_scheduling_poll_items), scheduling_poll_edit_url(@poll), :class => 'icon icon-edit' %> + <% if defined? scheduling_icon_with_label %><%# redmine >= 6.0 %> + <%= link_to(scheduling_icon_with_label('edit', l(:label_edit_scheduling_poll_items)), + scheduling_poll_edit_url(@poll), :class => 'icon icon-edit') %> + <% else %> + <%= link_to l(:label_edit_scheduling_poll_items), scheduling_poll_edit_url(@poll), :class => 'icon icon-edit' %> + <% end %>

<%= @poll.issue.subject %>

@@ -59,7 +64,12 @@
<% if User.current.allowed_to?(:vote_schduling_polls, @poll.issue.project) %>
- <%= link_to_function l(:label_add_comment_with_scheduling_poll_vote), '$("#vote_comment_fields").show();$(this).hide()', :class => 'icon icon-comment' %> + <% if defined? scheduling_icon_with_label %><%# redmine >= 6.0 %> + <%= link_to_function(scheduling_icon_with_label('comment', l(:label_add_comment_with_scheduling_poll_vote)), + '$("#vote_comment_fields").show();$(this).hide()', :class => 'icon icon-comment') %> + <% else %> + <%= link_to_function l(:label_add_comment_with_scheduling_poll_vote), '$("#vote_comment_fields").show();$(this).hide()', :class => 'icon icon-comment' %> + <% end %>