In order to be able to theme the location input form, I've created a little patch that
1. gives me a css-handle to style the location-fields
2. let's me overwrite the theming with a phptemplate theming function

Just look at the current output, then apply the patch and add the following 2 css-lines to your theme and tell me what you think

.location-input .container-inline { clear: left; }
.location-input .container-inline label { display: block; float: left; width: 120px; }

Comments?

Comments

ray007’s picture

There anything wrong with this patch?
Or did I miss something about theming location input fields without this patch?

ray007’s picture

*Bump*

Shall I close this issue and keep the patch in my private branch, or is somebody else interested in this too?

lias’s picture

I think this is a good thing. One question, does this also work with contemplate so that location can be customized there?

ray007’s picture

Contemplate is for formatting data to view, while this little patch provides the means to better format the location input form.

So, formatting location data with contemplate isn't influenced in any way by this patch.

I'd really appreciate a word from the maintainer if this can go in or if I should change something ...

ray007’s picture

I see you have checked something in to have theming for location input.
I've had problems with long descriptions breaking the layout because they didn't wrap so I'd suggest to add a line like the following to the location.css file:

form .location tr .form-item { white-space: normal; }

I also think it would be a good idea to bring the map for selecting coordinates over the whole width instead of only the right column.

ray007’s picture

StatusFileSize
new1.58 KB

Attached patch gives the gmap some more room and top-aligns the field-titles.

smitty’s picture

Thanks to ray007 for this patch and the css-snippet.
I think, this is very important for the usability with flexible themes on small displays.
Please add it to the next version!

Some additional remarks:

  • The suggested css snippet also caused a linebreak in the first column. To avoid this, I enhanced the css to:
    form .location tr td .form-item { white-space: normal; }
    form .location tr td .form-item label { white-space: nowrap; } 


  • When I added the css snippet to the location.css I found that the location.css in not yet included in the location.module
  • The help-text of the lat/long fields is placed in the right column of the table under the long-field. Because it belongs to both fields I would prefer to have it above these two fields with the whole width instead of only the right column. Could anybody tell me, how I can change this?
sebs’s picture

To include location.css in the list of css files loaded with a given page:

Modify file: modules/location.inc
Function: location_form
Add at line #317:

drupal_add_css(drupal_get_path('module', 'location') .'/location.css');

cheers,
sebs

pkej’s picture

This works very well, I applied #6, #7, #8 and suddenly things looks much nicer, and the map can be bigger.

This should be put into the next release.

chriszz’s picture

Version: 5.x-1.x-dev » 5.x-2.7

It works with 2.7, as i just found out.

But still - there are two fieldsets, which looks silly

pkej’s picture

I guess, but I've never tried this, that the outer fieldset is supposed to contain all the location points when there are more than one added for a node. I personally only use 1 for any node, so I agree that it looks silly with two fieldsets.

There should be some logic in the code which would get rid of the outer fieldset if only one location is used in the node.

smitty’s picture

Please have a look at: http://drupal.org/node/160443

smitty’s picture

Well, I used the suggested changes of this thread for a while. But I got problems with several themes because the Location Table seems to be bigger than my content area (at least using this Default location map macro: [gmap|id=locmap |center=51,9 |zoom=5 |width=100% |height=400px |tcontrol=on]): In Garland the table hides the right column and in YAML a part of the table disappears behind the right column.

Besides that, it is a table! And tables are not recommended by drupal UI guideline.

So I suggest to throw out this table (by applying the patch of http://drupal.org/node/213989) and come back to the first patch in this thread, provided by ray007 in #1.

Only the css seems not to work any more in the meantime.

So I used this css:

.location-input .form-item input { 
  display: block; 
  float: left; 
  width: 342px; 
  margin-bottom: 5px
}

.location-input .form-item label { 
  display: block; 
  float: left; 
  text-align: left; 
  width: 100px; 
  padding-right: 10px
}

.location-input .form-item {
  clear:both;
}
smitty’s picture

I found the solution for the table in the right width: http://drupal.org/node/165434#comment-699756

Adding the following line to the CSS file does the fix:

form .locations .description { white-space: normal; }
dgtlmoon’s picture

doing #6, #7, #8 also cleaned it up massively for me

bdragon’s picture

Status: Needs review » Closed (duplicate)

Marking as duplicate of http://drupal.org/node/231419. Please followup there.