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
def active
@maps = map_scope(Map)
@maps = map_scope(Map.where.not(name: 'Untitled Map'))
respond_to do |format|
format.html do

View file

@ -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

View file

@ -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 () {