diff --git a/README.md b/README.md index 71c12fa..0c43374 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ Link to Redmine plugin page: https://www.redmine.org/plugins/redmine_issue_todo_ ## Compatibility -* Last tested with Redmine 3.4, should also work with 2.6 - 3.3 +* Version 1.3 for >= Redmine 4 **ONLY** +* Version 1.2 for <= Redmine 3.4 +* Currently there's no difference between 1.2 and 1.3 except Redmine 4 compatibility ## Features diff --git a/app/controllers/issue_todo_list_items_controller.rb b/app/controllers/issue_todo_list_items_controller.rb index 66f9025..44febb1 100644 --- a/app/controllers/issue_todo_list_items_controller.rb +++ b/app/controllers/issue_todo_list_items_controller.rb @@ -1,7 +1,7 @@ class IssueTodoListItemsController < ApplicationController - before_filter :find_project - before_filter :find_todo_list + before_action :find_project + before_action :find_todo_list def create @item = IssueTodoListItem.new diff --git a/app/controllers/issue_todo_lists_controller.rb b/app/controllers/issue_todo_lists_controller.rb index c24d546..969264b 100644 --- a/app/controllers/issue_todo_lists_controller.rb +++ b/app/controllers/issue_todo_lists_controller.rb @@ -1,7 +1,7 @@ class IssueTodoListsController < ApplicationController - before_filter :find_project, :except => [:bulk_allocate_issues] - before_filter :find_todo_list, :only => [:show, :edit, :update, :destroy, :update_item_order, :bulk_allocate_issues] + before_action :find_project, :except => [:bulk_allocate_issues] + before_action :find_todo_list, :only => [:show, :edit, :update, :destroy, :update_item_order, :bulk_allocate_issues] def index @todo_lists = IssueTodoList.where(project_id: @project.id).order('id') diff --git a/app/models/issue_todo_list.rb b/app/models/issue_todo_list.rb index 69ebc64..99959eb 100644 --- a/app/models/issue_todo_list.rb +++ b/app/models/issue_todo_list.rb @@ -3,13 +3,7 @@ class IssueTodoList < ActiveRecord::Base belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by' belongs_to :last_updated_by, :class_name => 'User', :foreign_key => 'last_updated_by' - # Rails 3 (Redmine 2) and Rails 4 (Redmine 3) - if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new('4.0.0') - has_many :issue_todo_list_items, -> { order('position ASC') }, dependent: :destroy - else - has_many :issue_todo_list_items, dependent: :destroy, :order => 'position ASC' - end - + has_many :issue_todo_list_items, -> { order('position ASC') }, dependent: :destroy has_many :issues, through: :issue_todo_list_items validates :title, presence: true diff --git a/db/migrate/001_create_todo_lists.rb b/db/migrate/001_create_todo_lists.rb index f866ca9..7b3634d 100644 --- a/db/migrate/001_create_todo_lists.rb +++ b/db/migrate/001_create_todo_lists.rb @@ -1,20 +1,5 @@ -class CreateTodoLists < ActiveRecord::Migration +class CreateTodoLists < ActiveRecord::Migration[4.2] def up - # Check if migration has already been run - version = ::ActiveRecord::Base.connection.select_values( - "SELECT version FROM #{::ActiveRecord::Migrator.schema_migrations_table_name} WHERE version='1-issue_todo_lists'" - ) - - # Plugin directory has been renamed - # Delete entry and return because migration adds entry afterwards anyway - if version.length != 0 - execute <<-SQL - DELETE FROM #{::ActiveRecord::Migrator.schema_migrations_table_name} WHERE version = '1-issue_todo_lists'; - SQL - - return - end - create_table :issue_todo_lists do |t| t.string :project_identifier t.string :title diff --git a/db/migrate/002_remove_closed_issues.rb b/db/migrate/002_remove_closed_issues.rb index 7365e54..2f7c9f2 100644 --- a/db/migrate/002_remove_closed_issues.rb +++ b/db/migrate/002_remove_closed_issues.rb @@ -1,4 +1,4 @@ -class RemoveClosedIssues < ActiveRecord::Migration +class RemoveClosedIssues < ActiveRecord::Migration[4.2] def change add_column :issue_todo_lists, :remove_closed_issues, :boolean, :default => false, :null => false end diff --git a/db/migrate/003_project_identifier_to_id.rb b/db/migrate/003_project_identifier_to_id.rb index 533e96f..6a53d11 100644 --- a/db/migrate/003_project_identifier_to_id.rb +++ b/db/migrate/003_project_identifier_to_id.rb @@ -1,4 +1,4 @@ -class ProjectIdentifierToId < ActiveRecord::Migration +class ProjectIdentifierToId < ActiveRecord::Migration[4.2] def up add_column :issue_todo_lists, :project_id, :integer, null: true, after: :id diff --git a/db/migrate/004_todo_list_item_comments.rb b/db/migrate/004_todo_list_item_comments.rb index 5430656..219786c 100644 --- a/db/migrate/004_todo_list_item_comments.rb +++ b/db/migrate/004_todo_list_item_comments.rb @@ -1,4 +1,4 @@ -class TodoListItemComments < ActiveRecord::Migration +class TodoListItemComments < ActiveRecord::Migration[4.2] def change add_column :issue_todo_list_items, :comment, :text, :after => :issue_id end diff --git a/init.rb b/init.rb index 362a3d8..3c354f4 100644 --- a/init.rb +++ b/init.rb @@ -5,7 +5,7 @@ name 'Issue To-do Lists Plugin' author 'Den' description 'Organize issues in to-do lists by manually ordering their priority' - version '1.2' + version '1.3' url 'https://github.com/canidas/redmine_issue_todo_lists' author_url 'mailto:dev@den.cx'