Skip to content

Commit

Permalink
fix conflict mergin master
Browse files Browse the repository at this point in the history
  • Loading branch information
Hernan Fernandez committed Sep 2, 2009
2 parents 61d78f1 + 6b1b40d commit 878a451
Show file tree
Hide file tree
Showing 29 changed files with 275 additions and 221 deletions.
6 changes: 3 additions & 3 deletions config/database.yml.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
login: &login
adapter: mysql
adapter: mysql
host: localhost
username: root
password: root
Expand All @@ -14,7 +14,7 @@ test:

production:
database: your_production_database
adapter: mysql
adapter: mysql
host: localhost
username: your_production_database_login
password: your_production_database_password
password: your_production_database_password
9 changes: 9 additions & 0 deletions db/migrate/20090822092032_add_skip_to_first_child_to_pages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddSkipToFirstChildToPages < ActiveRecord::Migration
def self.up
add_column :pages, :skip_to_first_child, :boolean, :default => false
end

def self.down
remove_column :pages, :skip_to_first_child
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20090618044141) do
ActiveRecord::Schema.define(:version => 20090822092032) do

create_table "images", :force => true do |t|
t.integer "parent_id"
Expand Down Expand Up @@ -87,6 +87,7 @@
t.integer "custom_title_image_id"
t.boolean "draft", :default => false
t.string "browser_title"
t.boolean "skip_to_first_child", :default => false
end

create_table "portfolio_entries", :force => true do |t|
Expand Down
4 changes: 2 additions & 2 deletions public/stylesheets/lightbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
#prevLink { left: 0; float: left;}
#nextLink { right: 0; float: right;}
#prevLink:hover, #prevLink:visited:hover { background: url(../images/prevlabel.gif) left 15% no-repeat; }
#nextLink:hover, #nextLink:visited:hover { background: url(../images/nextlabel.gif) right 15% no-repeat; }
#prevLink:hover, #prevLink:visited:hover { background: url(/images/lightbox/prevlabel.gif) left 15% no-repeat; }
#nextLink:hover, #nextLink:visited:hover { background: url(/images/lightbox/nextlabel.gif) right 15% no-repeat; }

#imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }

Expand Down
1 change: 1 addition & 0 deletions public/wymeditor/jquery.refinery.wymeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,7 @@ WYMeditor.INIT_DIALOG = function(wym, selected, isIframe) {
parent.target = target;
}
else {
replaceable.before(link);
jQuery(link).append(replaceable[0]);
}
}
Expand Down
200 changes: 116 additions & 84 deletions vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
Original file line number Diff line number Diff line change
@@ -1,98 +1,110 @@
module ActiveRecord
module Acts
module Tree
def self.included(base)
base.extend(ClassMethods)
end
module Acts
module Tree
def self.included(base)
base.extend(ClassMethods)
end

# Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children
# association. This requires that you have a foreign key column, which by default is called +parent_id+.
#
# class Category < ActiveRecord::Base
# acts_as_tree :order => "name"
# end
#
# Example:
# root
# \_ child1
# \_ subchild1
# \_ subchild2
#
# root = Category.create("name" => "root")
# child1 = root.children.create("name" => "child1")
# subchild1 = child1.children.create("name" => "subchild1")
#
# root.parent # => nil
# child1.parent # => root
# root.children # => [child1]
# root.children.first.children.first # => subchild1
#
# In addition to the parent and children associations, the following instance methods are added to the class
# after calling <tt>acts_as_tree</tt>:
# * <tt>siblings</tt> - Returns all the children of the parent, excluding the current node (<tt>[subchild2]</tt> when called on <tt>subchild1</tt>)
# * <tt>self_and_siblings</tt> - Returns all the children of the parent, including the current node (<tt>[subchild1, subchild2]</tt> when called on <tt>subchild1</tt>)
# * <tt>ancestors</tt> - Returns all the ancestors of the current node (<tt>[child1, root]</tt> when called on <tt>subchild2</tt>)
# * <tt>root</tt> - Returns the root of the current node (<tt>root</tt> when called on <tt>subchild2</tt>)
# Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children
# association. This requires that you have a foreign key column, which by default is called +parent_id+.
#
# class Category < ActiveRecord::Base
# acts_as_tree :order => "name"
# end
#
# Example:
# root
# \_ child1
# \_ subchild1
# \_ subchild2
#
# root = Category.create("name" => "root")
# child1 = root.children.create("name" => "child1")
# subchild1 = child1.children.create("name" => "subchild1")
#
# root.parent # => nil
# child1.parent # => root
# root.children # => [child1]
# root.children.first.children.first # => subchild1
#
# In addition to the parent and children associations, the following instance methods are added to the class
# after calling <tt>acts_as_tree</tt>:
# * <tt>siblings</tt> - Returns all the children of the parent, excluding the current node (<tt>[subchild2]</tt> when called on <tt>subchild1</tt>)
# * <tt>self_and_siblings</tt> - Returns all the children of the parent, including the current node (<tt>[subchild1, subchild2]</tt> when called on <tt>subchild1</tt>)
# * <tt>ancestors</tt> - Returns all the ancestors of the current node (<tt>[child1, root]</tt> when called on <tt>subchild2</tt>)
# * <tt>root</tt> - Returns the root of the current node (<tt>root</tt> when called on <tt>subchild2</tt>)
# * <tt>descendants</tt> - Returns a flat list of the descendants of the current node (<tt>[child1, subchild1, subchild2]</tt> when called on <tt>root</tt>)
module ClassMethods
# Configuration options are:
#
# * <tt>foreign_key</tt> - specifies the column name to use for tracking of the tree (default: +parent_id+)
# * <tt>order</tt> - makes it possible to sort the children according to this SQL snippet.
# * <tt>counter_cache</tt> - keeps a count in a +children_count+ column if set to +true+ (default: +false+).
def acts_as_tree(options = {})
configuration = { :foreign_key => "parent_id", :order => nil, :counter_cache => nil }
configuration.update(options) if options.is_a?(Hash)
module ClassMethods
# Configuration options are:
#
# * <tt>foreign_key</tt> - specifies the column name to use for tracking of the tree (default: +parent_id+)
# * <tt>order</tt> - makes it possible to sort the children according to this SQL snippet.
# * <tt>counter_cache</tt> - keeps a count in a +children_count+ column if set to +true+ (default: +false+).
# * <tt>include</tt> - ability to add eager loading to tree finds by specifying associations to include. 'children' association eager loaded by default. Disable by supplying :include => nil or :include => []
def acts_as_tree(options = {})
configuration = { :foreign_key => "parent_id", :order => nil, :counter_cache => nil, :include => [:children] }
configuration.update(options) if options.is_a?(Hash) # to avoid something nasty happening check for Hash here.
configuration.update({:include => []}) if configuration[:include].nil? # if calling class really doesn't want to eager load its children.

belongs_to :parent, :class_name => name, :foreign_key => configuration[:foreign_key], :counter_cache => configuration[:counter_cache]
has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order], :dependent => :destroy
belongs_to :parent, :class_name => name, :foreign_key => configuration[:foreign_key], :counter_cache => configuration[:counter_cache], :include => configuration[:include]
has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order], :dependent => :delete_all, :include => configuration[:include]

