silvermoon 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +8 -0
 - data/.rvmrc +1 -0
 - data/Gemfile +14 -0
 - data/Gemfile.lock +159 -0
 - data/Guardfile +21 -0
 - data/MIT-LICENSE +20 -0
 - data/README.md +83 -0
 - data/Rakefile +27 -0
 - data/lib/generators/silvermoon/install/install_generator.rb +16 -0
 - data/lib/generators/silvermoon/install/templates/silvermoon.yml +17 -0
 - data/lib/silvermoon.rb +54 -0
 - data/lib/silvermoon/action_controller_extension.rb +22 -0
 - data/lib/silvermoon/notifier.rb +18 -0
 - data/lib/silvermoon/notifier/base.rb +19 -0
 - data/lib/silvermoon/notifier/facebook.rb +35 -0
 - data/lib/silvermoon/notifier/twitter.rb +27 -0
 - data/lib/silvermoon/railtie.rb +11 -0
 - data/lib/silvermoon/version.rb +3 -0
 - data/silvermoon.gemspec +21 -0
 - data/spec/dummy/Rakefile +7 -0
 - data/spec/dummy/app/controllers/application_controller.rb +3 -0
 - data/spec/dummy/app/controllers/notifications_controller.rb +86 -0
 - data/spec/dummy/app/helpers/application_helper.rb +2 -0
 - data/spec/dummy/app/helpers/notifications_helper.rb +2 -0
 - data/spec/dummy/app/models/notification.rb +2 -0
 - data/spec/dummy/app/views/layouts/application.html.erb +14 -0
 - data/spec/dummy/app/views/notifications/_form.html.erb +29 -0
 - data/spec/dummy/app/views/notifications/edit.html.erb +6 -0
 - data/spec/dummy/app/views/notifications/index.html.erb +27 -0
 - data/spec/dummy/app/views/notifications/new.html.erb +5 -0
 - data/spec/dummy/app/views/notifications/show.html.erb +20 -0
 - data/spec/dummy/config.ru +4 -0
 - data/spec/dummy/config/application.rb +45 -0
 - data/spec/dummy/config/boot.rb +10 -0
 - data/spec/dummy/config/database.yml +22 -0
 - data/spec/dummy/config/environment.rb +5 -0
 - data/spec/dummy/config/environments/development.rb +26 -0
 - data/spec/dummy/config/environments/production.rb +49 -0
 - data/spec/dummy/config/environments/test.rb +35 -0
 - data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
 - data/spec/dummy/config/initializers/inflections.rb +10 -0
 - data/spec/dummy/config/initializers/mime_types.rb +5 -0
 - data/spec/dummy/config/initializers/secret_token.rb +7 -0
 - data/spec/dummy/config/initializers/session_store.rb +8 -0
 - data/spec/dummy/config/locales/en.yml +5 -0
 - data/spec/dummy/config/routes.rb +60 -0
 - data/spec/dummy/config/silvermoon.yml +12 -0
 - data/spec/dummy/db/migrate/20110906125229_create_notifications.rb +15 -0
 - data/spec/dummy/db/schema.rb +23 -0
 - data/spec/dummy/public/404.html +26 -0
 - data/spec/dummy/public/422.html +26 -0
 - data/spec/dummy/public/500.html +26 -0
 - data/spec/dummy/public/favicon.ico +0 -0
 - data/spec/dummy/public/javascripts/application.js +2 -0
 - data/spec/dummy/public/javascripts/controls.js +965 -0
 - data/spec/dummy/public/javascripts/dragdrop.js +974 -0
 - data/spec/dummy/public/javascripts/effects.js +1123 -0
 - data/spec/dummy/public/javascripts/prototype.js +6001 -0
 - data/spec/dummy/public/javascripts/rails.js +191 -0
 - data/spec/dummy/public/stylesheets/.gitkeep +0 -0
 - data/spec/dummy/public/stylesheets/scaffold.css +56 -0
 - data/spec/dummy/script/rails +6 -0
 - data/spec/integration/navigation_spec.rb +9 -0
 - data/spec/silvermoon/action_controller_extension_spec.rb +45 -0
 - data/spec/silvermoon/notifier/base_spec.rb +18 -0
 - data/spec/silvermoon/notifier_spec.rb +20 -0
 - data/spec/silvermoon_spec.rb +45 -0
 - data/spec/spec_helper.rb +34 -0
 - data/spec/support/config_helpers.rb +13 -0
 - data/spec/support/stubs.rb +15 -0
 - metadata +186 -0
 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rails'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Silvermoon
         
     | 
