Every repository with this icon (
Every repository with this icon (
Customizing tog
Tog comes with a simple default community application. It’s only purpose is to see what tog can do and to serve as base for a real social web development.
Default user
After Installing tog you’ll have a running application. One of the first things you will do is check for the default user. There isn’t any. You will need to register and the first registered user will have admin privileges. So easy like that.
Please, note that this process follows the registration flow, so you will receive a mail for activation and so on, so, be sure that you have configured the mailer for you aplication properly!.
Upgrade tog and its plugins notice
We are working on a painless way of upgrading tog’s plugins. Unfortunatly this is not possible right now due to different reasons, so until them you will need to it by hand.
Anyway, independly of the way you upgrade your tog installation, it’s important that you make your customization changes in the main application, not in tog plugins directly. Thanks to desert, Tog class and template loader gives priority to aplication’s files over plugins’ files, so you’ll have the expected behavior and we can upgrade the system without breaking you site.
Check what we have.
Public site
Member area
Admin area
Customize it!
Customizing views
Tog comes with a set of templates, css stylesheets, images, icons, etc. The best way to customizing them is to copy the file from one of tog’s plugins to the main application and then change it to fit your needs.
For example. If we try to change conversatio’s (tog’s blog system) public index page, we should have to copy conversatio’s template (located in APP_ROOT/vendor/plugins/tog_conversatio/app/views/conversatio/blogs/index.html.erb) to the main aplication, wtih the same folder structure (that is: APP_ROOT/app/views/conversatio/blogs/index.html.erb) and change it.
For CSS and javascript, we recomend you to make a copy with a new name or define a new one from scracth, at least if you want to maintain the admin/backoffice site “as is”.
Customizing functionality
Adding methods and overriding them is very easy thanks to desert . If you want to add some functionality to a class in one of tog’s plugins, you don’t need to edit this class. Just write a new class with the same name in the same namespace, and write your own code on it. Only the new code. Tog and desert will merge both classes.
For example. tog_user comes with a class User in tog_user/app/model/user.rb
class User < ActiveRecord::Base ... end
When we developed tog_social, we wanted to add to the user some relationships, a new method for getting the full name and a beore_create method to create the profile at the same time as the user. So, we write in tog_social a class User in tog_social/app/model/user.rb with the code below and we are done!.
class User < ActiveRecord::Base
before_create :create_profile
has_one :profile, :dependent => :destroy
...
has_many :groups, :through => :memberships,
:conditions => "memberships.state='active' and groups.state='active'"
...
def name
profile.full_name
end
...
protected
...
def create_profile
self.profile ||= Profile.new
end
end
The same works for controllers.
Note that you will need to set class loading order (just set the require_plugin directives in the right places) to get this to work properly.






