I have a table in which users can insert css declarations to customize
a page. In a controller I retrieve these declarations, and in a view I
would like them to be inserted in the head section.

This is what the rows object contains:

declaration_id                    1
declaration.company_id     263
declaration_selector           #header
declaration_property           background-color
declaration.value                 #4169E1

declaration_id                    1
declaration.company_id     263
declaration_selector           #header
declaration_property           color
declaration.value                 #FFFFFF


This is what the head section should contain:

#header{background-color:#4169E1;color:#FFFFFF;}


I started off like this:

{{oldselector=None}}
  {{for row in rows}}
    {{if row.selector!=oldselector}}
      {{=row.selector}} {
      {{oldselector=row.selector}}
    {{pass}}
    {{=row.property}}:{{=row.value:}};
  {{pass}}


The problem is that I can't figure out how to insert the closing } in:
#header{background-color:#4169E1;color:#FFFFFF;}

I hope one of you could help me solve this problem.

Furthermore, I wonder whether this is right approach or whether there
is a better way to implement this.


Kind regards,

Annet.

Reply via email to