Fix method overlap for issue sorting
This commit is contained in:
parent
62ed1c537e
commit
e0aa5c371e
5 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
||||||
module InternalId
|
module InternalId
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
include Sortable
|
|
||||||
|
|
||||||
included do
|
included do
|
||||||
validate :set_iid, on: :create
|
validate :set_iid, on: :create
|
||||||
|
|
|
@ -17,7 +17,7 @@ module Sortable
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def sort(method)
|
def order_by(method)
|
||||||
case method.to_s
|
case method.to_s
|
||||||
when 'name' then order_name_asc
|
when 'name' then order_name_asc
|
||||||
when 'recent' then order_recent
|
when 'recent' then order_recent
|
||||||
|
@ -25,7 +25,7 @@ module Sortable
|
||||||
when 'recent_updated' then order_recent_updated
|
when 'recent_updated' then order_recent_updated
|
||||||
when 'oldest_updated' then order_oldest_updated
|
when 'oldest_updated' then order_oldest_updated
|
||||||
else
|
else
|
||||||
self
|
all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,6 +24,7 @@ class Issue < ActiveRecord::Base
|
||||||
include Issuable
|
include Issuable
|
||||||
include InternalId
|
include InternalId
|
||||||
include Taskable
|
include Taskable
|
||||||
|
include Sortable
|
||||||
|
|
||||||
ActsAsTaggableOn.strict_case_match = true
|
ActsAsTaggableOn.strict_case_match = true
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ class MergeRequest < ActiveRecord::Base
|
||||||
include Issuable
|
include Issuable
|
||||||
include Taskable
|
include Taskable
|
||||||
include InternalId
|
include InternalId
|
||||||
|
include Sortable
|
||||||
|
|
||||||
belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project"
|
belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project"
|
||||||
belongs_to :source_project, foreign_key: :source_project_id, class_name: "Project"
|
belongs_to :source_project, foreign_key: :source_project_id, class_name: "Project"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
class Milestone < ActiveRecord::Base
|
class Milestone < ActiveRecord::Base
|
||||||
include InternalId
|
include InternalId
|
||||||
|
include Sortable
|
||||||
|
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
has_many :issues
|
has_many :issues
|
||||||
|
|
Loading…
Reference in a new issue