librelist archives

« back to archive

Custom Theme Creation Issues

Custom Theme Creation Issues

From:
torrancew
Date:
2012-03-21 @ 00:56
Hi all,

New nesta user here. I was trying my hand at a custom nesta theme ala
"clean" by rwdaigle, but I seem to have hit a stumbling block.

As yet, my theme is mostly blank. The app.rb has most of the meat, in
which I am using the Rack::Codehighlighter middleware. This part seems to
work fine - I can see the highlight classes being added to the markup that
nesta is generating. My next step was adding a layout.haml file, but here
is where things go wrong. The CSS I loaded didn't take effect, and after
attempting to customize the layout.haml by insterting random markup here
and there, I can see that my layout isn't being applied at all. Any advice?
I feel that I've hit something pretty simple or common. For the record, I
can make this work by customizing a view, I just want to try to get it into
a self-contained template.

Thanks,
-- 
torrancew

Re: [nesta] Custom Theme Creation Issues

From:
Graham Ashton
Date:
2012-03-21 @ 13:20
On 21 Mar 2012, at 00:56, torrancew wrote:

> As yet, my theme is mostly blank.

That's given me an idea.

> My next step was adding a layout.haml file, but here is where things go wrong.

Have you also added your own page.haml template? You'll need to. Nesta's 
docs include this innocent looking sentence:

"If the template you’re redefining is rendered with a layout (i.e. it’s a 
top level template such as page.haml) then Sinatra will expect to find the
layout in the same directory as the template itself."

It's on http://nestacms.com/docs/design/editing-default-templates

Any suggestions on how to make this more obvious/apparent would be welcome.

If that doesn't explain it, we'll need access to your theme as Chad 
suggests to be able to spot what's wrong (it's always worth doing that 
when mailing the list if you can).

Re: [nesta] Custom Theme Creation Issues

From:
torrancew
Date:
2012-03-21 @ 16:20
This did the trick. Apparently my theme was loading the default page.haml
and as a result, the default layout.

What are your thoughts on having 'nesta theme:create <foo>' either:
  a) Copy the default layout and page templates to the new theme directory
  b) Copy very basic stub layout and templates to the new theme directory

I think either of those would make it a bit more clear to the new user how
to proceed, and make the custom themes about as easy to jump into as Nesta
itself.

Thanks, all!
-- 
torrancew

On Wed, Mar 21, 2012 at 01:20:21PM +0000, Graham Ashton wrote:
> On 21 Mar 2012, at 00:56, torrancew wrote:
> 
> > As yet, my theme is mostly blank.
> 
> That's given me an idea.
> 
> > My next step was adding a layout.haml file, but here is where things go wrong.
> 
> Have you also added your own page.haml template? You'll need to. Nesta's
docs include this innocent looking sentence:
> 
> "If the template you’re redefining is rendered with a layout (i.e. it’s 
a top level template such as page.haml) then Sinatra will expect to find 
the layout in the same directory as the template itself."
> 
> It's on http://nestacms.com/docs/design/editing-default-templates
> 
> Any suggestions on how to make this more obvious/apparent would be welcome.
> 
> If that doesn't explain it, we'll need access to your theme as Chad 
suggests to be able to spot what's wrong (it's always worth doing that 
when mailing the list if you can).

Re: [nesta] Custom Theme Creation Issues

From:
Graham Ashton
Date:
2012-03-21 @ 16:23
On 21 Mar 2012, at 16:20, torrancew wrote:

> What are your thoughts on having 'nesta theme:create <foo>' either:
>  a) Copy the default layout and page templates to the new theme directory

I suspect there's too much cruft in the defaults.

>  b) Copy very basic stub layout and templates to the new theme directory

Good idea; that'd be great. Anybody fancy submitting a pull request with 
some very basic HTML5 and .sass format files to get themes started?

--
Graham Ashton
Founder, The Agile Planner
http://theagileplanner.com | @agileplanner | @grahamashton


Re: [nesta] Custom Theme Creation Issues

From:
Jake Subs
Date:
2012-03-22 @ 16:50
On 21 March 2012 16:23, Graham Ashton <graham@effectif.com> wrote:
>>  b) Copy very basic stub layout and templates to the new theme directory
>
> Good idea; that'd be great. Anybody fancy submitting a pull request with
some very basic HTML5 and .sass format files to get themes started?

Would love to. Haven't really used Git very much, so not 100% sure
what to do, or even really what one would want in way of templates.

I'll have a poke around!

-- 
[~] Jake Rayson
[w] www.jrayson.co.uk
[e] subs@growdigital.org
[t] @growdigital

Re: [nesta] Custom Theme Creation Issues

From:
Graham Ashton
Date:
2012-03-22 @ 19:57
On 22 Mar 2012, at 16:50, Jake Subs wrote:

> Would love to. Haven't really used Git very much, so not 100% sure
> what to do, or even really what one would want in way of templates.

