Showing posts with label BrowserCMS. Show all posts
Showing posts with label BrowserCMS. Show all posts

29 January 2010

Generating Calendar With Rails

Download the source code from GitHub

Working on a Rails CMS based project using BrowserCMS, there was a requirement to have a page which would display a calendar for the current month and onClick of each date, it has to make an Ajax request to query the database table and update a portion on the same page.

Everything is fine with the requirement, but a Rails calendar with each date sending an Ajax request to the controller?

My initial move was to look for some Rails plugin which would serve this purpose. Had a thorough Google search on this. Time was ticking, I managed to find one or two Rails calendar Plugin, but when tried on my project, it did not serve the exact purpose of each date sending the Ajax request. No much help was there on this in any Rails based forum as well.

This finally made me to think of writing the code for generating the calendar of my own. It was indeed going to be a tough task. But I had no other choice left in-front of me.

I have shared the code for the same through my GitHub account.

There in the GitHub repository you will find only a controllers folder and a views folder. Well that's all we need to get this done. If you have a Rails project up and running, you can go ahead and generate this Calendar Controller and use the code and modify it, style it as per your own requirement.

Here what I have done is, in the "calendar index" page you can see the calendar for the current month, with links for next and previous months, so that you can have a view of all the months. When you click on the next/previous links, the months partial is being updated. Similarly, onClick of each date will update a test "div" with the value of month and date. You can apply any logic here and make it work for your purpose.


Ruby/Rails Tips for the day:

=>How to get the starting day of the month ?

Loading development environment (Rails 2.3.5)
>> date = Date.today
=> Fri, 29 Jan 2010
>> start_date = Date.parse "#{date.year}-#{date.month}-01"
=> Fri, 01 Jan 2010

=>How to get the last day of the month ?

>> last_date = (start_date >> 1)-1
=> Sun, 31 Jan 2010

=>How to get the weekday of a particular date?

>> start_date.wday
=> 5

Special thanks to Nithin Bekal who helped me in getting this work done in no time.
If anyone uses this code for their application, please share with me the improvements made.

10 January 2010

Moving along with BrowserCMS

As I have mentioned in one of my previous posts that, the project I am associated at present deals with setting up a Content management System using BrowserCMS. Its been quite a some time I am involved in this project and in the mean time learnt a lot about this CMS. The best part is that, the CTO of BrowserMedia Mr.Patrick Peak would answer to any of your doubts related to BrowserCMS. I have had a lot of questions related to BCMS and most of them were answered by him in a matter of day. So Iam really thankful to him and really appreciate the work he has been doing.

This project is taking quite a bit of time to get it completed because of some special requiremnts from the client like setting up Multi Language functionality. Though BrowserCMS don't have a built in support for i18n(As told by Mr.Patrick Peak,CTO BrowserMedia), It was a huge challenge for me to bring some unique concept of Multi Language functionality in Browser CMS. Well, I did make a quite a bit of research on this and finally came up with indeed a unique concept to get this requirement done.
The concept has been explained to our client and is waiting to get his approval.

In the coming posts you can expect, the Idea behind setting up the Multi Language Functionality using browser CMS. So stay tuned. Till then CiaO

Ruby Tip of the day:

To check if there is an item in an array...
>> ['Cat', 'Dog', 'Bird'].include? 'Dog'
=> true

09 December 2009

BrowserCMS - RoR Content management System

Hi
These days I am busy learning new technical stuffs from Rails framework to wordpress developments. Recently I am engaged with a project which is related to Rails Content Management System. And among the various content management systems available for Rails framework, I am doing this project in BrowserCMS.



Quoting the description about BrowserCMS's from their WiKi,


BrowserCMS is a general purpose, open source Web Content Management System (CMS), written in Ruby on Rails. It is designed to support three distinct groups of people:
  1. Non-technical web editors who want a humane system to manage their site, without needing to understand what HTML or even Rails is.
  2. Designers who want to create large and elegantly designed websites with no artificial constraints by the CMS.
  3. Developers who want create CMS driven websites for their clients, or add a CMS to their Rails applications.



The very first thing every developer would do is install the BrowserCMS system in their local server and once learn how to go about using it, then move on to installing the system over the server and deploy the application.


The funny part is , In my case it all began in a reverse order.


We have got hosting account from HostingRails, where as our client has got hosting account from WebbyNode.


Initially we configured the BrowserCMS on HostingRails which worked fine as we were successfull in deploying the BrowserCMS demo site. Later on we did the same over WebbyNode and were successfull there too.


As I wanted to work on this project on my local machine and later on deploy it over the server, I went ahead and tried installing it on my local server which was also a successful attempt.


In upcoming days I will be posting step by step instructions, how I was able to install BrowserCMS over localhost in my computer and also various technical aspects on BrowserCMS.


So if you are a rails developer and is interested about BrowserCMS, do get back to get more updates.