Re: [Radiant] Customizing the user admin UI at the column level

2010-08-12 Thread Wes Gamble

 On 8/12/10 6:47 PM, William Ross wrote:

On 13 Aug 2010, at 00:35, Wes Gamble wrote:

I have reviewed the contents of 
http://wiki.github.com/radiant/radiant/modifying-the-page-ui in depth.


I have extension that modifies the user model to be attached to 
something called a program, and I've made the change in the DB, and 
modified the user model in my extension code like so:


User && class User < ActiveRecord::Base
  belongs_to :program
end

so that the association will be there.

Now, I would like to be able to display and edit program assignments 
for a given user in the admin. UI.


In my extension's "activate" method, I added the following lines in 
the hopes of customizing the UI:


admin.user.edit.form << 'edit_program'
admin.user.index.thead << 'program_header'
admin.user.index.tbody << 'program_cell'

thinking that the display of the user admin was super dynamic and it 
would just figure out how to display the edit components based on 
attribute type.


But when I try to look at the index view of users, I get:

"`program_header' default partial not found! `program_cell' default 
partial not found!" as errors in the index display.


and

`edit_program' default partial not found! as an error in the edit 
display.

**
After looking into it, though, I see the admin/users/edit and 
admin/users/index views under the Radiant core are more or less 
hard-coded at the column level, but the error messages imply that I 
should be able to add a partial somewhere for my custom fields.


Questions:

What is the preferred way to customize at this level?


You're on the right lines, though I would normally use this kind of 
idiom to get more control:


admin.users.edit.add :form, "edit_program", :after => "something"
and then you need to create the partial, which in this case would be
vendor/extensions/your_extension/app/views/admin/users/_edit_program.html.haml


I did this, and created a file in the correct place, and entered the 
following in my "activate" method:


  admin.users.edit.add :form, "edit_program", :after => "edit_roles"

My partial looks like this:

- form.edit_program do
  %p
= f.label :program_id, t('program'), :class => "optional"
= f.select :program_id, Program.all.collect {|p| [p.name, p.id]}

and I get the classic

" |wrong number of arguments (0 for 1)|"

message when I try to render the form.  This is because, AFAIK, the 
partial hasn't been passed the "form" variable as a local.


How does the partial get rendered in the context of the existing form?

Thanks,
Wes



Re: [Radiant] create new page on heroku

2010-08-12 Thread Josh French
We ran into this before on another extension, there's an SQL  
difference with Postgres that affects some group queries. I just need  
to remember which one and I'll apply the fix.


j

On Aug 12, 2010, at 6:55 PM, Steven Southard wrote:

With 9.1 on Heroku I am having a problem saving new pages.  It saves  
pages I made on my localhost just won't make a new one.


I get this:

ActiveRecord::StatementInvalid (PGError: ERROR:  invalid input  
syntax for integer: ""
: SELECT * FROM "page_parts" WHERE ("page_parts"."id" IN ('',''))  
AND ("page_parts".page_id = NULL)  ORDER BY id):
 /home/slugs/258179_58f1601_b92e/mnt/.gems/gems/will_paginate-2.3.14/ 
lib/will_paginate/finder.rb:170:in `method_missing'
 radiant (0.9.1) app/controllers/admin/resource_controller.rb:64:in  
