ui_changed 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/app/assets/javascripts/ui_changed/application.js +17 -0
  2. data/app/assets/javascripts/ui_changed/screenshots.js +280 -0
  3. data/app/assets/stylesheets/scaffold.css +56 -0
  4. data/app/assets/stylesheets/ui_changed/application.css.scss +17 -0
  5. data/app/assets/stylesheets/ui_changed/screenshot_ignore_urls.css +4 -0
  6. data/app/assets/stylesheets/ui_changed/screenshots.css +24 -0
  7. data/app/controllers/ui_changed/application_controller.rb +4 -0
  8. data/app/controllers/ui_changed/screenshot_ignore_urls_controller.rb +61 -0
  9. data/app/controllers/ui_changed/screenshots_controller.rb +266 -0
  10. data/app/controllers/ui_changed/screenshots_controller_base.rb +26 -0
  11. data/app/helpers/ui_changed/application_helper.rb +45 -0
  12. data/app/helpers/ui_changed/screenshot_ignore_urls_helper.rb +4 -0
  13. data/app/helpers/ui_changed/screenshots_helper.rb +4 -0
  14. data/app/mailers/ui_changed/notifications_mailer.rb +57 -0
  15. data/app/models/ui_changed/all_screenshot.rb +11 -0
  16. data/app/models/ui_changed/config_helper.rb +12 -0
  17. data/app/models/ui_changed/screenshot.rb +258 -0
  18. data/app/models/ui_changed/screenshot_ignore_url.rb +15 -0
  19. data/app/views/layouts/ui_changed/application.html.haml +15 -0
  20. data/app/views/ui_changed/screenshot_ignore_urls/index.haml +21 -0
  21. data/app/views/ui_changed/screenshots/_side_nav.haml +32 -0
  22. data/app/views/ui_changed/screenshots/_top_buttons.haml +36 -0
  23. data/app/views/ui_changed/screenshots/diff.haml +17 -0
  24. data/app/views/ui_changed/screenshots/diffs.haml +35 -0
  25. data/app/views/ui_changed/screenshots/index.haml +31 -0
  26. data/app/views/ui_changed/screenshots/screenshots.haml +30 -0
  27. data/app/workers/ui_changed/compare.rb +11 -0
  28. data/app/workers/ui_changed/crawl_control.rb +11 -0
  29. data/app/workers/ui_changed/crawl_test.rb +11 -0
  30. data/app/workers/ui_changed/worker_base.rb +206 -0
  31. data/config/initializers/load_config.rb +1 -0
  32. data/config/routes.rb +40 -0
  33. data/db/migrate/20130203000059_create_ui_changed_screenshots.rb +18 -0
  34. data/db/migrate/20130203001050_create_ui_changed_screenshot_ignore_urls.rb +9 -0
  35. data/lib/generators/ui_changed/resque_generator.rb +11 -0
  36. data/lib/generators/ui_changed/templates/resque.rb +7 -0
  37. data/lib/tasks/ui_changed_tasks.rake +42 -0
  38. data/lib/ui_changed/engine.rb +18 -0
  39. data/lib/ui_changed/railtie.rb +12 -0
  40. data/lib/ui_changed/version.rb +3 -0
  41. data/lib/ui_changed.rb +5 -0
  42. data/spec/dummy/README.rdoc +261 -0
  43. data/spec/dummy/Rakefile +7 -0
  44. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  45. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  46. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  47. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  49. data/spec/dummy/chromedriver.log +486 -0
  50. data/spec/dummy/config/application.rb +59 -0
  51. data/spec/dummy/config/boot.rb +10 -0
  52. data/spec/dummy/config/database.yml +20 -0
  53. data/spec/dummy/config/environment.rb +5 -0
  54. data/spec/dummy/config/environments/development.rb +37 -0
  55. data/spec/dummy/config/environments/production.rb +67 -0
  56. data/spec/dummy/config/environments/test.rb +37 -0
  57. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  58. data/spec/dummy/config/initializers/inflections.rb +15 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  60. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  61. data/spec/dummy/config/initializers/session_store.rb +8 -0
  62. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  63. data/spec/dummy/config/locales/en.yml +5 -0
  64. data/spec/dummy/config/routes.rb +4 -0
  65. data/spec/dummy/config/ui_changed.yml +25 -0
  66. data/spec/dummy/config.ru +4 -0
  67. data/spec/dummy/db/development.sqlite3 +0 -0
  68. data/spec/dummy/db/schema.rb +37 -0
  69. data/spec/dummy/log/development.log +28757 -0
  70. data/spec/dummy/log/test.log +47119 -0
  71. data/spec/dummy/public/404.html +26 -0
  72. data/spec/dummy/public/422.html +26 -0
  73. data/spec/dummy/public/500.html +25 -0
  74. data/spec/dummy/public/favicon.ico +0 -0
  75. data/spec/dummy/script/rails +6 -0
  76. data/spec/dummy/tmp/cache/assets/C25/650/sprockets%2F2146cc379ac52d93283881b087238840 +0 -0
  77. data/spec/dummy/tmp/cache/assets/C88/A00/sprockets%2F1576563f31b9463de3b98380b65316ec +0 -0
  78. data/spec/dummy/tmp/cache/assets/C9B/6B0/sprockets%2F14ad16343013da7f4c5807074f60da43 +0 -0
  79. data/spec/dummy/tmp/cache/assets/CB1/9B0/sprockets%2F11e63881c7fd93eb64b28b031752f184 +0 -0
  80. data/spec/dummy/tmp/cache/assets/CB6/C00/sprockets%2Fb3476726ad470583738cd4b345f805fa +0 -0
  81. data/spec/dummy/tmp/cache/assets/CB7/210/sprockets%2F138a8a31cd8188425abf378b7580856b +0 -0
  82. data/spec/dummy/tmp/cache/assets/CC0/7C0/sprockets%2Fdb1c954004648bf1999b7ef93c470907 +0 -0
  83. data/spec/dummy/tmp/cache/assets/CC1/7E0/sprockets%2F552f5b296379701887bf62b61e1eef55 +0 -0
  84. data/spec/dummy/tmp/cache/assets/CC2/E90/sprockets%2F5ca8fbc29937906ce87a35703a588175 +0 -0
  85. data/spec/dummy/tmp/cache/assets/CCE/6B0/sprockets%2F3c43115c074131cc27dff45ad1436d39 +0 -0
  86. data/spec/dummy/tmp/cache/assets/CE1/C50/sprockets%2Fb8c09b0556e29fb12b443f9491758ba1 +0 -0
  87. data/spec/dummy/tmp/cache/assets/CE2/4F0/sprockets%2F6cf98982c6e31026cd1b25b10d91d955 +0 -0
  88. data/spec/dummy/tmp/cache/assets/CE2/C60/sprockets%2F05ee6fb6374ce346eb036fa585800159 +0 -0
  89. data/spec/dummy/tmp/cache/assets/CE4/590/sprockets%2F3f8762728eca1e27313d667a68da61d2 +0 -0
  90. data/spec/dummy/tmp/cache/assets/CE7/120/sprockets%2F91db081288bd6181c67f7f600d8ac179 +0 -0
  91. data/spec/dummy/tmp/cache/assets/CE9/6D0/sprockets%2F8eeb2f4e707f4444d25caf8597182412 +0 -0
  92. data/spec/dummy/tmp/cache/assets/CF1/2F0/sprockets%2F84b5d275d61e77e4c8e971305e71b4d9 +0 -0
  93. data/spec/dummy/tmp/cache/assets/CF5/010/sprockets%2Ff9d2179a39f51f93bc6f88003845d72f +0 -0
  94. data/spec/dummy/tmp/cache/assets/D05/6A0/sprockets%2F8d3a80f374b4052fa19d7903c0615dda +0 -0
  95. data/spec/dummy/tmp/cache/assets/D06/890/sprockets%2F078f78e2e12080050f3bc2eab77b24d8 +0 -0
  96. data/spec/dummy/tmp/cache/assets/D0E/710/sprockets%2F98ad5b57d4c0b614b15d44e16c20988c +0 -0
  97. data/spec/dummy/tmp/cache/assets/D18/E30/sprockets%2F373b25f3feb8e02173177a3258fa9f8f +0 -0
  98. data/spec/dummy/tmp/cache/assets/D1B/200/sprockets%2Feb488fd44186315924274c9fbddf26c1 +0 -0
  99. data/spec/dummy/tmp/cache/assets/D2B/650/sprockets%2F17e0bd2471845003ab1d326b9df4fb2d +0 -0
  100. data/spec/dummy/tmp/cache/assets/D33/A80/sprockets%2Fe0e3c435fb1e0437fd54f6118152dbd4 +0 -0
  101. data/spec/dummy/tmp/cache/assets/D51/3D0/sprockets%2F0b8889dd27a294e91ac45d88f45ab19e +0 -0
  102. data/spec/dummy/tmp/cache/assets/D52/FC0/sprockets%2Fc7ee307174bd9ce8d84a7a714989de50 +0 -0
  103. data/spec/dummy/tmp/cache/assets/D57/590/sprockets%2Fa5889cfed7da6867603309e46febf336 +0 -0
  104. data/spec/dummy/tmp/cache/assets/D62/A70/sprockets%2F9da26ba4665f1bd1946b15f4fb7c00a2 +0 -0
  105. data/spec/dummy/tmp/cache/assets/D64/280/sprockets%2F41468fda40a48db35907717ec1cae4aa +0 -0
  106. data/spec/dummy/tmp/cache/assets/D65/BE0/sprockets%2Facc8f0cfb7c0b17255efd15087505b18 +0 -0
  107. data/spec/dummy/tmp/cache/assets/D6C/9E0/sprockets%2F8168f977dd050ba2afddd02af6139c71 +0 -0
  108. data/spec/dummy/tmp/cache/assets/D70/3A0/sprockets%2Fe4a9a1e8cb76dfec37b1f404f8519240 +0 -0
  109. data/spec/dummy/tmp/cache/assets/D74/BE0/sprockets%2Fd7aee2b6e1730859c0e0467f1d7cce93 +0 -0
  110. data/spec/dummy/tmp/cache/assets/D78/BC0/sprockets%2F207af09f77a5d6abe8dc1e03949835fc +0 -0
  111. data/spec/dummy/tmp/cache/assets/D84/D90/sprockets%2Fb8af3475f4baf9fd7b6a7c46c7451868 +0 -0
  112. data/spec/dummy/tmp/cache/assets/D8B/A20/sprockets%2F3ed551887fcdca6e97a755b75f945c6d +0 -0
  113. data/spec/dummy/tmp/cache/assets/D8E/0D0/sprockets%2F8742e2ef2bd56a3d1d0bb872b3cc217a +0 -0
  114. data/spec/dummy/tmp/cache/assets/D9F/BC0/sprockets%2F2f95d2d7024aadccb97622d868ec4db2 +0 -0
  115. data/spec/dummy/tmp/cache/assets/D9F/DC0/sprockets%2F37e94b5bc0f9440b90d05da4e4feee63 +0 -0
  116. data/spec/dummy/tmp/cache/assets/DB5/B70/sprockets%2F9b6928fa917be6edb53695facf9037db +0 -0
  117. data/spec/dummy/tmp/cache/assets/DC6/940/sprockets%2Facd26daf8801a48cf5d6b0d441da38d6 +0 -0
  118. data/spec/dummy/tmp/cache/assets/DED/010/sprockets%2F63ff0e07c5aa4b10d7defd921c0cf41d +0 -0
  119. data/spec/dummy/tmp/cache/assets/DFB/070/sprockets%2F827a36ec30d2db41fb4174a9c3dfeffe +0 -0
  120. data/spec/dummy/tmp/cache/assets/DFD/DD0/sprockets%2F20e429deffdda56940cc5c6cab9d73a3 +0 -0
  121. data/spec/dummy/tmp/cache/assets/E89/3E0/sprockets%2Fea640cb8bbbf5cfa9435ddeebd7b42a8 +0 -0
  122. data/spec/dummy/tmp/cache/sass/2d87c55fb19cbf8c06f79a1d11d9921f7ccdf621/bootstrap-responsive.scssc +0 -0
  123. data/spec/dummy/tmp/cache/sass/2d87c55fb19cbf8c06f79a1d11d9921f7ccdf621/bootstrap.scssc +0 -0
  124. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_accordion.scssc +0 -0
  125. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_alerts.scssc +0 -0
  126. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_breadcrumbs.scssc +0 -0
  127. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_button-groups.scssc +0 -0
  128. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_buttons.scssc +0 -0
  129. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_carousel.scssc +0 -0
  130. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_close.scssc +0 -0
  131. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_code.scssc +0 -0
  132. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_component-animations.scssc +0 -0
  133. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_dropdowns.scssc +0 -0
  134. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_forms.scssc +0 -0
  135. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_grid.scssc +0 -0
  136. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_hero-unit.scssc +0 -0
  137. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_labels-badges.scssc +0 -0
  138. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_layouts.scssc +0 -0
  139. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_media.scssc +0 -0
  140. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_mixins.scssc +0 -0
  141. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_modals.scssc +0 -0
  142. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_navbar.scssc +0 -0
  143. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_navs.scssc +0 -0
  144. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_pager.scssc +0 -0
  145. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_pagination.scssc +0 -0
  146. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_popovers.scssc +0 -0
  147. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_progress-bars.scssc +0 -0
  148. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_reset.scssc +0 -0
  149. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-1200px-min.scssc +0 -0
  150. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-767px-max.scssc +0 -0
  151. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-768px-979px.scssc +0 -0
  152. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-navbar.scssc +0 -0
  153. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-utilities.scssc +0 -0
  154. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_scaffolding.scssc +0 -0
  155. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_sprites.scssc +0 -0
  156. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_tables.scssc +0 -0
  157. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_thumbnails.scssc +0 -0
  158. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_tooltip.scssc +0 -0
  159. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_type.scssc +0 -0
  160. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_utilities.scssc +0 -0
  161. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_variables.scssc +0 -0
  162. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_wells.scssc +0 -0
  163. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/bootstrap.scssc +0 -0
  164. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/responsive.scssc +0 -0
  165. data/spec/dummy/tmp/cache/sass/94c49ca37a72afd14b662ec7a424412bc283c3cf/application.css.scssc +0 -0
  166. data/spec/dummy/tmp/cache/sass/a83afe1449c73975e2fd619cb5f810eada3c2894/_font-awesome.sassc +0 -0
  167. data/spec/models/screenshot_actions_spec.rb +126 -0
  168. data/spec/models/screenshots_ignore_url_spec.rb +24 -0
  169. data/spec/models/screenshots_spec.rb +144 -0
  170. data/spec/routing/screenshots_spec.rb +71 -0
  171. data/spec/spec_helper.rb +66 -0
  172. data/spec/support/factories/screenshot.rb +14 -0
  173. data/spec/support/factories/screenshot_ignore_url.rb +5 -0
  174. data/spec/test_screenshots/control/image_1.png +0 -0
  175. data/spec/test_screenshots/control/image_1_small.png +0 -0
  176. data/spec/test_screenshots/control/image_2.png +0 -0
  177. data/spec/test_screenshots/control/image_2_small.png +0 -0
  178. data/spec/test_screenshots/control/image_3.png +0 -0
  179. data/spec/test_screenshots/control/image_3_small.png +0 -0
  180. data/spec/test_screenshots/control/image_4.png +0 -0
  181. data/spec/test_screenshots/control/image_4_small.png +0 -0
  182. data/spec/test_screenshots/control/image_5.png +0 -0
  183. data/spec/test_screenshots/control/image_5_small.png +0 -0
  184. data/spec/test_screenshots/test/image_10.png +0 -0
  185. data/spec/test_screenshots/test/image_10_small.png +0 -0
  186. data/spec/test_screenshots/test/image_6.png +0 -0
  187. data/spec/test_screenshots/test/image_6_small.png +0 -0
  188. data/spec/test_screenshots/test/image_7.png +0 -0
  189. data/spec/test_screenshots/test/image_7_small.png +0 -0
  190. data/spec/test_screenshots/test/image_8.png +0 -0
  191. data/spec/test_screenshots/test/image_8_small.png +0 -0
  192. data/spec/test_screenshots/test/image_9.png +0 -0
  193. data/spec/test_screenshots/test/image_9_small.png +0 -0
  194. metadata +610 -0
