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 'mini_magick'
gem 'nokogiri'
gem 'mongoid'
gem 'rake', '>=0.9.2'

View File

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

View File

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

View File

@ -23,6 +23,13 @@ class Admin::DesignsController < ApplicationController
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
@design = Design.find(params[:id])
filename = params[:filename]

View File

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

View File

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