`create'


Is there a problem with page_parts or will_paginate-2.3.14?  Any  
ideas?



Cheers,


Steven







Re: [Radiant] Customizing the user admin UI at the column level

2010-08-12 Thread William Ross
On 13 Aug 2010, at 00:35, Wes Gamble wrote:

> I have reviewed the contents of 
> http://wiki.github.com/radiant/radiant/modifying-the-page-ui in depth.
> 
> I have extension that modifies the user model to be attached to something 
> called a program, and I've made the change in the DB, and modified the user 
> model in my extension code like so:
> 
> User && class User < ActiveRecord::Base
>   belongs_to :program
> end
> 
> so that the association will be there.
> 
> Now, I would like to be able to display and edit program assignments for a 
> given user in the admin. UI.
> 
> In my extension's "activate" method, I added the following lines in the hopes 
> of customizing the UI:
> 
> admin.user.edit.form << 'edit_program'
> admin.user.index.thead << 'program_header'
> admin.user.index.tbody << 'program_cell'
> 
> thinking that the display of the user admin was super dynamic and it would 
> just figure out how to display the edit components based on attribute type.
> 
> But when I try to look at the index view of users, I get:
> 
> "`program_header' default partial not found! `program_cell' default partial 
> not found!" as errors in the index display.
> 
> and 
> 
> `edit_program' default partial not found! as an error in the edit display.
> 
> After looking into it, though, I see the admin/users/edit and 
> admin/users/index views under the Radiant core are more or less hard-coded at 
> the column level, but the error messages imply that I should be able to add a 
> partial somewhere for my custom fields.
> 
> Questions:
> 
> What is the preferred way to customize at this level?  

You're on the right lines, though I would normally use this kind of idiom to 
get more control:

admin.users.edit.add :form, "edit_program", :after => "something"
 
and then you need to create the partial, which in this case would be


vendor/extensions/your_extension/app/views/admin/users/_edit_program.html.haml

If you want it to live somewhere else - eg. to share a form component between 
several models - then you can specify the full path to the partial in the usual 
way:

admin.users.edit.add :form, "admin/programs/edit_program", :after => 
"something"

> Do I need to just override the entire edit and index views?

Much better to avoid that: working through the UI you are relatively safe from 
interface changes and able to co-operate with other extensions.

> Is there some Javascript-y way to do this that I'm missing?

Nope.

best,

will

[Radiant] Customizing the user admin UI at the column level

2010-08-12 Thread Wes Gamble
 I have reviewed the contents of 
http://wiki.github.com/radiant/radiant/modifying-the-page-ui in depth.


I have extension that modifies the user model to be attached to 
something called a program, and I've made the change in the DB, and 
modified the user model in my extension code like so:


User && class User < ActiveRecord::Base
  belongs_to :program
end

so that the association will be there.

Now, I would like to be able to display and edit program assignments for 
a given user in the admin. UI.


In my extension's "activate" method, I added the following lines in the 
hopes of customizing the UI:


admin.user.edit.form << 'edit_program'
admin.user.index.thead << 'program_header'
admin.user.index.tbody << 'program_cell'

thinking that the display of the user admin was super dynamic and it 
would just figure out how to display the edit components based on 
attribute type.


But when I try to look at the index view of users, I get:

"`program_header' default partial not found! `program_cell' default 
partial not found!" as errors in the index display.


and

`edit_program' default partial not found! as an error in the edit display.
**
After looking into it, though, I see the admin/users/edit and 
admin/users/index views under the Radiant core are more or less 
hard-coded at the column level, but the error messages imply that I 
should be able to add a partial somewhere for my custom fields.


Questions:

What is the preferred way to customize at this level?

Do I need to just override the entire edit and index views?

Is there some Javascript-y way to do this that I'm missing?

Many thanks,
Wes


[Radiant] create new page on heroku

2010-08-12 Thread Steven Southard
With 9.1 on Heroku I am having a problem saving new pages.  It saves  
pages I made on my localhost just won't make a new one.


I get this:

ActiveRecord::StatementInvalid (PGError: ERROR:  invalid input syntax  
for integer: ""
: SELECT * FROM "page_parts" WHERE ("page_parts"."id" IN ('','')) AND  
("page_parts".page_id = NULL)  ORDER BY id):
  /home/slugs/258179_58f1601_b92e/mnt/.gems/gems/will_paginate-2.3.14/ 
lib/will_paginate/finder.rb:170:in `method_missing'
  radiant (0.9.1) app/controllers/admin/resource_controller.rb:64:in  
