Skip to content
 
 

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TheBanners

git clone git@github.com:dk-iziteq/TheBanners.git

Gemfile

gem 'the_banners', path: '../TheBanners'
bundle

config/routes.rb

TheBanners::Routes.mixin(self)
rails g the_banners install
rake the_banners_engine:install:migrations
rake db:migrate

Insert banner on page

= Banner.for_location('top-800-150').published.first.try(:insert)

Manage banners

= link_to t('.banners'), banners_path, class: 'list-group-item'

layout.html.erb

= yield :the_banners_main
# Banner.for_location('left-top-198-240').published.first.try(:insert, banners_proxy_url)

class Banner < ActiveRecord::Base
  include ::TheBanners::Model

  def self.locations
    %w(left-top-198-240)
  end
end
TheBanners.configure do |config|
  config.images_path = ':rails_root/public/uploads/:class/:attachment/:style/:filename'
  config.images_url  = '/uploads/:class/:attachment/:style/:filename'
end
class BannersController < ApplicationController
  layout 'bootstrap_default'
  include TheBanners::Controller
end
- content_for :left_sidebar do
  = raw Banner.for_location('left-top-198-240').published.sample.try(:insert)
TheBanners::Routes.mixin(self)
# This migration comes from the_banners_engine (originally 20141215103839)
class TheBannersCreateBanners < ActiveRecord::Migration
  def change
    create_table :banners do |t|
      t.string :name

      t.string :slug
      t.string :location

      t.text :html_code, null: false
      t.text :uri, null: false

      t.integer :w
      t.integer :h

      t.integer :view_counter,  default: 0
      t.integer :click_counter, default: 0

      t.string :state, default: :draft, null: false

      t.timestamps
    end
  end
end

This project rocks and uses MIT-LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages