From 3f2643bb66554dc586565ff5e1ff52d6c3f6d81b Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 10:55:49 +0800 Subject: [PATCH 1/9] fix useless notice at login --- app/views/devise/sessions/new.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 29501fbf..96840bf5 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -3,9 +3,11 @@

<%= t(:login) %>

+ <% flash.each do |key, msg| %> + <%= content_tag :spen, msg, :class => [key, "notice label label-warning"] %> + <% end%> <%= form_for :user, :url => user_session_path, :html => {:class => 'user_new form-horizontal'} do |f| %>
-

Notice

You need to sign in or sign up before continuing.

@@ -34,4 +36,3 @@
-asdaskljh;ufdshu;fdsijo;dklsfij;jsfijsflijwjiijpv'jpifjpifwepjif From ddf7931123b2b0fe69ba473b5932c2432c19a690 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 11:38:45 +0800 Subject: [PATCH 2/9] Change ad_banner preview from using title to id --- app/assets/javascripts/inc/modal-preview.js | 2 -- .../admin/ad_banners_controller.rb | 4 +-- .../admin/ad_banners/_ad_banner_tab.html.erb | 2 +- .../admin/ad_banners/_modal_preview.html.erb | 36 ++++++++++--------- config/routes.rb | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js index 35195999..44fa62a3 100644 --- a/app/assets/javascripts/inc/modal-preview.js +++ b/app/assets/javascripts/inc/modal-preview.js @@ -7,9 +7,7 @@ $(document).ready(function() { $(this).after(""); $.ajax({ type: 'PUT', - //async : true, url:$(this).attr("href"), - contentType: 'application/javascript; charset=utf-8', data:$(this).parents("form").serialize(), success: function (msg) { $("#"+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 1e96907f..a21693aa 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -45,8 +45,8 @@ class Admin::AdBannersController < ApplicationController end def realtime_preview - @ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone - #@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) + @ad_banner = AdBanner.find( params[:id] ).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 c1e406db..79dc647c 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -11,7 +11,7 @@
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> - <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%> + <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger btn btn-success'%>
    <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> diff --git a/app/views/admin/ad_banners/_modal_preview.html.erb b/app/views/admin/ad_banners/_modal_preview.html.erb index 27222e57..12e95020 100644 --- a/app/views/admin/ad_banners/_modal_preview.html.erb +++ b/app/views/admin/ad_banners/_modal_preview.html.erb @@ -1,6 +1,6 @@ <% if ad_banner -%> -