From da3795a2c2bee89f68a3edb57e6308ab3561d558 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 2 Oct 2016 22:49:45 -0400 Subject: [PATCH] new map improvements (#710) * prehighlight the text for editing when taken to a new map * style --- app/controllers/explore_controller.rb | 2 +- app/controllers/main_controller.rb | 11 +++++------ frontend/src/Metamaps/Map/InfoBox.js | 6 +++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/explore_controller.rb b/app/controllers/explore_controller.rb index 59045d5d..dc4c2de9 100644 --- a/app/controllers/explore_controller.rb +++ b/app/controllers/explore_controller.rb @@ -9,7 +9,7 @@ class ExploreController < ApplicationController # GET /explore/active def active - @maps = map_scope(Map) + @maps = map_scope(Map.where.not(name: 'Untitled Map')) respond_to do |format| format.html do diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 0ea9ba97..7df4e366 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -2,18 +2,17 @@ class MainController < ApplicationController before_action :authorize_main after_action :verify_authorized - after_action :verify_policy_scoped, only: [:home] # GET / def home respond_to do |format| format.html do - if !authenticated? - skip_policy_scope - render 'main/home' - else - @maps = policy_scope(Map).order(updated_at: :desc).page(1).per(20) + if authenticated? + @maps = policy_scope(Map).where.not(name: 'Untitled Map') + .order(updated_at: :desc).page(1).per(20) render 'explore/active' + else + render 'main/home' end end end diff --git a/frontend/src/Metamaps/Map/InfoBox.js b/frontend/src/Metamaps/Map/InfoBox.js index c36f70c3..ba95df4b 100644 --- a/frontend/src/Metamaps/Map/InfoBox.js +++ b/frontend/src/Metamaps/Map/InfoBox.js @@ -38,6 +38,9 @@ const InfoBox = { if (querystring == 'new') { self.open() $('.mapInfoBox').addClass('mapRequestTitle') + $('#mapInfoName').trigger('click') + $('#mapInfoName textarea').focus() + $('#mapInfoName textarea').select() } }, toggleBox: function (event) { @@ -139,7 +142,8 @@ const InfoBox = { // mobile menu $('#header_content').html(name) $('.mapInfoBox').removeClass('mapRequestTitle') - document.title = name + ' | Metamaps' + document.title = `${name} | Metamaps` + window.history.replaceState('', `${name} | Metamaps`, window.location.pathname) }) $('.mapInfoDesc .best_in_place_desc').unbind('ajax:success').bind('ajax:success', function () {