debian-mirror-gitlab/app/helpers/compare_helper.rb

22 lines
617 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module CompareHelper
2015-09-11 14:41:01 +05:30
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
from.present? &&
to.present? &&
from != to &&
2016-09-29 09:46:39 +05:30
project.feature_available?(:merge_requests, current_user) &&
2015-09-11 14:41:01 +05:30
project.repository.branch_names.include?(from) &&
project.repository.branch_names.include?(to)
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
def create_mr_path(from = params[:from], to = params[:to], project = @project)
2015-04-26 12:48:37 +05:30
new_namespace_project_merge_request_path(
2015-09-11 14:41:01 +05:30
project.namespace,
project,
2015-04-26 12:48:37 +05:30
merge_request: {
2015-09-11 14:41:01 +05:30
source_branch: to,
target_branch: from
2015-04-26 12:48:37 +05:30
}
)
2014-09-02 18:07:02 +05:30
end
end