Fully updated..

This commit is contained in:
Harry Bomrah committed 2012-04-09 17:55:03 +08:00
commit 32a1be624b
239 files changed
+3932 -2047

No files matched your search

+11 -3
View File
@@ -1,5 +1,5 @@
class Admin::AdBannersController < ApplicationController
layout "admin"
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
@@ -10,11 +10,14 @@ class Admin::AdBannersController < ApplicationController
end
def show
@ad_banner = AdBanner.find(params[:id])
@ad_banners = AdBanner.all
@active = AdBanner.find(params[:id])
render :action => 'index'
end
def new
@ad_banner = AdBanner.new
@ad_banners = AdBanner.all
render :action => 'index',:params => 'new'
end
def create
@@ -36,8 +39,13 @@ class Admin::AdBannersController < ApplicationController
redirect_to admin_ad_banners_url
end
def destroy_ad_image
end
def index
@ad_banners = AdBanner.all
@active = @ad_banners.first
end
end
@@ -0,0 +1,47 @@
class Admin::AdImagesController < ApplicationController
layout 'new_admin'
before_filter :authenticate_user!
before_filter :is_admin?
def edit
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = @ad_banner.ad_images.find params[:id]
end
def update
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = AdImage.find params[:id]
@ad_image.update_attributes(params[:ad_image])
@ad_image.to_save = true
@ad_image.save!
redirect_to admin_ad_banner_path @ad_banner
end
def new
@ad_image =AdImage.new
#render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil}
end
def create
@ad_banner = AdBanner.find params[:ad_banner][:id]
ad_image = AdImage.new params[:ad_image]
ad_image.to_save = true
@ad_banner.ad_images << ad_image
if @ad_banner.save!
redirect_to admin_ad_banner_path @ad_banner
end
end
def destroy
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = @ad_banner.ad_images.find params[:id]
if @ad_image.destroy
flash[:notice] = t('admin.success_destroy_ad_image')
redirect_to admin_ad_banner_path @ad_banner
end
end
end
+15 -2
View File
@@ -1,11 +1,12 @@
class DesktopController< ApplicationController
layout 'desktop'
before_filter :authenticate_user!
def index
@desktop = current_user.desktop
end
def desktop
render :layout => false
end
@@ -17,6 +18,18 @@ class DesktopController< ApplicationController
render :layout => false
end
def save_desktop_settings
@desktop = Desktop.find(params["id"])
@desktop.update_attributes(:theme => params["theme"])
a = Array.new
a << {"success"=>"true"}
render :json=>a.to_json
end
def get_desktop_settings
@desktop = Desktop.find(params["id"])
render :json => @desktop.to_json
end
def settings
render :layout => false
end
+1 -1
View File
@@ -3,7 +3,7 @@ require 'mongo'
class GridfsController < ActionController::Metal
def serve
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "")
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "").force_encoding("UTF-8")
begin
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
self.response_body = gridfs_file.read