Re: [Radiant] Extend ApplicationHelper

2011-10-11 Thread Shanison
Thanks for the reply. However if i create new helper module, it won't behave 
as application_helper. So there is not method inheritance.  Then for other 
modules that i need to use some codes inside this helper, i need to include 
the new module?

Re: [Radiant] Extend ApplicationHelper

2011-10-11 Thread Shanison
You have the following application helper

module ApplicationHelper
  def method_a
  end
end

Then if you have other helper
module OtherHelper
  def b
   method_a # i can call method a here
  end
end

I am not sure how this actually works since module has not inheritance. So 
my question is if I didn't extend the applicationhelper module, but create a 
new module for it, let's say UserHelper. Then in any other helper module, i 
need to include this UserHelper module if the helper module needs to use 
some of the codes in it. Hope i get myself clear.


Re: [Radiant] Extend ApplicationHelper

2011-10-11 Thread Shanison
I have follow the code in help extension. But it doesn't seem to work. I am 
using Radiant 0.9.1. I have a a common_helper.rb under my extension 
my_extension/app/helpers/common_helper.rb. So under
class MyExtensionExtension  Radiant::Extension
   def activate
  ApplicationController.class_eval{
helper CommonHelper
  }
   end
end

But the methods in CommonHelper is not visible in the view. I always get 
undefined methods error for ActionView::Base. However i move the code to the 
following then it works. I suspect it is the loading order problem.

require_dependency 'application_controller'
ApplicationController.class_eval{
  helper CommonHelper
}

class MyExtensionExtension  Radiant::Extension
   def activate
   end
end

I saw some extension directly include the Helper for ActionView::Base and it 
works.
ActionView::Base.send :include, ShareLayouts::Helper


[Radiant] Extend ApplicationHelper

2011-10-09 Thread Shanison
Hi all,

I have some methods that needs to be used by all helpers in the
extensions. So I need to add some methods to ApplicationHelper. I
can't just create the application_helper.rb in my extensions, it will
just overwrite the application_helper in radiant and only my own
methods in the application_helper.rb is visible.

I tried to do ApplicationHelper.send(:include,
MyExtensions::ApplicationHelperExtensions) when activating the
extension. However, those methods in ApplicationHelperExtensions are
also not visible to my helpers. I tried to use rails console and do
ApplicationHelper.instance_methods.include?('my_method_name')

It returns true. I don't understand why my helpers are not able to
pick up those methods. Any help is appreciated. Thanks.


[Radiant] Exclude extensions with :all present

2011-07-25 Thread Shanison
Hi all,

I try to exclude some certain extension, however, with the :all keyword, the 
-= doesn't work.
config.extensions = [ :share_layouts, :all]

config.extensions -= [:markdown_filter]

I understand the reason as pointed by Jim last time 
at https://groups.google.com/forum/#!topic/radiantcms/h55I9AKHg9o

So is there a workaround for this for Radiant 0.9.1? It would be very 
troublesome if I need to specify every single extensions to load. Thank you.






Re: [Radiant] Re: Multiple Server Deployment for Radiant

2011-06-27 Thread Shanison
Hi WIlliam,

Thanks a lot for the reference. Yes, static file would perform better 
compares to storing large BLOB in db. If i have to use the database method, 
i should think of a way of generating the files out from the db and serves 
as a cache and have to think of invalidating the cache if the files are 
updated.

It is a pity that there were not call back that we can hook up to do some 
file management after uploading or deleting. Have to alias the methods to 
achieve the purpose. 


Regards,
Shanison


[Radiant] Re: Multiple Server Deployment for Radiant

2011-06-26 Thread Shanison
Hi William,

Thank you very much for your detailed explanation and suggestion. This
is very helpful. For my case, actually it is for railover, so I think
I have to use rSync or write an extension that money patch the asset
manager, where upon any files uploaded to the server, I can do a
synchronization.

This is a bit trouble though. We have also thought of storing all
assets in the db instead. Synchronization of db is much easier and
efficient. But this means that we have to money patch the asset
manager again to make it store in db instead of file system.

Thanks,
Shanison

