summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/helpers/builds_helper.rb2
-rw-r--r--app/helpers/ci/commits_helper.rb24
-rw-r--r--app/helpers/ci_status_helper.rb3
-rw-r--r--app/helpers/labels_helper.rb5
-rw-r--r--app/helpers/milestones_helper.rb3
-rw-r--r--app/helpers/runners_helper.rb26
7 files changed, 24 insertions, 43 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 3ab44719d9f..cab2278adb7 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -314,4 +314,8 @@ module ApplicationHelper
html.html_safe
end
+
+ def truncate_first_line(message, length = 50)
+ truncate(message.each_line.first.chomp, length: length) if message
+ end
end
diff --git a/app/helpers/builds_helper.rb b/app/helpers/builds_helper.rb
index 626f4e2f4c0..1b5a2c31d74 100644
--- a/app/helpers/builds_helper.rb
+++ b/app/helpers/builds_helper.rb
@@ -8,6 +8,6 @@ module BuildsHelper
end
def build_url(build)
- ci_project_build_url(build.project, build)
+ namespace_project_build_path(build.gl_project, build.project, build)
end
end
diff --git a/app/helpers/ci/commits_helper.rb b/app/helpers/ci/commits_helper.rb
deleted file mode 100644
index a0df4c3d72d..00000000000
--- a/app/helpers/ci/commits_helper.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-module Ci
- module CommitsHelper
- def ci_commit_path(commit)
- ci_project_commits_path(commit.project, commit)
- end
-
- def commit_link(commit)
- link_to(commit.short_sha, ci_commit_path(commit))
- end
-
- def truncate_first_line(message, length = 50)
- truncate(message.each_line.first.chomp, length: length) if message
- end
-
- def ci_commit_title(commit)
- content_tag :span do
- link_to(
- simple_sanitize(commit.project.name), ci_project_path(commit.project)
- ) + ' @ ' +
- gitlab_commit_link(@project, @commit.sha)
- end
- end
- end
-end
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index 794bdc2530e..dbd1e26fa79 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -1,6 +1,7 @@
module CiStatusHelper
def ci_status_path(ci_commit)
- ci_project_commits_path(ci_commit.project, ci_commit)
+ project = ci_commit.gl_project
+ ci_namespace_project_commit_path(project.namespace, project, ci_commit.sha)
end
def ci_status_icon(ci_commit)
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 8036303851b..66b18eea699 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -93,7 +93,10 @@ module LabelsHelper
end
def project_labels_options(project)
- options_from_collection_for_select(project.labels, 'name', 'name', params[:label_name])
+ labels = project.labels.to_a
+ labels.unshift(Label::None)
+ labels.unshift(Label::Any)
+ options_from_collection_for_select(labels, 'name', 'title', params[:label_name])
end
# Required for Gitlab::Markdown::LabelReferenceFilter
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb
index 132a893e532..37a5b58cce8 100644
--- a/app/helpers/milestones_helper.rb
+++ b/app/helpers/milestones_helper.rb
@@ -30,7 +30,8 @@ module MilestonesHelper
grouped_milestones = Milestones::GroupService.new(milestones).execute
grouped_milestones.unshift(Milestone::None)
+ grouped_milestones.unshift(Milestone::Any)
- options_from_collection_for_select(grouped_milestones, 'title', 'title', params[:milestone_title])
+ options_from_collection_for_select(grouped_milestones, 'name', 'title', params[:milestone_title])
end
end
diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb
index 5d7d06c8490..5afebab88e1 100644
--- a/app/helpers/runners_helper.rb
+++ b/app/helpers/runners_helper.rb
@@ -1,20 +1,16 @@
module RunnersHelper
def runner_status_icon(runner)
- unless runner.contacted_at
- return content_tag :i, nil,
- class: "fa fa-warning-sign",
- title: "New runner. Has not connected yet"
- end
-
- status =
- if runner.active?
- runner.contacted_at > 3.hour.ago ? :online : :offline
- else
- :paused
- end
+ status = runner.status
+ case status
+ when :not_connected
+ content_tag :i, nil,
+ class: "fa fa-warning",
+ title: "New runner. Has not connected yet"
- content_tag :i, nil,
- class: "fa fa-circle runner-status-#{status}",
- title: "Runner is #{status}, last contact was #{time_ago_in_words(runner.contacted_at)} ago"
+ when :online, :offline, :paused
+ content_tag :i, nil,
+ class: "fa fa-circle runner-status-#{status}",
+ title: "Runner is #{status}, last contact was #{time_ago_in_words(runner.contacted_at)} ago"
+ end
end
end