Re: [Radiant] Which extension to use?
k Am Freitag, 13. Juni 2008 16:26:21 schrieb Thomas Bell: You might get some ideas from or be able to use this Newsletter extension: http://github.com/pilu/radiant-newsletter/tree/master. --Tom On Fri, Jun 13, 2008 at 6:39 AM, Jamey Cribbs [EMAIL PROTECTED] wrote: I would second what Jim says. Radiant makes it so easy to write extensions, that if I were you I would just roll my own. I did something similar for event registration. If you make sure to add the public facing route in your extension file, then you can just link to your newsletter signup form from within a radiant page. No need even to have to create any custom radiant tags. HTH, Jamey On Fri, Jun 13, 2008 at 12:22 AM, Jim Gay [EMAIL PROTECTED] wrote: On Jun 13, 2008, at 12:06 AM, [EMAIL PROTECTED] wrote: Hey guys, I am trying to figure out how to add a sign up page for a newsletter my client want to send out. I am not worried about the newsletter part, yet, but I cannot for the life of me figure out which extension I need to use to build and process the sign up form. I have tried using database_form, but there is something wrong with the way it handles the redirect after the form data is sent to the db and I cannot get any of the validation working. I also looked into the form extension from the official list of extensions, but the comment at the top of the readme says that it is very alpha and shouldn't be used. Has anybody set up a form like this in 0.6.7 yet? I am not looking for somebody else to do my work for me, but can anybody point me in the right direction? I would greatly appreciate it. Thanks, Nate Thats on my list of things to do as well. Try the share_layouts extension from the core and build an extension with a controller exposed to the public (ie. not in the admin namespace) and set no_login_required at the top of your controller. Another option is to take a look at the mailer extension (which provides and processes public facing forms). It might give you some ideas about tags that you could create and how to consume the form data. I believe that that is the direction you might want to try, but I haven't tackled it myself yet. -Jim ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant -- Ponton Consulting GmbH voice: + 49.40.69213-354 http://www.ponton-consulting.de/ fax:+ 49.40.69213-355 Dorotheenstraße 60 22301 Hamburgmailto:[EMAIL PROTECTED] Germany Ponton Consulting is a Member of C1 Group HRB 81480, AG Hamburg, Managing Director: Dr. Michael Merz Ponton Consulting is a Member of C1 Group (www.c1-group.com) ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
On Mon, Jun 16, 2008 at 12:58 PM, Andrea Franz [EMAIL PROTECTED] wrote: Thank you for contributing to the extension. Did you fork it from github? I'd like to fetch you changes. Send me a pull request! I actually generated the Subscriber Lists extension from scratch, and plagiarized the bits from the Newsletter extension that I needed, piecemeal. I did make a couple of customisations which could enhance the Newsletter extension, so I'll have a go at forking it and send you a pull request. I'm taking this git revolution one step at a time... Cheers, Drew ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
Nate, Did you make any headway on this? Try running this in script/console: s = Page.find_by_class_name(SubscriberListPage) = #SubscriberListPage id: 11, title: Newsletter, slug: newsletter, breadcrumb: Newsletter, class_name: SubscriberListPage, status_id: 100, parent_id: 1, layout_id: nil, created_at: 2008-06-15 14:38:39, updated_at: 2008-06-15 14:38:39, published_at: 2008-06-15 15:38:39, created_by_id: nil, updated_by_id: nil, virtual: false, lock_version: 0, description: nil, keywords: nil Subscriber.count_active_subscribers(s) = 0 I'm afraid I can't reproduce the error, and I am also using Radiant 0.6.7, Rails 2.0.2. What database are you using? I've only tested on MySQL. Looking at the definition of the method count_active_subscribers, I'm wondering if it is MySQL specific: def count_active_subscribers(subscriber_list) count(:conditions = [unsubscribed_at IS ? AND subscriber_list_id = ?, nil, subscriber_list.id]) end I'm not certain whether this would work with, say SqlLite. Even so, the error message says undefined method, which is surprising since the method is defined in the Subscriber model. Drew vendor/extensions/subscriber_lists/app/views/subscribers/ index.html.erb where line #15 raised: undefined method `count_active_subscribers' for #Class: 0x7fcb342a30d0 Extracted source (around line #15): 12: % @lists.each do |list| % 13: tr 14: tda href=%= url_for :action = 'list', :id = list.id %span class=title%= list.title %/span/a/td 15: td%= Subscriber.count_active_subscribers(list) %/td 16: td%= link_to Edit page, page_edit_path(:id = list.id) %/td 17: td%= link_to Export, :action = export, :id = list.id %/td 18: /tr ### I have huffed and I have puffed, but I cannot figure out how why it isn't working. Do you have any thoughts? Radiant 0.6.7, Rails 2.0.2 ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
On Mon, 2008-06-16 at 20:00 +0100, Andrew Neil wrote: What database are you using? I've only tested on MySQL. I am using Sqlite. Looking at the definition of the method count_active_subscribers, I'm wondering if it is MySQL specific: def count_active_subscribers(subscriber_list) count(:conditions = [unsubscribed_at IS ? AND subscriber_list_id = ?, nil, subscriber_list.id]) end I'm not certain whether this would work with, say SqlLite. Even so, the error message says undefined method, which is surprising since the method is defined in the Subscriber model. I thought it was strange as well. Like I said, I am going to be working on it tonight and I'll let you know how it goes. ~Nate ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
Sean, Rails 2.0.x allows you to use hashes in conditions, even for nil attributes, so you could refactor that like so: count(:conditions = {:unsubscribed_at = nil, :subscriber_list_id = subscriber_list.id }) Is there a way to say NOT NULL?, e.g. :condition = [unsubscribed_at IS NOT ? AND subscriber_list_id = ?, nil, subscriber_list.id] I tried this: :conditions = {:unsubscribed_at = !nil, :subscriber_list_id = subscriber_list.id } I also tried replacing !nil with true and 0, but without success. Thanks, Drew ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
Andrew, Unfortunately no... you'll have to do IS NOT NULL (without the interpolation). However, that is SQL-92 compatible, so most DBMS should recognize it. DataMapper allows things like :unsubscribed_at.not = nil, but unfortunately Radiant uses AR. Sean Andrew Neil wrote: Sean, Rails 2.0.x allows you to use hashes in conditions, even for nil attributes, so you could refactor that like so: count(:conditions = {:unsubscribed_at = nil, :subscriber_list_id = subscriber_list.id }) Is there a way to say NOT NULL?, e.g. :condition = [unsubscribed_at IS NOT ? AND subscriber_list_id = ?, nil, subscriber_list.id] I tried this: :conditions = {:unsubscribed_at = !nil, :subscriber_list_id = subscriber_list.id } I also tried replacing !nil with true and 0, but without success. Thanks, Drew ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
On Mon, 2008-06-16 at 20:00 +0100, Andrew Neil wrote: Nate, Did you make any headway on this? Also, when I commented out the count-active-subscribers method and the index action rendered propery, hitting the export link caused an undefined method error when it hit the find_active_subscribers_by_subscriber_list method. Either your plugin really doesn't like Sqlite or I did something really wrong when I built this thing. If I don't rebuild my app on MySQL, which I am loathe to do, I will create a brand new app and try and load the subscriber-lists extension on a clean install. ~Nate ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
Nate, Glad you like it. You are my frickin' hero! :-) Andrea is the hero. I just took a hatchet to his code! can I add additional columns in extension migrations or will it somehow break the extension? Give it a go. I don't think it should break anything. If you want the extra fields to be added to the CSV export, then you should modify the export action in the SubscribersController as follows: def export @list = Page.find(params[:id]) subscribers = Subscriber.find_active_subscribers_by_subscriber_list(@list) stream_csv do |csv| csv [email,name,your additional column name] subscribers.each do |subscriber| csv [subscriber.email,subscriber.name,subscriber.additional_column] end end end Cheers, Drew ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
On Sun, 2008-06-15 at 17:45 +0100, Andrew Neil wrote: You are my frickin' hero! :-) Andrea is the hero. I just took a hatchet to his code! Well the, he rocks, too. In hindsight if I had been able to figure out how the newsletter extension all works, I might have gone that route. As it is, I am using the subscriber lists extension. I am having a problem with it, though. The error is below: ### Showing vendor/extensions/subscriber_lists/app/views/subscribers/index.html.erb where line #15 raised: undefined method `count_active_subscribers' for #Class:0x7fcb342a30d0 Extracted source (around line #15): 12: % @lists.each do |list| % 13: tr 14: tda href=%= url_for :action = 'list', :id = list.id %span class=title%= list.title %/span/a/td 15: td%= Subscriber.count_active_subscribers(list) %/td 16: td%= link_to Edit page, page_edit_path(:id = list.id) %/td 17: td%= link_to Export, :action = export, :id = list.id %/td 18: /tr ### I have huffed and I have puffed, but I cannot figure out how why it isn't working. Do you have any thoughts? Radiant 0.6.7, Rails 2.0.2 ~Nate ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
I would second what Jim says. Radiant makes it so easy to write extensions, that if I were you I would just roll my own. I did something similar for event registration. If you make sure to add the public facing route in your extension file, then you can just link to your newsletter signup form from within a radiant page. No need even to have to create any custom radiant tags. HTH, Jamey On Fri, Jun 13, 2008 at 12:22 AM, Jim Gay [EMAIL PROTECTED] wrote: On Jun 13, 2008, at 12:06 AM, [EMAIL PROTECTED] wrote: Hey guys, I am trying to figure out how to add a sign up page for a newsletter my client want to send out. I am not worried about the newsletter part, yet, but I cannot for the life of me figure out which extension I need to use to build and process the sign up form. I have tried using database_form, but there is something wrong with the way it handles the redirect after the form data is sent to the db and I cannot get any of the validation working. I also looked into the form extension from the official list of extensions, but the comment at the top of the readme says that it is very alpha and shouldn't be used. Has anybody set up a form like this in 0.6.7 yet? I am not looking for somebody else to do my work for me, but can anybody point me in the right direction? I would greatly appreciate it. Thanks, Nate Thats on my list of things to do as well. Try the share_layouts extension from the core and build an extension with a controller exposed to the public (ie. not in the admin namespace) and set no_login_required at the top of your controller. Another option is to take a look at the mailer extension (which provides and processes public facing forms). It might give you some ideas about tags that you could create and how to consume the form data. I believe that that is the direction you might want to try, but I haven't tackled it myself yet. -Jim ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Which extension to use?
On Jun 13, 2008, at 12:06 AM, [EMAIL PROTECTED] wrote: Hey guys, I am trying to figure out how to add a sign up page for a newsletter my client want to send out. I am not worried about the newsletter part, yet, but I cannot for the life of me figure out which extension I need to use to build and process the sign up form. I have tried using database_form, but there is something wrong with the way it handles the redirect after the form data is sent to the db and I cannot get any of the validation working. I also looked into the form extension from the official list of extensions, but the comment at the top of the readme says that it is very alpha and shouldn't be used. Has anybody set up a form like this in 0.6.7 yet? I am not looking for somebody else to do my work for me, but can anybody point me in the right direction? I would greatly appreciate it. Thanks, Nate Thats on my list of things to do as well. Try the share_layouts extension from the core and build an extension with a controller exposed to the public (ie. not in the admin namespace) and set no_login_required at the top of your controller. Another option is to take a look at the mailer extension (which provides and processes public facing forms). It might give you some ideas about tags that you could create and how to consume the form data. I believe that that is the direction you might want to try, but I haven't tackled it myself yet. -Jim ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant