Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing usage documentation #28

Open
craigs100 opened this issue Nov 3, 2020 · 16 comments
Open

Missing usage documentation #28

craigs100 opened this issue Nov 3, 2020 · 16 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested

Comments

@craigs100
Copy link

It would be very helpful if you could give an example of how you get the map data out of the datatype in a view. The instructions just tell you how to install it, not how to use it.

var map = Model.Value("map") doesn't seem to work. (Umb 8.9.0) so I'm now stuck.

Also could you either add a link to the test site mentioned or remove the credentials if it doesn't exist?

Thanks.

@ronaldbarendse
Copy link
Collaborator

@craigs100 Thanks for your feedback, this is indeed something that can be improved (documentation/readme PRs are welcome) 👍

This editor works just like all other 'complex' editors: it returns a model/class containing the map data. Using var map = Model.Value("map") will get this data from the property with alias map, although it's returned as an object (which is rather useless without manually casting it to the right type). If you use Model.Value<GmapsModel>("map") or Model.Map (if you're using Models Builder), the correct type will be returned and you can get the address/map config values.

Also could you either add a link to the test site mentioned or remove the credentials if it doesn't exist?

The test site is included in the source code, so you need to clone the repository and run the site locally.

@ronaldbarendse ronaldbarendse added documentation Improvements or additions to documentation question Further information is requested labels Nov 3, 2020
@craigs100
Copy link
Author

Thanks for the clarification on the test site address. Maybe I'm getting null on the Model.Value("map") because it's not saving properly. I have another issue in for in for that #29.
Thanks.

@ronaldbarendse ronaldbarendse added the good first issue Good for newcomers label Nov 18, 2020
@hfloyd
Copy link
Collaborator

hfloyd commented May 5, 2022

A question - The Readme doc mentions that config for the API key, etc. should be set in Web.config/appsettings.json, but when you create the DataType via the back-office, there are fields there for API key, etc. Is this so that you can created multiple Map DataTypes with different config? If you have it set on the DataType, does it then negate the need for text-file config updates, or...?

@robertjf
Copy link
Collaborator

robertjf commented May 5, 2022

@hfloyd the setting in the prevalues for the DataType is more for backwards compatibility, but you should be able use this instead of the appsettings.json/web.config, yes.

@hfloyd
Copy link
Collaborator

hfloyd commented May 5, 2022

So, if you leave the fields blank on the data type, it will just use the config file, then?

@robertjf
Copy link
Collaborator

robertjf commented May 5, 2022

@hfloyd correct :)

@hfloyd
Copy link
Collaborator

hfloyd commented May 6, 2022

Is it possible to contribute to the "Wiki" tab, somehow?

Suggested Documentation topics:

Installing & Configuring (NuGet, Web.config/AppSettings, DataType setup)
Accessing & Working with Map Data (Model structure, code examples)
Rendering & Styling Maps on the front-end (Usage in a View file)

Troubleshooting
"This page can't load Google Maps correctly." (https://developers.google.com/maps/documentation/javascript/error-messages)

@robertjf
Copy link
Collaborator

robertjf commented May 6, 2022

@hfloyd hm. That's a question for @ArnoldV I think...

@robertjf
Copy link
Collaborator

robertjf commented May 6, 2022

@hfloyd I've created a couple of placeholder pages based on your suggestions - can you do an experiment and see if you can submit edits?

@hfloyd
Copy link
Collaborator

hfloyd commented May 6, 2022

Hi @robertjf I was able to Clone the wiki without issues:

image

But there is no Fork option.

I made some local changes, but I am not able to push them

[03:59 PM] Push: Authentication using OAuth failed
remote: Permission to ArnoldV/Our.Umbraco.GMaps.wiki.git denied to hfloyd.

Another option which would allow forks/PRs is to use a Docs folder and GitHub pages
image
image

@ArnoldV
Copy link
Owner

ArnoldV commented May 6, 2022

@hfloyd you should have access now

@hfloyd
Copy link
Collaborator

hfloyd commented May 6, 2022

@ArnoldV Yes, thanks. Pushing to the WIKI repo now works.
If you'd like broader contributions, you might consider the GitHub Pages implementation instead...

@samgooch
Copy link

samgooch commented Jul 1, 2022

Is there no longer a method to render the actual Google map to a page?

@craigs100
Copy link
Author

Is there no longer a method to render the actual Google map to a page?

It's just a bit of javascript. No different to any other implementation of a Google map. Here's my implementation if it helps...

<h4>Map</h4>
<div id="map-canvas" style="width:100%;height:300px"></div>

<script>
    var map;
    var property = '@Model.Name';

    @{
      var homeCoords = Model.GoogleMap.Address.Coordinates.Latitude.ToString() + ',' + Model.GoogleMap.Address.Coordinates.Longitude.ToString();
      var zoom = Model.GoogleMap.MapConfig.Zoom;
    }

    function initMap() {
      var home = new google.maps.LatLng(@homeCoords);
      var map = new google.maps.Map(document.getElementById('map-canvas'), {
        zoom: @zoom,
        center: home,
    mapTypeId: google.maps.MapTypeId.ROADMAP
      });
      var marker = new google.maps.Marker({
        position: home,
        map: map
      });
    }

  </script>
  <script async defer src="https://maps.googleapis.com/maps/api/js?key=@(Model.GoogleMap.MapConfig.ApiKey)&callback=initMap"></script>

@samgooch
Copy link

samgooch commented Jul 4, 2022 via email

@pdao1
Copy link

pdao1 commented Oct 27, 2022

Hi,

I've tried using Model.Value("propertyAlias") but getting type or namespace could not be found

Umbraco 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants