diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/account_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/account_settings_controller.rb | 0 | ||||
-rw-r--r-- | app/controllers/api/identities_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/api/services_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/api/sessions_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/api_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/errors_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/home_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/pages_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/sessions_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 2 |
12 files changed, 27 insertions, 3 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index ee7cca4..42e8983 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -3,6 +3,8 @@ class AccountController < ApplicationController before_filter :require_registration_allowed before_filter :redirect_if_logged_in + respond_to :html + def new @user = User.new end diff --git a/app/controllers/account_settings_controller.rb b/app/controllers/account_settings_controller.rb deleted file mode 100644 index e69de29..0000000 --- a/app/controllers/account_settings_controller.rb +++ /dev/null diff --git a/app/controllers/api/identities_controller.rb b/app/controllers/api/identities_controller.rb index ab2ac00..de4910a 100644 --- a/app/controllers/api/identities_controller.rb +++ b/app/controllers/api/identities_controller.rb @@ -3,6 +3,8 @@ module Api before_filter :token_authenticate before_filter :require_monitor + respond_to :json + def show @identity = Identity.find_by_address(params[:id]) if @identity diff --git a/app/controllers/api/services_controller.rb b/app/controllers/api/services_controller.rb index da2774b..58e129c 100644 --- a/app/controllers/api/services_controller.rb +++ b/app/controllers/api/services_controller.rb @@ -2,6 +2,8 @@ class Api::ServicesController < ApiController before_filter :require_login, :unless => :anonymous_access_allowed? + respond_to :json + def show respond_with current_user.effective_service_level end diff --git a/app/controllers/api/sessions_controller.rb b/app/controllers/api/sessions_controller.rb index c8deb7a..178f86e 100644 --- a/app/controllers/api/sessions_controller.rb +++ b/app/controllers/api/sessions_controller.rb @@ -2,6 +2,7 @@ module Api class SessionsController < ApiController before_filter :require_login, only: :destroy + respond_to :json def new @session = Session.new diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 70b3cac..95c8f57 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -1,7 +1,6 @@ class ApiController < ApplicationController skip_before_filter :verify_authenticity_token - respond_to :json protected diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2af2f29..8d08a2c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,12 @@ class ApplicationController < ActionController::Base before_filter :no_cache_header before_filter :no_frame_header before_filter :language_header + + # UPGRADE: this won't be needed in Rails 5 anymore as it's the default + # behavior if a template is present but a different format would be + # rendered and that template is not present + before_filter :verify_request_format!, if: :mime_types_specified + rescue_from StandardError, :with => :default_error_handler rescue_from CouchRest::Exception, :with => :default_error_handler @@ -11,6 +17,11 @@ class ApplicationController < ActionController::Base protected + def mime_types_specified + mimes = collect_mimes_from_class_level + mimes.present? + end + def default_error_handler(exc) respond_to do |format| format.json { render_json_error(exc) } diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index d869ab5..80c270f 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,5 +1,7 @@ # We render http errors ourselves so we can customize them class ErrorsController < ApplicationController + respond_to :html + # 404 def not_found render status: 404 diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1d62178..86c36e9 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,8 @@ class HomeController < ApplicationController layout 'home' + respond_to :html + def index if logged_in? redirect_to current_user diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index e0f39e3..b9c601a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -2,7 +2,9 @@ # Render static pages # + class PagesController < ApplicationController + respond_to :html def show @show_navigation = false diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 34d4f53..18e5216 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,6 +1,7 @@ class SessionsController < ApplicationController before_filter :redirect_if_logged_in, :only => [:new] + respond_to :html, :json def new @session = Session.new @@ -16,7 +17,7 @@ class SessionsController < ApplicationController end # - # Warden will catch all 401s and run this instead: + # Warden will catch all 401s and triggers this action: # def unauthenticated login_required diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4d198b9..0a0f551 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -7,7 +7,7 @@ class UsersController < ApplicationController before_filter :require_login before_filter :require_admin, :only => [:index, :deactivate, :enable] - before_filter :fetch_user, :only => [:show, :edit, :destroy, :deactivate, :enable] + before_filter :fetch_user, :except => [:index] respond_to :html |