From 58bc692d6552e6ed9b742cbeb30e3e654ab693b6 Mon Sep 17 00:00:00 2001 From: sashadev-sky Date: Thu, 25 Jul 2019 07:41:26 -0400 Subject: [PATCH 1/5] h --- app/assets/javascripts/application.js | 1 + app/assets/stylesheets/application.scss | 2 ++ app/views/maps/index.html.erb | 3 --- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 72f372210..d95b2d626 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -22,6 +22,7 @@ //= require leaflet-providers/leaflet-providers.js //= require leaflet-toolbar/dist/leaflet.toolbar.js //= require leaflet-distortableimage/dist/leaflet.distortableimage.js +//= require leaflet-environmental-layers/dist/LeafletEnvironmentalLayers.js //= require leaflet-easybutton/src/easy-button.js //= require sparklines/source/sparkline.js //= require annotations-legacy.js diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 55fa8d78c..25bb6f016 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -6,10 +6,12 @@ $icon-font-path: "bootstrap-sass/assets/fonts/bootstrap/"; @import "annotations"; @import "sidebar.css"; @import "bootstrap/dist/css/bootstrap.min.css"; +@import "leaflet/dist/leaflet.css"; @import "leaflet-draw/dist/leaflet.draw.css"; @import "leaflet-illustrate/dist/Leaflet.Illustrate.css"; @import "leaflet-toolbar/dist/leaflet.toolbar.css"; @import "leaflet-distortableimage/dist/leaflet.distortableimage.css"; +@import "leaflet-environmental-layers/dist/LeafletEnvironmentalLayers.css"; @import "@fortawesome/fontawesome-free/css/all.css"; // /* // * This is a manifest file that'll be compiled into application.css, which will include all the files diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb index 283a468be..76c5b12a9 100644 --- a/app/views/maps/index.html.erb +++ b/app/views/maps/index.html.erb @@ -1,6 +1,3 @@ -<%= stylesheet_link_tag "/lib/leaflet/dist/leaflet.css" %> -<%= stylesheet_link_tag "/lib/leaflet-environmental-layers/dist/LeafletEnvironmentalLayers.css" %> -<%= javascript_include_tag('/lib/leaflet-environmental-layers/dist/LeafletEnvironmentalLayers.js') %> <%= javascript_include_tag('/lib/leaflet-environmental-layers/dist/windRoseLayer.js') %> <%= javascript_include_tag('/lib/leaflet-fullhash/leaflet-fullHash.js') %> <%= javascript_include_tag('https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js') %> From 8dcff6a162f140d8d7e4026c80aa314c3efc38d4 Mon Sep 17 00:00:00 2001 From: sashadev-sky Date: Thu, 25 Jul 2019 07:41:26 -0400 Subject: [PATCH 2/5] h From 596f1504b7b21316b9a269546849bb399fd687d1 Mon Sep 17 00:00:00 2001 From: sashadev-sky Date: Tue, 10 Sep 2019 17:48:53 -0400 Subject: [PATCH 3/5] updates --- Gemfile | 2 + Gemfile.lock | 3 +- .../javascripts/mapknitter/core/Class.js | 77 ------------------- app/views/maps/show.html.erb | 2 +- test/controllers/front_ui_controller_test.rb | 9 --- test/controllers/maps_controller_test.rb | 2 +- test/system/images_test.rb | 4 +- 7 files changed, 7 insertions(+), 92 deletions(-) delete mode 100644 app/assets/javascripts/mapknitter/core/Class.js diff --git a/Gemfile b/Gemfile index bc983cd82..5556a32cc 100644 --- a/Gemfile +++ b/Gemfile @@ -66,6 +66,8 @@ end group :development, :test do gem 'capybara' + # see https://github.com/SeleniumHQ/selenium/issues/5248 + # gem 'webdrivers' gem 'selenium-webdriver' gem 'byebug', '~> 11.0.1', platforms: [:mri, :mingw, :x64_mingw] gem 'faker', '~> 2.2.1' diff --git a/Gemfile.lock b/Gemfile.lock index 0c6fb0510..51e98cab8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -339,8 +339,7 @@ DEPENDENCIES byebug (~> 11.0.1) capybara codecov - foreman (~> 0.85.0) - faker (~> 2.1.2) + faker (~> 2.2.1) friendly_id geokit-rails (= 1.1.4) httparty diff --git a/app/assets/javascripts/mapknitter/core/Class.js b/app/assets/javascripts/mapknitter/core/Class.js deleted file mode 100644 index bede701eb..000000000 --- a/app/assets/javascripts/mapknitter/core/Class.js +++ /dev/null @@ -1,77 +0,0 @@ -var MapKnitter = {}; - -/* - * MapKnitter.Class: A bare-bones version of Leaflet's Class feature, - * for simple classical inheritance. - * See https://github.com/Leaflet/Leaflet/blob/master/src/core/Class.js. - */ - -MapKnitter.Class = function() {}; -MapKnitter.Class.extend = function(obj) { - var NewClass = function() { - if (this.initialize) { - this.initialize.apply(this, arguments); - } - - // call all constructor hooks - this.callInitHooks(); - }; - - var F = function() {}; - F.prototype = this.prototype; - - var proto = new F(); - proto.constructor = NewClass; - - NewClass.prototype = proto; - - for (var i in this) { - if (this.hasOwnProperty(i) && i !== 'prototype') { - NewClass[i] = this[i]; - } - } - - L.extend(proto, obj); - - var parent = this; - NewClass.__super__ = parent.prototype; - - proto._initHooks = []; - - // add method for calling all hooks - proto.callInitHooks = function () { - - if (this._initHooksCalled) { return; } - - if (parent.callInitHooks) { - parent.callInitHooks.call(this); - } - - this._initHooksCalled = true; - - for (var i = 0, len = proto._initHooks.length; i < len; i++) { - proto._initHooks[i].call(this); - } - }; - - return NewClass; -}; - - -MapKnitter.Class.include = function(obj) { - L.extend(this.prototype, obj); -}; - -// @function addInitHook(fn: Function): this -// Adds a [constructor hook](#class-constructor-hooks) to the class. -MapKnitter.Class.addInitHook = function (fn) { // (Function) || (String, args...) - var args = Array.prototype.slice.call(arguments, 1); - - var init = typeof fn === 'function' ? fn : function () { - this[fn].apply(this, args); - }; - - this.prototype._initHooks = this.prototype._initHooks || []; - this.prototype._initHooks.push(init); - return this; -}; \ No newline at end of file diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 4e5a9952e..87880914f 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -17,7 +17,7 @@
- + diff --git a/test/controllers/front_ui_controller_test.rb b/test/controllers/front_ui_controller_test.rb index b2c3fdd78..ddb40b16b 100644 --- a/test/controllers/front_ui_controller_test.rb +++ b/test/controllers/front_ui_controller_test.rb @@ -45,13 +45,4 @@ def teardown assert !@maps.collect(&:name).include?('Saugus Landfill Incinerator') assert @maps.collect(&:name).include?('Cubbon Park') end - - test 'view map page' do - map = maps(:saugus) - get :view_map, id: map.slug - - assert_response :success - assert assigns(:maps) - assert_template 'front_ui/view_map' - end end diff --git a/test/controllers/maps_controller_test.rb b/test/controllers/maps_controller_test.rb index 92ab5074c..91faf1154 100644 --- a/test/controllers/maps_controller_test.rb +++ b/test/controllers/maps_controller_test.rb @@ -313,7 +313,7 @@ def export_anonmymous_map end test 'show' do - get :show, id: @map.slug + get :show, params: { id: @map.slug} assert_response :success assert assigns(:maps) diff --git a/test/system/images_test.rb b/test/system/images_test.rb index 31ec24fcd..aa71627d8 100644 --- a/test/system/images_test.rb +++ b/test/system/images_test.rb @@ -26,8 +26,8 @@ def setup #log in page.set_rack_session(user_id: @user.id) - visit "/maps/#{@map.slug}" - click_link('Images') + visit "/maps/#{@map.slug}/edit" + click_on 'Images' #expect layers to not have an ldi instance before placing assert !page.evaluate_script(check_if_image_placed) From 5b1f88289a7b3df0fab88d0555bc004dcc0b013e Mon Sep 17 00:00:00 2001 From: sashadev-sky Date: Tue, 10 Sep 2019 19:14:21 -0400 Subject: [PATCH 4/5] use task to update schema --- db/schema.rb.example | 2 +- lib/tasks/schema_copy.rake | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 lib/tasks/schema_copy.rake diff --git a/db/schema.rb.example b/db/schema.rb.example index f87a6c45e..ef9559207 100644 --- a/db/schema.rb.example +++ b/db/schema.rb.example @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_07_15_092943) do +ActiveRecord::Schema.define(version: 2019_09_09_224739) do create_table "annotations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "map_id" diff --git a/lib/tasks/schema_copy.rake b/lib/tasks/schema_copy.rake new file mode 100644 index 000000000..d25a097ed --- /dev/null +++ b/lib/tasks/schema_copy.rake @@ -0,0 +1,8 @@ +desc "Make a copy of the schema.rb" + +task :copy_schema do + file_name = "./db/schema.rb" + copy_file_name = "./db/schema.rb.example" + schema = File.read(file_name) + File.write(copy_file_name, schema) +end \ No newline at end of file From 26cbb2a2586fbd66a310f9eb5eae2cb936b0c771 Mon Sep 17 00:00:00 2001 From: sashadev-sky Date: Wed, 11 Sep 2019 08:01:09 -0400 Subject: [PATCH 5/5] add new line t end of file --- lib/tasks/schema_copy.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/schema_copy.rake b/lib/tasks/schema_copy.rake index d25a097ed..c74a71188 100644 --- a/lib/tasks/schema_copy.rake +++ b/lib/tasks/schema_copy.rake @@ -5,4 +5,4 @@ task :copy_schema do copy_file_name = "./db/schema.rb.example" schema = File.read(file_name) File.write(copy_file_name, schema) -end \ No newline at end of file +end