Nitrogen Web Framework for Erlang" Received: by 10.224.196.196 with SMTP id eh4mr4764967qab.5.1332448025967; Thu, 22 Mar 2012 13:27:05 -0700 (PDT) X-BeenThere: nitrogenweb@googlegroups.com Received: by 10.229.117.204 with SMTP id s12ls2402410qcq.7.gmail; Thu, 22 Mar 2012 13:27:05 -0700 (PDT) Received: by 10.236.139.199 with SMTP id c47mr12662863yhj.5.1332448025136; Thu, 22 Mar 2012 13:27:05 -0700 (PDT) Received: by 10.236.139.199 with SMTP id c47mr12662862yhj.5.1332448025116; Thu, 22 Mar 2012 13:27:05 -0700 (PDT) Return-Path: Received: from mail-yw0-f42.google.com (mail-yw0-f42.google.com [209.85.213.42]) by gmr-mx.google.com with ESMTPS id b7si3668219yhm.1.2012.03.22.13.27.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Mar 2012 13:27:05 -0700 (PDT) Received-SPF: pass (google.com: domain of jeno.i.ha...@gmail.com designates 209.85.213.42 as permitted sender) client-ip=209.85.213.42; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jeno.i.ha...@gmail.com designates 209.85.213.42 as permitted sender) smtp.mail=jeno.i.ha...@gmail.com; dkim=pass header...@gmail.com Received: by mail-yw0-f42.google.com with SMTP id q11so2098648yhf.15 for ; Thu, 22 Mar 2012 13:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=W+1USI5CAcndFcnwaJD+2FCcyOBszVmjxGHrbcT3Og0=; b=qj5a6iB1+BK3BHeBglWVJowOLNud8NoeIclR8KASLYKS1AbJe/2lYaA7kmfXaa3YUQ AFukfvLofkGYNDKwYbav9GXm7mJIZddvyB1iyE0w71anJXzJIb0k9FFmAOls07HVHwwZ C28+oS6WM3y/6S7cJtA8qtBiUtdiJnzgccE5oIMwHyYYDJ8ruDxSSxbXpaiHljjn1Ytd Ad/YAw0XfrWjWywyTb1lsInfYI2CHYjatiA41FfBKiZ0TX56jPJFXSApEHQ/lQv4LFoZ OxX4Ugn9Car/QVSLwiWYQdeCysn9GI5spXiJUjF9CXPwEv9Fn68JKy2SBG8N6nhgDdwt whyA== MIME-Version: 1.0 Received: by 10.236.102.230 with SMTP id d66mr9607648yhg.72.1332448024902; Thu, 22 Mar 2012 13:27:04 -0700 (PDT) Received: by 10.101.66.20 with HTTP; Thu, 22 Mar 2012 13:27:04 -0700 (PDT) In-Reply-To: <4F6B6930.5000...@matchix.com> References: <4F6B6930.5000...@matchix.com> Date: Thu, 22 Mar 2012 21:27:04 +0100 Message-ID: Subject: Re: Adding id to html elements From: "Jeno I. Hajdu" To: nitrogenweb@googlegroups.com Content-Type: multipart/alternative; boundary=20cf303b3f9334bca704bbdabb8b --20cf303b3f9334bca704bbdabb8b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, I think most of us would prefer this, but the problem is what Jesse wrote previously, there can be cases when a single element has multiple wfids and then you can have problems. Anyway I have modified the elements to use a new html_id field, I plan to push it to github tonight. Alternatively we could figure out how to handle properly the case of multiple wfids in general from the id attribute's point of view. BR, Jeno 2012/3/22 S=E9bastien Saint-Sevin > Hi list, > > Just to add some confusion to that subject. I did it the other way (for > the same need of Jquery mobile integration). > > I created JQM elements that matches base elements for those that needs > Jquery mobile attributes such as : > > - element_jqm_panel > - element_jqm_link, > etc.... > > And I duplicated some rendering code (to avoid touching current nitrogen > structure) as : > > -module(element_jqm_panel). > -compile(export_all). > -include_lib("nitrogen_core/**include/wf.hrl"). > -include("records.hrl"). > > reflect() -> record_info(fields, jqm_panel). > > render_element(Record) -> > wf_tags:emit_tag('div', Record#jqm_panel.body, [ > {class, ["panel", Record#jqm_panel.class]}, > {style, Record#jqm_panel.style}, > {id, Record#jqm_panel.id -- ".wfid_"}, > {'data-role', Record#jqm_panel.data_role}, > {'data-theme', Record#jqm_panel.data_theme}, > {'data-collapsed', Record#jqm_panel.data_**collapsed} > ]). > > > Have a look at the ID line where I removed the ".wfid_" prefix. At least > the record ID field generates an ID html attribute ! (otherwise ID > generates a class attribute, and html_id an ID attribute) > > I think I would prefer that the nitrogen framework keep closer to the > generated HTML instead of creating new attributes. > > My 2 cents, > Cheers, > > S=E9bastien > > Le 20/03/2012 23:36, Jesse Gumm a =E9crit : > > Yes, having it in ELEMENT_BASE is the right way to go, but Mattias's >> version works if you're cherry picking which elements will support the >> html_id (and it certainly saved him a handful of work while >> accomplishing his goal of incorporating jquery mobile). >> >> -Jesse >> >> On Tue, Mar 20, 2012 at 5:02 PM, Jeno I. Hajdu >> wrote: >> >>> >>> >>> On Tue, Mar 20, 2012 at 9:30 PM, Mattias Holmlund >>> wrote: >>> >>>> >>>> On Tue, Mar 20, 2012 at 5:05 PM, Jesse Gumm >>>> wrote: >>>> >>>>> >>>>> In any case, if anyone wants to save me the work and add html_id to >>>>> the base element and modify all elements to emit it, I wouldn't save >>>>> no :) >>>>> >>>>> >>>> I have done this for textbox, textarea and dropdown in nitrogen_core, >>>> but >>>> with the html_id in the record for each element. Might be useful as a >>>> starting point for someone. >>>> >>> >>> >>> Thanks, I have checked it. I am wondering whether it would be better to >>> have >>> the html_id as part of the ELEMENT_BASE macro instead of adding it >>> separately for each element. I have looked through the elements which >>> don't >>> have a direct wf_tags:emit_tag() call and only for a bunch it would mak= e >>> no >>> sense to have an html_id (for example flash, bind, template or function= ), >>> roughly 6-7, so ~10% of all the element types. Unfortunately the >>> rendering >>> part still has to be repeated. If we can decide which would be better >>> from >>> the above two options, I'll go through the elements and make the >>> modification. >>> >>> BR, >>> Jeno >>> >>> -- >>> You received this message because you are subscribed to the Google Grou= ps >>> "Nitrogen Project / The Nitrogen Web Framework for Erlang" group. >>> To post to this group, send email to nitrogenweb@googlegroups.com. >>> To unsubscribe from this group, send email to >>> nitrogenweb+unsubscribe@**googlegroups.com >>> . >>> For more options, visit this group at >>> http://groups.google.com/**group/nitrogenweb?hl=3Den >>> . >>> >> >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Nitrogen Project / The Nitrogen Web Framework for Erlang" group. > To post to this group, send email to nitrogenweb@googlegroups.com. > To unsubscribe from this group, send email to nitrogenweb+unsubscribe@** > googlegroups.com . > For more options, visit this group at http://groups.google.com/** > group/nitrogenweb?hl=3Den > . > > --20cf303b3f9334bca704bbdabb8b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I think most of us would prefer this, but the problem is what Je= sse wrote previously, there can be cases when a single
element has multi= ple wfids and then you can have problems.
Anyway I have modified the ele= ments to use a new html_id field, I plan to push it to github tonight.
Alternatively we could figure out how to handle properly the case of multip= le wfids in general from the id attribute's
point of view.

BR= ,
Jeno

2012/3/22 S=E9bastien Saint-Sevin <seb-goo...@matchix.com>
Hi list,

Just to add some confusion to that subject. I did it the other way (for the= same need of Jquery mobile integration).

I created JQM elements that matches base elements for those that needs Jque= ry mobile attributes such as :

- element_jqm_panel
- element_jqm_link,
etc....

And I duplicated some rendering code (to avoid touching current nitrogen st= ructure) as :

-module(element_jqm_panel).
-compile(export_all).
-include_lib("nitrogen_core/include/wf.hrl").
-include("records.hrl").

reflect() -> record_info(fields, jqm_panel).

render_element(Record) ->
=A0 =A0wf_tags:emit_tag('div', Record#jqm_panel.body, [
=A0 =A0 =A0 =A0{class, ["panel", Record#jqm_panel.class]},
=A0 =A0 =A0 =A0{style, Record#jqm_panel.style},
=A0 =A0 =A0 =A0{id, Record#jqm_panel.id -- ".wfid_"},
=A0 =A0{'data-role', Record#jqm_panel.data_role},
=A0 =A0{'data-theme', Record#jqm_panel.data_theme},
=A0 =A0{'data-collapsed', Record#jqm_panel.data_collapsed}<= br> =A0 =A0]).


Have a look at the ID line where I removed the ".wfid_" prefix. A= t least the record ID field generates an ID html attribute ! (otherwise ID = generates a class attribute, and html_id an ID attribute)

I think I would prefer that the nitrogen framework keep closer to the gener= ated HTML instead of creating new attributes.

My 2 cents,
Cheers,

S=E9bastien

Le 20/03/2012 23:36, Jesse Gumm a =E9crit :

Yes, having it in ELEMENT_BASE is the right way to go, but Mattias's version works if you're cherry picking which elements will support the<= br> html_id (and it certainly saved him a handful of work while
accomplishing his goal of incorporating jquery mobile).

-Jesse

On Tue, Mar 20, 2012 at 5:02 PM, Jeno I. Hajdu<jeno.i.ha...@gmail.com> =A0wrote:=


On Tue, Mar 20, 2012 at 9:30 PM, Mattias Holmlund
<mattias= .holml...@gmail.com> =A0wrote:

On Tue, Mar 20, 2012 at 5:05 PM, Jesse Gumm<g...@sigma-star.com> =A0wrote:

In any case, if anyone wants to save me the work and add html_id to
the base element and modify all elements to emit it, I wouldn't save no :)


I have done this for textbox, textarea and dropdown in nitrogen_core, but with the html_id in the record for each element. Might be useful as a
starting point for someone.


Thanks, I have checked it. I am wondering whether it would be better to hav= e
the html_id as part of the ELEMENT_BASE macro instead of adding it
separately for each element. I have looked through the elements which don&#= 39;t
have a direct wf_tags:emit_tag() call and only for a bunch it would make no=
sense to have an html_id (for example flash, bind, template or function), roughly 6-7, so ~10% of all the element types. Unfortunately the rendering<= br> part still has to be repeated. If we can decide which would be better from<= br> the above two options, I'll go through the elements and make the
modification.

BR,
Jeno

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.=
To post to this group, send email to nitrogenweb@googlegroups.com.
To unsubscribe from this group, send email to
nitrogenweb+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/nitrogenweb?hl=3Den.




--
You received this message because you are subscribed to the Google Groups &= quot;Nitrogen Project / The Nitrogen Web Framework for Erlang" group.<= br> To post to this group, send email to nitrogenweb@googlegroups.com.
To unsubscribe from this group, send email to nitrogenweb+unsubscribe@= googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nitrogenweb?hl=3Den.


--20cf303b3f9334bca704bbdabb8b--