Skip to content

Commit

Permalink
Get rid of webui2_ prefix in helpers
Browse files Browse the repository at this point in the history
We don't have to distinguish between new and old helpers, as Bento is
no longer used, and Bento views will be removed soon.
  • Loading branch information
eduardoj committed Sep 3, 2019
1 parent 1a0eabe commit ef35b3a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/api/app/helpers/webui/webui_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def format_projectname(prjname, login)
prjname
end

WEBUI2_REPO_STATUS_ICONS = {
REPO_STATUS_ICONS = {
'published' => 'truck',
'outdated_published' => 'truck',
'publishing' => 'truck-loading',
Expand Down Expand Up @@ -82,8 +82,8 @@ def repo_status_description(status)
REPO_STATUS_DESCRIPTIONS[status] || 'Unknown state of repository'
end

def webui2_repo_status_icon(status)
WEBUI2_REPO_STATUS_ICONS[status] || 'eye'
def repo_status_icon(status)
REPO_STATUS_ICONS[status] || 'eye'
end

def check_first(first)
Expand All @@ -100,19 +100,19 @@ def image_template_icon(template)
end
end

def webui2_repository_status_icon(status:, details: nil, html_class: '')
def repository_status_icon(status:, details: nil, html_class: '')
outdated = status.sub!(/^outdated_/, '')
description = outdated ? 'State needs recalculations, former state was: ' : ''
description << repo_status_description(status)
description << " (#{details})" if details

repo_state_class = webui2_repository_state_class(outdated, status)
repo_state_class = repository_state_class(outdated, status)

content_tag(:i, '', class: "repository-state-#{repo_state_class} #{html_class} fas fa-#{webui2_repo_status_icon(status)}",
content_tag(:i, '', class: "repository-state-#{repo_state_class} #{html_class} fas fa-#{repo_status_icon(status)}",
data: { content: description, placement: 'top', toggle: 'popover' })
end

def webui2_repository_state_class(outdated, status)
def repository_state_class(outdated, status)
return 'outdated' if outdated
return status =~ /broken|building|finished|publishing|published/ ? status : 'default'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
- if !result.is_repository_in_db
%i.fas.fa-clock.text-warning{ title: 'This result is outdated' }
- else
= webui2_repository_status_icon(status: result.state, details: result.details)
= repository_status_icon(status: result.state, details: result.details)
%span.ml-1
= result.architecture
.col-6.col-sm-5.col-xl-6.ml-2.text-nowrap
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui2/webui/package/binaries.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- @buildresults.each do |result|
%h5.bg-light.p-2.mb-0
= webui2_repository_status_icon(status: result[:repocode].to_s, html_class: 'fa-xs')
= repository_status_icon(status: result[:repocode].to_s, html_class: 'fa-xs')
= result[:arch]
- if result[:binaries].empty?
%p.pl-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- build_results.sort_by(&:architecture).each do |build_result|
.row.py-1
.col-4.col-sm-3.offset-1.offset-sm-2.text-nowrap{ title: "#{repository} summary" }
= webui2_repository_status_icon(status: build_result.state, details: build_result.details)
= repository_status_icon(status: build_result.state, details: build_result.details)
%span.ml-1
= link_to(build_result.architecture, { action: :monitor,
"#{valid_xml_id('repo_' + repository)}": 1,
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui2/webui/project/monitor.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- archlist.each do |arch|
- tableinfo << [repo, arch]
%th.text-center
= webui2_repository_status_icon(status: @repostatushash[repo][arch], html_class: 'mr-1')
= repository_status_icon(status: @repostatushash[repo][arch], html_class: 'mr-1')
= arch
%tbody{ data: { packagenames: @packagenames, project: @project, statushash: @statushash.to_json, tableinfo: tableinfo } }

Expand Down

0 comments on commit ef35b3a

Please sign in to comment.