Coder Social home page Coder Social logo

Comments (10)

Matt-Jensen avatar Matt-Jensen commented on June 1, 2024 1

Hard to beat the simple approach:

{{#if active}}
  {{#bs-modal}}
  ...
  {{/bs-modal}}
{{/if}}

from ember-cli-g-maps.

Matt-Jensen avatar Matt-Jensen commented on June 1, 2024

Do you think you could show me some code or an example of the issue?

from ember-cli-g-maps.

cmonzon44 avatar cmonzon44 commented on June 1, 2024

yes, when i open the route, the modal display.

<div class="modal fade" id="modelo-show" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" {{action 'back'}}>
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">{{fa-icon 'street-view'}} Information</h4>
            </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="row">
                                <div class="col-xs-12">
                                    Place
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-12">
                                    <p>Some text in the modal.</p>
                                    {{g-maps name="mi-mapa" lat=model.latitud lng=model.longitud zoom=17 draggable=false markers=model.marks }}


                                </div>
                            </div>
                        </div>
                    </div>
                </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-danger" data-dismiss="modal" {{action 'back'}}>
                {{fa-icon 'times'}} Close
            </button>
          </div>
        </div>
    </div>
</div>

or in other case, i put a modal bootstrap structure in a single route which activate when click on button and inside the modal i put map and it doesn't appear

from ember-cli-g-maps.

Matt-Jensen avatar Matt-Jensen commented on June 1, 2024

I'm not experiencing this issue
bitmap
Have you set a hight for your map in your css file?

from ember-cli-g-maps.

jfbaquerocelis avatar jfbaquerocelis commented on June 1, 2024

Hi @Matt-Jensen, I would like re-open this issue. I've a similar problem with ember-cli-g-maps and the bootstrap-modals.

I have a trigger modal button

{{#bs-button onClick=(action (mut modalPolyline) true)}}
  {{fa-icon 'map-o'}} Generar Polil铆nea
{{/bs-button}}

and its modal:

{{#bs-modal open=modalPolyline onSubmit=(action "setPoints") onHidden=(action (mut modalPolyline) false) as |modal|}}
  {{#modal.header}}
    <h4 class="modal-title">Polil铆nea</h4>
  {{/modal.header}}
  {{#modal.body}}
    {{g-maps name="my-map" lat=lat lng=lng zoom=zoom}}
  {{/modal.body}}
  {{#modal.footer}}
    {{#bs-button onClick=(action modal.close)}}Cancelar{{/bs-button}}
    {{#bs-button type="success" onClick=(action modal.submit)}}Generar{{/bs-button}}
  {{/modal.footer}}
{{/bs-modal}}

But, When I click the button, the map doesn't appear. I used the devTool to find the problem and I saw:
image

The properties width and height are equals to zero. My styles are like:

.ember-cli-g-map {
 width: auto;
 height: 300px;
}

Something is changing these properties and appending width: 0; height: 0;. I'm using ember-bootstrap. Thanks 馃憤 馃槃

Note: The map works! But inside the modal doesn't work.

from ember-cli-g-maps.

Matt-Jensen avatar Matt-Jensen commented on June 1, 2024

When is the map actually rendered? When the modal is activated or when the general template renders?

I ask because if the map is rendered when it is not visible, I think google maps will set the height to 0px. If that is the case you will likely just need to ensure the modals' contents does not get rendered until the modal is activated.

from ember-cli-g-maps.

jfbaquerocelis avatar jfbaquerocelis commented on June 1, 2024

The map rendered when the template renders. I'm trying to render the map when the modal is active. But I don't know how to do it.

This is the template:

templates/components/trips/trip-form.hbs

{{#bs-form class="row" model=model onSubmit=(action "save") as |form|}}
  <div class="col-xs-5">
    {{form.element controlType="text" label="Nombre" placeholder="e.g. Pradera - UPB" property="name" required=true}}
    {{form.element controlType="number" label="Orientaci贸n" placeholder="Orientaci贸n" property="orientation" required=true}}
    {{form.element controlType="number" label="Trayecto" placeholder="Trayecto" property="way" required=true}}
  </div>

  <!-- This is the trigger modal button -->
  <div class="col-xs-7">
    {{#bs-button onClick=(action (mut modalPolyline) true)}}
      {{fa-icon 'map-o'}} Generar Polil铆nea
    {{/bs-button}}
  </div>
<!-- This is the trigger modal button -->

  <div class="col-xs-12">
    {{#bs-button type="primary" buttonType="submit"}}
      {{fa-icon ico}} {{title}}
    {{/bs-button}}
    {{#bs-button type="danger" onClick=(action "cancel")}}
      {{fa-icon "close"}} Cancelar
    {{/bs-button}}
  </div>
{{/bs-form}}

{{#bs-modal open=modalPolyline onSubmit=(action "setPoints") onHidden=(action (mut modalPolyline) false) as |modal|}}
  {{#modal.header}}
    <h4 class="modal-title">Polil铆nea</h4>
  {{/modal.header}}
  {{#modal.body}}
    {{g-maps
      name="my-map"
      lat=lat
      lng=lng
      zoom=zoom
      selections=selections
      selectionsModes=myModes
      selectionsPolyline="onPolylineSelect"
      polylines=polylines
      showMapTypeControl=false
      showZoomControl=false
      disableDoubleClickZoom=true}}
  {{/modal.body}}
  {{#modal.footer}}
    {{#bs-button onClick=(action modal.close)}}Cancelar{{/bs-button}}
    {{#bs-button type="success" onClick=(action modal.submit)}}Generar{{/bs-button}}
  {{/modal.footer}}
{{/bs-modal}}

from ember-cli-g-maps.

jfbaquerocelis avatar jfbaquerocelis commented on June 1, 2024

It isn't works 馃槶

{{#bs-form class="row" model=model onSubmit=(action "save") as |form|}}
  <div class="col-xs-5">
    {{form.element controlType="text" label="Nombre" placeholder="e.g. Pradera - UPB" property="name" required=true}}
    {{form.element controlType="number" label="Orientaci贸n" placeholder="Orientaci贸n" property="orientation" required=true}}
    {{form.element controlType="number" label="Trayecto" placeholder="Trayecto" property="way" required=true}}
  </div>

  <!-- This is the trigger modal button -->
  <div class="col-xs-7">
    {{#bs-button onClick=(action (mut modalPolyline) true)}}
      {{fa-icon 'map-o'}} Generar Polil铆nea
    {{/bs-button}}
  </div>
<!-- This is the trigger modal button -->

  <div class="col-xs-12">
    {{#bs-button type="primary" buttonType="submit"}}
      {{fa-icon ico}} {{title}}
    {{/bs-button}}
    {{#bs-button type="danger" onClick=(action "cancel")}}
      {{fa-icon "close"}} Cancelar
    {{/bs-button}}
  </div>
{{/bs-form}}

{{#if modalPolyline}}
{{#bs-modal open=modalPolyline onSubmit=(action "setPoints") onHidden=(action (mut modalPolyline) false) as |modal|}}
  {{#modal.header}}
    <h4 class="modal-title">Polil铆nea</h4>
  {{/modal.header}}
  {{#modal.body}}
    {{g-maps
      name="my-map"
      lat=lat
      lng=lng
      zoom=zoom
      selections=selections
      selectionsModes=myModes
      selectionsPolyline="onPolylineSelect"
      polylines=polylines
      showMapTypeControl=false
      showZoomControl=false
      disableDoubleClickZoom=true}}
  {{/modal.body}}
  {{#modal.footer}}
    {{#bs-button onClick=(action modal.close)}}Cancelar{{/bs-button}}
    {{#bs-button type="success" onClick=(action modal.submit)}}Generar{{/bs-button}}
  {{/modal.footer}}
{{/bs-modal}}
{{/if}}

from ember-cli-g-maps.

Matt-Jensen avatar Matt-Jensen commented on June 1, 2024

@jfbaquerocelis I've gotten this to work as per my comment on: May 11, 2016.

I'm sorry you're having trouble, however looking at code samples in comments isn't really helping my understanding. Please try simplying your code or giving me access to code I can help debug.

from ember-cli-g-maps.

jfbaquerocelis avatar jfbaquerocelis commented on June 1, 2024

@Matt-Jensen It's works! The bootstrap modal has an onShown event, I created a bool variable and I active the map when it's true

from ember-cli-g-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.