Re: Confirm through colorbox.
perhaps you can try to locate you element with jQuery and listen to event with jquery shortcut. jQuery('#'+element).click(function(e) { e.preventDefault(); jQuery.colorbox({ inline:"true", href: "#modalDiv", height:"300px", width:"400px" }); }); François 2011/6/21 Kado : > Thanks for the hint! > > I find it very useful at first sight but I am not able to use stack because > I am using > Tapestry 5.1.0.5 and It seems that I can't Import stack. > > Juan > > On 06/19/2011 12:23 PM, françois facon wrote: >> >> Hi Juan, >> >> Did you have a look at IOKO contribution? >> >> It is a nice example that provide also a mixin for dialog. >> >> >> http://code.google.com/p/ioko-tapestry-commons/source/browse/trunk/tapestry-commons/tapestry-mixins/src/main/resources/uk/co/ioko/tapestry/mixins/mixins/overlay.js >> >> There is also Reveal mixin in tapestry-query provided by Emmanel Demey at >> >> https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/mixins/reveal/reveal.js >> this one use jquery e.preventDefault(); to stop the event >> >> >> François >> >> >> 2011/6/15 Kado: >>> >>> Hi everybody, >>> >>> I am trying to make a confirm using the jQuery plugin "colorbox". >>> >>> The main problem is that when I click the modal is open for 2 seconds and >>> the page continues the natural flow. >>> >>> This is the mixin and tml of the code that I am using: >>> >>> >>> _*This is the tml example:*_ >>> >>> >>> >> t:question="delete?" >>> t:mixins="condorTapestryLib/ModalConfirm" >>> t:yesLabel="Yes, >>> delete" >>> t:noLabel="No, don't delete" >>> >>> t:zone="gridEndpointZone"> >>> >>> Delete >>> >>> >>> >>> >>> _*Java for the mixin:*_ >>> >>> @BeforeRenderTemplate >>> public void afterRenderTemplateLink() { >>> renderSupport.addScript(String.format("new ModalConfirm('%s', >>> '%s','%s', '%s', '%s');", >>> element.getClientId(), question, zoneId, yesLabel, >>> noLabel)); >>> } >>> >>> >>> >>> _*The javascript:*_ >>> >>> var ModalConfirm = Class.create(); >>> ModalConfirm.prototype = { >>> initialize: function(element, question, zoneId, yesLabel, noLabel) >>> { >>> >>> /* modalContainer is a div with the modal colorbox. >>> It is fullfilled with the parameters received in the >>> function (question, zoneId...) >>> */ >>> >>> document.body.appendChild(modalContainer); >>> >>> Event.observe($(element), 'click', >>> function(event){ >>> Event.stop(event); // This is NOT stopping >>> anything. >>> jQuery.colorbox({ >>> inline:"true", >>> href: "#modalDiv", >>> height:"300px", >>> width:"400px" >>> }); >>> }); >>> } >>> } >>> >>> >>> >>> >>> Thanks in advance to everybody! >>> >>> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Confirm through colorbox.
Thanks for the hint! I find it very useful at first sight but I am not able to use stack because I am using Tapestry 5.1.0.5 and It seems that I can't Import stack. Juan On 06/19/2011 12:23 PM, françois facon wrote: Hi Juan, Did you have a look at IOKO contribution? It is a nice example that provide also a mixin for dialog. http://code.google.com/p/ioko-tapestry-commons/source/browse/trunk/tapestry-commons/tapestry-mixins/src/main/resources/uk/co/ioko/tapestry/mixins/mixins/overlay.js There is also Reveal mixin in tapestry-query provided by Emmanel Demey at https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/mixins/reveal/reveal.js this one use jquery e.preventDefault(); to stop the event François 2011/6/15 Kado: Hi everybody, I am trying to make a confirm using the jQuery plugin "colorbox". The main problem is that when I click the modal is open for 2 seconds and the page continues the natural flow. This is the mixin and tml of the code that I am using: _*This is the tml example:*_ Delete _*Java for the mixin:*_ @BeforeRenderTemplate public void afterRenderTemplateLink() { renderSupport.addScript(String.format("new ModalConfirm('%s', '%s','%s', '%s', '%s');", element.getClientId(), question, zoneId, yesLabel, noLabel)); } _*The javascript:*_ var ModalConfirm = Class.create(); ModalConfirm.prototype = { initialize: function(element, question, zoneId, yesLabel, noLabel) { /* modalContainer is a div with the modal colorbox. It is fullfilled with the parameters received in the function (question, zoneId...) */ document.body.appendChild(modalContainer); Event.observe($(element), 'click', function(event){ Event.stop(event); // This is NOT stopping anything. jQuery.colorbox({ inline:"true", href: "#modalDiv", height:"300px", width:"400px" }); }); } } Thanks in advance to everybody! - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Confirm through colorbox.
Hi Juan, Did you have a look at IOKO contribution? It is a nice example that provide also a mixin for dialog. http://code.google.com/p/ioko-tapestry-commons/source/browse/trunk/tapestry-commons/tapestry-mixins/src/main/resources/uk/co/ioko/tapestry/mixins/mixins/overlay.js There is also Reveal mixin in tapestry-query provided by Emmanel Demey at https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/mixins/reveal/reveal.js this one use jquery e.preventDefault(); to stop the event François 2011/6/15 Kado : > Hi everybody, > > I am trying to make a confirm using the jQuery plugin "colorbox". > > The main problem is that when I click the modal is open for 2 seconds and > the page continues the natural flow. > > This is the mixin and tml of the code that I am using: > > > _*This is the tml example:*_ > > > t:question="delete?" > t:mixins="condorTapestryLib/ModalConfirm" > t:yesLabel="Yes, delete" > t:noLabel="No, don't delete" > > t:zone="gridEndpointZone"> > > Delete > > > > > _*Java for the mixin:*_ > > @BeforeRenderTemplate > public void afterRenderTemplateLink() { > renderSupport.addScript(String.format("new ModalConfirm('%s', > '%s','%s', '%s', '%s');", > element.getClientId(), question, zoneId, yesLabel, > noLabel)); > } > > > > _*The javascript:*_ > > var ModalConfirm = Class.create(); > ModalConfirm.prototype = { > initialize: function(element, question, zoneId, yesLabel, noLabel) { > > /* modalContainer is a div with the modal colorbox. > It is fullfilled with the parameters received in the > function (question, zoneId...) > */ > > document.body.appendChild(modalContainer); > > Event.observe($(element), 'click', > function(event){ > Event.stop(event); // This is NOT stopping > anything. > jQuery.colorbox({ > inline:"true", > href: "#modalDiv", > height:"300px", > width:"400px" > }); > }); > } > } > > > > > Thanks in advance to everybody! > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Confirm through colorbox.
Hi everybody, I am trying to make a confirm using the jQuery plugin "colorbox". The main problem is that when I click the modal is open for 2 seconds and the page continues the natural flow. This is the mixin and tml of the code that I am using: _*This is the tml example:*_ t:question="delete?" t:mixins="condorTapestryLib/ModalConfirm" t:yesLabel="Yes, delete" t:noLabel="No, don't delete" t:zone="gridEndpointZone"> Delete _*Java for the mixin:*_ @BeforeRenderTemplate public void afterRenderTemplateLink() { renderSupport.addScript(String.format("new ModalConfirm('%s', '%s','%s', '%s', '%s');", element.getClientId(), question, zoneId, yesLabel, noLabel)); } _*The javascript:*_ var ModalConfirm = Class.create(); ModalConfirm.prototype = { initialize: function(element, question, zoneId, yesLabel, noLabel) { /* modalContainer is a div with the modal colorbox. It is fullfilled with the parameters received in the function (question, zoneId...) */ document.body.appendChild(modalContainer); Event.observe($(element), 'click', function(event){ Event.stop(event); // This is NOT stopping anything. jQuery.colorbox({ inline:"true", href: "#modalDiv", height:"300px", width:"400px" }); }); } } Thanks in advance to everybody!