class_eval <<-EOV
include ActiveRecord::Acts::Tree::InstanceMethods
class_eval <<-EOV
include ActiveRecord::Acts::Tree::InstanceMethods
def self.roots
find(:all, :conditions => "#{configuration[:foreign_key]} IS NULL", :order => #{configuration[:order].nil? ? "nil" : %Q{"#{configuration[:order]}"}})
end
def self.roots
find :all, :conditions => "#{configuration[:foreign_key]} IS NULL", :order => #{configuration[:order].nil? ? "nil" : %Q{"#{configuration[:order]}"}}, :include => %W{#{configuration[:include].join(' ')}}
end
def self.root
find(:first, :conditions => "#{configuration[:foreign_key]} IS NULL", :order => #{configuration[:order].nil? ? "nil" : %Q{"#{configuration[:order]}"}})
end
EOV
end
end
def self.root
find :first, :conditions => "#{configuration[:foreign_key]} IS NULL", :order => #{configuration[:order].nil? ? "nil" : %Q{"#{configuration[:order]}"}}, :include => %W{#{configuration[:include].join(' ')}}
end
def self.childless
nodes = []
module InstanceMethods
# Returns list of ancestors, starting from parent until root.
#
# subchild1.ancestors # => [child1, root]
def ancestors
node, nodes = self, []
nodes << node = node.parent until node.parent.nil? and return nodes
end
find(:all, :include => configuration[:include]).each do |node|
nodes << node if node.children.empty?
end
# Returns the root node of the tree.
def root
node = self
node = node.parent until node.parent.nil? and return node
end
nodes
end
EOV
end
end

# Returns all siblings of the current node.
#
# subchild1.siblings # => [subchild2]
def siblings
self_and_siblings - [self]
end
module InstanceMethods
# Returns list of ancestors, starting from parent until root.
#
# subchild1.ancestors # => [child1, root]
def ancestors
node, nodes = self, []
nodes << node = node.parent until node.parent.nil? and return nodes
end

# Returns the root node of the tree.
def root
node = self
node = node.parent until node.parent.nil? and return node
end

# Returns all siblings of the current node.
#
# subchild1.siblings # => [subchild2]
def siblings
self_and_siblings - [self]
end

# Returns all siblings and a reference to the current node.
#
# subchild1.self_and_siblings # => [subchild1, subchild2]
def self_and_siblings
parent ? parent.children : self.class.roots
end
# Returns all siblings and a reference to the current node.
#
# subchild1.self_and_siblings # => [subchild1, subchild2]
def self_and_siblings
parent ? parent.children : self.class.roots
end

# Returns a flat list of the descendants of the current node.
#
# root.descendants # => [child1, subchild1, subchild2]
# root.descendants # => [child1, subchild1, subchild2]
def descendants(node=self)
nodes = []
nodes << node unless node == self
Expand All @@ -103,7 +115,27 @@ def descendants(node=self)

nodes.compact
end
end
end
end

def chain
[self.ancestors, self, self.descendants].flatten
end

# Returns a flat list of all of the children under the current node
# which don't have any children belonging to them (childless)
#
# node.childess # => [subchild1, subchild2]
def childless
nodes = []

unless self.children.empty?
nodes << self.children.collect { |child| child.childless }
else
nodes << self
end

nodes.flatten.compact
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
<% if params[:action] =~ /(edit)|(update)/ %>
<div style='float: right; width: 25%;'>
<label>Current Image</label>
<%= image_tag @image.public_filename(:medium), :class => "brown_border" %>
<%= image_fu @image, :medium, { :class => "brown_border" } %>
</div>
<% end %>
42 changes: 21 additions & 21 deletions vendor/plugins/images/app/views/admin/images/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@
<div id='records'>
<% if @images.size > 0 %>
<h2>Images</h2>
<ul>
<li>
<% unless session[:image_view] == "list" %>
<%= link_to "List view", "#{admin_images_url}?view=list" %>
<% else %>
List view
<% end %>
</li>
<li>
<% unless session[:image_view] == "grid" %>
<%= link_to "Grid view", "#{admin_images_url}?view=grid" %>
<% else %>
Grid view
<% end %>
</li>
</ul>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<ul>
<%= render :partial => "#{session[:image_view] ||= "list"}_view" %>
</ul>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<ul>
<% @images.each do |image| -%>
<li id="sortable_<%= image.id %>" class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag('refinery/icons/eye.png'), image.public_filename,
:target => "_blank", :title => "#{image_fu image, :preview}" %>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_image_path(image),
:title => 'Edit this image' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_image_path(image),
:confirm => "Are you sure you want to delete #{image.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this image forever" %>
</span>
<%=h image.title %> <span class="preview">&nbsp;</span>
</span>
</li>
<% end -%>
</ul>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<% else %>
<p>
<strong>
Expand Down
5 changes: 1 addition & 4 deletions vendor/plugins/images/app/views/admin/images/insert.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
<ul>
<% @images.each do |image| %>
<li<%= " class='selected'" if @image_id == image.id %>>
<%= image_tag image.public_filename(:dialog_thumb),
:alt => image.title,
:title => image.title,
:id => "image_#{image.id}" -%>
<%= image_fu image, :dialog_thumb, {:alt => image.title, :title => image.title, :id => "image_#{image.id}"} -%>
</li>
<% end -%>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class InquiriesController < ApplicationController
before_filter :find_page, :only => [:create, :new]

def thank_you
@page = Page.find_by_menu_match("^/inquiries/thank_you$", :include => [:parts, :slugs, :children])
@page = Page.find_by_menu_match("^/inquiries/thank_you$", :include => [:parts, :slugs])
end

def new
Expand Down Expand Up @@ -35,7 +35,7 @@ def create
protected

def find_page
@page = Page.find_by_link_url('/inquiries/new', :include => [:parts, :slugs, :children])
@page = Page.find_by_link_url('/inquiries/new', :include => [:parts, :slugs])
end

end
4 changes: 2 additions & 2 deletions vendor/plugins/inquiries/app/models/inquiry_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ class InquiryMailer < ActionMailer::Base
def confirmation(inquiry, request)
@subject = "Thank you for your inquiry"
@recipients = inquiry.email
@from = "#{RefinerySetting[:site_name]} <no-reply@#{request.domain(RefinerySetting[:tld_length] ||= 1)}>"
@from = "#{RefinerySetting[:site_name]} <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
@sent_on = Time.now
@body[:inquiry] = inquiry
end

def notification(inquiry, request)
@subject = "New inquiry from your website"
@recipients = InquirySetting.notification_recipients.value
@from = "#{RefinerySetting[:site_name]} <no-reply@#{request.domain(RefinerySetting[:tld_length] ||= 1)}>"
@from = "#{RefinerySetting[:site_name]} <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
@sent_on = Time.now
@body[:inquiry] = inquiry
end
Expand Down
Loading

0 comments on commit 878a451

Please sign in to comment.