Class: UiChanged::ScreenshotIgnoreUrlsController

Inherits:
ScreenshotsControllerBase show all
Defined in:
app/controllers/ui_changed/screenshot_ignore_urls_controller.rb

Instance Method Summary collapse

Methods inherited from ScreenshotsControllerBase

#screenshot_counts

Instance Method Details

#addObject


13
14
15
16
17
18
19
20
21
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 13

def add
  ids = params[:id].split(",")
  ids.each do |id|
    ss = UiChanged::Screenshot.find(id)
    ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(ss.url)
    ss_ignore.save
  end
  head :ok
end

#add_all_comparesObject


39
40
41
42
43
44
45
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 39

def add_all_compares
  UiChanged::Screenshot.not_in_ignored.where(:is_compare => true).each do |screenshot|
    ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(screenshot.url)
    ss_ignore.save
  end
  head :ok
end

#add_all_controlsObject


23
24
25
26
27
28
29
30
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 23

def add_all_controls
  screenshots = UiChanged::Screenshot.not_in_ignored.where(:is_control => true)
  screenshots.each do |screenshot|
    ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(screenshot.url)
    ss_ignore.save
  end
  head :ok
end

#add_all_testsObject


31
32
33
34
35
36
37
38
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 31

def add_all_tests
  screenshots = UiChanged::Screenshot.not_in_ignored.where(:is_test => true)
  screenshots.each do |screenshot|
    ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(screenshot.url)
    ss_ignore.save
  end
  head :ok
end

#destroyObject


47
48
49
50
51
52
53
54
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 47

def destroy
  ids = params[:id].split(",")
  ids.each do |id|
    ss_ignore = UiChanged::ScreenshotIgnoreUrl.find(id)
    ss_ignore.destroy
  end
  head :ok
end

#destroy_allObject


55
56
57
58
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 55

def destroy_all
  UiChanged::ScreenshotIgnoreUrl.delete_all
  head :ok
end

#indexObject


6
7
8
9
10
11
# File 'app/controllers/ui_changed/screenshot_ignore_urls_controller.rb', line 6

def index
  params[:sort] ||= "url asc"
  @ignored_urls = UiChanged::ScreenshotIgnoreUrl.search(params[:search]).paginate(:page => params[:page],
                                                                                  :per_page => params[:per_page],
                                                                                  :order => params[:sort])
end