Exemple:Rails contenu global_for
J'ai 2 _map.haml partielle et _bigmap.haml.
:: _map.haml
- content_for :map do
%script{:type => "text/javascript", :src => "http://maps.google.com/maps/api/js?sensor=true"}
...
:: _bigmap.haml
- content_for :bigmap do
%script{:type => "text/javascript", :src => "http://maps.google.com/maps/api/js?sensor=true"}
...
Dans ma mise en page j'inclure javascripts dans
= yield(:map)
= yield(:bigmap)
QUESTION 1: Cela signifie bibliothèque Google sera inclus deux fois. Comment puis-je gérer cela afin que la bibliothèque soit toujours chargée une seule fois? A pensait à voir heler peut-être?
QUESTION 2: Est-il possible d'avoir un champ content_for global où chaque partie ajoute son contenu? Thx.