These are chat archives for jescalan/roots

4th
Jul 2015
Henry Snopek
@hhsnopek
Jul 04 2015 00:32
@t0t
index = ->
  console.log 'index'

contacto = ->
  console.log 'contacto'

productos = ->
  console.log 'productos'

empresa = ->
  console.log 'empresa'

notFound = ->
  console.log 'notFound'

# app-wide routing
page '/', index
page '/contacto', contacto
page '/productos', productos
page '/empresa', empresa
page '*', notFound
page()
you were missing empresa() and you need to define your functions first
Daniel Box
@dbox
Jul 04 2015 13:47
So just re-read through a bunch of messages again. Has anyone successfully gotten Roots + Lost grid (post css) to play nicely together? If so would you mind posting a sample repo I could look at?
Daniel Box
@dbox
Jul 04 2015 13:52
Sergio Forés
@t0t
Jul 04 2015 21:13
@hhsnopek yes! Thanks ;)
Henry Snopek
@hhsnopek
Jul 04 2015 21:17
no problem!
Sergio Forés
@t0t
Jul 04 2015 21:31
@hhsnopek I'm a dummy with development but I would love to be able to load the static html files through page.js functions. I have not found any tutorial on that. Could you give me some idea?
productos = ->
  $( ".main-content" ).load( "productos.html" )
Henry Snopek
@hhsnopek
Jul 04 2015 21:33
I wouldn't use page.js in that fashion, I'd move to a different framework - you might wanna use Marionette
or if you're trying to stay static without an MVC just use relative URL's to your static pages from roots
Sergio Forés
@t0t
Jul 04 2015 21:43
@hhsnopek hmmm... I've used MVC with Angular in other projects but I'm not developer and feel more comfortable focusing only css+roots+html and a bit of JS for interaction and routing. Single page webs are the future but by now seems is not SEO friendly... I'll take a look to Marionette. tks :+1:
Henry Snopek
@hhsnopek
Jul 04 2015 21:46
yeah, what you're trying to do looks like it should be used with an MVC
otherwise I would just make everything static without using routing, and just using a tags to navigate
Sergio Forés
@t0t
Jul 04 2015 22:55
yes, I really feel more freedom with jade+stylus. How would you add a simple .active class to a menu item? I'm learning Jade and Roots but dont find a way to acomplish that in this context... https://github.com/t0t/maderlim/blob/page/views/_partials/_nav.jade
I did with simple JS to add a class on clickbut when the target loads the menu is reset... :(
Henry Snopek
@hhsnopek
Jul 04 2015 23:04
add a function to parse the url when the page loads, then add the active class to the menu
Sergio Forés
@t0t
Jul 04 2015 23:20
@hhsnopek it sould be something like this
# Active current menu item
$('.nav-main__menu a').each ->
  if $(this).attr('href') == window.location.pathname
    $(this).parent().addClass('active')
  return
but class .active is not being applied to the menu item. Do u see what is missing? thanks again...
Henry Snopek
@hhsnopek
Jul 04 2015 23:28
Pathname isn't gonna match you're href unless your href has the full url