On Jun 20, 3:14 am, William Ross w...@spanner.org wrote:
 On 19 Jun 2011, at 16:54,Shanisonwrote:

  Hi all,

  I have one Radiant website but deployed to a few servers, and one of
  the server S1 will be used to serve static file content and serve as a
  reverse proxy and redirect dynamic page request back to the other
  servers S2, S3, S4. So my question is that when admin login to the
  admin page, it can be from any of the servers, S2 or S3, S4. If he
  uploads files e.g. images to S2, how can the rest of servers serves
  the files? If a request comes in to display a page and is served at
  S3, that images used in the page won't be displayed as it is not in
  the same server.

  Is there a way to synchronize it? Thank you.

 I've done this different ways in the past and the I think the right one would 
 depend on your reason for spreading across several servers in the first place:

 * If it's for load-sharing, and you can think of one of the servers as the 
 master, you may find it's enough just to redirect all requests for /admin and 
 /assets to the master.

 * if it's for redundancy and failover, you will need some scripting behind 
 radiant to move files around. Again, the method depends on your situation: 
 you can do it with rsync or an active push from the receiving server. It 
 would be easy to write an extension that triggered the mirroring script upon 
 image update, but note that you'd have to duplicate all the thumbnail sizes 
 as well as the original image.

 * If it's geographical, or the other two solutions don't appeal, you could 
 just use a CDN with uplift, or the built-in S3 support we get from paperclip.

 I think the most successful strategy I've used was to set up both database 
 servers (this was a rather paranoid and very busy site) as simple static-file 
 asset servers, and to direct all requests for static files from those two. 
 There were some rather basic rsync scripts to mirror uploaded assets. I 
 figured that if the database went down then the rest didn't really matter 
 anyway.

 If anyone knows a standard (cross-platform) way that we could meet this 
 requirement from within radiant's asset manager I'd be very happy to write it 
 in.

 For what it's worth, I don't deploy across multiple servers any more, apart 
 from a separate database host. More recently I've found that one decent 
 server with a long cache life is more efficient than several with only brief 
 caches (as they must be, because you're only ever clearing the cache on one 
 of them).

 best,

 will


Re: [Radiant] radiant-1.0 any time soon?

2011-05-15 Thread Shanison
It is great to hear that 1.0 is releasing soon. Can we know what are the new 
updates to 1.0? Thank you.

Re: [Radiant] radiant-1.0 any time soon?

2011-05-15 Thread Shanison
Thank you very much. Glad to see so many changes.

[Radiant] Re: if/unless. Proposal for a new conditional tag

2011-05-05 Thread Shanison
Current Radius tag design has determined that it can't use radius tag as 
attribute for radius tag. And the if else combination would add more 
complexity to the parsing of the Radius tag, which I feel that it may affect 
the performance issue.

[Radiant] Re: What's the snippet?

2011-05-05 Thread Shanison
I don't quite understand why you need to put a 'mode' for snippets. You 
wanna show the snippets according to different mode? All the snippets are at 
one place and has a name, so i don't understand when you are saying It 
would tremendously ease finding the respective snippet when looking 
at the rendered page. Maybe can explain more? Or anyone else can answer?

[Radiant] Re: Help My Sites are down and I am stumped

2011-04-23 Thread Shanison
Try uninstall gallery extension. I am not sure if gallery extension is
still compatible with the latest Radiant.

On Apr 23, 4:06 pm, Gilroy Rick rick.hoib...@gmail.com wrote:
 created a clean radiant application no extensions running sqllite:

 I am getting this on all my applications. Something is wrong with the
 environment. I started out the day trying to install the gallery
 extension and this is where I am at.  I also tried updating to the
 latest ruby-enterprise in the existing /opt/ruby-
 enterprise-1.8.7-2010.01/ directory.

 Any ideas would be appreciated!

 /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:417:in `load_missing_constant': Object is not missing
 constant StandardTags! (ArgumentError)
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:80:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:92:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:98:in `send'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:98:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/app/models/page.rb:32
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/
 rubygems/custom_require.rb:31:in `gem_original_require'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/
 rubygems/custom_require.rb:31:in `require'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:158:in `require'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:265:in `require_or_load'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:425:in `load_missing_constant'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:80:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:92:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/extensions/archive/app/models/archive_page.rb:1
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/
 rubygems/custom_require.rb:31:in `gem_original_require'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/
 rubygems/custom_require.rb:31:in `require'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:158:in `require'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:265:in `require_or_load'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:425:in `load_missing_constant'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:80:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:92:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:437:in `load_missing_constant'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/rails/activesupport/lib/active_support/
 dependencies.rb:96:in `const_missing'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/vendor/extensions/archive/archive_extension.rb:10:in
 `activate'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/lib/radiant/extension.rb:86:in `activate'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/ostruct.rb:83:in
 `to_proc'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/lib/radiant/extension_loader.rb:106:in `each'
         from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/
 radiant-0.9.1/lib/radiant/extension_loader.rb:106:in
 

[Radiant] Re: Radiant 0.9.1 - How to start the server in Windows

2011-04-09 Thread Shanison
First of all, Radiant doesn't work with Rails 3, ruby 1.8.7 is ok.

However, Radiant core itself comes with Rails 2. So no matter which rails 
you installed in your windows. It doesn't matter.

Since Radiant project you created is not Rails 3. So you shouldn't run rails 
server. But you should use ruby script/server instead.



[Radiant] Page Versioning Extensions

2011-04-05 Thread Shanison
Hi,