`create'


Is there a problem with page_parts or will_paginate-2.3.14?  Any ideas?


Cheers,


Steven





Re: [Radiant] TinyMCE _images_sizes.html.haml

2010-08-12 Thread Steven Southard


On Aug 12, 2010, at 5:10 PM, Steven Southard wrote:



On Aug 11, 2010, at 2:30 PM, Jim Gay wrote:




On Wed, Aug 11, 2010 at 2:43 PM, Steven Southard > wrote:
Is this caused by migrating paperclipped before settings?  I read  
something about that but why does that cause a problem?  Is there a  
good way to fix the issue if it really is an issue?


Cheers,

Steven

On Aug 10, 2010, at 11:51 AM, Steven Southard wrote:

I have the same thing now.  Did you ever get an answer?

Cheers,

Steven

See this 
http://saturnflyer.com/blog/jim/2010/06/29/ruby-metaprogramming-is-awesome/
That's only a short-term solution.

As for you TinyMCE error, I don't know. I haven't used it.


2) Upon trying to browse for an image when clicking the insert image
button using the TinyMCE wysiwyg editor I get the following error:

--

Showing vendor/extensions/tiny_paper/app/views/admin/tiny_paper/
_images_sizes.html.haml where line #6 raised:

undefined method `each' for #
Extracted source (around line #6):

3: %p= asset.title
4: %div
5:   %table#sizes
6: - @thumbnails.each do |k, v|
7:   %tr
8: %th= link_to k, asset.asset.url(k)
9: %td= asset.width(k).to_s + 'px x ' +  
asset.height(k).to_s +

'px'

--

Has anyone else encountered this problem or have any idea/clue as how
to fix it. Any help is appreciated.

Kind Regards
Rich



--
Jim Gay
Saturn Flyer LLC
http://www.saturnflyer.com
571-403-0338


This is the first time I've used it and so far I could say it is  
kind of what I've been avoiding.  I really believe if people gave  
textile a chance for a week they would get it.  This seems hard to  
use properly, but my client thinks it looks great if only the photo  
thing would work.


http://github.com/Aissac/radiant-tiny-paper-extension/issues/issue/1

I really like this:
archercom May 19, 2010 | link
nevermind, I had to make sure the settings extension was raked  
before paperclipped


cristi May 25, 2010 | link
fixed and closed



Is this really true?  Does setting need to be raked first?  Is this  
something I should change in environment.rb.



Cheers,


Steven






I still don't know about the setting needing racked first but the  
tiny_paper problem seemed to be solved when I got the proper version.


Cheers,


Steven




Re: [Radiant] TinyMCE _images_sizes.html.haml

2010-08-12 Thread Steven Southard


On Aug 11, 2010, at 2:30 PM, Jim Gay wrote:




On Wed, Aug 11, 2010 at 2:43 PM, Steven Southard > wrote:
Is this caused by migrating paperclipped before settings?  I read  
something about that but why does that cause a problem?  Is there a  
good way to fix the issue if it really is an issue?


Cheers,

Steven

On Aug 10, 2010, at 11:51 AM, Steven Southard wrote:

I have the same thing now.  Did you ever get an answer?

Cheers,

Steven

See this 
http://saturnflyer.com/blog/jim/2010/06/29/ruby-metaprogramming-is-awesome/
That's only a short-term solution.

As for you TinyMCE error, I don't know. I haven't used it.


2) Upon trying to browse for an image when clicking the insert image
button using the TinyMCE wysiwyg editor I get the following error:

--

Showing vendor/extensions/tiny_paper/app/views/admin/tiny_paper/
_images_sizes.html.haml where line #6 raised:

