Merge branch 'master' of github.com:internetee/registry

This commit is contained in:
Andres Keskküla 2014-09-25 16:45:12 +03:00
commit e7fb6208ce
12 changed files with 77 additions and 8 deletions

View file

@ -1,4 +1,4 @@
class Admin::ContactsController < ApplicationController
class Admin::ContactsController < AdminController
# TODO created_by and updated_by ids
before_action :set_contact, only: [:show, :destroy, :edit, :update]

View file

@ -1,4 +1,4 @@
class Admin::DomainsController < ApplicationController
class Admin::DomainsController < AdminController
before_action :set_domain, only: [:show, :edit, :update, :destroy]
before_action :verify_deletion, only: [:destroy]

View file

@ -1,4 +1,4 @@
class Admin::RegistrarsController < ApplicationController
class Admin::RegistrarsController < AdminController
def search
render json: Registrar.search_by_query(params[:q])
end

View file

@ -1,4 +1,4 @@
class Admin::SettingGroupsController < ApplicationController
class Admin::SettingGroupsController < AdminController
before_action :set_setting_group, only: [:show, :update]
def index

View file

@ -0,0 +1,7 @@
class AdminController < ApplicationController
before_action :verify_admin
def verify_admin
redirect_to client_root_path unless current_user.try(:admin?)
end
end

View file

@ -2,7 +2,8 @@ class Client::DomainsController < ClientController
include Shared::CommonDomain
def index
@q = current_user.registrar.domains.search(params[:q])
@q = Domain.search(params[:q]) if current_user.admin?
@q = current_user.registrar.domains.search(params[:q]) unless current_user.admin?
@domains = @q.result.page(params[:page])
end

View file

@ -1,8 +1,10 @@
class SessionsController < Devise::SessionsController
def create
if Rails.env.development?
if Rails.env.development? || Rails.env.test?
@user = User.find_by(username: 'gitlab') if params[:gitlab]
@user = User.find_by(username: 'zone') if params[:zone]
flash[:notice] = I18n.t('shared.welcome')
sign_in_and_redirect @user, :event => :authentication
return
end