Edit uploaded package

This commit is contained in:
chris 2012-10-24 18:40:38 +08:00
parent 9110c3e716
commit 2b2dd53218
28 changed files with 256 additions and 251 deletions

View File

@ -1,111 +1,7 @@
<%#= encoding: utf-8 %>
$(document).on('click', '#ajax_form_submit', function(){
// $('#ajaxForm').ajaxSubmit({
// beforeSubmit: function(a,f,o) {
// o.dataType = 'script';
// if (o.dataType == 'script') {
// o.url = o.url.split('?'); // split on GET params
// if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
// o.url = o.url.join('?'); // join on GET params
// }
// },
// success: function(response,status,xhr){
// alert(response);
// alert(status);
// alert(xhr);
// },
// error:function(){
// alert("error");
// }
// });
var o = {
// dataType: 'script',
dataType: 'html',
url:$("#ajaxForm").attr("action"),
beforeSubmit: function(){
var sub = true;
$("span.error").remove();
$("#dyn_error").empty();
$("#ajaxForm input").each(function(){
if($(this).val() == ""){
$("<span class='error'> *</span>").insertAfter($(this));
sub = false;
}
})
if(!sub){
$("#dyn_error").text("Cannot be empty.");
$("#dyn_error").text("<%= I18n.t('cant_empty_star') %>");
return false;
}
$('#ajaxForm').ajaxForm({
beforeSubmit: function(a,f,o) {
o.dataType = 'script';
},
success: function(response,status,xhr){
if(typeof tinyMCEPopup != "undefined"){
var x = response.split("#");
var returnurl = x[0],
returntitle = x[1],
returndescription = x[2];
var win = tinyMCEPopup.getWindowArg("window");
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl;
win.document.getElementById(tinyMCEPopup.getWindowArg("alt")).value = returndescription;
win.document.getElementById(tinyMCEPopup.getWindowArg("title")).value = returntitle;
if (typeof(win.ImageDialog) != "undefined") {
// we are, so update image dimensions...
if (win.ImageDialog.getImageData)
win.ImageDialog.getImageData();
// ... and preview if necessary
if (win.ImageDialog.showPreviewImage)
win.ImageDialog.showPreviewImage(returnurl);
success: function(data) {
}
tinyMCEPopup.close();
}else{
//incase if we want to do something for quick edit file upload
// var modalvalues = "";
// var r = "";
// if(rcom.getInternetExplorerVersion() > -1){
// r = "<tr><td>" + response + "</td></tr>";
// r = r.replace("**","</td><td>");
// r = r.replace("**","</td><td>");
// r = $(r);
// modalvalues = r.find("span").attr("data-content").split("#");
// r.attr("id",r.find("span").attr("for"));
// var table=document.getElementById(modalvalues[0]);
// //var tbody = table.getElementsByTagName("tbody");
// var row = table.insertRow(table.rows.length-1);
// var c1 = row.insertCell(0),
// c2 = row.insertCell(1),
// c3 = row.insertCell(2);
// c1.innerHTML = r.find("td").eq(0).html();
// c2.innerHTML = r.find("td").eq(1).html();
// c3.innerHTML = r.find("td").eq(2).html();
// var trow = $("#bulletin_files tfoot").find("tr").eq(0);
// $("#bulletin_files tbody").append(trow);
// }else{
// response = response.replace("**","");
// response = response.replace("**","");
// r = $(response);
// modalvalues = r.find("span").attr("data-content").split("#");
// $('#' + modalvalues[0]+ ' tbody').append(r);
// }
// console.log(modalvalues[1]);
// $("#"+modalvalues[1]).modal('hide');
//$('#bulletin_files tbody').append(r);
//$(response).fadeIn();
}
},
error:function(){
alert("error");
}
}
if (o.dataType == 'script') {
o.url = o.url.split('?'); // split on GET params
if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
o.url = o.url.join('?'); // join on GET params
}
$('#ajaxForm').ajaxSubmit(o);
});

View File

@ -267,6 +267,12 @@
#post-body-content {
padding: 8px 0 8px 6px;
}
#post-body-content .middle {
width: 100%;
padding: 0;
border: none;
box-shadow: none;
}
.filter .accordion-group {
margin-bottom: 0;
border: none;

View File

@ -34,14 +34,37 @@ class Admin::DesignsController < OrbitBackendController
def update
@design = Design.find(params[:id])
if @design.update_attributes(params[:design])
flash[:notice] = "Successfully updated design and tasks."
redirect_to admin_designs_url(@design)
else
render :action => 'edit'
@design.update_attributes(params[:design])
# if @design.update_attributes(params[:design])
# flash[:notice] = "Successfully updated design and tasks."
# redirect_to admin_designs_url(@design)
# else
# render :action => 'edit'
# end
respond_to do |format|
format.js {nil}
end
end
def update_file
@design = Design.find(params[:id])
case params[:type]
when 'layout', 'css_default', 'css_reset'
@object = @design.send(params[:type])
when 'image', 'javascript', 'theme'
@object = @design.send(params[:type]).find(params[:object_id])
end
Dir.mktmpdir('f_path') { |dir|
temp_file = File.new(dir + '/' + File.basename(@object.file.url), 'w+')
temp_file.write(params[:file][:content].force_encoding('UTF-8'))
@object.remove_file!
@object.file = temp_file
@object.save
}
end
def edit_file
@design = Design.find(params[:id])
filename = params[:filename]
@ -92,13 +115,19 @@ class Admin::DesignsController < OrbitBackendController
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def upload_image
@design = Design.find(params[:id])
@image = @design.images.build(params[:image])
@image.save
render :layout => false
end
protected
def unzip_design(file, zip_name)
Zip::ZipFile.open(file) { |zip_file|
design = Design.new.from_json(zip_file.read("#{zip_name}/info.json"))
Dir.mktmpdir('f_path') { |dir|
design.build_layout
themes_entries = []
javascripts_entries = []
images_entries = []
@ -106,25 +135,11 @@ class Admin::DesignsController < OrbitBackendController
zip_file.entries.each do |entry|
case (path = entry.to_s)
when /\A(#{zip_name})\/(default\.css)\z/ #for default css
filename = File.basename(entry.to_s)
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
default_css = design.build_default_css
default_css.file = temp_file
default_css.to_save = true
design.build_css_default(:file => get_temp_file(zip_file, dir, entry))
when /\A(#{zip_name})\/(reset\.css)\z/ #for reset css
filename = File.basename(entry.to_s)
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
reset_css = design.build_reset_css
reset_css.file = temp_file
reset_css.to_save = true
design.build_css_reset(:file => get_temp_file(zip_file, dir, entry))
when /\A(#{zip_name})\/(layout\.html)\z/ #for layout html
filename = File.basename(entry.to_s)
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
design.layout.file = temp_file
design.layout.to_save=true
design.build_layout(:file => get_temp_file(zip_file, dir, entry))
when /\A(#{zip_name})\/(themes)\/.*(\.css)\z/ #for themes css
themes_entries << entry
when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js
@ -136,12 +151,7 @@ class Admin::DesignsController < OrbitBackendController
['themes', 'javascripts', 'images'].each do |type|
eval("#{type}_entries").each do |entry|
filename = File.basename entry.to_s
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.write (zip_file.read entry).force_encoding('UTF-8')
build_and_store = eval("design.#{type}").build
build_and_store.file = temp_file
build_and_store.to_save = true
eval("design.#{type}").build(:file => get_temp_file(zip_file, dir, entry))
end
end
}
@ -149,4 +159,11 @@ class Admin::DesignsController < OrbitBackendController
}
end
def get_temp_file(zip_file, dir, entry)
filename = File.basename(entry.to_s)
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
temp_file
end
end

View File

@ -71,8 +71,8 @@ class Admin::PurchasesController < ApplicationController
Dir.mktmpdir('f_path') { |dir|
build_file(orig_zip, zip_name, dir, design.layout) if design.layout
build_file(orig_zip, zip_name, dir, design.default_css) if design.default_css
build_file(orig_zip, zip_name, dir, design.reset_css) if design.reset_css
build_file(orig_zip, zip_name, dir, design.css_default) if design.css_default
build_file(orig_zip, zip_name, dir, design.css_reset) if design.css_reset
['themes', 'javascripts', 'images'].each do |type|
design.send(type).each do |object|

View File

@ -7,7 +7,7 @@ class SessionsController < Devise::SessionsController
# login_password = params[:user][:password]
# login_uid = params[:user][:nccu_ldap_uid]
login_password = params[:user][:password]
login_email = params[:user][:login]
login_email = params[:user][:email]
result = false
resource = User.first(conditions:{ email: login_email })
set_flash_message(:notice, :signed_in) if is_navigational_format?

View File

@ -181,13 +181,13 @@ module ApplicationHelper
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
stylesheets << "<link href='#{page.design.css_reset.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_reset
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/font-awesome.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/orbit-bar.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
stylesheets

View File

@ -0,0 +1,5 @@
class CssDefault < Stylesheet
belongs_to :design
end

View File

@ -0,0 +1,5 @@
class CssReset < Stylesheet
belongs_to :design
end

View File

@ -3,26 +3,28 @@ class Design
include Mongoid::Timestamps
include ParserLayout
field :title, :type => String
field :author, :type => String
field :intro, :type => String
field :title, :type => String
field :version, :type => String
has_one :css_default, :autosave => true, :dependent => :destroy
has_one :layout, :autosave => true, :dependent => :destroy
has_one :css_reset, :autosave => true, :dependent => :destroy
has_many :images, :autosave => true, :dependent => :destroy
has_many :javascripts, :autosave => true, :dependent => :destroy
has_many :pages
has_many :themes, :autosave => true, :dependent => :destroy
embeds_one :layout, :cascade_callbacks => true
embeds_one :default_css, :class_name => "Stylesheet", :cascade_callbacks => true
embeds_one :reset_css, :class_name => "Stylesheet", :cascade_callbacks => true
embeds_many :themes, :cascade_callbacks => true
embeds_many :javascripts, :cascade_callbacks => true
embeds_many :images, :as => :design_image, :cascade_callbacks => true
# embeds_many :custom_images, :class_name => 'Image', :cascade_callbacks => true
accepts_nested_attributes_for :images, :allow_destroy => true
accepts_nested_attributes_for :javascripts, :allow_destroy => true
accepts_nested_attributes_for :themes, :allow_destroy => true
validates_presence_of :title
validates_presence_of :author
validates_presence_of :author, :title
after_save :parse_css_for_images
def new_files=(*attrs)
attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs
self.files=([items_ary, key])
@ -66,14 +68,10 @@ class Design
protected
def parse_css_for_images
if (self.default_css && self.default_css.changed)
self.default_css.parse_urls
end
self.css_default.parse_urls
self.themes.each do |theme|
if theme.changed?
theme.parse_urls
end
end
parse_body_for_images(self)
end

View File

@ -4,7 +4,14 @@ class DesignFile
mount_uploader :file, AssetUploader
field :to_save, :type => Boolean
field :to_destroy, :type => Boolean
field :name
before_save :set_name
protected
def set_name
self.name = self.file_identifier
end
end

View File

@ -1,11 +1,23 @@
class Image < DesignFile
class Image
include Mongoid::Document
include Mongoid::Timestamps
field :in_css, :type => Boolean
field :name
field :html_id
field :html_class
embedded_in :design_image, polymorphic: true
field :in_css, :type => Boolean, :default => false
field :in_html, :type => Boolean, :default => false
field :name
mount_uploader :file, ImageUploader
belongs_to :design
before_save :set_name
protected
def set_name
self.name = self.file_identifier
end
end

View File

@ -1,3 +1,3 @@
class Javascript < DesignFile
embedded_in :design
belongs_to :design
end

View File

@ -6,7 +6,7 @@ class Layout < DesignFile
field :body
embeds_one :menu
embedded_in :design
belongs_to :design
embeds_many :layout_parts
before_save :parse_layout

View File

@ -1,5 +1,5 @@
class Stylesheet < DesignFile
embedded_in :design
belongs_to :design
mount_uploader :file_orig, AssetUploader
def parse_urls
@ -11,7 +11,9 @@ class Stylesheet < DesignFile
content.scan(/(?<=url)(.*?)(?=\))/){
css_name = $1.gsub(' ','').gsub('(','')
name = File.basename(css_name).gsub(/[\\\"]/, '')
file_name = images.detect{ |i| i.file_identifier.eql?(name) }.file_url rescue nil
image = images.detect{ |i| i.file_identifier.eql?(name) } rescue nil
image.update_attribute(:in_css, true) if image
file_name = image.file_url rescue nil
names << [css_name, file_name]
}
names.each do |name|

View File

@ -1,9 +1,6 @@
class Theme < Stylesheet
field :name
embedded_in :design
before_save :set_name
belongs_to :design
protected

View File

@ -24,7 +24,7 @@ class ImageUploader < CarrierWave::Uploader::Base
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"image/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
"#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
@ -48,7 +48,7 @@ class ImageUploader < CarrierWave::Uploader::Base
# end
version :thumb do
process :resize_to_fit => [200, 200]
process :resize_to_limit => [200, 200]
end
# Add a white list of extensions which are allowed to be uploaded.

View File

@ -1,60 +1,24 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "design" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "design" %>
<%= form_for @design, :url => admin_design_path(@design), :html => {:class => 'form-horizontal'}, :remote => true do |f| %>
<%= f.error_messages %>
<div class="control-group">
<%= f.label :title, t('admin.title'), :class => "control-label" %>
<div class="controls">
<%= f.text_field :title %>
</div>
</div>
<div class="control-group">
<%= f.label :author, t('admin.author'), :class => "control-label" %>
<div class="controls">
<%= f.text_field :author %>
</div>
</div>
<div class="control-group">
<%= f.label :intro, t('admin.intro'), :class => "control-label" %>
<div class="controls">
<%= f.text_field :intro %>
</div>
</div>
<%= f.submit t('update') %>
<% end %>
<p>
<%= f.label :title, t('admin.title') %>
<%= f.text_field :title, :class => 'text' %>
</p>
<p>
<%= f.label :author, t('admin.author') %>
<%= f.text_field :author, :class => 'text' %>
</p>
<p>
<%= f.label :intro, t('admin.intro') %>
<%= f.text_field :intro, :class => 'text' %>
</p>
<p>
<%= f.label "layout", t('admin.layout') %>
<% if @design.layout.blank? %>
<%= fields_for 'design[layout]' do |f| %>
<%= f.file_field :file %>
<%#= f.hidden_field :to_save, :value => true %>
<% end %>
<% else %>
<%= File.basename (@design.layout.file.url) %>
<% end %>
</p>
<p>
<%= f.label "default_css", t('admin.default_css') %>
<% if @design.default_css.blank? %>
<%= fields_for 'design[default_css]' do |f| %>
<%= f.file_field :file %>
<%#= f.hidden_field :to_save, :value => true %>
<% end %>
<% else %>
<%= File.basename (@design.default_css.file.url) rescue "" %>
<% end %>
</p>
<p>
<%= f.label :themes, t('admin.themes') %>
<ul>
<% @design.themes.each do |theme| %>
<%= render :partial => 'design_file', :object => theme, :locals => { :field_name => "themes", :f => f, :classes => "r_destroy, r_edit" } %>
<% end %>
</ul>
<%= render :partial => 'new_design_file', :object => @design.themes.build, :locals => { :field_name => "themes", :f => f, :classes => "r_destroy" } %>
</p>
<p>
<%#= render :partial => 'design_file', :locals => { :object => @design, :field_name => "javascripts", :f => f, :classes => "r_destroy, r_edit" } %>
</p>
<p>
<%#= render :partial => 'design_file', :locals => { :object => @design, :field_name => "images", :f => f, :classes => "r_destroy, r_snapshot" } %>
</p>

View File

@ -0,0 +1,6 @@
<tr>
<td><%= image.name %></td>
<td><%= image_tag image.file.thumb %></td>
<td><%= number_to_human_size(image.file.file.file_length) %></td>
<td><%= image.file.url %></td>
</tr>

View File

@ -0,0 +1,40 @@
<table id='image_list' class="table table-striped">
<thead>
<tr>
<th class="span1"><%= t(:name) %></th>
<th class="span1"><%= t(:image) %></th>
<th class="span1"><%= t(:size) %></th>
<th class="span4"><%= t(:url) %></th>
</tr>
</thead>
<tbody id="tbody_assets" class="sort-holder">
<%= render :partial => 'image', :collection => @design.images %>
</tbody>
</table>
<div class="modal hide fade" id="imageModal" tabindex="-1" role="dialog" aria-labelledby="imageModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="imageModalLabel">Add image</h3>
</div>
<%= form_for :image, :url => upload_image_admin_design_path, :html => {:id => 'ajaxForm', :class => 'form-horizontal'}, :method => :post do |f| %>
<div class="modal-body">
<div class="control-group">
<%= f.label :image, t('admin.image'), :class => "control-label" %>
<div class="controls">
<%= f.file_field :file %>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<%= f.submit t(:add), :class => "btn btn-primary" %>
</div>
<% end %>
</div>
<div class="form-actions form-fixed pagination-right">
<button class="btn btn-primary" href="#imageModal" data-toggle="modal"><%= t(:add) %></button>
</div>

View File

@ -0,0 +1,8 @@
<%= form_for :file, :url => update_file_admin_design_path(:type => type, :object_id => object.id), :remote => true, :method => :post do |f| %>
<div id='post-body-content'>
<%= f.text_area :content, :class => 'middle', :value => object.file.read.force_encoding('UTF-8') %>
</div>
<div class="form-actions form-fixed pagination-right">
<button class="btn btn-primary"><%= t(:save) %></button>
</div>
<% end %>

View File

@ -4,10 +4,40 @@
<h1><%= t('admin.editing_design') %></h1>
<%= form_for @design, :url => admin_design_path(@design),:html => {:multipart => true} do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit t('update') %> <%= link_back %>
</p>
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#info" data-toggle="tab"><%= t('design.info') %></a></li>
<li><a href="#layout" data-toggle="tab"><%= @design.layout.name %></a></li>
<li><a href="#css_default" data-toggle="tab"><%= @design.css_default.name %></a></li>
<li><a href="#css_reset" data-toggle="tab"><%= @design.css_reset.name %></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= t('design.themes') %> <b class="caret"></b></a>
<ul class="dropdown-menu">
<% @design.themes.each do |theme| %>
<li><a href="#<%= dom_id theme %>" data-toggle="tab"><%= theme.name %></a></li>
<% end %>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= t('design.javascripts') %> <b class="caret"></b></a>
<ul class="dropdown-menu">
<% @design.javascripts.each do |js| %>
<li><a href="#<%= dom_id js %>" data-toggle="tab"><%= js.name %></a></li>
<% end %>
</ul>
</li>
<li><a href="#images" data-toggle="tab"><%= t('design.images') %></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="info"><%= render :partial => 'form' %></div>
<div class="tab-pane" id="layout"><%= render :partial => 'tab_form', :locals => {:type => :layout, :object => @design.layout} %></div>
<div class="tab-pane" id="css_default"><%= render :partial => 'tab_form', :locals => {:type => :css_default, :object => @design.css_default} %></div>
<div class="tab-pane" id="css_reset"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => @design.css_reset} %></div>
<% @design.themes.each do |theme| %>
<div class="tab-pane" id="<%= dom_id theme %>"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => theme} %></div>
<% end %>
<% @design.javascripts.each do |js| %>
<div class="tab-pane" id="<%= dom_id js %>"><%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => js} %></div>
<% end %>
<div class="tab-pane" id="images"><%= render :partial => 'images' %></div>
</div>

View File

@ -0,0 +1 @@
// $('.modal').modal('hide')

View File

@ -0,0 +1,9 @@
<% if !request.xhr? %>
<textarea>
<% end %>
$('#image_list').append("<%= j render :partial => 'image', :object => @image %>");
$('#imageModal').modal('hide');
$('#ajaxForm').resetForm();
<% if !request.xhr? %>
</textarea>
<% end %>

View File

@ -11,8 +11,8 @@
<p class="alert hide">You need to sign in or sign up before continuing.</p>
<div class="main">
<div class="control-group clear">
<%= f.label :login ,t("admin.user_new_interface.email")%>
<%= f.text_field :login, :placeholder => t("admin.user_new_interface.email"), :style => "width: 330px;" %>
<%= f.label :email ,t("admin.user_new_interface.email")%>
<%= f.text_field :email, :placeholder => t("admin.user_new_interface.email"), :style => "width: 330px;" %>
<span class="help-inline">Please correct the error</span>
</div>
<div class="control-group clear">

View File

@ -58,6 +58,8 @@ Orbit::Application.routes.draw do
end
member do
post 'edit_file' => 'designs#edit_file'
post 'update_file' => 'designs#update_file'
post 'upload_image' => 'designs#upload_image'
end
end
resources :infos do

View File

@ -22,7 +22,7 @@ module ParserLayout
body.css('.page_image').each do |page_image|
image = design.images.where( file: File.basename(page_image['src']))[0]
image.update_attributes(:name => File.basename(page_image['src']), :html_id => page_image['id'], :html_class => page_image['class']) if image
image.update_attributes(:html_id => page_image['id'], :html_class => page_image['class'], :in_html => true) if image
end
end

View File

@ -71,7 +71,7 @@ namespace :dev do
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
design.build_default_css(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
design.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
#
@ -89,7 +89,7 @@ namespace :dev do
design_1 = Design.new(:title => "Bob", :author => "Me", :intro => "Moran")
design_1.build_default_css(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
design_1.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
#

View File

@ -13,7 +13,7 @@ namespace :pages do
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
design.build_default_css(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
design.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
#
@ -37,7 +37,7 @@ namespace :pages do
design_1 = Design.new(:title => "Bob", :author => "Me", :intro => "Moran")
design_1.build_default_css(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
design_1.build_css_default(:file => File.open("#{Rails.root}/lib/fraisier/default.css"))
# image = design.images.build(:file => File.open("#{Rails.root}/lib/fraisier/img/buttons.gif"))
#