<commit_before>Ad_man
======

Ad_man is an advertising manager mountable engine.  It allows the user to upload and manage advertising banners, and provides an easy to use helper for inserting the banners on your website.  Also counts the number of times an ad has shown, and the number of times an advertisement has been clicked on.  The user must set a keyword for each ad.

Currently supports two image sizes for advertising: Leaderboard 728 x 90 and Banner 468 x 60. 
TODO: Will implement 9 different sizes as mentioned by google's adwords requirements.

Requires Paperclip 3.1, and requires ImageMagick be running on the server.

## Getting started

Ad_man works with Rails 3.2 onwards. You can add it to your Gemfile with:

```ruby
gem 'ad_man'
```

After you install Ad_man and add it to your Gemfile, you need to run the generator:

```console
rails generate ad_man:install
```

This will install the migrations and a few controller files, then just rake the database:
```console
rake db:migrate
```

See where Ad_man is located by running: 
```console
rake routes
```

In our case, we needed to move the line generated by the install in the routes file to our admin space.  Then add any before_filters to the controllers that were generated.

Make sure to change references to the application using the main_app helper:
```erb
<%= link_to "Home", main_app.root_path %>
<%= link_to "Advertising", main_app.ad_man_path %>
```

## Changing default values

If you need to change the default values set by ad_man, you will need to create an ad_man.rb initializer in your config/initializers folder.  

```ruby
# AdMan Default Values
AdMan.leaderboard_size = "728x90"
AdMan.banner_size = "468x60"
AdMan.max_image_size = 50 # 50Kb maximum image size

# These are configurable dimensions (currently leaderboard default)
AdMan.image_dimensions_width = 728
AdMan.image_dimensions_height = 90

# Configurable content type for advertising
AdMan.content_type = ["image/jpg", "image/bmp", "image/png", "image/gif", "image/jpeg"]

# Configurable max advertising for keyword
AdMan.max_count = 6
```

## Putting an advertisement in the view

To put your advertisement in the view just add:
```erb
<%= link_to_ad %><commit_msg>add default values of the remaining size<commit_after>Ad_man
======

Ad_man is an advertising manager mountable engine.  It allows the user to upload and manage advertising banners, and provides an easy to use helper for inserting the banners on your website.  Also counts the number of times an ad has shown, and the number of times an advertisement has been clicked on.  The user must set a keyword for each ad.

Currently supports two image sizes for advertising: Leaderboard 728 x 90 and Banner 468 x 60. 
TODO: Will implement 9 different sizes as mentioned by google's adwords requirements.

Requires Paperclip 3.1, and requires ImageMagick be running on the server.

## Getting started

Ad_man works with Rails 3.2 onwards. You can add it to your Gemfile with:

```ruby
gem 'ad_man'
```

After you install Ad_man and add it to your Gemfile, you need to run the generator:

```console
rails generate ad_man:install
```

This will install the migrations and a few controller files, then just rake the database:
```console
rake db:migrate
```

See where Ad_man is located by running: 
```console
rake routes
```

In our case, we needed to move the line generated by the install in the routes file to our admin space.  Then add any before_filters to the controllers that were generated.

Make sure to change references to the application using the main_app helper:
```erb
<%= link_to "Home", main_app.root_path %>
<%= link_to "Advertising", main_app.ad_man_path %>
```

## Changing default values

If you need to change the default values set by ad_man, you will need to create an ad_man.rb initializer in your config/initializers folder.  

```ruby
# AdMan Default Values
AdMan.leaderboard_size = "728x90"
AdMan.banner_size = "468x60"
AdMan.mobile_leaderboard_size = "320X50"
AdMan.square_size = "250X250"
AdMan.small_square_size = "200X200"
AdMan.large_rectangle_size = "336X280"
AdMan.inline_rectangle_size = "300X250"
AdMan.skyscraper_size = "120X600"
AdMan.wide_skyscraper_size = "160X600"

AdMan.max_image_size = 50 # 50Kb maximum image size

# These are configurable dimensions (currently leaderboard default)
AdMan.image_dimensions_width = 728
AdMan.image_dimensions_height = 90

# Configurable content type for advertising
AdMan.content_type = ["image/jpg", "image/bmp", "image/png", "image/gif", "image/jpeg"]

# Configurable max advertising for keyword
AdMan.max_count = 6
```

## Putting an advertisement in the view

To put your advertisement in the view just add:
```erb
<%= link_to_ad %>
{'fraction_non_alphanumeric': 0.07286591823766152, 'fraction_numerical': 0.023511967803431476, 'mean_word_length': 4.815270935960591, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1233980', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1359, 'n_words': 628}