43 lines
1.0 KiB
Ruby
43 lines
1.0 KiB
Ruby
class SubscriptionsController < ApplicationController
|
|
|
|
skip_before_filter :verify_authenticity_token
|
|
|
|
def index
|
|
@contact = Contact.find(UrlParamCrypt.decrypt(params[:contact]))
|
|
|
|
#prozatim takhle super primitivne
|
|
@contact.remove_trialwalkthrough_subscription(featured_product)
|
|
end
|
|
|
|
def from_download
|
|
@product = Product[params[:product]]
|
|
render :layout => "iframe"
|
|
end
|
|
|
|
def create
|
|
@subscription = Subscription.new(params[:subscription])
|
|
|
|
@callback = params[:callback] || "subscription_saved"
|
|
|
|
if @subscription.save_many
|
|
respond_to do |format|
|
|
format.html { render :text => "OK" }
|
|
format.js {
|
|
render :update do |page|
|
|
page.call @callback, params[:form_id]
|
|
end
|
|
}
|
|
end
|
|
else
|
|
respond_to do |format|
|
|
format.html { render :text => "ERROR" }
|
|
format.js {
|
|
render :update do |page|
|
|
page.call "subscription_not_saved", t('txt.support.unsaved_subscription')
|
|
end
|
|
}
|
|
end
|
|
end
|
|
end
|
|
end
|