[opensuse-buildservice] Make webui request listings nicer
From 7636b1d876c7ee9b9a38314a15e236e72a0babb0 Mon Sep 17 00:00:00 2001 From: Dirk Mueller <dmueller@suse.com> Date: Wed, 21 Mar 2012 15:27:18 +0100 Subject: [PATCH] [WEBUI] shorten project name in request lists Shorten the home:<username>:branches:<project> project names more unix-fashion like in request lists to save screen space and improve readability. In views where no target column is visible, make use of the extra screen space by doubling elide limit. --- src/webui/app/helpers/application_helper.rb | 20 +++++++++++++++++++- src/webui/app/views/shared/_requests.html.erb | 9 +++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/webui/app/helpers/application_helper.rb b/src/webui/app/helpers/application_helper.rb index b260f89..52b6925 100644 --- a/src/webui/app/helpers/application_helper.rb +++ b/src/webui/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# vim: sw=2 et + require 'digest/md5' require 'action_view/helpers/asset_tag_helper.rb' @@ -134,6 +136,22 @@ module ApplicationHelper @statushash[repo][arch][package] || { "package" => package } end + def format_projectname(prjname, homename) + splitted = prjname.split(':', 4) + if splitted[0] == "home" + if homename and splitted[1] == homename + if splitted.length == 2 + prjname = "~" + else + prjname = "~:" + splitted[-1] + end + else + prjname = "~" + splitted[1] + ":" + splitted[-1] + end + end + prjname + end + def status_id_for( repo, arch, package ) valid_xml_id("id-#{package}_#{repo}_#{arch}") end @@ -149,7 +167,7 @@ module ApplicationHelper code = '' theclass='' end - + out = "<td class='#{theclass} buildstatus'>" if ["unresolvable", "blocked"].include? code out += link_to code, "#", :title => link_title, :id => status_id diff --git a/src/webui/app/views/shared/_requests.html.erb b/src/webui/app/views/shared/_requests.html.erb index 1eb1533..d00ce5f 100644 --- a/src/webui/app/views/shared/_requests.html.erb +++ b/src/webui/app/views/shared/_requests.html.erb @@ -1,7 +1,7 @@ -<% elide_len ||= 40 %> <% request_table_id ||= 'request_table' %> <% hide_state ||= false %> <% no_target ||= false %> +<% elide_len ||= no_target ? 80 : 40 %> <% if requests.blank? %> <p>No requests.</p> @@ -33,9 +33,10 @@ <td> <% if ae.has_element? :source %> <!-- <%= ae.source.project %> --
<% if ae.source.has_attribute? :package %> <!-- <%= ae.source.package %> --> - <% src_proj, src_pack = elide_two(ae.source.project, ae.source.package, elide_len) %> - <%= link_to(src_proj, :controller => :project, :action => :show, :project => ae.source.project) %> / - <% if Package.exists?(ae.source.project, ae.source.package) %> + <% src_proj = format_projectname(ae.source.project, BsRequest.creator(req).login) + src_pack = elide(ae.source.package, elide_len >> 1) %> + <%= link_to(src_proj, {:controller => :project, :action => :show, :project => ae.source.project}, { :title => ae.source.project} ) %> / + <% if Package.exists?(ae.source.project, ae.source.package) %> <%= link_to(src_pack, :controller => :package, :action => :show, :project => ae.source.project, :package => ae.source.package) %> <% else %> <%= src_pack %> -- 1.7.9.2 -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (1)
-
Dirk Müller