Skip to content

Commit

Permalink
fix fax
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Pardo committed Mar 17, 2016
1 parent d22f966 commit 299e44e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
7 changes: 1 addition & 6 deletions app/controllers/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,7 @@ def show
@description = @campaign.to_html(@campaign.intro).html_safe

@videotron = UnvlogIt.new(@campaign.video_url) unless @campaign.video_url.blank?

unless @campaign.ttype == 'fax'
@instanke = Campaign.types[@campaign.ttype.to_sym][:model_name].constantize.new
else
@instanke = Fax.new
end
@instanke = Campaign.types[@campaign.ttype.to_sym][:model_name].constantize.new

@message_body = @campaign.default_message_body if @instanke.respond_to?(:body)
@message_subject = @campaign.default_message_subject if @instanke.respond_to?(:subject)
Expand Down
27 changes: 13 additions & 14 deletions app/models/campaign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class Campaign < ActiveRecord::Base
:message => I18n.t('oigame.campaigns.type.mailing_message'),
:action => I18n.t('oigame.campaigns.type.mailing_action'),
},
#:fax =>
#{
# :name => I18n.t('fax'),
# :img => 'icon-print',
# :model_name => 'Fax',
# :message => I18n.t('oigame.campaigns.type.fax_message'),
# :action => I18n.t('oigame.campaigns.type.fax_action'),
#},
:fax =>
{
:name => I18n.t('fax'),
:img => 'icon-print',
:model_name => 'Fax',
:message => I18n.t('oigame.campaigns.type.fax_message'),
:action => I18n.t('oigame.campaigns.type.fax_action'),
},
}
# { :petition => 'Petición online', :mailing => 'Envio de correo', :fax => 'Envio de fax' }

Expand Down Expand Up @@ -116,7 +116,7 @@ def last_campaigns_without_pagination(limit = nil)
end

def last_campaigns_moderated(page = 1, sub_oigame = nil)
where(:sub_oigame_id => sub_oigame).where(:wstatus => 'active').order('created_at DESC').where('moderated = ?', true).page(page)
where(:sub_oigame_id => sub_oigame).where(:wstatus => 'active').order('created_at DESC').where('moderated = ?', true).page(page)
end

def last_campaigns_moderated_without_pagination(sub_oigame = nil)
Expand Down Expand Up @@ -299,7 +299,7 @@ def other_campaigns
def get_absolute_url
if sub_oigame.nil?
return APP_CONFIG[:domain] + "/campaigns/" + slug
else
else
return APP_CONFIG[:domain] + "/o/" + sub_oigame.name + "/campaigns/" + slug
end
end
Expand Down Expand Up @@ -387,7 +387,7 @@ def active_or_duedate_at?
end

def obj_minus_gotten_result
target.to_i - participants_count
target.to_i - participants_count
end

def messages_count
Expand Down Expand Up @@ -485,14 +485,14 @@ def tweet_campaign
# custom validation for image width & height minimum dimensions
def validate_minimum_image_size
if self.image_width < 500 && self.image_height < 200
errors.add :image, "debe tener 500px de ancho y 200px de largo como mínimo"
errors.add :image, "debe tener 500px de ancho y 200px de largo como mínimo"
end
end

def validate_video_url_provider
if !self.video_url.blank?
unless self.video_url.start_with?("http://youtu.be/", "http://www.youtube.com/watch?v=", "https://www.youtube.com/watch?v=", "http://vimeo.com/")
errors.add :video_url, "must be a valid provider"
errors.add :video_url, "must be a valid provider"
end
end
end
Expand All @@ -501,4 +501,3 @@ def fax_campaign?
self.ttype == 'fax'
end
end

0 comments on commit 299e44e

Please sign in to comment.