Skip to content

Commit

Permalink
testirovanie
Browse files Browse the repository at this point in the history
  • Loading branch information
bek0nik committed May 26, 2012
1 parent 14c389a commit 9fb7fd9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/controllers/authentications_controller.rb
Expand Up @@ -6,7 +6,7 @@ def index
end

def create
render :text => request.env["omniauth.auth"].to_yaml
render :text => request.env['omniauth.auth'].to_yaml
# auth = request.env["omniauth.auth"]
# current_user.authentications.create(:provider => auth['provider'], :uid => auth['uid'])
# flash[:notice] = "Authentication successful."
Expand Down
29 changes: 15 additions & 14 deletions app/controllers/test_names_controller.rb
Expand Up @@ -10,25 +10,26 @@ def index

def show
@test = TestName.find(params[:id])
question = Hash.new(@test.questions.all.sample(25))
@question = @test.questions.limit(25)
# question = Hash.new(@test.questions.all.sample(25))
# @question = @test.questions.limit(25)
#render :action => :start
session[:test_step] = nil
# session[:test_step] = nil
end

def start
@test = TestName.find(params[:id])
@question = @test.questions.limit(25)
session[:test_step].deep_merge!(params[:f]) if params[:f]
@test.current_step = session[:test_step]
if params[:back_button]
@test.previous_step
elsif @test.last_step?
@test.result
else
@test.next_step
end
session[:test_step] = @test.current_step
@question = @test.questions.all.sample(5)
# @question = @test.questions.limit(25)
# session[:test_step].deep_merge!(params[:f]) if params[:f]
# @test.current_step = session[:test_step]
# if params[:back_button]
# @test.previous_step
# elsif @test.last_step?
# @test.result
# else
# @test.next_step
# end
# session[:test_step] = @test.current_step
end

end
1 change: 0 additions & 1 deletion app/views/authentications/index.html.erb
@@ -1,4 +1,3 @@
1111
<% if @authentications %>
<% unless @authentications.empty? %>
<p><strong>You can sign in to this account using:</strong></p>
Expand Down
15 changes: 7 additions & 8 deletions app/views/test_names/start.html.erb
@@ -1,9 +1,8 @@
<div id="test-online">
<%= form_tag(start_test_name_path, :method => 'get') do |f| %>
<div id="question-part">
<%= render "#{@test.current_step}_step", :f => f %>
<%= submit_tag "Предыдущий", :class => 'btn', :name => "back_button" unless @test.first_step? %>
<%= submit_tag "Следующий", :class => 'btn', :name => "next_button" %>
</div>
<%= form_tag(start_test_names_path, :method => 'get') do %>
<% @question.each do |q| %>
<%= q.title %>
<%= q.radio_button q.variant_1 %>
<% end %>
<%= submit_tag "Закончить" %>
<% end %>
</div>
9 changes: 9 additions & 0 deletions app/views/test_names/startttttt.html.erb
@@ -0,0 +1,9 @@
<div id="test-online">
<%= form_tag(start_test_name_path, :method => 'get') do |f| %>
<div id="question-part">
<%= render "#{@test.current_step}_step", :f => f %>
<%= submit_tag "Предыдущий", :class => 'btn', :name => "back_button" unless @test.first_step? %>
<%= submit_tag "Следующий", :class => 'btn', :name => "next_button" %>
</div>
<% end %>
</div>
2 changes: 1 addition & 1 deletion config/initializers/omniauth.rb
@@ -1,4 +1,4 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV['361123313948615'], ENV['4df96223d2c848558d52d9d72e010de1']
provider :vkontakte, ENV['API_KEY'], ENV['API_SECRET']
provider :vkontakte, ENV['2966688'], ENV['VQlTgna4PCbMj07uGFpy']
end

0 comments on commit 9fb7fd9

Please sign in to comment.