Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
42
app/controllers/subscriptions_controller.rb
Normal file
42
app/controllers/subscriptions_controller.rb
Normal file
@@ -0,0 +1,42 @@
|
||||
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
|
||||
Reference in New Issue
Block a user