add nokogiri into Gemfile and fixing dup bug again...

This commit is contained in:
Kaito 2011-07-29 17:49:10 +08:00
parent c9e4d0f345
commit b6db304579
6 changed files with 17 additions and 3 deletions

View File

@ -9,6 +9,8 @@ gem 'ckeditor'
gem 'devise' gem 'devise'
gem 'mini_magick' gem 'mini_magick'
gem 'nokogiri'
gem 'mongoid' gem 'mongoid'
gem 'rake', '>=0.9.2' gem 'rake', '>=0.9.2'

View File

@ -77,6 +77,7 @@ GEM
mongo (~> 1.3) mongo (~> 1.3)
tzinfo (~> 0.3.22) tzinfo (~> 0.3.22)
multi_json (1.0.3) multi_json (1.0.3)
nokogiri (1.5.0)
orm_adapter (0.0.5) orm_adapter (0.0.5)
polyglot (0.3.1) polyglot (0.3.1)
rack (1.3.0) rack (1.3.0)
@ -159,6 +160,7 @@ DEPENDENCIES
jquery-rails (>= 1.0.3) jquery-rails (>= 1.0.3)
mini_magick mini_magick
mongoid mongoid
nokogiri
rails (>= 3.1.0.rc4) rails (>= 3.1.0.rc4)
rake (>= 0.9.2) rake (>= 0.9.2)
rcov rcov

View File

@ -15,7 +15,7 @@ function r_editor(tgetUrl,tpostUrl,tfilename,toption){
html = $(code); html = $(code);
html.children("textarea").load(editor.getUrl); html.children("textarea").load(editor.getUrl);
html.children("input.discard").click(function(){ html.children("input.discard").click(function(){
editor.reload(); editor.destroy();
}); });
html.children("input.send").click(function(){ html.children("input.send").click(function(){
editor.send(); editor.send();

View File

@ -23,6 +23,13 @@ class Admin::DesignsController < ApplicationController
end end
end end
def apply
@design = Design.find(params[:id])
#TODO do somehting to validate
debugger
doc = Nokogiri::HTML(@design.layout.file.read)
end
def edit_file def edit_file
@design = Design.find(params[:id]) @design = Design.find(params[:id])
filename = params[:filename] filename = params[:filename]

View File

@ -36,8 +36,10 @@ class Design
def files=(attrs) def files=(attrs)
files = eval(attrs.last) files = eval(attrs.last)
attrs[0].each do |a| attrs[0].each do |a|
if(a[:id]=='' && !a[:file].nil?) if(a[:id]=='' && !a[:file].nil? )
files.build(:file => a[:file], :to_save => true) if(a[:file]!='')
files.build(:file => a[:file], :to_save => true)
end
else else
files.each do |file| files.each do |file|
if file.id.to_s == a[:id] if file.id.to_s == a[:id]

View File

@ -47,6 +47,7 @@ PrototypeR4::Application.routes.draw do
resources :designs do resources :designs do
member do member do
post 'edit_file' => 'designs#edit_file' post 'edit_file' => 'designs#edit_file'
get 'apply'
get 'delete' get 'delete'
end end
end end