-
Notifications
You must be signed in to change notification settings - Fork 0
Rails plugin for site wide announcements
License
zerobearing2/announcement_fu
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
*********************************************************************************** * * CAUTION: this is very early development, pre-beta; not recommended for use yet! * *********************************************************************************** Announcement Fu ============== Site wide announcements made easy. I needed a way to provide site wide announcements for many different projects After searching around for a plugin that already encapsulated the announcement functionality, I realized there isn't much out there. So in true hacker fashion, I wrote my own. Inspired by Railscast Episode #103 - Thanks to Ryan Bates for show us the way. http://railscasts.com/episodes/103-site-wide-announcements Install ============== You need to create a migration with the following: ---------------- > script/generate migration Announcements class Announcements < ActiveRecord::Migration def self.up create_table :announcements, :force => true do |t| t.text :message t.datetime :starts_at t.datetime :ends_at t.timestamps end add_index :announcements, [:starts_at, :ends_at] end def self.down drop_table :announcements end end > rake db:migrate Add routes: ---------------- > mate config/routes.rb ActionController::Routing::Routes.draw do |map| ... map.announcements ... end Add announcements to layout/view: ---------------- ... <%= display_announcements %> ... Add CSS styling (customize as needed): ---------------- #announcement { position: absolute; z-index: 1000; left: 50%; top: 0px; width: 800px; margin-left: -400px; border: 1px solid #666; border-top: none; background-color: #FFDEDF; color: #501D00; padding: 5px; font-size: 1.1em; } #announcement h1, #announcement h2, #announcement h3, #announcement h4, #announcement h5 { font-size: 1.1em; font-weight: bold; } #announcement a { position: absolute; right: 5px; bottom: 5px; } Configuration ============== Default configurations: { :table => "announcements", :header => "Attention:", :hide_label => "[x] close" } You may override this default by setting AnnouncementFu::Base.config inside config/initializers or config/environment.rb, for example: AnnouncementFu::Base.config[:table] = "notices" Copyright (c) 2009 zerobearing2, released under the MIT license
About
Rails plugin for site wide announcements
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published