cyberhobo / wordpress-geo-mashup

Official repository for Geo Mashup, the plugin that makes WordPress into a GeoCMS. Documentation:
https://github.com/cyberhobo/wordpress-geo-mashup/wiki/Getting-Started
63 stars 15 forks source link

Remove tables - Responsive #766

Open StaggerLeee opened 7 years ago

StaggerLeee commented 7 years ago

Is it possible to do something about it ? Tables makes it impossible to style it better for smaller devices.

(If whole philosophy would change somehow it would be possible to use Metabox right-sidebar in backend. For now it is absolutely impossible, regarding how it looks. Maybe something like Mappress, 2 columns, not tables, 30% left columns for all values. Display block to be able to style them same way for phones. Right column 70% with map. Media queries for responsive and width of two columns changes accordinly.)

If you dont have time for it can you make file edit-form.php possible to override in theme folder: geo-mashup-edit-form.php ?

We can try to style it by ourself. Some things I changed not to touch plugin core files. More cannot be done for now.

I already did change location-editor.css to be overirden:

add_action( 'admin_enqueue_scripts', 'remove_default_stylesheet', 100  );
function remove_default_stylesheet() {
    wp_dequeue_style( 'geo-mashup-edit-form' );
    wp_deregister_style( 'geo-mashup-edit-form' );

    wp_register_style( 'new-style', get_stylesheet_directory_uri() . '/location-editor.css', false, '1.0.0' ); 
    wp_enqueue_style( 'new-style' );
}

Here is another snippet for custom default coordinates and default zoom:

function geo_mashup_editor_map() {
  echo '<script type="text/javascript">
  (function($) {

$(function () {
    /* Specify the initial location/zoom level for the location editor map */
geo_mashup_location_editor.mapCreated.addHandler( function() {
      geo_mashup_location_editor.map.setCenterAndZoom( new mxn.LatLonPoint( 48.2206636,16.3100207 ), 16 );
} );
})

})(jQuery);
  </script>';
}
add_action( 'admin_head', 'geo_mashup_editor_map' );
StaggerLeee commented 7 years ago

I styled it somehow and had plans to share new location-editor.css, but there is no point. Tables make it long from finished. And will never be possible to finish it.

Image of Yaktocat Image of Yaktocat

StaggerLeee commented 7 years ago

Small correction for snippet above. Better to use this one and limit snippet to post/page edit screens. It gives errors and problem in Geo Mashup Options screen.

function geo_mashup_editor_map() {
if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') ) {
  echo '<script type="text/javascript">
  (function($) {
$(function () {
    /* Specify the initial location/zoom level for the location editor map */
geo_mashup_location_editor.mapCreated.addHandler( function() {
      geo_mashup_location_editor.map.setCenterAndZoom( new mxn.LatLonPoint( 48.2206636,16.3100207 ), 16 );
} );
})
})(jQuery);
  </script>';
}
}
add_action( 'admin_head', 'geo_mashup_editor_map' );
cyberhobo commented 7 years ago

You should be able use the customization plugin to center the map.

I'd be happy to consider replacing the table HTML & CSS. A pull request would be the best way to come up with a good working alternative.

A bigger effort would be to just create a new and better location editor. Feel free to add ideas to that wiki page.

StaggerLeee commented 7 years ago

Can you borrow some ideas from guy behind ACF plugin ? All his Metaboxes are without tables, even Google Map field.