I think we need three template files; layout.haml, page.haml and 
master.sass. They need the most minimal valid content that we deem 
necessary (so master.sass would probably be empty, maybe with a comment).

page.haml would just render the @page object (you can see how that happens
in the default page.haml file), and layout.haml should probably be valid 
HTML5 with the bare minimum required to insert the contents of page.haml 
into the body tag.

Then we need to update the `nesta theme:create` command so that it drops 
these template files in when a new theme is created. That bit will need 
some unit tests for the Create class in commands.rb. There's plenty of 
similar stuff going on in commands.rb already. [1]

Do as much or as little as you fancy, and send me a pull request...

[1] https://github.com/gma/nesta/blob/master/lib/nesta/commands.rb

Re: [nesta] Custom Theme Creation Issues

From:
Jake Subs
Date:
2012-03-24 @ 11:19
On 22 March 2012 19:57, Graham Ashton <graham@effectif.com> wrote:
> I think we need three template files; layout.haml, page.haml and master.sass.

Will get on the case next week.

cheers, Jake

-- 
[~] Jake Rayson
[w] www.jrayson.co.uk
[e] subs@growdigital.org
[t] @growdigital

Re: [nesta] Custom Theme Creation Issues

From:
Jake Subs
Date:
2012-03-27 @ 10:44
> On 22 March 2012 19:57, Graham Ashton <graham@effectif.com> wrote:
>> I think we need three template files; layout.haml, page.haml and master.sass.

I've some barebones template files, just about to commit them but
don't know where they need to go?

nesta/templates/themes ?

Really is time I learnt me some Ruby...

-- 
[~] Jake Rayson
[w] www.jrayson.co.uk
[e] subs@growdigital.org
[t] @growdigital

Re: [nesta] Custom Theme Creation Issues

From:
Graham Ashton
Date:
2012-03-27 @ 10:50
On 27 Mar 2012, at 11:44, Jake Subs wrote:

> I've some barebones template files, just about to commit them but
> don't know where they need to go?
> 
> nesta/templates/themes ?

Nice one. Make a subfolder in templates/themes called views, and bung them
in there. Then the templates/themes folder can mimic the layout of a new 
theme.

Graham

Re: [nesta] Custom Theme Creation Issues

From:
Jake Subs
Date:
2012-03-27 @ 11:03
On 27 March 2012 11:50, Graham Ashton <graham@effectif.com> wrote:
> Nice one. Make a subfolder in templates/themes called views, and bung 
them in there. Then the templates/themes folder can mimic the layout of a 
new theme.

My first ever pull request. It's all a bit Hello World.

Not sure about the rendering of the page object, sure you can work it out!

cheers, Jake

-- 
[~] Jake Rayson
[w] www.jrayson.co.uk
[e] subs@growdigital.org
[t] @growdigital

Re: [nesta] Custom Theme Creation Issues

From:
Jake Subs
Date:
2012-03-29 @ 15:20
On 27 March 2012 12:03, Jake Subs <subs@growdigital.org> wrote:
>> Nice one. Make a subfolder in templates/themes called views, and bung 
them in there. Then the templates/themes folder can mimic the layout of a 
new theme.
>
> My first ever pull request. It's all a bit Hello World.

Hope the files were okay, let me know if any changes need making.

Also, is the mailing list best place to discuss github stuff, or github? Or IRC?

cheers, Jake

-- 
[~] Jake Rayson
[w] www.jrayson.co.uk
[e] subs@growdigital.org
[t] @growdigital

Re: [nesta] Custom Theme Creation Issues

From:
Graham Ashton
Date:
2012-03-29 @ 16:18
On 29 Mar 2012, at 16:20, Jake Subs wrote:

> Hope the files were okay, let me know if any changes need making.

I had a quick glance, they looked fine. Sorry I haven't replied yet, but I
need to set aside half an hour to deal with an average pull request, and I
haven't been able to schedule any time on Nesta this week.

> Also, is the mailing list best place to discuss github stuff, or github? Or IRC?

I'd say pull requests should generally only be discussed on GitHub. It's a
bit noisy for everybody else otherwise.

Also feel free to just email me directly if you've got a question for me, 
rather than a message for the list...

Graham

Re: [nesta] Custom Theme Creation Issues

From:
Jake Subs
Date:
2012-03-30 @ 09:21
On 29 March 2012 17:18, Graham Ashton <graham@effectif.com> wrote:
> but I need to set aside half an hour to deal with an average pull 
request, and I haven't been able to schedule any time on Nesta this week.

Thanks for the info.

Can imagine that managing a project takes up a lot of time.

cheers, Jake

-- 
[~] Jake Rayson
[w] www.jrayson.co.uk
[e] subs@growdigital.org
[t] @growdigital

Re: [nesta] Custom Theme Creation Issues

From:
Chad Ostrowski
Date:
2012-03-21 @ 10:20
If you could push your misbehaving project to Github or some such, that
would help us browse through it to find your error.