Project

kublog

0.01
No commit activity in last 3 years
No release in over 3 years
Rails Mountable Engine that sets up your Product Blog, share your posts on facebook, twitter and E-mail your users with your latest product news
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0.0.beta14
>= 1.0.13
>= 0
>= 3.1.0
 Project Readme

Kublog¶ ↑

Kublog is a simple yet complete way to have a Product Blog that integrates with your apps user base. It includes social sharing, atom feeds and moderated comments.

Built for Rails 3.1, Kublog is a complete stack, fully configurable solution.

Currently live for Rutanet on rutanet.com/blog and other products at Innku.

Features¶ ↑

  • Publish posts with the most basic and simple wysiwyg

  • Attach multiple images to your content

  • Share your posts on your Product’s Twitter Page and Facebook Fan Page

  • E-mail personalized versions of your posts to all your users

  • Optional background processing with Delayed Job

  • Moderated comments from apps users, apps admins, and visitors

  • Atom feed for main blog and individual post categories

Kublog Basic Usage¶ ↑

Kublog is a mountable Engine that assumes you use the following tools for development:

  • Rails 3.1

  • ActiveRecord

Generate migrations and all the code you’ll likely want to customize.

rails generate kublog:install

Copy the migrations to the parent applications

rake kublog:install:migrations

Run the migrations

rake db:migrate

Mount the engine on your routes

mount Kublog::Engine => "/blog(.:format)"

Include the author module under the model that will have access to create posts on the blog:

class User < ActiveRecord::Base
  include Kublog::Author
end

Configure your blog’s basic information on initializers/kublog.rb

Kublog.setup do |config|
  config.blog_name = 'Example blog'
  config.blog_description = 'Best blog ever'
  config.default_url_options = {:host => 'www.exampleblog.com'}
end

Kublog uses I18n, the install generator will create the file locales/kublog/en.yml, make sure to add its content to your own en.yml file or add the following line on your application.rb also include the folders under locales:

config.i18n.load_path += Dir[File.join(Rails.root, 'config', 'locales', '**', '*.{rb,yml}')]

To get the most of Kublog you’ll want to **Integrate your Users**, **Add E-mail Notifications** and **Configure your Social Networks**.

Integrate your Users¶ ↑

The install generator will create the file controllers/kublog/application_controller.

On this file you will see the definitions of two empty methods current_user and **is_admin?**. Since Kublog is an isolated mountable Engine, you will need to define this methods, even if you have them on your apps application_controller.

After you finish, it might will look something like this:

def current_user
  @current_user ||= User.find(session[:user_id])
end

def is_admin?
  @current_user.admin?
end

It’s important to know that if you’re using Devise, you won’t need a current_user method. If the model you’re using is named something other than user, you can call the controller access method inside of current_user.

Author#to_s¶ ↑

I recommend you define a to_s method for your Author such as:

def to_s
  "#{self.name} #{self.last_name}"
end

Invited Author Funcionality¶ ↑

When editing a form, the admin can assign the post to an invited author. If this happens, the mails that are sent when a person comments on the post, are sent to the invited author and the admin that published the post.

Add E-mail Notifications¶ ↑

To add E-mail notifications, include the Kublog::Notifiable module into the user class that will be notified.

class User < ActiveRecord::Base
  include Kublog::Notifiable
end

The E-mail from which they will receive the notification is configured in your kublog.rb initializer:

config.author_email "Kublog Test <test@kublog.com>"

You may also configure a block to specify that the user receives the notification from the author’s E-mail:

config.author_email do |post|
  post.user.email
end

Configure your social Networks¶ ↑

Configuring Twitter is pretty easy, you might want to create a twitter app on dev.twitter.com/

You will need to feed Kublog:

  • Consumer Key

  • Consumer Secret

  • Oauth Token

  • Oauth Secret

Sample twitter configuration on initializers/kublog.rb¶ ↑

config.twitter do |twitter|
  twitter.consumer_key = 'your-consumer-key'
  twitter.consumer_secret = 'your-consumer-secret'
  twitter.oauth_token = 'your-oauth-token'
  twitter.oauth_token_secret = 'your-consumer-secret'
end

Configuring Facebook Fan page posts is a little trickier, you will only need the access token for your Fan Page.

Find out how to get it here: github.com/innku/authorizefb

Sample Facebook configuration on initializers/kublog.rb¶ ↑

config.facebook_page_token = 'your-page-token'

What’s coming ¶ ↑

  • Drafts

  • Captcha for unsigned user notifications

  • Pagination

If you wish to work on this. Fork it and pull request, please =)

Check out the code¶ ↑

Kublog is made to be as simple as possible so you can modify fork it, modify it and reuse it. Please do.