Giter VIP home page Giter VIP logo

Comments (12)

brutasse avatar brutasse commented on August 16, 2024

That'd be interesting to have indeed. I'll have a look but I think django's media system does a bit of magic wrt media handling. You could try subclassing the Base* widgets and set their Media.js attributes but I'm not sure it'll completely override the original widget's media files.

That said, I don't think you can host the google maps API yourself. With OpenLayers it's not an issue but I can imagine it'd break the google maps terms of service or something.

I haven't tried django-compressor with that stuff, the idea of the CDN versions is that you have a better chance of getting the library from the browser cache. Less data transfer but one more connection to make, the best way to know would be to try and measure :)

from django-floppyforms.

galuszkak avatar galuszkak commented on August 16, 2024

There is an issue with using OpenLayer.js on remote hosting.

If you are using ssl (https) chrome will block javascript without https (so for example OpenLayer.js are blocked and OpenStreetMaps). I think we should embed OpenLayers into floppyforms. I will send pull request to resolve that issue.

Also for Google and OSM we should have ability to choose scripts with or without https.

ssl_issue_floppyforms

from django-floppyforms.

gregmuellegger avatar gregmuellegger commented on August 16, 2024

@galuszkak Did you already do anything on the described efforts? After 10 months you propably lost interest or solved the problem differently, but maybe you can let us know how you did :)

Cheers!

from django-floppyforms.

galuszkak avatar galuszkak commented on August 16, 2024

@gregmuellegger I resolved this somehow, please give me 5-10 min I will find how I did it.

from django-floppyforms.

galuszkak avatar galuszkak commented on August 16, 2024

@gregmuellegger Ok I have it. I've created a widget with own Media. and embeded OpenLayers.js locally in static folder. If they can be added to floppyforms that still will be benefit for people using ssl because they won't be struggling with this bug :). If you have any more question please feel free to ask.

class PointWidget(floppyforms.gis.PointWidget, floppyforms.gis.BaseOsmWidget):
    template_name = 'my_template/osm.html'
    map_srid = 900913

    def get_context_data(self):
        ctx = super(PointWidget, self).get_context_data()
        ctx.update({
            'center_point_lat': str(self.center_point_lat).replace(',', '.'),
            'center_point_long': str(self.center_point_long).replace(',', '.'),
            'admin': self.admin,
        })
        return ctx

    class Media:
        extend = False
        js = ('js/openlayers/OpenLayers.js',
              'https://www.openstreetmap.org/openlayers/OpenStreetMap.js',
              'floppyforms/js/MapWidget.js')

from django-floppyforms.

gregmuellegger avatar gregmuellegger commented on August 16, 2024

Thanks for taking the time to reply that quickly! I will try to incorporate that at some point into floppyforms.

from django-floppyforms.

galuszkak avatar galuszkak commented on August 16, 2024

Good Job @gregmuellegger 👍

from django-floppyforms.

gregmuellegger avatar gregmuellegger commented on August 16, 2024

Took a few years but finally it for good ;)
Am 17.02.2015 00:31 schrieb "Kamil Gałuszka" [email protected]:

Good Job @gregmuellegger https://github.com/gregmuellegger [image: 👍]


Reply to this email directly or view it on GitHub
#15 (comment)
.

from django-floppyforms.

gregmuellegger avatar gregmuellegger commented on August 16, 2024

django-floppyforms 1.4.0 is now available on PyPI which includes these changes. Thanks for the help!
https://pypi.python.org/pypi/django-floppyforms/

from django-floppyforms.

mikeedwards avatar mikeedwards commented on August 16, 2024

Hi! It looks like some of the OpenLayers static files didn't make it to PyPi. For example the theme/default/ directory is missing.

from django-floppyforms.

gregmuellegger avatar gregmuellegger commented on August 16, 2024

@mikeedwards Doh! You are absolutely right. I added them to the source distribution now and released 1.4.1 which includes these. Thanks for letting me know.

from django-floppyforms.

mikeedwards avatar mikeedwards commented on August 16, 2024

Awesome! Thank you for fixing that so quickly--totally made my morning!

from django-floppyforms.

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.