@@ -0,0 +1,17 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap
16
+ //= require ui_changed/screenshots
17
+ //= require_tree .
@@ -0,0 +1,280 @@
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
+ });
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+
15
+ @import "bootstrap";
16
+ @import "bootstrap-responsive";
17
+ @import "font-awesome";
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,24 @@
1
+ body {margin-top: 40px;}
2
+
3
+ .btn-toolbar form, .btn-toolbar form input, .btn-toolbar form button, .btn-toolbar form div {margin-bottom: 0;}
4
+
5
+ .well {background-color: #FFF;}
6
+
7
+ .crawl_btns .running {border: 3px solid red;}
8
+
9
+ .diff_screenshots img, table.screenshots tbody tr td img {border: 1px solid #ccc; padding: 2px;}
10
+ .diff_screenshots img:hover, table.screenshots tbody tr td img:hover {border: 1px solid #000;}
11
+ .diffs tbody tr {cursor: pointer;}
12
+ .diffs tbody tr td input:hover {cursor: default;}
13
+
14
+ .crawling {margin-top: 5px;}
15
+ .crawling .urls {overflow: scroll;}
16
+ .crawling .last_img, .crawling .urls {float: left; width: 300px; height: 300px; padding: 7px; border: 1px solid #bbb; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; margin: 3px;}
17
+ .crawling .urls li {text-align: left; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; padding: 2px 5px;}
18
+ .crawling .urls li.active {background-color: #ddd;}
19
+ .crawling .urls li:hover {cursor: pointer; background-color: #efefef;}
20
+ .crawling .urls li a i.diff_found {color: red;}
21
+ .crawling .urls li a span {margin-left: 3px;}
22
+ .crawling .last_img {overflow: hidden;}
23
+ .crawling .last_img .no_diff_found, .crawling .last_img .diff_found {text-align: center;}
24
+ .crawling .last_img .no_diff_found .icon {font-size: 280px;}
@@ -0,0 +1,4 @@
1
+ module UiChanged
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,61 @@
1
+ require_dependency "ui_changed/application_controller"
2
+
3
+ module UiChanged
4
+ class ScreenshotIgnoreUrlsController < ScreenshotsControllerBase
5
+
6
+ def index
7
+ params[:sort] ||= "url asc"
8
+ @ignored_urls = UiChanged::ScreenshotIgnoreUrl.search(params[:search]).paginate(:page => params[:page],
9
+ :per_page => params[:per_page],
10
+ :order => params[:sort])
11
+ end
12
+
13
+ def add
14
+ ids = params[:id].split(",")
15
+ ids.each do |id|
16
+ ss = UiChanged::Screenshot.find(id)
17
+ ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(ss.url)
18
+ ss_ignore.save
19
+ end
20
+ head :ok
21
+ end
22
+
23
+ def add_all_controls
24
+ screenshots = UiChanged::Screenshot.not_in_ignored.where(:is_control => true)
25
+ screenshots.each do |screenshot|
26
+ ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(screenshot.url)
27
+ ss_ignore.save
28
+ end
29
+ head :ok
30
+ end
31
+ def add_all_tests
32
+ screenshots = UiChanged::Screenshot.not_in_ignored.where(:is_test => true)
33
+ screenshots.each do |screenshot|
34
+ ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(screenshot.url)
35
+ ss_ignore.save
36
+ end
37
+ head :ok
38
+ end
39
+ def add_all_compares
40
+ UiChanged::Screenshot.not_in_ignored.where(:is_compare => true).each do |screenshot|
41
+ ss_ignore = UiChanged::ScreenshotIgnoreUrl.find_or_create_by_url(screenshot.url)
42
+ ss_ignore.save
43
+ end
44
+ head :ok
45
+ end
46
+
47
+ def destroy
48
+ ids = params[:id].split(",")
49
+ ids.each do |id|
50
+ ss_ignore = UiChanged::ScreenshotIgnoreUrl.find(id)
51
+ ss_ignore.destroy
52
+ end
53
+ head :ok
54
+ end
55
+ def destroy_all
56
+ UiChanged::ScreenshotIgnoreUrl.delete_all
57
+ head :ok
58
+ end
59
+ end
60
+
61
+ end