diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index c593e33..73b8788 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -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." diff --git a/app/controllers/test_names_controller.rb b/app/controllers/test_names_controller.rb index 3bca573..6548a00 100644 --- a/app/controllers/test_names_controller.rb +++ b/app/controllers/test_names_controller.rb @@ -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 diff --git a/app/views/authentications/index.html.erb b/app/views/authentications/index.html.erb index 0da3b5f..a900f6e 100644 --- a/app/views/authentications/index.html.erb +++ b/app/views/authentications/index.html.erb @@ -1,4 +1,3 @@ -1111 <% if @authentications %> <% unless @authentications.empty? %>

You can sign in to this account using:

diff --git a/app/views/test_names/start.html.erb b/app/views/test_names/start.html.erb index a728130..3c9c87b 100644 --- a/app/views/test_names/start.html.erb +++ b/app/views/test_names/start.html.erb @@ -1,9 +1,8 @@ -
-<%= form_tag(start_test_name_path, :method => 'get') do |f| %> -
- <%= 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" %> -
+<%= 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 %> -
diff --git a/app/views/test_names/startttttt.html.erb b/app/views/test_names/startttttt.html.erb new file mode 100644 index 0000000..a728130 --- /dev/null +++ b/app/views/test_names/startttttt.html.erb @@ -0,0 +1,9 @@ +
+<%= form_tag(start_test_name_path, :method => 'get') do |f| %> +
+ <%= 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" %> +
+<% end %> +
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 67d86a5..6d62f9d 100644 --- a/config/initializers/omniauth.rb +++ b/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