Skip to content

Instantly share code, notes, and snippets.

@marcuscaum
Last active June 30, 2016 21:26
Show Gist options
  • Select an option

  • Save marcuscaum/74b048ddbb24396edadb1cdd11961b77 to your computer and use it in GitHub Desktop.

Select an option

Save marcuscaum/74b048ddbb24396edadb1cdd11961b77 to your computer and use it in GitHub Desktop.
Remove phone mark from lp
def remove_phone(acc)
Account.find(acc).landing_pages_manager.landing_pages.each do |lp|
if lp.custom_js_body.present?
lp.custom_js_body << %Q(<script type="text/javascript"> if ($('input[class*="phone"]').length) { $('input[class*="phone"]').removeClass("phone")}</script>)
end
ActiveRecord::Base.record_timestamps = false
lp.save
if lp.published == 'yes'
lp.publish!
end
ActiveRecord::Base.record_timestamps = true
end
end
def find_phone_and_remove(acc)
xunda = Array.new
Account.find(acc).landing_pages_manager.landing_pages.each do |lp|
script = %Q(<script type="text/javascript"> if ($('input[class*="phone"]').length) { $('input[class*="phone"]').removeClass("phone")}</script>)
unless lp.custom_js_body.include? script
xunda << lp
end
end
xunda.each do |lp|
lp.custom_js_body << %Q(<script type="text/javascript"> if ($('input[class*="phone"]').length) { $('input[class*="phone"]').removeClass("phone")}</script>)
ActiveRecord::Base.record_timestamps = false
lp.save
if lp.published == 'yes'
lp.publish!
end
ActiveRecord::Base.record_timestamps = true
end
end
def find_phone(acc)
xunda = Array.new
Account.find(acc).landing_pages_manager.landing_pages.each do |lp|
script = %Q(<script type="text/javascript"> if ($('input[class*="phone"]').length) { $('input[class*="phone"]').removeClass("phone")}</script>)
if lp.custom_js_body.include? script
xunda << lp
end
end
xunda.count
end
def release_the_kraken(accounts)
xunda = Array.new
accounts.each do |acc|
a = Account.find acc
if a.landing_pages_manager.domain_scope == -1
xunda << acc
end
end
xunda.each do |acc|
a = Account.find acc
a.give_access_to_lps_new_flow
a.give_access_to_lps_publish_new_flow
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment