Where to put custom frontends (v3.2.2)

37 views
Skip to first unread message

Mic

unread,
Apr 3, 2012, 10:31:03 AM4/3/12
to actives...@googlegroups.com
Hi guys,

Hi would like to use a "custom" frontend in the way it's described in the API documentation :

frontend (global local)
ActiveScaffold is skinnable by creating and using different frontends. These frontends can package up completely different javascript, stylesheets, images, language files, and partials. They are a powerful way of potentially changing the entire UI for ActiveScaffold to blend with your design. Any partial called for by the ActiveScaffold code that is not provided by a frontend will fallback to using the partial from the default frontend.
When more frontends are shipped with ActiveScaffold, or when you have written your own, you can decide which frontend to use either globally or on a per-controller basis.
 
Examples:
config.frontend = :shiny_new_frontend

Does someone know :
  • where to put the custom frontend folder in a rails project ?
  • how to package assets (stylesheet, javascript and images) in it ?
I did several attempts, but nothing works. 
I've a folder named custom_frontend, in that folder I've a folder views containing a list.html.erb file (.../custom_frontend/views/list.html.erb
In my ApplicationControler I added the line : 
config.frontend = :custom_fronted

I put my custom_frontend directory in the following directories of my Rails app (successively) without results :
  • /app/frontends/
  • /vendor/plugins/active_scaffold-3.2.2/frontends/                (rails 2.x way)
  • /lib/active_scaffold-3.2.2/frontends/                                     (rails 3.2.x way)
When I say it doesn't work, I mean that for the list.html.erb, rails keeps loading the default one.
Thanks in advance for your answers and suggestions.

Mic
 

Sergio Cambra

unread,
Apr 3, 2012, 10:53:43 AM4/3/12
to actives...@googlegroups.com
On Martes, 3 de abril de 2012 07:31:03 Mic escribió:
> Hi guys,
>
> Hi would like to use a "custom" frontend in the way it's described in the
> API documentation :
>
> *frontend (**global local)
>
> > *ActiveScaffold is skinnable by creating and using different frontends.

> > These frontends can package up completely different javascript,
> > stylesheets, images, language files, and partials. They are a powerful way
> > of potentially changing the entire UI for ActiveScaffold to blend with
> > your
> > design. Any partial called for by the ActiveScaffold code that is not
> > provided by a frontend will fallback to using the partial from the default
> > frontend.
> > When more frontends are shipped with ActiveScaffold, or when you have
> > written your own, you can decide which frontend to use either globally or
> > on a per-controller basis.
> > **
> >
> >
> >
> > *Examples:*

> > config.frontend = :shiny_new_frontend
>
> Does someone know :
>
> - where to put the custom frontend folder in a rails project ?
> - how to package assets (stylesheet, javascript and images) in it ?

>
> I did several attempts, but nothing works.
> I've a folder named *custom_frontend, *in that folder I've a folder views

> containing a list.html.erb file (.../custom_frontend/views/list.html.erb
>
> In my ApplicationControler I added the line :
> > config.frontend = :custom_fronted
>
> I put my custom_frontend directory in the following directories of my Rails
> app (successively) without results :
>
> - /app/frontends/
> - /vendor/plugins/active_scaffold-3.2.2/frontends/ (rails
> 2.x way)
> - /lib/active_scaffold-3.2.2/frontends/

> (rails 3.2.x way)
>
> When I say it doesn't work, I mean that for the list.html.erb, rails keeps
> loading the default one.
> Thanks in advance for your answers and suggestions.
>
> Mic


Frontends were a 2.x feature, when active scaffold was a plugin, and frontends
should be in active_scaffold directory. Since active scaffold is a gem that
feature it's broken, nobody have asked for it I think it's a feature which
nobody was using.

Mic

unread,
Apr 3, 2012, 11:35:38 AM4/3/12
to actives...@googlegroups.com
Thanks for the fast answer !
I assume that it's the same for the theme feature (enables to change css for a given frontend) ?

So, the way to override CSS of AS is to put everything in a file  active_scaffold_override.css , am I right ?
If yes, may I use scss instead of css ?

Thanks.

Mic

Sergio Cambra

unread,
Apr 3, 2012, 11:54:46 AM4/3/12
to actives...@googlegroups.com
On Martes, 3 de abril de 2012 08:35:38 Mic escribió:
> Thanks for the fast answer !
> I assume that it's the same for the *theme* feature (enables to change css

> for a given frontend) ?
>
> So, the way to override CSS of AS is to put everything in a file *
> active_scaffold_override.css* , am I right ?

> If yes, may I use scss instead of css ?

No, theme feature is easier and it should work. When you set a theme, a class
named theme_name-theme is added to main div (the div with active-scaffold
class), so you can add some css rules in your pipeline like:
.theme_name-theme .record ...

Also, you can override colors using scss, you can use any name for the scss
file. Require the scss file in your manifest file and import active_scaffold in
your scss file:

# application.css file
/*
*= require ...
*= require active_scaffold_override
*= require ...
*/

# active_scaffold_override.css.scss
$header_color: #fff;
@import 'active_scaffold';

You can look at active_scaffold_colors.css.scss for available scss variables

Reply all
Reply to author
Forward
0 new messages