Redmine3 support #364

This commit is contained in:
Karel Pičman 2015-03-25 12:58:01 +01:00
parent fde9b16bd4
commit dd6b70f7dd
11 changed files with 19 additions and 19 deletions

View File

@ -227,7 +227,7 @@ class DmsfController < ApplicationController
end
def entries_email
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
@email_params = e_params
else
@email_params = params[:email]
@ -251,7 +251,7 @@ class DmsfController < ApplicationController
end
def create
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
@folder = DmsfFolder.new(
params.require(:dmsf_folder).permit(:title, :description, :dmsf_folder_id))
else

View File

@ -100,7 +100,7 @@ class DmsfFilesController < ApplicationController
if @file.locked_for_user?
flash[:error] = l(:error_file_is_locked)
else
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
aparams = frev_params
else
aparams = params

View File

@ -25,7 +25,7 @@ class DmsfLinksController < ApplicationController
before_filter :authorize
def new
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
@dmsf_link = DmsfLink.new(l_params)
else
@dmsf_link = DmsfLink.new(:project_id => params[:project_id])

View File

@ -52,7 +52,7 @@ class DmsfUploadController < ApplicationController
# async single file upload handling
def upload_file
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
@tempfile = params.require(:file)
else
@tempfile = params[:file]
@ -86,7 +86,7 @@ class DmsfUploadController < ApplicationController
end
def commit_files
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
commited_files = params.require(:commited_files)
else
commited_files = params[:commited_files]

View File

@ -36,7 +36,7 @@ class DmsfFile < ActiveRecord::Base
belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id'
belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id'
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
has_many :revisions, -> { order("#{DmsfFileRevision.table_name}.major_version DESC, #{DmsfFileRevision.table_name}.minor_version DESC, #{DmsfFileRevision.table_name}.updated_at DESC") },
:class_name => 'DmsfFileRevision', :foreign_key => 'dmsf_file_id',
:dependent => :destroy
@ -57,11 +57,11 @@ class DmsfFile < ActiveRecord::Base
:conditions => {:target_type => DmsfFile.model_name}, :dependent => :destroy
end
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
accepts_nested_attributes_for :revisions, :locks, :referenced_links
end
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
scope :visible, -> { where(deleted: false) }
scope :deleted, -> { where(deleted: true) }
else

View File

@ -26,13 +26,13 @@ class DmsfFileRevision < ActiveRecord::Base
belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id'
has_many :access, :class_name => 'DmsfFileRevisionAccess', :foreign_key => 'dmsf_file_revision_id', :dependent => :destroy
has_many :dmsf_workflow_step_assignment, :dependent => :destroy
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
accepts_nested_attributes_for :access, :dmsf_workflow_step_assignment, :file, :user
end
# Returns a list of revisions that are not deleted here, or deleted at parent level either
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
scope :visible, -> { where(deleted: false) }
scope :deleted, -> { where(deleted: true) }
else
@ -46,7 +46,7 @@ class DmsfFileRevision < ActiveRecord::Base
:datetime => Proc.new {|o| o.updated_at },
:description => Proc.new {|o| o.comment },
:author => Proc.new {|o| o.user }
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
acts_as_activity_provider :type => 'dmsf_file_revisions',
:timestamp => "#{DmsfFileRevision.table_name}.updated_at",
:author_key => "#{DmsfFileRevision.table_name}.user_id",

View File

@ -22,7 +22,7 @@ class DmsfFileRevisionAccess < ActiveRecord::Base
belongs_to :user
delegate :project, :to => :revision, :allow_nil => false
delegate :file, :to => :revision, :allow_nil => false
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
accepts_nested_attributes_for :user, :revision
end
@ -34,7 +34,7 @@ class DmsfFileRevisionAccess < ActiveRecord::Base
:datetime => Proc.new {|o| o.updated_at },
:description => Proc.new {|o| o.revision.comment },
:author => Proc.new {|o| o.user }
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
acts_as_activity_provider :type => 'dmsf_file_revision_accesses',
:timestamp => "#{DmsfFileRevisionAccess.table_name}.updated_at",
:author_key => "#{DmsfFileRevisionAccess.table_name}.user_id",

View File

@ -34,7 +34,7 @@ class DmsfFolder < ActiveRecord::Base
:dependent => :destroy
has_many :files, :class_name => 'DmsfFile', :foreign_key => 'dmsf_folder_id',
:dependent => :destroy
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
has_many :folder_links, -> { where target_type: DmsfFolder.model_name },
:class_name => 'DmsfLink', :foreign_key => 'dmsf_folder_id', :dependent => :destroy
has_many :file_links, -> { where target_type: DmsfFile.model_name },
@ -61,7 +61,7 @@ class DmsfFolder < ActiveRecord::Base
:dependent => :destroy
end
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
scope :visible, -> { where(deleted: false) }
scope :deleted, -> { where(deleted: true) }
else

View File

@ -40,7 +40,7 @@ class DmsfLink < ActiveRecord::Base
end
end
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
scope :visible, -> { where(deleted: false) }
scope :deleted, -> { where(deleted: true) }
else

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DmsfWorkflow < ActiveRecord::Base
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
has_many :dmsf_workflow_steps, -> { order 'step ASC, operator DESC' }, :dependent => :destroy
else
has_many :dmsf_workflow_steps, :dependent => :destroy, :order => 'step ASC, operator DESC'

View File

@ -32,7 +32,7 @@ module RedmineDmsf
unloadable
alias_method_chain :copy, :dmsf
if (Redmine::VERSION::MAJOR >= 3)
if (Rails::VERSION::MAJOR > 3)
has_many :dmsf_files, -> { where dmsf_folder_id: nil},
:class_name => 'DmsfFile', :foreign_key => 'project_id', :dependent => :destroy
has_many :dmsf_folders, -> {where dmsf_folder_id: nil},