Thanks Germain, I rather like your solution. I think that's a better
approach as it is more dynamic.
James Wennmacher - Unicon
480.558.2420
On 04/29/2014 11:45 PM, Germain Souquet wrote:
> Hi James,
>
> We worked a few on Bootstrap while developping portlets on uPortal
> using both Universality and Respondr. We also faced the same issue as
> you.
> If you include twice the JavaScript it will break. We fixed the
> solution in an other way than you did.
>
> Instead of including your JavaScript this way :
> *
> **<script
> src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"><\/script>
>
> *We wrote this little snippet :
>
> *<script type="text/javascript">**
> ** $().carousel || document.write('<script
> src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"><\/script>')**
> **</script>**
>
> **$().carousel* is a bootstrap component which will be equals to
> *[object Object]* if bootstrap.js is already imported and will be
> equals to *undefined* .
> In JavaScript and in a boolean expression *[object Object]* will be
> *true* and *undefined* will be *false*.
>
> It doesn't solve the double CSS importation but I wanted to share it
> with you to know what you think about it ?
>
> Thanks,
> Germain
>
> Le 30/04/2014 03:35, James Wennmacher a ?crit :
>> FYI. I wrote up https://issues.jasig.org/browse/UP-4077 proposing
>> adding a new portlet preference ' usePortalBootstrap' that similar to
>> the 'usePortalJSLibs' portlet preference is used by Bootstrap-enabled
>> portlets to determine whether to include Bootstrap Javascript and a
>> name-spaced Bootstrap CSS in the portlet, or rely on the portal to
>> have already imported both Bootstrap and Bootstrap CSS. I'm also
>> adding into 4.1.0 Universality including the Bootstrap Javascript and
>> name-spaced Bootstrap CSS.
>>
>> The motivation for this is that you cannot have 2 imports of
>> Bootstrap Javascript on a page since it is not name-spaced and does
>> not play well with itself, whether included on the portal and in the
>> portlet, or by two portlets on the page. At minimum it causes the
>> Options drop-down to not work for any portlet on the page.
>>
>> I propose best practice is the default of this portlet preference be
>> set to true so including the portlet into a uPortal 4.1 system
>> (Universality or Respondr) will just work. As a bonus it is slightly
>> more efficient. If a bootstrap-enabled portlet is included into an
>> earlier uPortal the portlet itself may have issues until you set the
>> portlet preference 'usePortalBootstrap' to true in the portlet
>> publishing process, or modify the portal to include Bootstrap and
>> name-spaced Bootstrap CSS. Best practice is for portlets to be
>> designed to display well in both Universality and Respondr, or at
>> least well in Respondr and adequately in Universality, though this
>> may not always be the case and the portlet may require Bootstrap
>> Javascript to function properly.
>>
>> As a related note (and I'm told documentation will be forthcoming),
>> the name-spaced Bootstrap CSS that will be included in 4.1.0
>> Universality (and Bootstrap-enabled portlets) requires the portlet
>> have a container element with a class 'bootstrap-styles' to pick up
>> the bootstrap styling in Universality within the portlet. The class
>> insures the name-spaced Bootstrap CSS will not impact other portlets
>> on the page that are not designed for Bootstrap. Of course sites may
>> need to add CSS overrides to match their color theme for these
>> particular Bootstrap-enabled portlets in pre-4.1 Universality.
>>
>> If there are concerns with this approach, a need for more discussion,
>> or better solutions, please let me know!
>> --
>> James Wennmacher - Unicon
>> 480.558.2420
>> You are currently subscribed [email protected]
>> as:[email protected]
>>
>> To unsubscribe, change settings or access archives, see
>> http://www.ja-sig.org/wiki/display/JSG/portlet-dev
>>
>
> --
> Germain Souquet
> Direction du Syst?me d'Information
> Universit? de La Rochelle
> http://dsi.univ-lr.fr
> http://www.univ-larochelle.fr
> You are currently subscribed to [email protected] as:
> [email protected]
>
> To unsubscribe, change settings or access archives, see
> http://www.ja-sig.org/wiki/display/JSG/portlet-dev
>
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/uportal-dev