new map improvements (#710)

* prehighlight the text for editing when taken to a new map

* style
This commit is contained in:
Connor Turland 2016-10-02 22:49:45 -04:00 committed by GitHub
parent 6d2efefbbc
commit da3795a2c2
3 changed files with 11 additions and 8 deletions

View file

@ -9,7 +9,7 @@ class ExploreController < ApplicationController
# GET /explore/active # GET /explore/active
def active def active
@maps = map_scope(Map) @maps = map_scope(Map.where.not(name: 'Untitled Map'))
respond_to do |format| respond_to do |format|
format.html do format.html do

View file

@ -2,18 +2,17 @@
class MainController < ApplicationController class MainController < ApplicationController
before_action :authorize_main before_action :authorize_main
after_action :verify_authorized after_action :verify_authorized
after_action :verify_policy_scoped, only: [:home]
# GET / # GET /
def home def home
respond_to do |format| respond_to do |format|
format.html do format.html do
if !authenticated? if authenticated?
skip_policy_scope @maps = policy_scope(Map).where.not(name: 'Untitled Map')
render 'main/home' .order(updated_at: :desc).page(1).per(20)
else
@maps = policy_scope(Map).order(updated_at: :desc).page(1).per(20)
render 'explore/active' render 'explore/active'
else
render 'main/home'
end end
end end
end end

View file

@ -38,6 +38,9 @@ const InfoBox = {
if (querystring == 'new') { if (querystring == 'new') {
self.open() self.open()
$('.mapInfoBox').addClass('mapRequestTitle') $('.mapInfoBox').addClass('mapRequestTitle')
$('#mapInfoName').trigger('click')
$('#mapInfoName textarea').focus()
$('#mapInfoName textarea').select()
} }
}, },
toggleBox: function (event) { toggleBox: function (event) {
@ -139,7 +142,8 @@ const InfoBox = {
// mobile menu // mobile menu
$('#header_content').html(name) $('#header_content').html(name)
$('.mapInfoBox').removeClass('mapRequestTitle') $('.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 () { $('.mapInfoDesc .best_in_place_desc').unbind('ajax:success').bind('ajax:success', function () {