This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###app/models/vertical.rb | |
class Vertical < ActiveRecord::Base | |
has_one :parent_relation, foreign_key: "child_id", class_name: "VerticalRelation" | |
has_many :child_relations, foreign_key: "parent_id", class_name: "VerticalRelation" | |
has_one :head_relation, foreign_key: "tail_id", class_name: "VerticalRelation" | |
has_one :tail_relation, foreign_key: "head_id", class_name: "VerticalRelation" | |
has_one :parent, through: :parent_relation | |
has_many :children, through: :child_relations, source: :child | |
has_one :head, through: :head_relation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## The vertical | |
#Be sure of that vertical with id 1 exists | |
## The campaign (form) | |
#Put to the campaign the state of washignton | |
#Set to the campaign the vertical: 1 | |
## The contacts (on the rails console) | |
Contact.create(:name => 'Jodee Clore', :vertical_id => 1, :geo_id => '15121') #this geo_id's are citys of washington | |
Contact.create(:name => 'Trish Roudebush', :vertical_id => 1, :geo_id => '14974') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.find_matching_campaigns_by_geo(contact) | |
matching_campaigns = [] | |
Campaign.all.each do |campaign| | |
campaign.geos.each do |geo| | |
match = Geo.where(id: contact.geo.id).includes(:geo_polygons).joins("LEFT JOIN geo_polygons as container ON container.geo_id = #{geo.id}").where('ST_Within(geo_polygons.poly, container.poly)') | |
matching_campaigns << campaign unless match.empty? | |
end | |
end | |
matching_campaigns | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new_contact_obligations | |
# self.vertical = conversions.first.placement.vertical | |
self.attributes = load_loc_attrs | |
self.save! | |
notify_observers(:find_campaigns) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after_save :bid_adjusts | |
def bid_adjusts | |
unless @old_exclusive_campaign.nil? | |
campaign = Campaign.find(@old_exclusive_campaign.id) | |
campaign.update_attributes(exclusivity: false) | |
campaign.save | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@javascript | |
Scenario: Returning to a form placement # features/collection.feature:12 | |
When a contact returns to a form placement completed previously # features/step_definitions/engine_steps.rb:132 | |
Unable to load URL: http://api.lvh.me:4433/placements/test (Capybara::Driver::Webkit::WebkitInvalidResponseError) | |
./features/step_definitions/engine_steps.rb:29:in `/^a contact visits a page with an? (\w+) placement$/' | |
features/collection.feature:13:in `When a contact returns to a form placement completed previously' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.player | |
.headerAndLibraryW | |
%header | |
%ul | |
%li | |
%a{ href:'' } Library | |
%a{ href:'' } Playlist | |
%a{ href:'' } Sign out | |
%form{ } | |
%input{ type:'text', value:'Search' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# This file is auto-generated from the current state of the database. Instead | |
# of editing this file, please use the migrations feature of Active Record to | |
# incrementally modify your database, and then regenerate this schema definition. | |
# | |
# Note that this schema.rb definition is the authoritative source for your | |
# database schema. If you need to create the application database on another | |
# system, you should be using db:schema:load, not running all the migrations | |
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
# you'll amass, the slower it'll run and the greater likelihood for issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It was happening when the options weren't having description, so the plugin gets inside this function and for some reason looks like the l0Height variable gets incremented (when it shouldn't). | |
// The fix for me was to put the line-height as constant with the: | |
// var lOHeight = '35px'; | |
// line. | |
//Private: Adjust appearence for drop down options (move title to middle), when no desripction | |
function adjustOptionsHeight(obj) { | |
obj.find('.dd-option').each(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delayed_job' | |
namespace :content do | |
desc "Generates the bouquet template images" | |
task :generate_bouquet_template_images => :environment do | |
puts ">>>>>>>>>>>>>>>>>>>>>> Creating (or recreating) the bouquet template image versions" | |
handle_asynchronously :recreate_bouquet_template_main_images | |
end | |
def recreate_bouquet_template_main_images |
OlderNewer