diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js index fd62a95e..2f915f6c 100644 --- a/app/assets/javascripts/inc/modal-preview.js +++ b/app/assets/javascripts/inc/modal-preview.js @@ -6,7 +6,7 @@ $(document).ready(function() { $("a.preview_trigger").click(function(){ $(this).after(""); $.ajax({ - type:"PUT", + type:"put", url:$(this).attr("href"), data:$(this).parents("form").serialize() }).done(function(){ $("#"+start_modal_with_id).modal('show');}); diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index c3d0cc58..19983b66 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -22,9 +22,14 @@ class Admin::AdBannersController < ApplicationController def create @ad_banner = AdBanner.new(params[:ad_banner]) - @ad_banner.save - redirect_to admin_ad_banners_url - + if @ad_banner.save + @active = @ad_banner + respond_to do |format| + format.js {render 'new_created_node'} + end + else + render 'create_error_msg' + end end def edit @@ -40,8 +45,8 @@ class Admin::AdBannersController < ApplicationController end def realtime_preview - @ad_banner = AdBanner.find(conditions: { title: params[:title] }).preview_clone - #@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) + @ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone + @ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) end def index diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 47986323..530e45cb 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,4 +1,4 @@ -
<%= t("admin.ad.banner_best_size") %>:
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 66f8de2b..36ebc4a3 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -4,7 +4,7 @@