[#369] add visibility icon to platforms

This commit is contained in:
Alexander Machehin 2014-06-26 18:29:07 +06:00
parent bdcbcdd197
commit d7d3ddfbd9
3 changed files with 12 additions and 3 deletions

View File

@ -25,4 +25,9 @@ module PlatformsHelper
settings.sort_by{ |s| s.arch.name }
end
def fa_platform_visibility_icon(platform)
return nil unless platform
image, color = platform.hidden? ? ['lock', 'text-danger fa-fw']: ['unlock-alt', 'text-success fa-fw']
fa_icon(image, class: color)
end
end

View File

@ -5,10 +5,13 @@
%table.table.table-hover.offset20
%thead
%tr
%th
%th= t 'activerecord.attributes.platform.name'
%th= t 'activerecord.attributes.platform.distrib_type'
%tbody
%tr{ 'ng-repeat' => 'item in platforms' }
%td
%i.fa.fa-lg{ 'ng-class' => 'item.visibility_class' }
%td
%a{ 'ng-href' => "{{item.link}}" }
{{item.name}}

View File

@ -1,9 +1,10 @@
json.platforms do
json.array!(@platforms) do |item|
json.cache! item, expires_in: 10.minutes do
json.name platform_printed_name(item)
json.link platform_path(item)
json.distrib_type item.distrib_type
json.name platform_printed_name(item)
json.link platform_path(item)
json.distrib_type item.distrib_type
json.visibility_class fa_platform_visibility_icon(item)
end
end
end