Skip to content

Commit

Permalink
Merge pull request #2700 from mkanoor/add_icons_for_methods
Browse files Browse the repository at this point in the history
Icons to discern automate method types
  • Loading branch information
h-kataria committed Nov 14, 2017
2 parents 6883c11 + dbd6aed commit fdb8f57
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/icon_customizations.scss
Expand Up @@ -59,4 +59,8 @@ opacity:0.6;
color: #ec7a08; //pf-orange-400
}

.fa-ruby {
@extend .fa, .fa-lg, .fa-diamond;
color: red;
}
/*end icon class customizations*/
17 changes: 15 additions & 2 deletions app/decorators/miq_ae_method_decorator.rb
@@ -1,5 +1,18 @@
class MiqAeMethodDecorator < MiqDecorator
def self.fonticon
'ff ff-method'
def fileicon
"svg/vendor-ansible.svg" if location == 'playbook'
end

def fonticon
case location
when "inline"
'fa-ruby'
when "expression"
'fa fa-search'
when "playbook"
nil
else
'ff ff-method'
end
end
end
1 change: 1 addition & 0 deletions app/presenters/tree_node/miq_ae_method.rb
@@ -1,4 +1,5 @@
module TreeNode
class MiqAeMethod < MiqAeNode
set_attribute(:image) { @object.try(:decorate).try(:fileicon) }
end
end
5 changes: 4 additions & 1 deletion app/views/miq_ae_class/_class_methods.html.haml
Expand Up @@ -16,7 +16,10 @@
%td.table-view-pf-select.noclick
%input{:type => 'checkbox', :value => cls_cid}
%td.table-view-pf-select
%i{:class => record.decorate.fonticon}
- if record.decorate.try(:fileicon)
%img{:src => ActionController::Base.helpers.image_path(record.decorate.fileicon)}
- else
%i{:class => record.decorate.fonticon}
%td
= record_name(record)
:javascript
Expand Down
2 changes: 1 addition & 1 deletion spec/presenters/tree_node/miq_ae_method_spec.rb
Expand Up @@ -5,6 +5,6 @@
let(:object) { FactoryGirl.create(:miq_ae_method, :scope => :class, :language => :ruby, :location => :inline) }

include_examples 'TreeNode::Node#key prefix', 'aem-'
include_examples 'TreeNode::Node#icon', 'ff ff-method'
include_examples 'TreeNode::Node#icon', 'fa-ruby'
include_examples 'TreeNode::Node#tooltip prefix', 'Automate Method'
end

0 comments on commit fdb8f57

Please sign in to comment.