Simple CMS in Rails
GreekSolution Simple CMS in Rails.
Rails version: 3.2
Ruby version: 1.9.3
Simple CMS is a nice project to be used as a base for more complex projects. I used as much as I could the best practices as I know and understand them and it is also in HTML5.
I've build it for creating some simple sites and for helping some friends learn / mess around with Ruby on Rails.
I also tried to keep it as simple as possible and I'll add more functionality in the future, probably using Rails Engines. It's also a nice project for beginners to explore and learn some basic things for Rails. If you have ideas, feedback or you need help, send me an email at [email@example.com] (mailto:firstname.lastname@example.org).
Installation - Absolute Beginner's Guide
Follow the steps below to install and use it:
git clone email@example.com:johndel/Rails-Simple-CMS.git
bundle installto install the necessary gems
- Create a database.yml or change the config/database.yml.example to config/database.yml file and fill in the credentials (beware of the socket! It depends on OS, I am using ubuntu so this is what it fits for me)
- Open the db/seeds.rb file and change the User.create to fit your needs (set an email and password for login to the administration panel)
rake db:create:allto create your databases
rake db:schema:loadto create database schema
rake db:seedto load some basic data
passenger start(install the passenger gem) to begin server
- Go to localhost:3000 and check if everything is working great! Your site is served :)
- For admin login, go to localhost:3000/admin/login and type your credentials
You can also load the schema from mysql (like the old days if you missed them). I've included gscms.sql file in the root path of the app, just type:
mysql -u username -ppassword -h localhost database_name < gscms.sql
or use any other shiny GUI MySQL interface - database interface to import it. Credentials of the file:
For production, be sure to write
rake assets:precompile first or if you are deploying with capistrano, let
load "deploy/assets" in the config/deploy.rb .
Some basic info about using it
(Pretty boring, just mess around with the project! Only for geeks who read the manual first...)
I've used mercury editor (AWESOME editor for people who just want something shiny and fast and don't know HTML) for editing content. For adding images just drag and drop them.
You can also edit html with two ways, either from the edit preferences, using content or from mercury.
Also I've added a simple count for SEO awareness in the edit-preferences (for the content it doesn't count the white spaces / line breaks and html tags as words / characters).
Create Sitemap just generates a sitemap.xml inside the public folder. I am also using page caching which is sweeped away on save / destroy pages and in sorting menus.
Currently I've added only one menu, even though you can hack around and add as many as you want. Every menu has a page_position, you can sort pages with drag and drop and edit the name of the menu (if you want to display it somewhere).
You can edit / delete users, there aren't any role management. I tried to keep it simple, remember?
Currently you can only change your displayed homepage. I'll add more functionality in the future.
For creating your layout, just hack around the app/views/layouts/pages.html.erb layout and app/views/pages/index.html.erb (it is for the index page) and views/pages/show.html.erb (it is for all the rest pages).
As you probably have guested, you can have different views between index page and all the other pages.
You can clear cache any time by visiting page http://yourdomain.com/admin/pages/clear_cache (you need to be logged in as administrator).
Edit to fit your needs / Developer's guide
The database has a general purpose table ( EAV ) with the name settings. I've created some projects which have a sidebar included and I've added it here. You can store anything you feel good in here and fits in your project.
Menus and pages is a typical many-to-many database relationship with the association table named page_menu_mappings. It also has a typical CRUD users table and a mercury_image for storing images for mercury editor. That's it! For now...
I've added mercury-gem under vendor/mercury-gem because I've added some things like authentication and a custom exit button. I'll keep it updated though in the future releases.
Pages should have at least a name and a clean url to be saved. Menus should have at least a name.
Future simple implementations
- Write more interaction tests
- Mercury - on save button, inform the user
- Better workflow for page creation
- Add trackback and pingback
- Inline editing for some elements
- Fix page_position to be inserted automatically (a small bug)
- Breadcrumb rescue on Backend, sometimes it brokes, I have to find out when
Future ideas (sorted with what I think best / most important to add)
- Photo Gallery / Video Gallery
- MarkitUp editor for some more experienced users
- Create custom layout / modules with a nice drag and drop interface and transfer content in every area of the project you like
- ... Your ideas here!!! Send me an email :)
I've used the awesome setup of Ryan Bates (How I test). Just type
guard and hit enter to run the tests. Some tests maybe failing but I'll fix them in the future.
If you are on a OSX you may need to customize it a bit to run the tests, just watch Ryan.
Feel free to use it as you like. I'd love to hear your comments about. Thank you!