Hi Sergio,
Some time ago I went about and created my Pier site into a bootstrap site. I used the css
loaded from Pier-Bootstrap. I think this is better, since there are versions, and you
don’t want your site suddenly to disfunction, just because there was an update of
bootstrap. But that is me. It should be just as easy to create one that uses the css that
comes from a different source. This is the recipe I used:
First we need to load Pier, and since I also want to export my code, I used the following
code:
Gofer new
smalltalkhubUser: 'Pier'
project: 'Pier3Addons';
configurationOf: 'Pier3AddOns';
load.
((Smalltalk at: #ConfigurationOfPier3AddOns) project version: #'development')
load: #( 'Pier-Exporter-Code' 'Pier-Bootstrap' ).
This gives us a clean Pier-site, that we can modify for our use. Since we need bootstrap
loaded, we first need to register pier, using bootstrap, and of course start the web
server:
PRKernel reset.
PRPierFrame registerAsBootstrapApplication: ’somename' kernel: (PRKernel named:
'pier').
ZnZincServerAdaptor startOn: 8088
Our template is quite simple: in our site we have a navbar, a main page and a footer. But
before we can change our template, we have to make sure that we can still edit, after
changing everything. This is how I would do it, if I needed to do it again.
We start by modifying the template. We add the stuff we are going to need in the
beginning. Since the footer will be sticky, we want some room at the bottom anyways, so
this will work fine.
+Navbar+
+MainPage+
+footer+
Now we start by adding the main page, just by clicking on main page. The main page has an
alternative look, when we are logged in, because I do not want the pier navigation shown
when we are logged out. This is a new component in Pier. I set it up with default
(+contents+) and an alternate:
{{{<div class="jumbotron">
<div class="container">}}}
!!!Ingelogd
{{{</div></div>}}}
+contents+
+Sidebar+
Now remember to select the main page, because otherwise everything will be added to the
template. Now login and modify the contents and the sidebar. The contents and sidebar, are
the “normal” contents and sidebar, displaying the contents and the navigation (Children
(dynamic)). Change the navigation and set the level to 1 and recursive to true. This will
give us better navigation.
Next step will be to edit the footer. Select the footer and click edit and fill out the
following:
{{{<div id="footer">
<div class="navbar navbar-default navbar-fixed-bottom"
role="navigation">
<div class="container-fluid">}}}
+Collapse+
{{{</div></div></div>}}}
And then the collapse looks like this:
{{{<button type="button" class="navbar-toggle"
data-toggle=“.fcollapse" data-target=".footer-collapse">
<span class="se-only">Toggle footer</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>}}}
{{{<div class="footer-collapse fcollapse">}}}
+Menu+
+Commands+
{{{</div>}}}
As you can see, there is still quite a lot of bootstrap code in our pier content, but
after we have set up our site, we do not need to bother with this any more. The menu is a
component, that displays some static Children. I added here the possibility to add some
css class. Fill out:
list class = nav navbar-nav navbar-right)
active class = active.
It needs to point to the node where you add the children you want displayed in your
footer. we leave this to default for now.
Now we change our navbar. This looks a lot like our footer.
{{{<div class="navbar navbar-inverse navbar-fixed-top"
role="navigation">
<div class=“container">}}}
+Title+
+Collapse+
{{{</div></div>}}}
With the collapse:
{{{<div class="navbar-collapse collapse">}}}
+Menu+
{{{</div>}}}
And the title
{{{<div class=“navbar-header”>
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target=".navbar-collapse">
<span class="se-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>}}}
{{{<a class="navbar-brand" href="/">}}}Your
site{{{</a></div>}}}
The menu is the same as in the footer. It is a static children component with the list
class set to "nav navbar-nav navbar-right” and the active class set to “active”, and
pointing to the place where we have our content.
We can now remove the unneeded things from our template and modify it into:
+Navbar+
+MainPage+
+footer+
you also need to modify your css, and deploy it as a bootstrap site (adding the bootstrap
libraries). This is the css I added:
.pier-login {
margin-top: 60px;
}
Finally, for our pages, we still have the jumbotron to add, so here is some bootstrap code
as well:
{{{<div class="jumbotron">
<div class="container">}}}
+Heading+
{{{</div></div>}}}
{{{<div class="container"><div class="row">
<div class="col-md-4">}}}+Netwerk+{{{</div>
<div class="col-md-4">}}}+Kwaliteit+{{{</div>
<div class="col-md-4">}}}+Agile+{{{</div>
</div></div>}}}
Note that for our static children you can only select nodes, that have children. You
probably want to create them in a separate place, then add 1 child, and then go back to
the menu to point it to the right place.
So this is still quite the manual, so maybe we should make some bootstrap specific
components. But then I do not know what components we exactly need, so please let me know
if you have ideas for this, or have better ways to do this.
As you can see, there are a few new components and options (static children, css options,
altdoc page) we added, but basically this is it. If you have any trouble or suggestions
for improvements, let me know.
Cheers,
Diego
_________
On 24 Jul 2014, at 14:25, sergio_101 <sergio.rrd(a)gmail.com> wrote:
how would i go about adding twitter bootstrap to my
pier site? i see that there are a great deal of packages and other things out there that
look like they are working on this project, but i would like to do something much lighter
weight.
i would like to just include the approprate JS and CSS files directly from CDN.
the same would apply for something like jquery datatables, etc.
any ideas?
thanks!
--
----
peace,
sergio
photographer, journalist, visionary
#BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki