Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sj cart ssr bug #227

Merged
merged 4 commits into from
Apr 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/protocols_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def create
def edit
@protocol_type = @protocol.type
@service_request = ServiceRequest.find(params[:srid])
@sub_service_request = SubServiceRequest.find(params[:sub_service_request_id]) if params[:sub_service_request_id]
@in_dashboard = false
@protocol.populate_for_edit
@protocol.valid?
Expand All @@ -96,6 +97,7 @@ def update

attrs = fix_date_params
@service_request = ServiceRequest.find(params[:srid])
@sub_service_request = SubServiceRequest.find(params[:sub_service_request_id]) if params[:sub_service_request_id]

if @protocol.update_attributes(attrs.merge(study_type_question_group_id: StudyTypeQuestionGroup.active_id))

Expand Down
2 changes: 1 addition & 1 deletion app/views/protocols/_summary.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%button.btn.btn-info.view-protocol-details-button{ data: { protocol_id: protocol.id } }
= I18n.t('protocols.view_details.button', protocol_type: protocol_type)
- if allow_edit
= link_to I18n.t('protocols.edit', protocol_type: protocol_type), edit_protocol_path(protocol, srid: service_request.id), class: 'btn btn-warning edit-protocol-information-button'
= link_to I18n.t('protocols.edit', protocol_type: protocol_type), edit_protocol_path(protocol, srid: service_request.id, sub_service_request_id: sub_service_request_id), class: 'btn btn-warning edit-protocol-information-button'
.clearfix
.panel-body#protocol-summary.text-left
- if RESEARCH_MASTER_ENABLED && protocol.is_study?
Expand Down
2 changes: 1 addition & 1 deletion app/views/protocols/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
= render 'shared/modal_errors', errors: @errors
#protocol
= render 'protocols/form/edit_protocol_type', protocol: @protocol, protocol_type: @protocol_type, service_request: @service_request, in_dashboard: @in_dashboard
= render 'protocols/form/protocol_form', protocol: @protocol, protocol_type: @protocol_type, service_request: @service_request
= render 'protocols/form/protocol_form', protocol: @protocol, protocol_type: @protocol_type, service_request: @service_request, sub_service_request_id: @sub_service_request.try(:id)
7 changes: 6 additions & 1 deletion app/views/protocols/form/_protocol_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
-# TODO rename :srid to :service_request_id in controller action
= hidden_field_tag :service_request_id, service_request.id
= hidden_field_tag :srid, service_request.id
- if @sub_service_request
= hidden_field_tag :sub_service_request_id, @sub_service_request.id
= form.hidden_field :requester_id
= form.hidden_field :type
- if protocol.type.capitalize == "Study"
Expand All @@ -43,5 +45,8 @@
.col-lg-4
.col-lg-4.text-center
%input.btn.btn-lg.btn-success{ type: "submit", value: t(:actions)[:save] }
= link_to t(:actions)[:cancel], protocol_service_request_path(service_request), class: 'btn btn-lg btn-danger'
- if @sub_service_request
= link_to t(:actions)[:cancel], protocol_service_request_path(service_request, sub_service_request_id: @sub_service_request.id), class: 'btn btn-lg btn-danger'
- else
= link_to t(:actions)[:cancel], protocol_service_request_path(service_request), class: 'btn btn-lg btn-danger'
.col-lg-4
4 changes: 4 additions & 0 deletions app/views/protocols/update.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<% unless @errors %>
<% if @sub_service_request %>
window.location = "<%= protocol_service_request_path(@service_request, sub_service_request_id: @sub_service_request.id) %>"
<% else %>
window.location = "<%= protocol_service_request_path(@service_request) %>"
<% end %>
<% else %>
$("#flashes_container").html("<%= escape_javascript(render( 'shared/modal_errors', errors: @errors )) %>")
$('#body').scrollTop(0)
Expand Down
4 changes: 2 additions & 2 deletions app/views/service_requests/navigation/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.bottom-nav.col-sm-12.ui-corner-all{ class: css_class }
.col-sm-3.text-left
= link_to t(:proper)[:navigation][:bottom][:back], back, class: 'btn btn-default'
= link_to t(:proper)[:navigation][:bottom][:back], sub_service_request_id ? "#{back}?sub_service_request_id=#{sub_service_request_id}" : back, class: 'btn btn-default'
- if controller.action_name == 'review'
.col-sm-3.text-center
= save_as_draft_button(sub_service_request_id)
Expand All @@ -35,7 +35,7 @@
- if SYSTEM_SATISFACTION_SURVEY && action_name == 'review'
.col-sm-3.text-right
= link_to t(:proper)[:navigation][:bottom][:submit],
confirmation_service_request_path(service_request, sub_service_request_id: sub_service_request_id),
confirmation_service_request_path(service_request, sub_service_request_id: sub_service_request_id),
class: 'btn btn-default form-submit-button'
- else
.col-sm-3.text-right
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
= t(:proper)[:protocol][:review_protocol_notice]
%small
= t(:proper)[:protocol][:review_protocol_instructions]
= render 'protocols/summary', protocol: protocol, protocol_type: protocol.type, service_request: service_request, allow_edit: true
= render 'protocols/summary', protocol: protocol, protocol_type: protocol.type, service_request: service_request, sub_service_request_id: sub_service_request_id, allow_edit: true
= render 'associated_users/table', protocol: protocol, service_request: service_request
- else
.page-header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.col-md-9.protocol-left
= render 'service_requests/protocol/service_list', service_request: @service_request, sub_service_request: @sub_service_request
= render 'service_requests/protocol/protocol_display', service_request: @service_request, protocol: @service_request.protocol
= render 'service_requests/protocol/protocol_display', service_request: @service_request, sub_service_request_id: @sub_service_request.try(:id), protocol: @service_request.protocol