Has anyone tried the page versioning gems with Radiant 0.9.1? I tried
it out, but it is not working with Radiant 0.9.1.
http://ext.radiantcms.org/extensions/62-page-versioning

After installed the gem and I click save and preview, the page parts
are to my surprise deleted in database. So when you click to edit the
page, you will see empty page parts there. What's more, the normal
editing of page is also not working, you can't save the changes to a
page any more.

I am trying to figure out the codes where it breaks. I post this bug
on github but the author  didn't reply to my post.

p.s Personally I feel a lot of Radiant extensions are not keep up to
date and maintained. If you search for a gem, not many of them
indicates that it is compatible with Radiant 0.9. So I feel it is a
bit difficult for Radiant to keep moving.


[Radiant] Radiant CMS and mass assignment

2011-04-05 Thread Shanison
Hi,

Radiant use update_attributes method to update data in a lot of places. The 
parameter passed to update_attributes is a params hash passed in from user 
request. However I checked Radiant's models like Page, PagePart, they don't 
have *attr_accessible *to white list those fields allowed for updating. This 
is mass assignment. It is quite dangerous. What if the user manipulate the 
input param and add the parameter and set himself as a administrator? Maybe 
I missed out any other parts where Radiant did protect this? 

Thank you.


[Radiant] Re: Radiant CMS and mass assignment

2011-04-05 Thread Shanison
Ok, i just found out that in the User model there is unprotected_attributes 
and in preferences_controller there is valid_params? method that will check 
only these unprotected_attributes will be updated. so there is no way that 
user can modify the params and update the database. 

[Radiant] Re: Create Custom controllers and Views in Radiant

2011-03-10 Thread Shanison
Since I am able to create controllers and views in the customed extensions. 
Why can't we do so without packaging it as extensions?Anybody could help? Is 
there any reason for this?

[Radiant] Create Custom controllers and Views in Radiant

2011-03-09 Thread Shanison
Hi,

I have been searching to see if Radiant is able to integrate into
existing projects. And I saw this in the mail archive
http://www.mail-archive.com/radiant@radiantcms.org/msg04311.html It
seems that we can only package our existing projects as an extension
and put it in the Radiant project, but not the other way round.
However, I don’t understand that why we can’t do it.

In radiant project, there is no app folder, where it should contain
controllers, helpers and views.  So why can’t we create the directory
in this project. E.g. app/customs_controller.rb, and create an action
inside, and create the views. Now we just modify the routes.rb in
config/routes.rb to be able to map to this controller. Then we are
able to do any dynamic pages that we wanted. Isn’t it?

One of the concerns is that if we do this the future upgrade of
Radiant maybe difficult?

Thank you very much.
Shanison


[Radiant] Re: Need advice: NoMethodError (undefined method `authenticate' for #Class...

2011-03-09 Thread Shanison
authenticate is one of the class method in 'User' model for Radiant.
Make sure that you didn't modify the original source of the 'User'
model. Or else, you should check what extensions that you have
installed to check the possibility that it has overwrite this User
model.

On Mar 10, 2:26 pm, Dmitry Belitsky dmitry.belit...@gmail.com wrote:
 Hello, I can't login on the one of our site more.
 It show me application error when I try to log in.
 Please advice me what I can do to resolve this issue.
 Thanks a lot!

 Log file:

 Processing Admin::WelcomeController#login [POST]
   Parameters: {action=login,
 authenticity_token=FWUgEe7WTxcXHD1xoLufxhhlWMXrOW0=,
 controller=admin/welcome, user={password=[FILTERED],
 login=admin}}

 NoMethodError (undefined method `authenticate' for #Class:
 0xb7708250):
   radiant (0.8.1) app/controllers/admin/welcome_controller.rb:13:in
 `login'
   radiant (0.8.1) vendor/plugins/haml/rails/./lib/sass/plugin/rails.rb:
 19:in `process'
   thin (1.2.5) lib/thin/connection.rb:76:in `pre_process'
   thin (1.2.5) lib/thin/connection.rb:74:in `catch'
   thin (1.2.5) lib/thin/connection.rb:74:in `pre_process'
   thin (1.2.5) lib/thin/connection.rb:57:in `process'
   thin (1.2.5) lib/thin/connection.rb:42:in `receive_data'
   eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
   eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
   thin (1.2.5) lib/thin/backends/base.rb:57:in `start'
   thin (1.2.5) lib/thin/server.rb:156:in `start'
   thin (1.2.5) lib/thin/controllers/controller.rb:80:in `start'
   thin (1.2.5) lib/thin/runner.rb:177:in `send'
   thin (1.2.5) lib/thin/runner.rb:177:in `run_command'
   thin (1.2.5) lib/thin/runner.rb:143:in `run!'
   thin (1.2.5) bin/thin:6
   /usr/bin/thin:19:in `load'
   /usr/bin/thin:19

 Rendering /radiant/public/500.html (500 Internal Server Error)