undefined method `each' for #
Extracted source (around line #6):

3: %p= asset.title
4: %div
5:   %table#sizes
6: - @thumbnails.each do |k, v|
7:   %tr
8: %th= link_to k, asset.asset.url(k)
9: %td= asset.width(k).to_s + 'px x ' + asset.height(k).to_s +
'px'

--

Has anyone else encountered this problem or have any idea/clue as how
to fix it. Any help is appreciated.

Kind Regards
Rich



--
Jim Gay
Saturn Flyer LLC
http://www.saturnflyer.com
571-403-0338


This is the first time I've used it and so far I could say it is kind  
of what I've been avoiding.  I really believe if people gave textile a  
chance for a week they would get it.  This seems hard to use properly,  
but my client thinks it looks great if only the photo thing would work.


http://github.com/Aissac/radiant-tiny-paper-extension/issues/issue/1

I really like this:
archercom May 19, 2010 | link
nevermind, I had to make sure the settings extension was raked before  
paperclipped


cristi May 25, 2010 | link
fixed and closed



Is this really true?  Does setting need to be raked first?  Is this  
something I should change in environment.rb.



Cheers,


Steven





[Radiant] Additional layers of tabs in admin interface

2010-08-12 Thread Wes Gamble

 All,

Can I generate another level of tabs in the admin interface, so that I 
have one tab at the top level and then when I click it, I see several 
sub-tabs, and under each of those I see various buttons?


Thanks,
Wes


Re: [Radiant] rack 1.0.1 and rack 1.1.0 problem with radiant-0.9.0.rc2 and rails 2.3.8

2010-08-12 Thread john muhl
On Wed, Aug 11, 2010 at 2:06 PM, Paulo Abreu  wrote:
> I'm trying to install radiant cms version 0.9.0 rc2 in ubuntu with
> passenger and rails 2.3.8 and I'm having the following error:

if this is a new installation i'd recommend using 0.9.1 as it will be
more stable than an outdated rc version.


[Radiant] image attachment question

2010-08-12 Thread swoany
Hi,

On the homepage there is a block with 4 houses (pages) .   How can i
attach the correct image to link and summary?  I use paperclipped for
assets management.


  
  


  


  
  Bekijk villa

  



Thanks in advance..

remco



Re: [Radiant] rack 1.0.1 and rack 1.1.0 problem with radiant-0.9.0.rc2 and rails 2.3.8

2010-08-12 Thread Bill
Paulo Abreu,

Editing the gemspec worked for me

/gems/1.8/specifications/radiant-0.8.2.gemspec

s.add_runtime_dependency(%q, [">= 1.0.0","< 1.2.1"])


>>> But with pre-0.9, you can fix the radiant gem spec:
>>> 
>>> /gems/1.8/specifications/radiant-0.8.2.gemspec
>>> 
>>> Change the line:
>>>   s.add_runtime_dependency(%q, [">= 1.0.0"])
>>> to:
>>>   s.add_runtime_dependency(%q, [">= 1.0.0","< 1.1.0"])


Or, You may can edit : (note I received from : Jeff Casimir)

/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/radiant-0.8.2/vendor/rails/actionpack/lib/action_controller.rb

change the gem rack line to 1.1.0.  

Changing the gemspec should just change the install-time dependencies, not the 
load time requirements -- unless I'm mistaken.  This change to action 
controller affects the loadtime.



On Aug 11, 2010, at 12:06 PM, Paulo Abreu wrote:

> Hello,
> 
> I'm trying to install radiant cms version 0.9.0 rc2 in ubuntu with
> passenger and rails 2.3.8 and I'm having the following error:
> 
> can't activate rack (~> 1.0.1, runtime) for [], already activated
> rack-1.1.0 for ["radiant-0.9.0.rc2"].
> 
> I have rack 1.0.1 and rack 1.1.0 installed in my system.
> 
> How can I overcame this problem? uninstalling rack 1.1.0 is not an
> option since my other rails applications stop to work.
> 
> Regards,
> 
> Paulo Abreu
> 
> -
> my gem list:
> 
> *** LOCAL GEMS ***
> 
> actionmailer (2.3.8)
> actionpack (2.3.8)
> activerecord (2.3.8)
> activeresource (2.3.8)
> activesupport (2.3.8)
> authlogic (2.1.6)
> bundler (0.9.26)
> rack (1.1.0, 1.0.1)
> radiant (0.9.0.rc2)
> rails (2.3.8)
> rake (0.8.7)
> RedCloth (4.2.3)
> sqlite3-ruby (1.3.1)
> will_paginate (2.3.14)



[Radiant] page with image?

2010-08-12 Thread swoany
Hi,

My pages are filled with content off houses/appartments. We have 1
image for the homepage and 9 for the landingpage.

What is best way to realize it?

remco


[Radiant] rack 1.0.1 and rack 1.1.0 problem with radiant-0.9.0.rc2 and rails 2.3.8

2010-08-12 Thread Paulo Abreu
Hello,

I'm trying to install radiant cms version 0.9.0 rc2 in ubuntu with
passenger and rails 2.3.8 and I'm having the following error:

can't activate rack (~> 1.0.1, runtime) for [], already activated
rack-1.1.0 for ["radiant-0.9.0.rc2"].

I have rack 1.0.1 and rack 1.1.0 installed in my system.

How can I overcame this problem? uninstalling rack 1.1.0 is not an
option since my other rails applications stop to work.

Regards,

Paulo Abreu

-
my gem list:

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
authlogic (2.1.6)
bundler (0.9.26)
rack (1.1.0, 1.0.1)
radiant (0.9.0.rc2)
rails (2.3.8)
rake (0.8.7)
RedCloth (4.2.3)
sqlite3-ruby (1.3.1)
will_paginate (2.3.14)


[Radiant] Re: Paperclipped (assets) and s3 path problem

2010-08-12 Thread cmyk
The problem was, that I set the path using assets.s3.path instead of
assets.path.
No wonder it created the whole path, since it defaults to this one:
:path => Radiant::Config["assets.path"] ?
Radiant::Config["assets.path"] : ":rails_root/
public/:class/:id/:basename:no_original_style.:extension"

Cheers,
Phil

On 11 Aug., 15:13, Philipp Ringli  wrote:
> Hi Keith,
>
> Thanks for your reply.
> I had the settings in place. I tried your setting, restarted apache and the 
> path looks still like 
> this:http://s3.amazonaws.com/com-sichtwerk-imuw-ch/Users/cmyk/Sites/imuw-c...
> It should look like, 
> no?:http://s3.amazonaws.com/com-sichtwerk-imuw-ch/public/assets/9/grt.jpg
>
> The problem is, that it won't find the assets once I push it to heroku.
>
> Phil
>
> On 11.08.2010, at 10:26, kbingman wrote:
>
>
>
> > You need to set the path in you Radiant::Config. I use the Settings
> > extension to make it easier.
>
> > Here is mine: :class/:id/:basename:no_original_style.:extension
>
> > Hope that helps
>
> > keith
>
> > On Aug 9, 7:18 pm, cmyk  wrote:
> >> I've got an issue with the paperclipped extension and s3.
> >> I set it to use S3 and it works, but the path it saves the images to
> >> (on the s3 server) looks exactly like the path on my system (/Users/
> >> cmyk/Sites/etc...)
> >> And when I upload something on heroku, the path looks like disk1/home/
> >> slugs etc..
> >> Any ideas on how to fix that?


[Radiant] Radiant 0.9.1 + reader extension problems

2010-08-12 Thread swartz
I'm trying to see if reader extension would work for me.
I have Rails 2.3.8. installed Radiant gem 0.9.1 + share_layouts from
spanner's github repo and then latest reader from spanner's github as
well

I ran the migrations, everything is going good. I can create users and
login successfully.
But as soon as I try to use reader tags inside pages, things just
don't work right.

After logging in, I can go to /login and it tells me I've successfully
logged in.
But then if I attempt to view a page (its type set to Application to
avoid caching) that has tags like these

We got reader!!!

or



it does not see that there is a current_reader logged in.

After some debugging, it appears that around line 260 (http://
github.com/spanner/radiant-reader-extension/blob/master/lib/
reader_tags.rb)

260:  if tag.locals.reader = Reader.current

Reader.current is remains nil

I've looked at the 
http://github.com/spanner/radiant-reader-extension/blob/master/lib/controller_extensions.rb
where Reader.current gets set, but can't figure out what's wrong.

There is nothing alarming in the logs.

I can't figure out why that is. The app sees a valid login, but the
tag's don't get the current_reader and thus don't work.

Any ideas?