| 
      
 5 
     | 
    
         
            +
              module Notifier
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def self.config
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @@config ||= begin
         
     | 
| 
      
 9 
     | 
    
         
            +
                                 YAML.load_file("#{Rails.root}/config/silvermoon.yml").symbolize_keys[Rails.env.to_sym]
         
     | 
| 
      
 10 
     | 
    
         
            +
                               end
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def self.reload_config!
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @@config = nil
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Silvermoon
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Notifier
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                class Base
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_accessor :identifier
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def config
         
     | 
| 
      
 9 
     | 
    
         
            +
                    Silvermoon::Notifier.config[identifier.to_sym] || Silvermoon::Notifier.config[identifier.to_s]
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  def notify(title, content, url, extras = {})
         
     | 
| 
      
 13 
     | 
    
         
            +
                    raise NotImplementedError
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'koala'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Silvermoon
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Notifier
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Facebook < Base
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  def identifier
         
     | 
| 
      
 8 
     | 
    
         
            +
                    :facebook
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def notify(title, content, url, extras = {})
         
     | 
| 
      
 12 
     | 
    
         
            +
                    Rails.logger.info("Notifying Facebook: #{title}, #{content}, #{url}")
         
     | 
| 
      
 13 
     | 
    
         
            +
                    comment = extras.delete(:comment)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    graph.put_wall_post(comment, {:link => url, :description => content, :picture => ''}.reverse_merge(extras), nil, :use_ssl => false)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def oauth
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @oauth ||= ::Koala::Facebook::OAuth.new(config['app_id'], config['app_secret'])
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def graph
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @graph ||= ::Koala::Facebook::GraphAPI.new(access_token)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  def access_token
         
     | 
| 
      
 26 
     | 
    
         
            +
                    @access_token ||= begin
         
     | 
| 
      
 27 
     | 
    
         
            +
                                        token = oauth.get_app_access_token
         
     | 
| 
      
 28 
     | 
    
         
            +
                                        raise "Cannot obtain access token" unless token
         
     | 
| 
      
 29 
     | 
    
         
            +
                                        token
         
     | 
| 
      
 30 
     | 
    
         
            +
                                      end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Silvermoon
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Notifier
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Twitter < Base
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def configure
         
     | 
| 
      
 6 
     | 
    
         
            +
                    ::Twitter.configure do |c|
         
     | 
| 
      
 7 
     | 
    
         
            +
                      c.consumer_key       = config['consumer_key']
         
     | 
| 
      
 8 
     | 
    
         
            +
                      c.consumer_secret    = config['consumer_secret']
         
     | 
| 
      
 9 
     | 
    
         
            +
                      c.oauth_token        = config['oauth_token']
         
     | 
| 
      
 10 
     | 
    
         
            +
                      c.oauth_token_secret = config['oauth_token_secret']
         
     | 
| 
      
 11 
     | 
    
         
            +
                    end
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def notify(title, content, url, extras = {})
         
     | 
| 
      
 15 
     | 
    
         
            +
                    Rails.logger.info("Notifying Twitter: #{title}, #{content}, #{url}")
         
     | 
| 
      
 16 
     | 
    
         
            +
                    twitter.update(title[0..140])
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def twitter
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @twitter ||= begin
         
     | 
| 
      
 21 
     | 
    
         
            +
                                   configure
         
     | 
| 
      
 22 
     | 
    
         
            +
                                   ::Twitter::Client.new
         
     | 
