class ApplicationHelper::Button::OrchestrationTemplateEditRemove < ApplicationHelper::Button::Basic
  def calculate_properties
    super
    if @view_context.x_active_tree == :ot_tree && @record
      self[:enabled] = !@record.in_use?
      self[:title] = if self[:id] =~ /_edit$/
                       _('Orchestration Templates that are in use cannot be edited')
                     else
                       _('Orchestration Templates that are in use cannot be removed')
                     end
    end
  end
end

class ApplicationHelper::Button::OrchestrationTemplateEditRemove < ApplicationHelper::Button::Basic
  def calculate_properties
    super
    if @view_context.x_active_tree == :ot_tree && @record
      if @record.in_use?
        self[:enabled] = false
        self[:title] = if self[:id] =~ /_edit$/
                         _('Orchestration Templates that are in use cannot be edited')
                       else
                         _('Orchestration Templates that are in use cannot be removed')
                       end
      end
    end
  end
end

Fix misleading tooltip in orchestration template toolbar
Fix misleading tooltip in orchestration template toolbar

Tooltip telling the orchestration template cannot be removed / edited
needs to be put in place only if the template is in use (not in
call cases).

https://bugzilla.redhat.com/show_bug.cgi?id=1295941
