Skip to content

Commit

Permalink
Upgraded for 0.80.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ajjahn committed Nov 23, 2011
1 parent a33693f commit 77d616d
Show file tree
Hide file tree
Showing 30 changed files with 44 additions and 38 deletions.
2 changes: 0 additions & 2 deletions app/controllers/admin/comment_types_controller.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/controllers/admin/comments_controller.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/controllers/spree/admin/comment_types_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Spree::Admin::CommentTypesController < Spree::Admin::ResourceController
end
7 changes: 7 additions & 0 deletions app/controllers/spree/admin/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Spree::Admin::CommentsController < Spree::Admin::ResourceController
private

def location_after_save
:back
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Admin::OrdersController.class_eval do
Spree::Admin::OrdersController.class_eval do
def comments
load_order
@comment_types = CommentType.where(:applies_to => "Order")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Admin::ShipmentsController.class_eval do
Spree::Admin::ShipmentsController.class_eval do
def comments
load_shipment
@comment_types = CommentType.where(:applies_to => "Shipment")
Expand Down
3 changes: 0 additions & 3 deletions app/models/comment_type.rb

This file was deleted.

3 changes: 0 additions & 3 deletions app/models/order_decorator.rb

This file was deleted.

3 changes: 0 additions & 3 deletions app/models/shipment_decorator.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/models/comment.rb → app/models/spree/comment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Comment < ActiveRecord::Base
class Spree::Comment < ActiveRecord::Base
include ActsAsCommentable::Comment

belongs_to :commentable, :polymorphic => true
Expand Down
3 changes: 3 additions & 0 deletions app/models/spree/comment_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Spree::CommentType < ActiveRecord::Base
has_many :comments
end
3 changes: 3 additions & 0 deletions app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Spree::Order.class_eval do
acts_as_commentable
end
3 changes: 3 additions & 0 deletions app/models/spree/shipment_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Spree::Shipment.class_eval do
acts_as_commentable
end
2 changes: 1 addition & 1 deletion app/overrides/add_comment_configuration.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => "admin/configurations/index",
Deface::Override.new(:virtual_path => "spree/admin/configurations/index",
:name => "converted_admin_configurations_menu_468573024",
:insert_after => "[data-hook='admin_configurations_menu'], #admin_configurations_menu[data-hook]",
:text => "<%= configurations_menu_item(I18n.t('comment_types'), admin_comment_types_url, I18n.t('manage_comment_types')) %>",
Expand Down
4 changes: 2 additions & 2 deletions app/overrides/add_comment_to_admin_orders_tabs.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Deface::Override.new(:virtual_path => "admin/shared/_order_tabs",
Deface::Override.new(:virtual_path => "spree/admin/shared/_order_tabs",
:name => "converted_admin_order_tabs_472794197",
:insert_bottom => "[data-hook='admin_order_tabs'], #admin_order_tabs[data-hook]",
:partial => "admin/orders/tab",
:partial => "spree/admin/orders/tab",
:disabled => false)
2 changes: 1 addition & 1 deletion app/overrides/add_shipment_comment_button.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Deface::Override.new(:virtual_path => "admin/shipments/edit",
:name => "converted_admin_shipment_edit_buttons_233418828",
:insert_after => "[data-hook='admin_shipment_edit_buttons'], #admin_shipment_edit_buttons[data-hook]",
:partial => "admin/shipments/button",
:partial => "spree/admin/shipments/button",
:disabled => false)
2 changes: 0 additions & 2 deletions app/views/admin/orders/comments.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/admin/shipments/comments.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<%= render :partial => 'admin/shared/configuration_menu' %>
<%= render :partial => 'spree/admin/shared/configuration_menu' %>

<%= hook :admin_comment_type_edit_form_header do %>
<h1><%= t(:editing_comment_type) %></h1>
<%= render 'shared/error_messages', :target => @comment_type %>
<%= render 'spree/shared/error_messages', :target => @comment_type %>
<% end %>

<%= hook :admin_comment_type_edit_form do %>
<%= form_for(@comment_type, :url => object_url, :html => { :method => :put }) do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>

<%= hook :admin_comment_type_edit_form_buttons do %>
<%= render :partial => 'admin/shared/edit_resource_links' %>
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
<% end %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render :partial => 'admin/shared/configuration_menu' %>
<%= render :partial => 'spree/admin/shared/configuration_menu' %>

<div class="toolbar">
<ul class="actions">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<%= render :partial => 'admin/shared/configuration_menu' %>
<%= render :partial => 'spree/admin/shared/configuration_menu' %>

<%= hook :admin_comment_type_new_form_header do %>
<h1><%= t(:new_comment_type) %></h1>

<%= render 'shared/error_messages', :target => @comment_type %>
<%= render 'spree/shared/error_messages', :target => @comment_type %>
<% end %>

<%= hook :admin_comment_type_new_form do %>
<%= form_for(:comment_type, :url => collection_url) do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>

<%= hook :admin_comment_type_new_form_buttons do %>
<%= render :partial => 'admin/shared/new_resource_links' %>
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
<% end %>
<% end %>
<% end %>
File renamed without changes.
2 changes: 2 additions & 0 deletions app/views/spree/admin/orders/comments.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= render 'spree/admin/shared/order_tabs', :current => 'Comments' %>
<%= render 'spree/admin/shared/comments', :commentable => @order %>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1><%= "#{t(:comments)} #{(t(:for) + " " + comments_for unless (comments_for rescue nil).nil?)}"%></h1>

<%= render 'admin/shared/comment_list', :commentable => commentable %>
<%= render 'spree/admin/shared/comment_list', :commentable => commentable %>

<div class="order-add-comment">
<%= form_for(:comment, :url => admin_comments_url) do |f| %>
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions app/views/spree/admin/shipments/comments.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= render 'spree/admin/shared/order_tabs', :current => 'Shipments' %>
<%= render 'spree/admin/shared/comments', {:commentable => @shipment, :comments_for => "Shipment ##{@shipment.number}"} %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#end
#

Rails.application.routes.draw do
Spree::Core::Engine.routes.prepend do
namespace :admin do
resources :comments
resources :comment_types
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20111123200847_prefix_tables_with_spree.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class PrefixTablesWithSpree < ActiveRecord::Migration
def change
rename_table :comments, :spree_comments
rename_table :comment_types, :spree_comment_types
end
end

0 comments on commit 77d616d

Please sign in to comment.