| 
      
 23 
     | 
    
         
            +
                                 end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        data/silvermoon.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
            $:.push File.expand_path("../lib", __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "silvermoon/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.name        = "silvermoon"
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.version     = Silvermoon::VERSION
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.authors     = ["Luiz Felipe G. Pereira"]
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.email       = ["luiz.felipe.gp@gmail.com"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.homepage    = ""
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.summary     = %q{A notification wrapper gem for rails}
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.description = %q{Silvermoon aims to provide a solid interface to exchange notifications of events on your rails application to several services}
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              #s.rubyforge_project = "silvermoon"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              s.files         = `git ls-files`.split("\n")
         
     | 
| 
      
 17 
     | 
    
         
            +
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
      
 18 
     | 
    
         
            +
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/dummy/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Add your own tasks in files placed in lib/tasks ending in .rake,
         
     | 
| 
      
 2 
     | 
    
         
            +
            # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require File.expand_path('../config/application', __FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rake'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Dummy::Application.load_tasks
         
     | 
| 
         @@ -0,0 +1,86 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class NotificationsController < ApplicationController
         
     | 
| 
      
 2 
     | 
    
         
            +
              notifies :twitter, :facebook
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              # GET /notifications
         
     | 
| 
      
 5 
     | 
    
         
            +
              # GET /notifications.xml
         
     | 
| 
      
 6 
     | 
    
         
            +
              def index
         
     | 
| 
      
 7 
     | 
    
         
            +
                @notifications = Notification.all
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                respond_to do |format|
         
     | 
| 
      
 10 
     | 
    
         
            +
                  format.html # index.html.erb
         
     | 
| 
      
 11 
     | 
    
         
            +
                  format.xml  { render :xml => @notifications }
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              # GET /notifications/1
         
     | 
| 
      
 16 
     | 
    
         
            +
              # GET /notifications/1.xml
         
     | 
| 
      
 17 
     | 
    
         
            +
              def show
         
     | 
| 
      
 18 
     | 
    
         
            +
                @notification = Notification.find(params[:id])
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                respond_to do |format|
         
     | 
| 
      
 21 
     | 
    
         
            +
                  format.html # show.html.erb
         
     | 
| 
      
 22 
     | 
    
         
            +
                  format.xml  { render :xml => @notification }
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              # GET /notifications/new
         
     | 
| 
      
 27 
     | 
    
         
            +
              # GET /notifications/new.xml
         
     | 
| 
      
 28 
     | 
    
         
            +
              def new
         
     | 
| 
      
 29 
     | 
    
         
            +
                @notification = Notification.new
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                respond_to do |format|
         
     | 
| 
      
 32 
     | 
    
         
            +
                  format.html # new.html.erb
         
     | 
| 
      
 33 
     | 
    
         
            +
                  format.xml  { render :xml => @notification }
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              # GET /notifications/1/edit
         
     | 
| 
      
 38 
     | 
    
         
            +
              def edit
         
     | 
| 
      
 39 
     | 
    
         
            +
                @notification = Notification.find(params[:id])
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              # POST /notifications
         
     | 
| 
      
 43 
     | 
    
         
            +
              # POST /notifications.xml
         
     | 
| 
      
 44 
     | 
    
         
            +
              def create
         
     | 
| 
      
 45 
     | 
    
         
            +
                @notification = Notification.new(params[:notification])
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                respond_to do |format|
         
     | 
| 
      
 48 
     | 
    
         
            +
                  if @notification.save
         
     | 
| 
      
 49 
     | 
    
         
            +
                    notify(@notification.title, @notification.content, @notification.url)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    format.html { redirect_to(@notification, :notice => 'Notification was successfully created.') }
         
     | 
| 
      
 51 
     | 
    
         
            +
                    format.xml  { render :xml => @notification, :status => :created, :location => @notification }
         
     | 
| 
      
 52 
     | 
    
         
            +
                  else
         
     | 
| 
      
 53 
     | 
    
         
            +
                    format.html { render :action => "new" }
         
     | 
| 
      
 54 
     | 
    
         
            +
                    format.xml  { render :xml => @notification.errors, :status => :unprocessable_entity }
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
              # PUT /notifications/1
         
     | 
| 
      
 60 
     | 
    
         
            +
              # PUT /notifications/1.xml
         
     | 
| 
      
 61 
     | 
    
         
            +
              def update
         
     | 
| 
      
 62 
     | 
    
         
            +
                @notification = Notification.find(params[:id])
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                respond_to do |format|
         
     | 
| 
      
 65 
     | 
    
         
            +
                  if @notification.update_attributes(params[:notification])
         
     | 
| 
      
 66 
     | 
    
         
            +
                    format.html { redirect_to(@notification, :notice => 'Notification was successfully updated.') }
         
     | 
| 
      
 67 
     | 
    
         
            +
                    format.xml  { head :ok }
         
     | 
| 
      
 68 
     | 
    
         
            +
                  else
         
     | 
| 
      
 69 
     | 
    
         
            +
                    format.html { render :action => "edit" }
         
     | 
| 
      
 70 
     | 
    
         
            +
                    format.xml  { render :xml => @notification.errors, :status => :unprocessable_entity }
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
              # DELETE /notifications/1
         
     | 
| 
      
 76 
     | 
    
         
            +
              # DELETE /notifications/1.xml
         
     | 
| 
      
 77 
     | 
    
         
            +
              def destroy
         
     | 
| 
      
 78 
     | 
    
         
            +
                @notification = Notification.find(params[:id])
         
     | 
| 
      
 79 
     | 
    
         
            +
                @notification.destroy
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                respond_to do |format|
         
     | 
| 
      
 82 
     | 
    
         
            +
                  format.html { redirect_to(notifications_url) }
         
     | 
| 
      
 83 
     | 
    
         
            +
                  format.xml  { head :ok }
         
     | 
| 
      
 84 
     | 
    
         
            +
                end
         
     | 
| 
      
 85 
     | 
    
         
            +
              end
         
     | 
| 
      
 86 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <%= form_for(@notification) do |f| %>
         
     | 
| 
      
 2 
     | 
    
         
            +
              <% if @notification.errors.any? %>
         
     | 
| 
      
 3 
     | 
    
         
            +
                <div id="error_explanation">
         
     | 
| 
      
 4 
     | 
    
         
            +
                  <h2><%= pluralize(@notification.errors.count, "error") %> prohibited this notification from being saved:</h2>
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  <ul>
         
     | 
| 
      
 7 
     | 
    
         
            +
                  <% @notification.errors.full_messages.each do |msg| %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                    <li><%= msg %></li>
         
     | 
| 
      
 9 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 10 
     | 
    
         
            +
                  </ul>
         
     | 
| 
      
 11 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 12 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              <div class="field">
         
     | 
| 
      
 15 
     | 
    
         
            +
                <%= f.label :title %><br />
         
     | 
| 
      
 16 
     | 
    
         
            +
                <%= f.text_field :title %>
         
     | 
| 
      
 17 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 18 
     | 
    
         
            +
              <div class="field">
         
     | 
| 
      
 19 
     | 
    
         
            +
                <%= f.label :content %><br />
         
     | 
| 
      
 20 
     | 
    
         
            +
                <%= f.text_field :content %>
         
     | 
| 
      
 21 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 22 
     | 
    
         
            +
              <div class="field">
         
     | 
| 
      
 23 
     | 
    
         
            +
                <%= f.label :url %><br />
         
     | 
| 
      
 24 
     | 
    
         
            +
                <%= f.text_field :url %>
         
     | 
| 
      
 25 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 26 
     | 
    
         
            +
              <div class="actions">
         
     | 
| 
      
 27 
     | 
    
         
            +
                <%= f.submit %>
         
     | 
| 
      
 28 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 29 
     | 
    
         
            +
            <% end %>
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <h1>Listing notifications</h1>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            <table>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <tr>
         
     | 
| 
      
 5 
     | 
    
         
            +
                <th>Title</th>
         
     | 
| 
      
 6 
     | 
    
         
            +
                <th>Content</th>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <th>Url</th>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <th></th>
         
     | 
| 
      
 9 
     | 
    
         
            +
                <th></th>
         
     | 
| 
      
 10 
     | 
    
         
            +
                <th></th>
         
     | 
| 
      
 11 
     | 
    
         
            +
              </tr>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            <% @notifications.each do |notification| %>
         
     | 
| 
      
 14 
     | 
    
         
            +
              <tr>
         
     | 
| 
      
 15 
     | 
    
         
            +
                <td><%= notification.title %></td>
         
     | 
| 
      
 16 
     | 
    
         
            +
                <td><%= notification.content %></td>
         
     | 
| 
      
 17 
     | 
    
         
            +
                <td><%= notification.url %></td>
         
     | 
| 
      
 18 
     | 
    
         
            +
                <td><%= link_to 'Show', notification %></td>
         
     | 
| 
      
 19 
     | 
    
         
            +
                <td><%= link_to 'Edit', edit_notification_path(notification) %></td>
         
     | 
| 
      
 20 
     | 
    
         
            +
                <td><%= link_to 'Destroy', notification, :confirm => 'Are you sure?', :method => :delete %></td>
         
     | 
| 
      
 21 
     | 
    
         
            +
              </tr>
         
     | 
| 
      
 22 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 23 
     | 
    
         
            +
            </table>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            <br />
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            <%= link_to 'New Notification', new_notification_path %>
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <p id="notice"><%= notice %></p>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            <p>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <b>Title:</b>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <%= @notification.title %>
         
     | 
| 
      
 6 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            <p>
         
     | 
| 
      
 9 
     | 
    
         
            +
              <b>Content:</b>
         
     | 
| 
      
 10 
     | 
    
         
            +
              <%= @notification.content %>
         
     | 
| 
      
 11 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            <p>
         
     | 
| 
      
 14 
     | 
    
         
            +
              <b>Url:</b>
         
     | 
| 
      
 15 
     | 
    
         
            +
              <%= @notification.url %>
         
     | 
| 
      
 16 
     | 
    
         
            +
            </p>
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            <%= link_to 'Edit', edit_notification_path(@notification) %> |
         
     | 
| 
      
 20 
     | 
    
         
            +
            <%= link_to 'Back', notifications_path %>
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path('../boot', __FILE__)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "active_model/railtie"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "active_record/railtie"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "action_controller/railtie"
         
     | 
| 
      
 6 
     | 
    
         
            +
            require "action_view/railtie"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require "action_mailer/railtie"
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Bundler.require
         
     | 
| 
      
 10 
     | 
    
         
            +
            require "silvermoon"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            module Dummy
         
     | 
| 
      
 13 
     | 
    
         
            +
              class Application < Rails::Application
         
     | 
| 
      
 14 
     | 
    
         
            +
                # Settings in config/environments/* take precedence over those specified here.
         
     | 
| 
      
 15 
     | 
    
         
            +
                # Application configuration should go into files in config/initializers
         
     | 
| 
      
 16 
     | 
    
         
            +
                # -- all .rb files in that directory are automatically loaded.
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                # Custom directories with classes and modules you want to be autoloadable.
         
     | 
| 
      
 19 
     | 
    
         
            +
                # config.autoload_paths += %W(#{config.root}/extras)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                # Only load the plugins named here, in the order given (default is alphabetical).
         
     | 
| 
      
 22 
     | 
    
         
            +
                # :all can be used as a placeholder for all plugins not explicitly named.
         
     | 
| 
      
 23 
     | 
    
         
            +
                # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                # Activate observers that should always be running.
         
     | 
| 
      
 26 
     | 
    
         
            +
                # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
         
     | 
| 
      
 29 
     | 
    
         
            +
                # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
         
     | 
| 
      
 30 
     | 
    
         
            +
                # config.time_zone = 'Central Time (US & Canada)'
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
         
     | 
| 
      
 33 
     | 
    
         
            +
                # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
         
     | 
| 
      
 34 
     | 
    
         
            +
                # config.i18n.default_locale = :de
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                # JavaScript files you want as :defaults (application.js is always included).
         
     | 
| 
      
 37 
     | 
    
         
            +
                # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                # Configure the default encoding used in templates for Ruby 1.9.
         
     | 
| 
      
 40 
     | 
    
         
            +
                config.encoding = "utf-8"
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                # Configure sensitive parameters which will be filtered from the log file.
         
     | 
| 
      
 43 
     | 
    
         
            +
                config.filter_parameters += [:password]
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # SQLite version 3.x
         
     | 
| 
      
 2 
     | 
    
         
            +
            #   gem install sqlite3
         
     | 
| 
      
 3 
     | 
    
         
            +
            development:
         
     | 
| 
      
 4 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 5 
     | 
    
         
            +
              database: db/development.sqlite3
         
     | 
| 
      
 6 
     | 
    
         
            +
              pool: 5
         
     | 
| 
      
 7 
     | 
    
         
            +
              timeout: 5000
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # Warning: The database defined as "test" will be erased and
         
     | 
| 
      
 10 
     | 
    
         
            +
            # re-generated from your development database when you run "rake".
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Do not set this db to the same as development or production.
         
     | 
| 
      
 12 
     | 
    
         
            +
            test:
         
     | 
| 
      
 13 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 14 
     | 
    
         
            +
              database: db/test.sqlite3
         
     | 
| 
      
 15 
     | 
    
         
            +
              pool: 5
         
     | 
| 
      
 16 
     | 
    
         
            +
              timeout: 5000
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            production:
         
     | 
| 
      
 19 
     | 
    
         
            +
              adapter: sqlite3
         
     | 
| 
      
 20 
     | 
    
         
            +
              database: db/production.sqlite3
         
     | 
| 
      
 21 
     | 
    
         
            +
              pool: 5
         
     | 
| 
      
 22 
     | 
    
         
            +
              timeout: 5000
         
     |