Skip to content

Commit

Permalink
12494: unify with older logic for instanceName
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperka committed Oct 31, 2023
1 parent f206b7e commit 6a60cfa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
9 changes: 4 additions & 5 deletions app/decorators/odk/form_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ class FormDecorator < BaseDecorator
IR_QUESTION = "ir01"
IR_CODE = "ir02"

def default_response_name_instance_tag
if default_response_name.present?
content_tag(:meta, tag(:instanceName))
else
""
def meta_tags
content_tag("orx:meta") do
h.concat(tag("orx:instanceID"))
h.concat(tag("orx:instanceName")) if default_response_name.present?
end
end

Expand Down
5 changes: 1 addition & 4 deletions app/views/forms/odk/_instances.xml.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<instance>
<%= content_tag(:data, id: @form.id, version: @form.number) do %>
<%= @form.default_response_name_instance_tag %>
<%= render("forms/odk/instance_node", node: @form.root_group) %>

<%# Incomplete response question nodes %>
Expand All @@ -9,9 +8,7 @@
<%= tag(ODK::FormDecorator::IR_CODE) %>
<% end %>

<orx:meta>
<orx:instanceID/>
</orx:meta>
<%= @form.meta_tags %>
<% end %>
</instance>

Expand Down
4 changes: 1 addition & 3 deletions spec/fixtures/odk/forms/default_patterns.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<model>
<instance>
<data id="*form1*" version="*formver1*">
<meta>
<instanceName/>
</meta>
<*itemcode1*>
<header/>
<*itemcode2*/>
Expand All @@ -19,6 +16,7 @@
<*itemcode6*/>
<orx:meta>
<orx:instanceID/>
<orx:instanceName/>
</orx:meta>
</data>
</instance>
Expand Down

0 comments on commit 6a60cfa

Please sign in to comment.