Skip to content

Commit

Permalink
Merge pull request #622 from alphagov/deploy-after-archiving
Browse files Browse the repository at this point in the history
Refactoring for re-opening
  • Loading branch information
pixeltrix authored Sep 12, 2017
2 parents 0b46e54 + b8f1314 commit 6d93d48
Show file tree
Hide file tree
Showing 176 changed files with 4,242 additions and 3,075 deletions.
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ gem 'dotenv-rails', :require => 'dotenv/rails-now'

gem 'rails', '4.2.8'

# Legacy Rails feature gems - will no longer be supported in Rails 5.0
gem 'responders'
gem 'rails_autolink'

gem 'rake'
gem 'pg'
gem 'authlogic'
Expand Down
6 changes: 0 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,13 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_autolink (1.1.6)
rails (> 3.1)
railties (4.2.8)
actionpack (= 4.2.8)
activesupport (= 4.2.8)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
request_store (1.2.1)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
Expand Down Expand Up @@ -341,9 +337,7 @@ DEPENDENCIES
pry
puma
rails (= 4.2.8)
rails_autolink
rake
responders
rspec-rails
sass-rails (~> 5.0)
shoulda-matchers
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/debate_outcomes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::DebateOutcomesController < Admin::AdminController
respond_to :html
before_action :fetch_petition
before_action :fetch_debate_outcome

Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/government_response_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::GovernmentResponseController < Admin::AdminController
respond_to :html
before_action :fetch_petition
before_action :fetch_government_response

Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/moderation_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::ModerationController < Admin::AdminController
respond_to :html
before_action :fetch_petition

def update
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/notes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::NotesController < Admin::AdminController
respond_to :html
before_action :fetch_petition
before_action :fetch_note

Expand Down
2 changes: 0 additions & 2 deletions app/controllers/admin/parliaments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class Admin::ParliamentsController < Admin::AdminController
respond_to :html

before_action :require_sysadmin
before_action :fetch_parliament

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/admin/petition_details_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::PetitionDetailsController < Admin::AdminController
respond_to :html
before_action :fetch_petition

def show
Expand All @@ -22,7 +21,7 @@ def fetch_petition
def petition_params
params.require(:petition).permit(
:action, :background, :additional_details,
:special_consideration, :creator_signature_attributes => [:name]
:special_consideration, :creator_attributes => [:name]
)
end
end
1 change: 0 additions & 1 deletion app/controllers/admin/petition_emails_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::PetitionEmailsController < Admin::AdminController
respond_to :html
before_action :fetch_petition
before_action :build_email, only: [:new, :create]
before_action :fetch_email, only: [:edit, :update, :destroy]
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/petition_tags_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::PetitionTagsController < Admin::AdminController
respond_to :html
before_action :fetch_petition

def show
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/schedule_debate_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::ScheduleDebateController < Admin::AdminController
respond_to :html
before_action :fetch_petition

def show
Expand Down
1 change: 0 additions & 1 deletion app/controllers/admin/take_down_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::TakeDownController < Admin::AdminController
respond_to :html
before_action :fetch_petition

def show
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/archived/petitions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'csv'

class Archived::PetitionsController < ApplicationController
respond_to :html, :json
respond_to :csv, only: [:index]

before_action :redirect_to_valid_state, only: [:index]
before_action :fetch_parliament, only: [:index]
before_action :fetch_petitions, only: [:index]
Expand All @@ -15,11 +12,18 @@ class Archived::PetitionsController < ApplicationController
helper_method :archived_petition_facets

def index
respond_with(@petitions)
respond_to do |format|
format.html
format.json
format.csv
end
end

def show
respond_with(@petition)
respond_to do |format|
format.html
format.json
end
end

private
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/archived/signatures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ class SignaturesController < ApplicationController
before_action :verify_unsubscribe_token
before_action :do_not_cache

respond_to :html

def unsubscribe
@signature.unsubscribe!(token_param)

Expand Down
13 changes: 8 additions & 5 deletions app/controllers/feedback_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
class FeedbackController < ApplicationController
respond_to :html

before_action :build_feedback, only: [:new, :create]

def new
respond_with @feedback
respond_to do |format|
format.html
end
end

def create
if @feedback.save
FeedbackEmailJob.perform_later(@feedback)
redirect_to thanks_feedback_url
else
respond_to do |format|
format.html { render :new }
end
end

respond_with @feedback, location: thanks_feedback_url
end

def thanks
Expand Down
15 changes: 10 additions & 5 deletions app/controllers/local_petitions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
require 'csv'

class LocalPetitionsController < ApplicationController
respond_to :html
respond_to :csv, :json, only: [:show, :all]

before_action :sanitize_postcode, only: :index
before_action :find_by_postcode, if: :postcode?, only: :index
before_action :find_by_slug, only: [:show, :all]
Expand All @@ -21,11 +18,19 @@ def index
end

def show
respond_with(@petitions)
respond_to do |format|
format.html
format.json
format.csv
end
end

def all
respond_with(@petitions)
respond_to do |format|
format.html
format.json
format.csv
end
end

private
Expand Down
24 changes: 15 additions & 9 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
class PagesController < ApplicationController
respond_to :html, only: [:index, :help, :privacy]
respond_to :xml, only: [:browserconfig]
respond_to :json, only: [:manifest]

def index
respond_with(nil)
respond_to do |format|
format.html
end
end

def help
respond_with(nil)
respond_to do |format|
format.html
end
end

def privacy
respond_with(nil)
respond_to do |format|
format.html
end
end

def browserconfig
respond_with(nil)
respond_to do |format|
format.xml
end
end

def manifest
respond_with(nil)
respond_to do |format|
format.json
end
end
end
Loading

0 comments on commit 6d93d48

Please sign in to comment.