Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
Move to :method => :patch from :put, ChangeLog
Browse files Browse the repository at this point in the history
  • Loading branch information
polar committed Aug 15, 2013
1 parent b9e68e3 commit 54b138a
Show file tree
Hide file tree
Showing 61 changed files with 229 additions and 206 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG
@@ -1,3 +1,31 @@


=3.0.0.pre1 -- Polar Humenn 15 Aug 2013
* Moved forms and links to unobtrusive javascript. Still using Prototype.
* Addressed almost all 4.0/4.1 deprecation issues
* Migrated to ActiveRecord Query syntax.
* Replaced :method => :put with :method => :patch
* Removed attr_accessible and attr_protected in favor of StrongParameters
* Replaced some 2.3 style plugins with bona fide gems, removed, or moved to lib
activity_tracker ---> lib
acts_as_list ---> gem acts_as_list
acts_as_commentable ---> gem acts_as_commentable, requires db:migrate
acts_as_publishable ---> lib
auto_complete ---> lib
bborn-acts-as-taggable-on ---> gem acts_as_taggable-on
enumerations_mixin ---> gem power_num
prototype_legacy_helper ---> lib (about to be removed)
resource_feeder ---> lib
responds_to_parent ---> removed
white_list ---> lib
* Replaced or Upgraded gems
gem ransak replaces gem meta_search
gem friendly_id upgrade requires a db:migrate and syntactical changes
* Added gems as per directions supporting caching in Rails 4
gem actionpack-action_caching
gem actionpack-page_caching
gem rails-observers

= TODO
* replace old multiple uploader
* fix photo uploading from welcome_photo page
Expand Down
43 changes: 6 additions & 37 deletions Gemfile
@@ -1,48 +1,17 @@
source 'http://rubygems.org'
ruby "2.0.0"

gem 'rails', "4.0.0"

gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', ">= 1.3.0"

gem 'omniauth-facebook'
gem 'power_enum'

gem 'configatron'
gem 'bcrypt-ruby'
gem 'haml'
gem 'hpricot'
gem 'aws-s3'
gem 'paperclip'
gem 'omniauth'
gem 'prototype-rails', "~> 3.2.0"
gem 'htmlentities'
gem 'ri_cal'
gem 'rakismet'
gem 'kaminari'
gem 'dynamic_form'
gem 'friendly_id', github: "norman/friendly_id" # Rails 4 compat
gem 'rails_autolink'
# We only use sprockets and uglifier development locally.
# users of the engine don't need these, if they do
# not want them.
gem 'uglifier', ">= 1.3.0"
gem 'sprockets'
gem 'ransack'
gem 'acts-as-taggable-on', "~> 2.4.1"
gem 'sanitize'
gem 'acts_as_commentable'
gem 'authlogic' #, github: "binarylogic/authlogic" # Rails 4 compat
gem 'recaptcha'
gem 'tinymce-rails'

#gem 'protected_attributes'
gem 'rails-observers'
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'

group :test do
gem "omniauth-facebook"
gem 'sqlite3'
gem "minitest"
gem "minitest-reporters"
end

gem "acts_as_list", ">= 0.3.0"

gemspec
19 changes: 17 additions & 2 deletions README.markdown
Expand Up @@ -2,11 +2,25 @@

