Fixed registrar module helper

This commit is contained in:
Priit Tark 2015-04-13 11:23:56 +03:00
parent 9bb20365c9
commit 8df6b3bdd1
4 changed files with 19 additions and 17 deletions

View file

@ -2,8 +2,8 @@ class Registrar::PollsController < Registrar::DeppController # EPP controller
before_action :init_epp_xml before_action :init_epp_xml
def show def show
authorize! :view, :registrar_dashboard authorize! :view, :registrar_dashboard
@data = depp_current_user.request(@ex.poll) @data = depp_current_user.request(@ex.poll)
end end
def destroy def destroy

View file

@ -1,5 +1,9 @@
class Registrar::SessionsController < ::SessionsController class Registrar::SessionsController < ::SessionsController
layout 'registrar/application' layout 'registrar/application'
helper_method :depp_controller?
def depp_controller?
false
end
def create def create
@user = ApiUser.first if params[:user1] @user = ApiUser.first if params[:user1]

View file

@ -1,15 +1,13 @@
module Registrar module Registrar::ApplicationHelper
module ApplicationHelper def env_style
def env_style return '' if unstable_env.nil?
return '' if unstable_env.nil? "background-image: url(#{image_path("registrar/bg-#{unstable_env}.png")});"
"background-image: url(#{image_path("registrar/bg-#{unstable_env}.png")});" end
end
def pagination_details def pagination_details
params[:page] ||= 1 params[:page] ||= 1
limit = ENV['depp_records_on_page'] || 20 limit = ENV['depp_records_on_page'] || 20
offset = ((params[:page].to_i - 1) * limit.to_i) offset = ((params[:page].to_i - 1) * limit.to_i)
[limit, offset] [limit, offset]
end
end end
end end

View file

@ -6,17 +6,17 @@ feature 'Root', type: :feature do
Fabricate(:api_user) Fabricate(:api_user)
end end
fit 'should redirect to registrar login page' do it 'should redirect to registrar login page' do
visit '/registrar/login' visit '/registrar/login'
current_path.should == '/registrar/login' current_path.should == '/registrar/login'
end end
fit 'should redirect to registrar login page' do it 'should redirect to registrar login page' do
visit '/registrar' visit '/registrar'
current_path.should == '/registrar/login' current_path.should == '/registrar/login'
end end
fit 'should redirect to registrar login page' do it 'should redirect to registrar login page' do
visit '/registrar/' visit '/registrar/'
current_path.should == '/registrar/login' current_path.should == '/registrar/login'
end end