# Thesis ### Thesis is a CMS gem that integrates as seamlessly as possible into your current Rails website. Most Rails content management systems make you conform to their system from the start, making it difficult to just "drop in" the gem and make it work with your CMS. Thesis tries to be a drop-in CMS that doesn't hijack your development workflow and stays out of the way. ### Requirements * Rails 3.2.x (or higher) * Ruby 1.9.3 (or higher) Thesis might work with earlier versions but that's not our focus. ## Getting Started ### Installation In your Gemfile: gem 'thesis' Then run these from your command line: bundle install rails g thesis:install rake db:migrate This will install thesis and add the database tables. ### Authentication **Thesis does not force you to use a particular authentication strategy.** Instead, it adds a method into your application_controller.rb file that allows you to hook up your own authentication logic. * If you return `false` from this method, nothing will show up client-side nor will the page be editable. * If you return `true` from this method, the Thesis editor will appear and the page will be editable. ```ruby # Thesis authentication def page_is_editable?(page) # Add your own criteria here for editing privileges. Examples: # current_user.admin? # Basic admin # can? :update, page # CanCan true # EVERYONE has access right now. end ``` ### Page Templates Thesis's installer will drop a `page_templates` folder into your `app/views` folder. This is where you put different styles of pages for use in the CMS. Thesis will install an ERB, [HAML](http://haml.info), or [Slim](http://slim-lang.com) version, depending on your configuration. #### Meta information Pages come with a few built-in fields for use in meta tags. ```haml %title= current_page.title %meta{ content: current_page.description, type: "description" } ``` #### Thesis Editor Place this right after your opening `body` tag to embed the Thesis editor. It will only show up if your `page_is_editable?` method returns `true`. ```haml %body = thesis_editor ``` #### Page title ```haml %h1= current_page.title ``` #### Primary Navigation Use `root_pages` to get a list of pages at the root level. You can use the page's `name` and `path` accessors in your links. ```haml %nav %ul %li= link_to "Home", root_path # You can mix and match dynamic and static pages - root_pages.each do |p| %li= link_to p.name, p.path %li= link_to "Static Page", static_page_path ``` #### Page content Content areas are accessible from any page using the `content` method. This method takes two arguments: name and type. Type defaults to `:html`. The only other type is `:text` (for now) which is plain text, no HTML accepted. Both content types will wrap their content in a `