CommunityEngine [![Build Status](https://secure.travis-ci.org/bborn/communityengine.png)](http://travis-ci.org/bborn/communityengine)

** Using Rails 3.x? You want the [rails2.x branch](https://github.com/bborn/communityengine/tree/master.x)

CommunityEngine [![Build Status](https://secure.travis-ci.org/bborn/communityengine.png)](http://travis-ci.org/bborn/communityengine)

Information at: [http://www.communityengine.org](http://www.communityengine.org)

** Using Rails 4.x? You are here. Current Version 3.0.0.pre1 15 Aug, 2013

This repository/branch is a thorough port of CommunityEngine to Rails 4, along with a few bug and aesthetic fixes. I
did a fair bit of work getting rid of most of the Rails 4.1 deprecation messages, except those that came from other
modules. Most of the gems have been locked at higher numbers. Authlogic is working,
but people say its tenuous as of this writing.

gem "https://github.com/polar/communityengine.git", :branch => "rails4", :tag => "3_0_0_pre1"

Requirements:

- RAILS VERSION 3.2.8
- RAILS VERSION 4.0.0
- RUBY 2.0.0

Getting CommunityEngine Running
--------------------------------
Expand Down Expand Up @@ -141,7 +155,7 @@ To make a controller from your application use CE's layout and inherit CE's help

class RecipesController < BaseController

before_filter :login_required
before_action :login_required

uses_tiny_mce do
{:only => [:show], :options => configatron.default_mce_options}
Expand Down Expand Up @@ -190,6 +204,7 @@ Contributors - Thanks! :)
- [Juan de Frías](http://github.com/juafrlo) static pages, photo albums, message_controller tests
- [Joel Nimety](http://github.com/jnimety) authlogic authentication
- [Stephane Decleire](http://github.com/sdecleire) i18n, fr-FR locale
- [Polar Humenn] (http://github.com/polar) Rails 4 port, and other slight improvements



Expand Down
10 changes: 10 additions & 0 deletions UPGRADING.markdown
@@ -1,3 +1,13 @@
Upgrading to v3.0.0
===================
Follow the various guides for converting to Rails 4 from Rails 3.x

Run `bundle exec rake app:community_engine:install:migrations`
Run `rake db:migrate`
Run `rake test && take community_engine:test`

Somethings may not be compatible. Some of the views and forms have changed.

Upgrading to v1.2.1
===================
Run `ruby script/generate plugin_migration`
Expand Down
14 changes: 7 additions & 7 deletions app/assets/javascripts/tinymce/plugins/curblyadvimage/image.htm
Expand Up @@ -61,7 +61,7 @@
<td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="src" type="text" id="src" value="" onchange="ImageDialog.showPreviewImage(this.value);" /></td>
<td><input name="src" type="text" id="src" value="" onchange="ImageDialog.showPreviewImage(this.value);" /></td>
<td id="srcbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
Expand All @@ -72,11 +72,11 @@
</tr>
<tr>
<td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td>
<td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
<td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
</tr>
<tr>
<td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td>
<td colspan="2"><input id="title" name="title" type="text" value="" /></td>
<td colspan="2"><input id="title" name="title" type="text" value="" /></td>
</tr>
</table>
</fieldset>
Expand Down Expand Up @@ -120,7 +120,7 @@
<tr>
<td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>
<td nowrap="nowrap">
<input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" /> x
<input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" /> x
<input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" /> px
</td>
</tr>
Expand All @@ -143,12 +143,12 @@

<tr>
<td class="column1"><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td>
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td>
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td>
</tr>

<tr>
<td class="column1"><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td>
</tr>

<tr>
Expand All @@ -158,7 +158,7 @@

<tr>
<td class="column1"><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td>
<td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td>
<td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td>
</tr>

</table>
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/albums_controller.rb
Expand Up @@ -60,8 +60,8 @@ def create
end
end

# PUT /albums/1
# PUT /albums/1.xml
# patch /albums/1
# patch /albums/1.xml
def update
@album = Album.find(params[:id])

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/categories_controller.rb
Expand Up @@ -74,8 +74,8 @@ def create
end
end

# PUT /categories/1
# PUT /categories/1.xml
# patch /categories/1
# patch /categories/1.xml
def update
@category = Category.friendly.find(params[:id])

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/clippings_controller.rb
Expand Up @@ -153,8 +153,8 @@ def create
end
end

# PUT /clippings/1
# PUT /clippings/1.xml
# patch /clippings/1
# patch /clippings/1.xml
def update
@user = User.friendly.find(params[:user_id])
@clipping = Clipping.find(params[:id])
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/photos_controller.rb
Expand Up @@ -138,8 +138,8 @@ def create
end


# PUT /photos/1
# PUT /photos/1.xml
# patch /photos/1
# patch /photos/1.xml
def update
@photo = Photo.find(params[:id])
@user = @photo.user
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/posts_controller.rb
Expand Up @@ -129,8 +129,8 @@ def create
end
end

# PUT /posts/1
# PUT /posts/1.xml
# patch /posts/1
# patch /posts/1.xml
def update
@post = Post.unscoped.find(params[:id])
@user = @post.user
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/rsvps_controller.rb
Expand Up @@ -36,8 +36,8 @@ def create
end
end

# PUT /rsvps/1
# PUT /rsvps/1.xml
# patch /rsvps/1
# patch /rsvps/1.xml
def update
@rsvp.attendees_count = rsvp_params[:attendees_count]
respond_to do |format|
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Expand Up @@ -170,15 +170,15 @@ def crop_profile_photo
flash[:notice] = :no_profile_photo.l
redirect_to upload_profile_photo_user_path(@user) and return
end
return unless request.put?
return unless request.put? || request.patch?

@photo.update_attributes(:crop_x => params[:crop_x], :crop_y => params[:crop_y], :crop_w => params[:crop_w], :crop_h => params[:crop_h])
redirect_to user_path(@user)
end

def upload_profile_photo
@avatar = Photo.new(avatar_params)
return unless request.put?
return unless request.put? || request.patch?

@avatar.user = @user
if @avatar.save
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/friendships_helper.rb
Expand Up @@ -3,11 +3,11 @@ module FriendshipsHelper
def friendship_control_links(friendship)
html = case friendship.friendship_status_id
when FriendshipStatus[:pending].id
"#{(link_to(:accept.l, accept_user_friendship_path(friendship.user, friendship), :method => :put, :class => 'button positive') unless friendship.initiator?)} #{link_to(:deny.l, deny_user_friendship_path(friendship.user, friendship), :method => :put, :class => 'button negative')}"
"#{(link_to(:accept.l, accept_user_friendship_path(friendship.user, friendship), :method => :patch, :class => 'button positive') unless friendship.initiator?)} #{link_to(:deny.l, deny_user_friendship_path(friendship.user, friendship), :method => :patch, :class => 'button negative')}"
when FriendshipStatus[:accepted].id
"#{link_to(:remove_this_friend.l, deny_user_friendship_path(friendship.user, friendship), :method => :put, :class => 'button negative')}"
"#{link_to(:remove_this_friend.l, deny_user_friendship_path(friendship.user, friendship), :method => :patch, :class => 'button negative')}"
when FriendshipStatus[:denied].id
"#{link_to(:accept_this_request.l, accept_user_friendship_path(friendship.user, friendship), :method => :put, :class => 'button positive')}"
"#{link_to(:accept_this_request.l, accept_user_friendship_path(friendship.user, friendship), :method => :patch, :class => 'button positive')}"
end

html.html_safe
Expand Down
2 changes: 1 addition & 1 deletion app/views/ads/edit.html.haml
@@ -1,7 +1,7 @@
-box do
%h3=:editing_ad.l
= error_messages_for :ad
= form_for(:ad, :url => ad_path(@ad), :html => { :method => :put, :class => "MainForm" }) do |f|
= form_for(:ad, :url => ad_path(@ad), :html => { :method => :patch, :class => "MainForm" }) do |f|
%label=:name.l
= f.text_field :name

Expand Down
2 changes: 1 addition & 1 deletion app/views/categories/edit.html.haml
Expand Up @@ -4,7 +4,7 @@
#yui-main
-box :class => "yui-b" do
%h3=:editing_category.l
= form_for(:category, :url => category_path(@category), :html => { :method => :put, :class => "MainForm" }) do |f|
= form_for(:category, :url => category_path(@category), :html => { :method => :patch, :class => "MainForm" }) do |f|

%label
=:name.l
Expand Down
2 changes: 1 addition & 1 deletion app/views/clippings/edit.html.haml
Expand Up @@ -8,7 +8,7 @@
-box do
%h3= :editing_clipping.l
%img{"src"=>"#{h @clipping.image_uri(:large)}"}
= form_for(:clipping, :url => user_clipping_path(@user, @clipping), :html => { :method => :put, :class => "MainForm" }) do |f|
= form_for(:clipping, :url => user_clipping_path(@user, @clipping), :html => { :method => :patch, :class => "MainForm" }) do |f|
%label= :url.l
= f.text_field :url

Expand Down
2 changes: 1 addition & 1 deletion app/views/comments/_edit_form.html.haml
@@ -1,4 +1,4 @@
= form_for(@comment, :url => {:controller => 'comments', :action => 'update', :id => comment.id}, :method => :put, :remote => true, :html => {:id => "edit_comment_#{comment.id}_form", :class => "MainForm"}) do |f|
= form_for(@comment, :url => {:controller => 'comments', :action => 'update', :id => comment.id}, :method => :patch, :remote => true, :html => {:id => "edit_comment_#{comment.id}_form", :class => "MainForm"}) do |f|
.errors
%label
%em=:comment_character_limit.l
Expand Down
2 changes: 1 addition & 1 deletion app/views/events/edit.html.haml
Expand Up @@ -2,7 +2,7 @@
-box do
%h3= :edit_event.l
= error_messages_for :event
= form_for(:event, :url => event_path(@event), :html => {:method => :put, :class => "MainForm"} ) do |f|
= form_for(:event, :url => event_path(@event), :html => {:method => :patch, :class => "MainForm"} ) do |f|
%label= :name.l
= f.text_field :name

Expand Down
2 changes: 1 addition & 1 deletion app/views/forums/edit.html.haml
Expand Up @@ -2,7 +2,7 @@
%h3= :edit_forum.l

%p= link_to :delete_this_forum.l, forum_path(@forum), :method => :delete, :class => "utility", :data => {:confirm => :are_you_sure.l}
= form_for :forum, :url => forum_path(@forum), :html => { :class => "MainForm", :method => :put } do |f|
= form_for :forum, :url => forum_path(@forum), :html => { :class => "MainForm", :method => :patch } do |f|
= render :partial => "form", :object => f
%p
= submit_tag :save_forum.l
Expand Down
2 changes: 1 addition & 1 deletion app/views/friendships/_friendships.html.erb
Expand Up @@ -7,7 +7,7 @@
<td><%= friendship.friend.login %>, <%= friendship.friendship_status.name %></td>
<td><%= friendship.initiator? ? "initiator" : "not initiator" %></td>
<td><%= time_ago_in_words friendship.created_at %></td>
<td><%= link_to(:accept.l, accept_user_friendship_path(@user, friendship), :method => :put) unless friendship.initiator? %></td>
<td><%= link_to(:accept.l, accept_user_friendship_path(@user, friendship), :method => :patch) unless friendship.initiator? %></td>
<td><%= link_to(:deny.l, user_friendship_path(friendship.user, friendship), :data => {:confirm => :are_you_sure.l}, :method => :delete) %></td>
</tr>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/friendships/show.html.haml
Expand Up @@ -6,7 +6,7 @@
=:to_accept.l
- elsif @friendship.pending?
=:this_friendship_is_pending.l
= link_to :click_to_accept_it.l, accept_user_friendship_path(@user, @friendship), :method => :put
= link_to :click_to_accept_it.l, accept_user_friendship_path(@user, @friendship), :method => :patch

%br
= link_to :back.l, accepted_user_friendships_path(@user)
2 changes: 1 addition & 1 deletion app/views/homepage_features/edit.html.haml
Expand Up @@ -3,7 +3,7 @@
%h1
= :editing_homepage_feature.l
= error_messages_for :homepage_feature
= form_for(:homepage_feature, :url => homepage_feature_path(@homepage_feature), :html => { :multipart => true, :method => :put }) do |f|
= form_for(:homepage_feature, :url => homepage_feature_path(@homepage_feature), :html => { :multipart => true, :method => :patch }) do |f|
%p
%b
URL
Expand Down
2 changes: 1 addition & 1 deletion app/views/metro_areas/edit.html.haml
Expand Up @@ -2,7 +2,7 @@
%h3= :editing_metro_area.l

= error_messages_for :metro_area
= form_for(@metro_area, :url => metro_area_path(@metro_area), :html => { :method => :put, :class => 'MainForm' }) do |f|
= form_for(@metro_area, :url => metro_area_path(@metro_area), :html => { :method => :patch, :class => 'MainForm' }) do |f|
%label= :country.l + ":"
= f.collection_select :country_id, Country.order("name").to_a, :id, :name
%label= :state.l + ":"
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/edit.html.haml
Expand Up @@ -3,7 +3,7 @@
-box do
%h3= :edit_page.l
= error_messages_for :page
= form_for(:page, :url => admin_page_path(@page), :html => {:method => :put, :class => "MainForm", :id => 'post_form'}) do |f|
= form_for(:page, :url => admin_page_path(@page), :html => {:method => :patch, :class => "MainForm", :id => 'post_form'}) do |f|

=render :partial => 'form', :locals => {:f => f}

Expand Down

0 comments on commit 54b138a

Please sign in to comment.