diff --git a/app/helpers/platforms_helper.rb b/app/helpers/platforms_helper.rb index a84c7761c..51131915a 100644 --- a/app/helpers/platforms_helper.rb +++ b/app/helpers/platforms_helper.rb @@ -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 diff --git a/app/views/platforms/platforms/index.html.haml b/app/views/platforms/platforms/index.html.haml index b30da5dc5..0d84f1c03 100644 --- a/app/views/platforms/platforms/index.html.haml +++ b/app/views/platforms/platforms/index.html.haml @@ -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}} diff --git a/app/views/platforms/platforms/index.json.jbuilder b/app/views/platforms/platforms/index.json.jbuilder index 4de185dd4..56acd2e81 100644 --- a/app/views/platforms/platforms/index.json.jbuilder +++ b/app/views/platforms/platforms/index.json.jbuilder @@ -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