Project

General

Profile

Revision 7ff105d1

Added by David Davis about 7 years ago

Fixes #12681 - Support rubocop 0.35.1 by fixing broken rules

View differences:

app/controllers/image_search_controller.rb
3 3

  
4 4
  def auto_complete_repository_name
5 5
    catch_network_errors do
6
      render :text => (use_hub? ? hub_image_exists?(params[:search]) :
7
          registry_image_exists?(params[:search])).to_s
6
      text = if use_hub?
7
               hub_image_exists?(params[:search])
8
             else
9
               registry_image_exists?(params[:search])
10
             end
11
      render :text => text.to_s
8 12
    end
9 13
  end
10 14

  
11 15
  def auto_complete_image_tag
12 16
    catch_network_errors do
13 17
      # This is the format jQuery UI autocomplete expects
14
      tags = use_hub? ? hub_auto_complete_image_tags(params[:search]) :
15
          registry_auto_complete_image_tags(params[:search])
18
      tags = if use_hub?
19
               hub_auto_complete_image_tags(params[:search])
20
             else
21
               registry_auto_complete_image_tags(params[:search])
22
             end
16 23
      respond_to do |format|
17 24
        format.js do
18 25
          tags.map! { |tag| { :label => CGI.escapeHTML(tag), :value => CGI.escapeHTML(tag) } }
......
24 31

  
25 32
  def search_repository
26 33
    catch_network_errors do
27
      repositories = use_hub? ? hub_search_image(params[:search]) :
28
                                registry_search_image(params[:search])
34
      repositories = if use_hub?
35
                       hub_search_image(params[:search])
36
                     else
37
                       registry_search_image(params[:search])
38
                     end
39

  
29 40
      respond_to do |format|
30 41
        format.js do
31 42
          render :partial => 'repository_search_results',
......
75 86
    result = ::Service::RegistryApi.new(:url => @registry.url,
76 87
                                        :user => @registry.username,
77 88
                                        :password => @registry.password).search(term)
78
    registry_name = term.split('/').size > 1 ? term :
79
        'library/' + term
89
    registry_name = if term.split('/').size > 1
90
                      term
91
                    else
92
                      "library/#{term}"
93
                    end
94

  
80 95
    result['results'].any? { |r| r['name'] == registry_name }
81 96
  end
82 97

  

Also available in: Unified diff