Kblog¶ ↑
Simple blog-engine for rails. Authentication can be done either role-based or via http-basic-auth. No specific authentication-framework needed. No relation to author present.
installation¶ ↑
-
gem install kblog
-
rake kblog:migrations:install
-
rake db:migrate
-
rails g kblog # creates kblog_init.rb in config/initializers
-
add the engine to route.rb:
# routes.rb mount Kblog::Engine => “/kblog”
-
perhaps add provided css to your layoutfile:
<%= stylesheet_link_tag ‘kblog/articles’, :media => “all” %>
adopt config/initializer/kblog_init.rb:
role-based authentication:: role-based rights to create/alter blog-articles user_class must respond_to :roles - and each roles string representation role.to_s == Kblog.auth_role
expects current_user beeing available in views and controller
# config/initializer/kblog_init.rb Kblog.auth_type = ‘role’ Kblog.auth_role = ‘blogger’ # role needed to alter blogs
basic-auth:: makes use of simple http-basic auth. configure with desired name/passwword # config/initializer/kblog_init.rb Kblog.auth_type == ‘basic’ Kblog.authname = ‘blogger’ Kblog.authpassword = ‘changeme’
usage¶ ↑
-
add helper
use it for displaying <num> articles. if argument <truncate> is greater than 0 - blog-text will be truncated after <truncate> chars
<%= display_latest_articles(num,truncate=0) %>
to your views
-
if mounted to /kblog visit index: /kblog/articles -