ui_changed 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,5 +13,5 @@
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
15
  //= require bootstrap
16
- //= require ui_changed/screenshots
16
+ //= require ui_changed/ui_changed
17
17
  //= require_tree .
@@ -0,0 +1,344 @@
1
+ if (typeof(UiChanged) === 'undefined') {
2
+ UiChanged = {
3
+ _initialized: false,
4
+ _clicked_urls_row: false,
5
+ _crawlStatusIntervalId: null,
6
+
7
+ /* selectors & classes used in the javascript below */
8
+
9
+ _crawl_btn_selector: '.crawl_btns .f_crawl_action',
10
+ _crawl_btn_btn_selector: '.crawl_btns button',
11
+ _crawl_cancel_btn_selector: '.crawl_btns .f_crawl_action.f_cancel',
12
+ _crawling_urls_selector: '.crawling .urls',
13
+ _crawling_urls_li_selector: '.crawling .urls li',
14
+ _crawling_last_img_selector: '.crawling a.last_img',
15
+ _crawling_last_img_img_selector: '.crawling a.last_img img',
16
+ _crawling_no_diff_found_selector: '.crawling a.last_img .no_diff_found',
17
+ _crawling_diff_found_selector: '.crawling a.last_img .diff_found',
18
+ _crawl_btn_running_class: 'running',
19
+
20
+ _diff_or_no_diff_found_selector: '.diff_found, .no_diff_found',
21
+ _crawling_urls_active_selector: '.active',
22
+ _crawling_urls_active_class: 'active',
23
+ _no_diff_found_class: 'no_diff_found',
24
+ _diff_found_class: 'diff_found',
25
+
26
+ _checkbox_master_selector: "#f_checkall",
27
+ _checkbox_child_selector: ".f_checkall_child",
28
+ _checkbox_child_checked_selector: ".f_checkall_child:checked",
29
+
30
+ _element_db_id_selector: '.f_id',
31
+ _row_selector: '.screenshots tbody tr',
32
+ _diffs_row_selector: '.screenshots.diffs tbody tr',
33
+ _row_checkbox_not_checked_selector: 'td:first input[type=checkbox]:not(:checked)',
34
+
35
+ _action_btn_selector: ".f_actions button",
36
+ _action_remove_selector: ".f_actions .f_remove",
37
+ _action_remove_test_and_diff_selector: ".f_actions .f_remove_test_and_diff",
38
+ _action_ignore_selector: ".f_actions .f_ignore",
39
+ _action_set_test_as_control_selector: ".f_actions .f_set_test_as_control",
40
+
41
+ _action_remove_all_diffs_and_tests_selector: ".f_bulk_actions .f_remove_all_diffs_and_tests",
42
+ _action_remove_all_selector: ".f_bulk_actions .f_remove_all",
43
+ _action_ignore_all_selector: ".f_bulk_actions .f_ignore_all_urls",
44
+ _action_set_all_tests_as_control_selector: ".f_bulk_actions .f_set_all_tests_as_control",
45
+
46
+ _on_homepage_selector: '.f_on_home_page',
47
+
48
+ _sidenav_diffs_count_selector: '.f_sidenav_diffs span:last',
49
+ _sidenav_controls_count_selector: '.f_sidenav_controls span:last',
50
+ _sidenav_tests_count_selector: '.f_sidenav_tests span:last',
51
+ _sidenav_compares_count_selector: '.f_sidenav_compares span:last',
52
+
53
+ /* url selectors */
54
+ _action_set_test_as_control_url_selector: '.f_set_test_as_control_url',
55
+ _remove_url_selector: '.f_remove_url',
56
+ _diffs_url_selector: '.f_diff_url',
57
+
58
+ /* urls */
59
+ _url_add_ignore: "/ui_changed/screenshot_ignore_urls/add?id=",
60
+ _url_crawl_status: "screenshots/crawl_status.json",
61
+
62
+ _init: function() {
63
+ if(this._initialized) return;
64
+
65
+ $(this._crawl_btn_selector).not(this._crawl_cancel_btn_selector).click(this._crawl_btns_clicked);
66
+ $(this._crawl_cancel_btn_selector).click(this._crawl_btn_cancel_clicked);
67
+ $(this._crawling_urls_selector).on('click', 'li:not(' + this._crawling_urls_active_selector + ')', this._crawling_urls_clicked);
68
+
69
+ $(this._checkbox_master_selector).change(this._checkall_master_change);
70
+ $(this._checkbox_child_selector).change(this._checkall_child_change);
71
+ $(this._diffs_row_selector).click(this._diffs_row_clicked);
72
+
73
+ $(this._action_remove_selector).click(this._actions_remove);
74
+ $(this._action_remove_test_and_diff_selector).click(this._actions_remove_test_and_diff);
75
+ $(this._action_ignore_selector).click(this._actions_ignore);
76
+ $(this._action_set_test_as_control_selector).click(this._actions_set_test_as_control);
77
+
78
+ $(this._action_remove_all_diffs_and_tests_selector).click(this._bulk_actions_remove_all_diffs_and_tests);
79
+ $(this._action_remove_all_selector).click(this._bulk_actions_remove_all);
80
+ $(this._action_ignore_all_selector).click(this._bulk_actions_ignore_all_urls);
81
+ $(this._action_set_all_tests_as_control_selector).click(this._bulk_actions_set_all_tests_as_control);
82
+
83
+ if ($(this._crawl_cancel_btn_selector).is(':visible')) $(this._crawl_btn_btn_selector).not(this._crawl_cancel_btn_selector).attr("disabled", "disabled");
84
+
85
+ if ($(this._on_homepage_selector).val() === "true") this._update_crawl_status();
86
+
87
+ this._disable_action_buttons();
88
+ this._initialized = true;
89
+ },
90
+
91
+ /* individual actions */
92
+ _actions_remove: function() {
93
+ UiChanged._ajax_with_type($(UiChanged._remove_url_selector).val() + UiChanged._get_checked_ids(), "DELETE");
94
+ },
95
+ _actions_remove_test_and_diff: function() {
96
+ UiChanged._ajax_with_type($(this).attr("data-href") + "?id=" + UiChanged._get_checked_ids(), "DELETE");
97
+ },
98
+ _actions_ignore: function() {
99
+ UiChanged._ajax_with_type(UiChanged._url_add_ignore + UiChanged._get_checked_ids(), "POST");
100
+ },
101
+ _actions_set_test_as_control: function() {
102
+ UiChanged._ajax_with_type($(UiChanged._action_set_test_as_control_url_selector).val() + '?id=' + UiChanged._get_checked_ids(), "POST");
103
+ },
104
+
105
+ /* bulk actions */
106
+ _bulk_actions_remove_all_diffs_and_tests: function() {
107
+ UiChanged._ajax_with_type($(this).attr("data-href"), "DELETE");
108
+ },
109
+ _bulk_actions_remove_all: function() {
110
+ UiChanged._ajax_with_type($(this).attr("data-href"), "DELETE");
111
+ },
112
+ _bulk_actions_ignore_all_urls: function() {
113
+ UiChanged._ajax_with_type($(this).attr("data-href"), "POST");
114
+ },
115
+ _bulk_actions_set_all_tests_as_control: function() {
116
+ UiChanged._ajax_with_type($(this).attr("data-href"), "POST");
117
+ },
118
+
119
+ _crawl_btns_clicked: function() {
120
+ $(UiChanged._crawl_btn_btn_selector).not(UiChanged._crawl_cancel_btn_selector).attr("disabled", "disabled");
121
+ $(UiChanged._crawl_cancel_btn_selector).show();
122
+
123
+ $.ajax({
124
+ url: $(this).attr('data-action'),
125
+ type: 'POST',
126
+ success: function(data) {
127
+ $(UiChanged._crawling_urls_li_selector).remove();
128
+ UiChanged._update_crawl_status();
129
+ }
130
+ });
131
+ },
132
+
133
+ _crawl_btn_cancel_clicked: function() {
134
+ $(this).attr("disabled", "disabled");
135
+ $.ajax({
136
+ url: $(this).attr('data-action'),
137
+ type: 'POST'
138
+ });
139
+ },
140
+
141
+ _crawling_urls_clicked: function() {
142
+ var elem = $(this);
143
+ if (elem.prev().length === 0) {
144
+ // reset our boolean
145
+ UiChanged._clicked_urls_row = false;
146
+ $(UiChanged._crawling_urls_li_selector).removeClass(UiChanged._crawling_urls_active_class);
147
+ elem.addClass(UiChanged._crawling_urls_active_class);
148
+ } else {
149
+ UiChanged._clicked_urls_row = true;
150
+ }
151
+
152
+ var anchor = elem.find('a');
153
+ if (typeof anchor.attr('data-alt') === 'undefined') return;
154
+ $(UiChanged._crawling_urls_li_selector).removeClass(UiChanged._crawling_urls_active_class);
155
+ elem.addClass(UiChanged._crawling_urls_active_class);
156
+
157
+ var is_compare = anchor.find(UiChanged._diff_or_no_diff_found_selector).length === 1;
158
+ var diff_found = anchor.find(UiChanged._diff_found_class).length === 1;
159
+
160
+ UiChanged._add_crawl_image_with_src({
161
+ 'file_name': anchor.attr('data-alt'),
162
+ 'src':anchor.attr('data-src'),
163
+ 'crawl_url': anchor.attr('href'),
164
+ 'is_compare': is_compare,
165
+ 'diff_found': diff_found});
166
+ },
167
+
168
+ _update_crawl_status: function() {
169
+ $.ajax({
170
+ dataType: "json",
171
+ url: UiChanged._url_crawl_status,
172
+ success: function(data) {
173
+ var screenshots = data[0].screenshots;
174
+ var running_status = data[0].worker.running_status;
175
+ var first_status = data[0].worker.first_status;
176
+ var running_type = data[0].worker.running_type;
177
+ $(UiChanged._crawl_btn_selector).removeClass(UiChanged._crawl_btn_running_class);
178
+ $(UiChanged._crawl_btn_with_type(running_type)).addClass(UiChanged._crawl_btn_running_class);
179
+ $(UiChanged._crawling_last_img_img_selector).removeAttr("src");
180
+ $(UiChanged._crawling_last_img_img_selector).removeAttr("alt");
181
+
182
+ $(UiChanged._sidenav_diffs_count_selector).text(data[0].counts.diff);
183
+ $(UiChanged._sidenav_controls_count_selector).text(data[0].counts.control);
184
+ $(UiChanged._sidenav_tests_count_selector).text(data[0].counts.test);
185
+ $(UiChanged._sidenav_compares_count_selector).text(data[0].counts.compare);
186
+
187
+ for (var i=0; i < screenshots.length; i++) {
188
+ UiChanged._add_crawl_url(screenshots[i]);
189
+ }
190
+ if (screenshots.length > 0 && !UiChanged._clicked_urls_row) {
191
+ /* if the user isn't looking at other rows, then show the most recent image */
192
+ UiChanged._show_top_most_image();
193
+ }
194
+
195
+ // $('.cmd_status_msg').text('running: ' + running_status + ' first: ' + first_status);
196
+ clearInterval(UiChanged._crawlStatusIntervalId);
197
+ if (running_status === "working" || (first_status === "working" || first_status === "queued")) {
198
+ UiChanged._crawlStatusIntervalId = setInterval(UiChanged._update_crawl_status, 3000);
199
+ return;
200
+ }
201
+ $(UiChanged._crawl_btn_btn_selector).removeAttr("disabled");
202
+ $(UiChanged._crawl_cancel_btn_selector).hide();
203
+ }
204
+ });
205
+ },
206
+
207
+ _show_top_most_image: function() {
208
+ $(UiChanged._crawling_urls_li_selector).each(function() {
209
+ var elem = $(this);
210
+ var anchor = elem.find('a');
211
+ if (anchor.hasClass(UiChanged._crawling_urls_active_class)) return;
212
+ var src = anchor.attr('data-src');
213
+ if (typeof src !== 'undefined') {
214
+ UiChanged._add_crawl_image_with_src({
215
+ 'file_name': anchor.attr('data-alt'),
216
+ 'src': src,
217
+ 'crawl_url': anchor.attr('data-href'),
218
+ 'is_compare': anchor.attr('data-type') === 'compare',
219
+ 'diff_found': anchor.find('i').hasClass(UiChanged._diff_found_class)});
220
+ return false;
221
+ }
222
+ });
223
+ },
224
+
225
+ _add_crawl_url: function(screenshot) {
226
+ if (screenshot.url === null) return;
227
+
228
+ if ($(UiChanged._crawling_urls_li_selector).length > 100) {
229
+ $(UiChanged._crawling_urls_selector).empty();
230
+ }
231
+
232
+ var type = "test";
233
+ var diff_class = "";
234
+ if (screenshot.is_control === true) {
235
+ type = "control";
236
+ } else if (screenshot.is_compare === true) {
237
+ diff_class = screenshot.diff_found === true ? UiChanged._diff_found_class : UiChanged._no_diff_found_class;
238
+ diff_class = " " + diff_class;
239
+ type = "compare";
240
+ }
241
+
242
+ var file_name = screenshot.image_file_name;
243
+ var src;
244
+ var icon_class;
245
+ if (file_name !== null) {
246
+ src = screenshot.displayable_image_path_full;
247
+ icon_class = 'icon-picture' + diff_class;
248
+ } else {
249
+ icon_class = 'icon-';
250
+ }
251
+
252
+ var existing_selector = UiChanged._crawling_url_with_href_and_type(screenshot.url, type);
253
+ var existing = $(existing_selector);
254
+ if (existing.length === 0) {
255
+ $(UiChanged._crawling_urls_selector).prepend('<li><a data-type="' + type + '" data-href="' + screenshot.url + '"><i></i><span>' + type + ' : ' + screenshot.url + '</span></a></li>');
256
+ existing = $(existing_selector);
257
+ }
258
+ if (typeof existing.attr('data-alt') === 'undefined' && src !== null) {
259
+ existing.find('i').attr('class', icon_class);
260
+ existing.attr('data-alt', file_name);
261
+ existing.attr('data-src', src);
262
+ }
263
+ },
264
+
265
+ _add_crawl_image_with_src: function(params) {
266
+ // don't replace the image with itself
267
+ var existing_img = $(UiChanged._crawling_last_img_img_selector + '[src="' + params.src + '"]').length;
268
+ if (existing_img > 0) return;
269
+
270
+ if (params.is_compare) {
271
+ if (params.diff_found === null || params.diff_found === false) {
272
+ $(UiChanged._crawling_no_diff_found_selector).show();
273
+ $(UiChanged._crawling_diff_found_selector).hide();
274
+ $(UiChanged._crawling_last_img_img_selector).hide();
275
+ } else {
276
+ $(UiChanged._crawling_no_diff_found_selector).hide();
277
+ $(UiChanged._crawling_diff_found_selector).show();
278
+ $(UiChanged._crawling_last_img_img_selector).show();
279
+ }
280
+ } else {
281
+ $(UiChanged._crawling_no_diff_found_selector).hide();
282
+ $(UiChanged._crawling_diff_found_selector).hide();
283
+ $(UiChanged._crawling_last_img_img_selector).show();
284
+ }
285
+ $(UiChanged._crawling_last_img_selector).attr('href', params.src);
286
+ $(UiChanged._crawling_last_img_img_selector).attr('alt', params.file_name);
287
+ $(UiChanged._crawling_last_img_img_selector).attr('src', params.src);
288
+
289
+ if (UiChanged._clicked_urls_row) return;
290
+ $(UiChanged._crawling_urls_li_selector).removeClass(UiChanged._crawling_urls_active_class);
291
+ $(UiChanged._crawling_url_with_href(params.crawl_url)).parent('li').addClass(UiChanged._crawling_urls_active_class);
292
+ },
293
+
294
+ _checkall_master_change: function() {
295
+ $(UiChanged._checkbox_child_selector).prop("checked", this.checked);
296
+ UiChanged._disable_action_buttons();
297
+ },
298
+ _checkall_child_change: function() {
299
+ $(UiChanged._checkbox_master_selector).prop("checked", $(UiChanged._checkbox_child_checked_selector).length == $(UiChanged._checkbox_child_selector).length);
300
+ UiChanged._disable_action_buttons();
301
+ },
302
+ _diffs_row_clicked: function(e) {
303
+ if (e.target.type === 'checkbox') return;
304
+ document.location = $(this).find(UiChanged._diffs_url_selector).val();
305
+ },
306
+
307
+ _disable_action_buttons: function() {
308
+ $(UiChanged._action_btn_selector).attr("disabled", $(UiChanged._checkbox_child_checked_selector).length === 0);
309
+ },
310
+ _ajax_with_type: function(url, type) {
311
+ $.ajax({
312
+ url: url,
313
+ type: type,
314
+ success: function() {
315
+ location.reload();
316
+ }
317
+ });
318
+ },
319
+ _get_checked_ids: function() {
320
+ var ids_array = [];
321
+ $(UiChanged._row_selector).each(function() {
322
+ var row = $(this);
323
+ if (!row.find(UiChanged._row_checkbox_not_checked_selector).length) {
324
+ var diff_id = row.find(UiChanged._element_db_id_selector).first().val();
325
+ ids_array.push(diff_id);
326
+ }
327
+ });
328
+ return ids_array.join(",");
329
+ },
330
+ _crawl_btn_with_type: function(type) {
331
+ return UiChanged._crawl_btn_selector + '[data-type="' + type + '"]';
332
+ },
333
+ _crawling_url_with_href: function(href) {
334
+ return UiChanged._crawling_urls_li_selector + ' a[data-href="' + href +'"]';
335
+ },
336
+ _crawling_url_with_href_and_type: function(href, data_type) {
337
+ return UiChanged._crawling_urls_li_selector + ' a[data-href="' + href + '"][data-type="' + data_type + '"]';
338
+ }
339
+ };
340
+ }
341
+
342
+ $(function() {
343
+ UiChanged._init();
344
+ });
@@ -6,6 +6,7 @@ body {margin-top: 40px;}
6
6
 
