2017-04-01 8 views

답변

0

나는 아마도 약간 늦었지만 같은 기능을 사용하는 프로젝트에서 작업하고 있습니다. 다른 사람이 똑같이 궁금해하면 희망이 있습니다. 일반적으로

, 그냥 같은 사악한를 설정하는 것이 가장 좋습니다 당신 것 정상적인 HTML의 마법사 :

응용 프로그램/컨트롤러/set_up_positions_controller.rb 여기에서 트릭이 모두를 만드는 것입니다

class SetUpPositionController < ApplicationController 

    include Wicked::Wizard 

    steps :appointment_settings, :lab_settings 

    def show 
     case step 
     when :appointment_settings 
     when :lab_settings 
     end 
     render_wizard 
    end 

    def update 
     case step 
     when :appointment_settings 
      #LOGIC 
     when :lab_settings 
      #LOGIC 
     end 
     render_wizard @position 
    end 

end 

각 단계에 대한 step_name.js.erb 및 _step_name.html.erb 파일 예.

응용 프로그램/뷰/set_up_positions/appointment_settings.js.erb

$('#clinics-content').html('<%= j render "clinic_management/set_up_position/appointment_settings" %>'); 

응용 프로그램/뷰/set_up_positions/_appointment_settings.html.erb

<%= simple_form_for [:clinic_management, @clinic, @position], url: wizard_path, method: :put, remote: true do |f| %> 
    <%= f.input :bill_authorization, collection: bill_authorization_options %> 
    #etc etc 
<% end%> 

당신은 아마 몇 가지 오류에 추가 할 수 있습니다 JS 파일과 메시징 (지금은 동일한 JS를 호출하고 필드 이름으로 오류를 렌더링합니다.이 경우 원하는 이름 일 수도 있고 그렇지 않을 수도 있습니다).

유스 케이스에 따라 이러한 유형의 작업 (steps.js 등)에 JS 프레임 워크 중 하나를 사용하는 것이 더 쉬울 수도 있습니다. 내가 루비를 JS보다 조금 더 잘 이해했기 때문에 나는하지 못했지만, 다른 사람들에게는 루비가 옵션이기도하다.