7
7
  .crawl_btns .running {border: 3px solid red;}
8
8
 
9
+ .diff_screenshots > div:first-child {margin-left: 0;}
9
10
  .diff_screenshots img, table.screenshots tbody tr td img {border: 1px solid #ccc; padding: 2px;}
10
11
  .diff_screenshots img:hover, table.screenshots tbody tr td img:hover {border: 1px solid #000;}
11
12
  .diffs tbody tr {cursor: pointer;}
@@ -1,7 +1,7 @@
1
1
  module UiChanged
2
2
  class ConfigHelper
3
3
  MTC_CONFIG.each do |config|
4
- # set the path
4
+ # set the path to inside our spec/dummy directory for control_path, test_path, and compare_path if running tests
5
5
  if Rails.env.test? && config[0].end_with?("_path")
6
6
  define_singleton_method config[0], lambda { "#{Rails.root}/#{config[1]}" }
7
7
  else
@@ -4,7 +4,7 @@ module UiChanged
4
4
 
5
5
  validates :url, :presence => true, :format => URI::regexp(%w(http https))
6
6
 
7
- self.per_page = 10
7
+ self.per_page = 15
8
8
 
9
9
  class << self
10
10
  def search(search)
@@ -7,7 +7,6 @@
7
7
  = stylesheet_link_tag "ui_changed/application", :media => "all"
8
8
  = javascript_include_tag "ui_changed/application"
9
9
  = csrf_meta_tags
10
- %script{:src => "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"}
11
10
  %body
12
11
  .container
13
12
  .row
@@ -16,7 +16,7 @@
16
16
  -@all_screenshots.each do |screenshots|
17
17
  %tr
18
18
  %input.f_id{:type => "hidden", :value => screenshots.diff_ss.id}
19
- %input.diff_url{:type => "hidden", :value => screenshot_diff_path + "?diff_id=#{screenshots.diff_ss.id}"}
19
+ %input.f_diff_url{:type => "hidden", :value => screenshot_diff_path + "?diff_id=#{screenshots.diff_ss.id}"}
20
20
  %td
21
21
  %input.f_checkall_child{:type => "checkbox"}
22
22
  %td
@@ -1,6 +1,3 @@
1
- require 'ui_changed'
2
- require 'rails'
3
-
4
1
  module UiChanged
5
2
  class Railtie < Rails::Railtie
6
3
  railtie_name :ui_changed
@@ -1,3 +1,3 @@
1
1
  module UiChanged
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -2,9 +2,6 @@ require 'spec_helper'
2
2
  require 'debugger'
3
3
 
4
4
  describe "screenshot actions" do
5
-
6
- # before(:each) { @screenshot = FactoryGirl.create(:screenshot) }
7
-
8
5
  # url
9
6
 
10
7
  it "should not allow urls that don't start with http or https" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ui_changed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70198372106700 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.2.11
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70198372106700
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.11
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: bootstrap-sass
27
- requirement: &70198372106280 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70198372106280
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: will_paginate
38
- requirement: &70198372105820 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70198372105820
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: bootstrap-will_paginate
49
- requirement: &70198372105400 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70198372105400
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: haml-rails
60
- requirement: &70198372104980 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *70198372104980
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: anemone
71
- requirement: &70198372104560 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *70198372104560
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: selenium-webdriver
82
- requirement: &70198372104140 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0'
88
118
  type: :runtime
89
119
  prerelease: false
90
- version_requirements: *70198372104140
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: jquery-rails
93
- requirement: &70198372103720 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,10 +133,15 @@ dependencies:
98
133
  version: '0'
99
134
  type: :runtime
100
135
  prerelease: false
101
- version_requirements: *70198372103720
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: font-awesome-sass-rails
104
- requirement: &70198372103300 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
147
  - - ! '>='
@@ -109,10 +149,15 @@ dependencies:
109
149
  version: '0'
110
150
  type: :runtime
111
151
  prerelease: false
112
- version_requirements: *70198372103300
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: resque
115
- requirement: &70198372102880 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
163
  - - ! '>='
@@ -120,10 +165,15 @@ dependencies:
120
165
  version: '0'
121
166
  type: :runtime
122
167
  prerelease: false
123
- version_requirements: *70198372102880
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
124
174
  - !ruby/object:Gem::Dependency
125
175
  name: resque_mailer
126
- requirement: &70198372102460 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
127
177
  none: false
128
178
  requirements:
129
179
  - - ! '>='
@@ -131,10 +181,15 @@ dependencies:
131
181
  version: '0'
132
182
  type: :runtime
133
183
  prerelease: false
134
- version_requirements: *70198372102460
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
135
190
  - !ruby/object:Gem::Dependency
136
191
  name: resque-status
137
- requirement: &70198371664240 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
138
193
  none: false
139
194
  requirements:
140
195
  - - ! '>='
@@ -142,10 +197,15 @@ dependencies:
142
197
  version: '0'
143
198
  type: :runtime
144
199
  prerelease: false
145
- version_requirements: *70198371664240
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
146
206
  - !ruby/object:Gem::Dependency
147
207
  name: sass-rails
148
- requirement: &70198371660460 !ruby/object:Gem::Requirement
208
+ requirement: !ruby/object:Gem::Requirement
149
209
  none: false
150
210
  requirements:
151
211
  - - ~>
@@ -153,10 +213,15 @@ dependencies:
153
213
  version: 3.2.3
154
214
  type: :development
155
215
  prerelease: false
156
- version_requirements: *70198371660460
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ~>
220
+ - !ruby/object:Gem::Version
221
+ version: 3.2.3
157
222
  - !ruby/object:Gem::Dependency
158
223
  name: rspec-rails
159
- requirement: &70198371658320 !ruby/object:Gem::Requirement
224
+ requirement: !ruby/object:Gem::Requirement
160
225
  none: false
161
226
  requirements:
162
227
  - - ! '>='
@@ -164,10 +229,15 @@ dependencies:
164
229
  version: '0'
165
230
  type: :development
166
231
  prerelease: false
167
- version_requirements: *70198371658320
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
168
238
  - !ruby/object:Gem::Dependency
169
239
  name: capybara
170
- requirement: &70198372124240 !ruby/object:Gem::Requirement
240
+ requirement: !ruby/object:Gem::Requirement
171
241
  none: false
172
242
  requirements:
173
243
  - - ! '>='
@@ -175,10 +245,15 @@ dependencies:
175
245
  version: '0'
176
246
  type: :development
177
247
  prerelease: false
178
- version_requirements: *70198372124240
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
179
254
  - !ruby/object:Gem::Dependency
180
255
  name: capybara-webkit
181
- requirement: &70198372123820 !ruby/object:Gem::Requirement
256
+ requirement: !ruby/object:Gem::Requirement
182
257
  none: false
183
258
  requirements:
184
259
  - - ! '>='
@@ -186,10 +261,15 @@ dependencies:
186
261
  version: '0'
187
262
  type: :development
188
263
  prerelease: false
189
- version_requirements: *70198372123820
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - ! '>='
268
+ - !ruby/object:Gem::Version
269
+ version: '0'
190
270
  - !ruby/object:Gem::Dependency
191
271
  name: database_cleaner
192
- requirement: &70198372123400 !ruby/object:Gem::Requirement
272
+ requirement: !ruby/object:Gem::Requirement
193
273
  none: false
194
274
  requirements:
195
275
  - - ! '>='
@@ -197,10 +277,15 @@ dependencies:
197
277
  version: '0'
198
278
  type: :development
199
279
  prerelease: false
200
- version_requirements: *70198372123400
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ none: false
282
+ requirements:
283
+ - - ! '>='
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
201
286
  - !ruby/object:Gem::Dependency
202
287
  name: factory_girl_rails
203
- requirement: &70198372122980 !ruby/object:Gem::Requirement
288
+ requirement: !ruby/object:Gem::Requirement
204
289
  none: false
205
290
  requirements:
206
291
  - - ! '>='
@@ -208,10 +293,15 @@ dependencies:
208
293
  version: '0'
209
294
  type: :development
210
295
  prerelease: false
211
- version_requirements: *70198372122980
296
+ version_requirements: !ruby/object:Gem::Requirement
297
+ none: false
298
+ requirements:
299
+ - - ! '>='
300
+ - !ruby/object:Gem::Version
301
+ version: '0'
212
302
  - !ruby/object:Gem::Dependency
213
303
  name: mysql2
214
- requirement: &70198372122560 !ruby/object:Gem::Requirement
304
+ requirement: !ruby/object:Gem::Requirement
215
305
  none: false
216
306
  requirements:
217
307
  - - ! '>='
@@ -219,10 +309,15 @@ dependencies:
219
309
  version: '0'
220
310
  type: :development
221
311
  prerelease: false
222
- version_requirements: *70198372122560
312
+ version_requirements: !ruby/object:Gem::Requirement
313
+ none: false
314
+ requirements:
315
+ - - ! '>='
316
+ - !ruby/object:Gem::Version
317
+ version: '0'
223
318
  - !ruby/object:Gem::Dependency
224
319
  name: debugger
225
- requirement: &70198372122140 !ruby/object:Gem::Requirement
320
+ requirement: !ruby/object:Gem::Requirement
226
321
  none: false
227
322
  requirements:
228
323
  - - ! '>='
@@ -230,7 +325,12 @@ dependencies:
230
325
  version: '0'
231
326
  type: :development
232
327
  prerelease: false
233
- version_requirements: *70198372122140
328
+ version_requirements: !ruby/object:Gem::Requirement
329
+ none: false
330
+ requirements:
331
+ - - ! '>='
332
+ - !ruby/object:Gem::Version
333
+ version: '0'
234
334
  description: Rails plugin for crawling domains for detecting differences in the UI
235
335
  email:
236
336
  - adelegard@gmail.com
@@ -239,18 +339,15 @@ extensions: []
239
339
  extra_rdoc_files: []
240
340
  files:
241
341
  - app/assets/javascripts/ui_changed/application.js
242
- - app/assets/javascripts/ui_changed/screenshots.js
342
+ - app/assets/javascripts/ui_changed/ui_changed.js
243
343
  - app/assets/stylesheets/scaffold.css
244
344
  - app/assets/stylesheets/ui_changed/application.css.scss
245
- - app/assets/stylesheets/ui_changed/screenshot_ignore_urls.css
246
- - app/assets/stylesheets/ui_changed/screenshots.css
345
+ - app/assets/stylesheets/ui_changed/ui_changed.css
247
346
  - app/controllers/ui_changed/application_controller.rb
248
347
  - app/controllers/ui_changed/screenshot_ignore_urls_controller.rb
249
348
  - app/controllers/ui_changed/screenshots_controller.rb
250
349
  - app/controllers/ui_changed/screenshots_controller_base.rb
251
350
  - app/helpers/ui_changed/application_helper.rb
252
- - app/helpers/ui_changed/screenshot_ignore_urls_helper.rb
253
- - app/helpers/ui_changed/screenshots_helper.rb
254
351
  - app/mailers/ui_changed/notifications_mailer.rb
255
352
  - app/models/ui_changed/all_screenshot.rb
256
353
  - app/models/ui_changed/config_helper.rb
@@ -451,7 +548,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
451
548
  version: '0'
452
549
  requirements: []
453
550
  rubyforge_project:
454
- rubygems_version: 1.8.10
551
+ rubygems_version: 1.8.25
455
552
  signing_key:
456
553
  specification_version: 3
457
554
  summary: Rails plugin for crawling domains for detecting differences in the UI
@@ -1,280 +0,0 @@
1
- if (typeof(Screenshots) === 'undefined') {
2
- Screenshots = {
3
- _initialized: false,
4
- _clicked_urls_row: false,
5
- _crawlStatusIntervalId: null,
6
-
7
- _init: function() {
8
- if(this._initialized) return;
9
-
10
- $('.crawl_btns .f_crawl_action').not('.f_cancel').click(this._crawl_btns_clicked);
11
- $('.crawl_btns .f_crawl_action.f_cancel').click(this._crawl_btn_cancel_clicked);
12
- $('.crawling .urls').on('click', 'li:not(.active)', this._crawling_urls_clicked);
13
-
14
- $("#f_checkall").change(this._checkall_master_change);
15
- $(".f_checkall_child").change(this._checkall_child_change);
16
- $('table.screenshots.diffs tbody tr').click(this._diffs_row_clicked);
17
-
18
- $(".f_actions .f_remove").click(this._actions_remove);
19
- $(".f_actions .f_remove_test_and_diff").click(this._actions_remove_test_and_diff);
20
- $(".f_actions .f_ignore").click(this._actions_ignore);
21
- $(".f_actions .f_set_test_as_control").click(this._actions_set_test_as_control);
22
-
23
- $(".f_bulk_actions .f_remove_all_diffs_and_tests").click(this._bulk_actions_remove_all_diffs_and_tests);
24
- $(".f_bulk_actions .f_remove_all").click(this._bulk_actions_remove_all);
25
- $(".f_bulk_actions .f_ignore_all_urls").click(this._bulk_actions_ignore_all_urls);
26
- $(".f_bulk_actions .f_set_all_tests_as_control").click(this._bulk_actions_set_all_tests_as_control);
27
-
28
- if ($('.f_cancel').is(':visible')) $('.crawl_btns button').not('.f_cancel').attr("disabled", "disabled");
29
-
30
- if ($('.f_on_home_page').val() === "true") this._update_crawl_status();
31
-
32
- this._disable_action_buttons();
33
- this._initialized = true;
34
- },
35
-
36
- /* individual actions */
37
- _actions_remove: function() {
38
- Screenshots._ajax_with_type($('.f_remove_url').val() + Screenshots._get_checked_ids(), "DELETE");
39
- },
40
- _actions_remove_test_and_diff: function() {
41
- Screenshots._ajax_with_type($(this).attr("data-href") + "?id=" + Screenshots._get_checked_ids(), "DELETE");
42
- },
43
- _actions_ignore: function() {
44
- Screenshots._ajax_with_type("/ui_changed/screenshot_ignore_urls/add?id=" + Screenshots._get_checked_ids(), "POST");
45
- },
46
- _actions_set_test_as_control: function() {
47
- Screenshots._ajax_with_type($('.f_set_test_as_control_url').val() + '?id=' + Screenshots._get_checked_ids(), "POST");
48
- },
49
-
50
- /* bulk actions */
51
- _bulk_actions_remove_all_diffs_and_tests: function() {
52
- Screenshots._ajax_with_type($(this).attr("data-href"), "DELETE");
53
- },
54
- _bulk_actions_remove_all: function() {
55
- Screenshots._ajax_with_type($(this).attr("data-href"), "DELETE");
56
- },
57
- _bulk_actions_ignore_all_urls: function() {
58
- Screenshots._ajax_with_type($(this).attr("data-href"), "POST");
59
- },
60
- _bulk_actions_set_all_tests_as_control: function() {
61
- Screenshots._ajax_with_type($(this).attr("data-href"), "POST");
62
- },
63
-
64
- _crawl_btns_clicked: function() {
65
- $('.crawl_btns button').not('.f_cancel').attr("disabled", "disabled");
66
- $('.crawl_btns .f_cancel').show();
67
-
68
- $.ajax({
69
- url: $(this).attr('data-action'),
70
- type: 'POST',
71
- success: function(data) {
72
- $('.crawling .urls li').remove();
73
- Screenshots._update_crawl_status();
74
- }
75
- });
76
- },
77
-
78
- _crawl_btn_cancel_clicked: function() {
79
- $(this).attr("disabled", "disabled");
80
- $.ajax({
81
- url: $(this).attr('data-action'),
82
- type: 'POST'
83
- });
84
- },
85
-
86
- _crawling_urls_clicked: function() {
87
- var elem = $(this);
88
- if (elem.prev().length === 0) {
89
- // reset our boolean
90
- Screenshots._clicked_urls_row = false;
91
- $('.crawling .urls li').removeClass('active');
92
- elem.addClass('active');
93
- } else {
94
- Screenshots._clicked_urls_row = true;
95
- }
96
-
97
- var anchor = elem.find('a');
98
- if (typeof anchor.attr('data-alt') === 'undefined') return;
99
- $('.crawling .urls li').removeClass('active');
100
- elem.addClass('active');
101
-
102
- var is_compare = anchor.find('i.diff_found, i.no_diff_found').length === 1;
103
- var diff_found = anchor.find('i.diff_found').length === 1;
104
-
105
- Screenshots._add_crawl_image_with_src({
106
- 'file_name': anchor.attr('data-alt'),
107
- 'src':anchor.attr('data-src'),
108
- 'crawl_url': anchor.attr('href'),
109
- 'is_compare': is_compare,
110
- 'diff_found': diff_found});
111
- },
112
-
113
- _update_crawl_status: function() {
114
- $.ajax({
115
- dataType: "json",
116
- url: "screenshots/crawl_status.json",
117
- success: function(data) {
118
- var screenshots = data[0].screenshots;
119
- var running_status = data[0].worker.running_status;
120
- var first_status = data[0].worker.first_status;
121
- var running_type = data[0].worker.running_type;
122
- $('.crawl_btns .f_crawl_action').removeClass('running');
123
- $('.crawl_btns .f_crawl_action[data-type="'+running_type+'"]').addClass('running');
124
- $('.crawling a.last_img img').removeAttr("src");
125
- $('.crawling a.last_img img').removeAttr("alt");
126
-
127
- $('.f_sidenav_diffs span:last').text(data[0].counts.diff);
128
- $('.f_sidenav_controls span:last').text(data[0].counts.control);
129
- $('.f_sidenav_tests span:last').text(data[0].counts.test);
130
- $('.f_sidenav_compares span:last').text(data[0].counts.compare);
131
-
132
- for (var i=0; i < screenshots.length; i++) {
133
- Screenshots._add_crawl_url(screenshots[i]);
134
- }
135
- if (screenshots.length > 0 && !Screenshots._clicked_urls_row) {
136
- /* if the user isn't looking at other rows, then show the most recent image */
137
- Screenshots._show_top_most_image();
138
- }
139
-
140
- // $('.cmd_status_msg').text('running: ' + running_status + ' first: ' + first_status);
141
- clearInterval(Screenshots._crawlStatusIntervalId);
142
- if (running_status === "working" || (first_status === "working" || first_status === "queued")) {
143
- Screenshots._crawlStatusIntervalId = setInterval(Screenshots._update_crawl_status, 3000);
144
- return;
145
- }
146
- $('.crawl_btns button').removeAttr("disabled");
147
- $('.crawl_btns .f_cancel').hide();
148
- }
149
- });
150
- },
151
-
152
- _show_top_most_image: function() {
153
- $('.crawling .urls li').each(function() {
154
- var elem = $(this);
155
- var anchor = elem.find('a');
156
- if (anchor.hasClass('active')) return;
157
- var src = anchor.attr('data-src');
158
- if (typeof src !== 'undefined') {
159
- Screenshots._add_crawl_image_with_src({
160
- 'file_name': anchor.attr('data-alt'),
161
- 'src': src,
162
- 'crawl_url': anchor.attr('data-href'),
163
- 'is_compare': anchor.attr('data-type') === 'compare',
164
- 'diff_found': anchor.find('i').hasClass('diff_found')});
165
- return false;
166
- }
167
- });
168
- },
169
-
170
- _add_crawl_url: function(screenshot) {
171
- if (screenshot.url === null) return;
172
-
173
- if ($('.crawling .urls li').length > 100) {
174
- $('.crawling .urls').empty();
175
- }
176
-
177
- var type = "test";
178
- var diff_class = "";
179
- if (screenshot.is_control === true) {
180
- type = "control";
181
- } else if (screenshot.is_compare === true) {
182
- diff_class = screenshot.diff_found === true ? " diff_found" : " no_diff_found";
183
- type = "compare";
184
- }
185
-
186
- var file_name = screenshot.image_file_name;
187
- var src;
188
- var icon_class;
189
- if (file_name !== null) {
190
- src = screenshot.displayable_image_path_full;
191
- icon_class = 'icon-picture' + diff_class;
192
- } else {
193
- icon_class = 'icon-';
194
- }
195
-
196
- var existing_selector = '.crawling .urls li a[data-href="'+screenshot.url+'"][data-type="' + type + '"]';
197
- var existing = $(existing_selector);
198
- if (existing.length === 0) {
199
- $('.crawling .urls').prepend('<li><a data-type="' + type + '" data-href="' + screenshot.url + '"><i></i><span>' + type + ' : ' + screenshot.url + '</span></a></li>');
200
- existing = $(existing_selector);
201
- }
202
- if (typeof existing.attr('data-alt') === 'undefined' && src !== null) {
203
- existing.find('i').attr('class', icon_class);
204
- existing.attr('data-alt', file_name);
205
- existing.attr('data-src', src);
206
- }
207
- },
208
-
209
- _add_crawl_image_with_src: function(params) {
210
- // don't replace the image with itself
211
- var existing_img = $('.crawling a.last_img img[src="'+params.src+'"]').length;
212
- if (existing_img > 0) return;
213
-
214
- if (params.is_compare) {
215
- if (params.diff_found === null || params.diff_found === false) {
216
- $('.crawling a.last_img .no_diff_found').show();
217
- $('.crawling a.last_img .diff_found').hide();
218
- $('.crawling a.last_img img').hide();
219
- } else {
220
- $('.crawling a.last_img .no_diff_found').hide();
221
- $('.crawling a.last_img .diff_found').show();
222
- $('.crawling a.last_img img').show();
223
- }
224
- } else {
225
- $('.crawling a.last_img .no_diff_found').hide();
226
- $('.crawling a.last_img .diff_found').hide();
227
- $('.crawling a.last_img img').show();
228
- }
229
- $('.crawling a.last_img').attr('href', params.src);
230
- $('.crawling a.last_img img').attr('alt', params.file_name);
231
- $('.crawling a.last_img img').attr('src', params.src);
232
-
233
- if (Screenshots._clicked_urls_row) return;
234
- $('.crawling .urls li').removeClass('active');
235
- $('.crawling .urls li a[data-href="'+params.crawl_url+'"]').parent('li').addClass('active');
236
- },
237
-
238
- _checkall_master_change: function() {
239
- $(".f_checkall_child").prop("checked", this.checked);
240
- Screenshots._disable_action_buttons();
241
- },
242
- _checkall_child_change: function() {
243
- $("#f_checkall").prop("checked", $(".f_checkall_child:checked").length == $(".f_checkall_child").length);
244
- Screenshots._disable_action_buttons();
245
- },
246
- _diffs_row_clicked: function(e) {
247
- if (e.target.type === 'checkbox') return;
248
- document.location = $(this).find('.diff_url').val();
249
- },
250
-
251
- _disable_action_buttons: function() {
252
- $(".f_actions button").attr("disabled", $(".f_checkall_child:checked").length === 0);
253
- },
254
- _ajax_with_type: function(url, type) {
255
- $.ajax({
256
- url: url,
257
- type: type,
258
- success: function() {
259
- location.reload();
260
- }
261
- });
262
- },
263
- _get_checked_ids: function() {
264
- var ids_array = [];
265
- $('.screenshots tbody tr').each(function() {
266
- var row = $(this);
267
- if (!row.find('td:first input[type=checkbox]:not(:checked)').length) {
268
- var diff_id = row.find('input.f_id').first().val();
269
- ids_array.push(diff_id);
270
- }
271
- });
272
- return ids_array.join(",");
273
- }
274
-
275
- };
276
- }
277
-
278
- $(function() {
279
- Screenshots._init();
280
- });
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- module UiChanged
2
- module ScreenshotIgnoreUrlsHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module UiChanged
2
- module ScreenshotsHelper
3
- end
4
- end