diff --git a/app/views/branded/plans/_show_details.html.erb b/app/views/branded/plans/_show_details.html.erb index 2a1b17e..d2e1192 100644 --- a/app/views/branded/plans/_show_details.html.erb +++ b/app/views/branded/plans/_show_details.html.erb @@ -1,30 +1,112 @@ -<% meta_fragment = @plan.json_fragment().meta%> -<% project_fragment = @plan.json_fragment().project%> -
- -
-
- <%= render(partial: 'shared/fragments/display', locals: { - fragment: meta_fragment, - schema: meta_fragment.madmp_schema, - classname: "meta" - } ) %> -
-
- <%= render(partial: 'shared/fragments/display', locals: { - fragment: project_fragment, +<% dmp_fragment = @plan.json_fragment() %> +<% meta_fragment = dmp_fragment.meta%> +<% project_fragment = dmp_fragment.project%> +<% anr_projects = Registry.find_by(name: "ANRProjects").registry_values %> +<% locale = @plan.template.locale %> +
+
+
+
+ +
+ +
+ <%= hidden_field_tag 'fragment-id', project_fragment.id, class: "fragment-id" %> +
+ <% I18n.with_locale locale do %> + <%= form_for :madmp_fragment, url: madmp_fragment_path(id: project_fragment.id), + html: { + method: :put, + 'data-autosave': project_fragment.id, + class: "form-answer madmp-fragment", + id: nil + } do |f| %> +
+
+ <%= render(partial: 'shared/dynamic_form/form', locals: { + f: f, + current_fragment: project_fragment, schema: project_fragment.madmp_schema, - classname: "project" - } ) %> + question_id: nil, + readonly: true, + classname: "project", + template_locale: locale, + form_prefix: nil, + source: "form" + }) %> +
+
+ + <% end %> + <% end %> +
+
+ +
+
+ + + +
+ <% meta_schema = MadmpSchema.find_by(name: "MetaStandard") %> + <%= hidden_field_tag 'fragment-id', project_fragment.id, class: "meta_fragment-id" %> +
+ <% I18n.with_locale locale do %> + <%= form_for :madmp_fragment, url: madmp_fragment_path(id: meta_fragment.id), + html: { + method: :put, + 'data-autosave': meta_fragment.id, + class: "form-answer madmp-fragment", + id: nil + } do |f| %> +
+
+ <%= render(partial: 'shared/dynamic_form/form', locals: { + f: f, + current_fragment: meta_fragment, + schema: meta_fragment.madmp_schema, + question_id: nil, + readonly: true, + classname: "meta", + template_locale: locale, + form_prefix: nil, + source: "form" + }) %> +
+
+ <% end %> + <% end %> +
+
- -
\ No newline at end of file +
+ \ No newline at end of file diff --git a/app/views/branded/shared/dynamic_form/fields/_fragment_select_field.html.erb b/app/views/branded/shared/dynamic_form/fields/_fragment_select_field.html.erb index 21daed3..e7f62a1 100644 --- a/app/views/branded/shared/dynamic_form/fields/_fragment_select_field.html.erb +++ b/app/views/branded/shared/dynamic_form/fields/_fragment_select_field.html.erb @@ -49,21 +49,23 @@ <% end %>
-
- <%= d_('dmpopidor', 'Selected value:') %> <%= selected_value.to_s %> - (<%= link_to new_edit_linked_madmp_fragments_url( - :fragment_id => selected_value.present? ? selected_value.id : 0000, - :parent_id => parent_id, - :schema_id => schema.id, - :source => "select-modal", - :template_locale => template_locale, - :query_id => query_id - ), { - :remote => true, - :target => "_self", - 'data-toggle' => 'modal', - 'data-target' => '#modal-window' - } do %> - <%= _('Edit') %> - <% end %>) -
\ No newline at end of file +<% unless readonly %> +
+ <%= d_('dmpopidor', 'Selected value:') %> <%= selected_value.to_s %> + (<%= link_to new_edit_linked_madmp_fragments_url( + :fragment_id => selected_value.present? ? selected_value.id : 0000, + :parent_id => parent_id, + :schema_id => schema.id, + :source => "select-modal", + :template_locale => template_locale, + :query_id => query_id + ), { + :remote => true, + :target => "_self", + 'data-toggle' => 'modal', + 'data-target' => '#modal-window' + } do %> + <%= _('Edit') %> + <% end %>) +
+<% end %> \ No newline at end of file diff --git a/app/views/branded/shared/dynamic_form/fields/registry/_multiple_complex.html.erb b/app/views/branded/shared/dynamic_form/fields/registry/_multiple_complex.html.erb index f7e140b..6291af6 100644 --- a/app/views/branded/shared/dynamic_form/fields/registry/_multiple_complex.html.erb +++ b/app/views/branded/shared/dynamic_form/fields/registry/_multiple_complex.html.erb @@ -15,47 +15,49 @@ data-schema-id="<%= schema_id %>" data-readonly="<%= !overridable %>" > - <%= intermediate_message %> -
- <%= select_tag "#{f.object_name}[#{field_name}]", - options_for_select( - select_values.map {|v| [ - v.to_s(locale), - select_value(v, locale) - ] - } - ), - disabled: readonly, - multiple: false, - include_blank: true, - "data-toggle": "tooltip", - title: ttip, - class: "form-control #{field_class}", - id: field_id %> + <% unless readonly %> + <%= intermediate_message %> +
+ <%= select_tag "#{f.object_name}[#{field_name}]", + options_for_select( + select_values.map {|v| [ + v.to_s(locale), + select_value(v, locale) + ] + } + ), + disabled: readonly, + multiple: false, + include_blank: true, + "data-toggle": "tooltip", + title: ttip, + class: "form-control #{field_class}", + id: field_id %> - <% if parent_id.present? || overridable %> - - <%= link_to new_edit_linked_madmp_fragments_url( - nil, - :parent_id => parent_id, - :schema_id => schema_id, - :template_locale => locale, - :source => "list-modal", - :property_name => property_name, - :query_id => query_id - ), { - :remote => true, - :target => "_self", - :class => "add-fragment", - 'data-toggle' => "tooltip", - 'data-original-title' => d_("dmpopidor", "Click here to add a new item") - } do %> - - <% end %> - - <% end %> -
- + <% if parent_id.present? || overridable %> + + <%= link_to new_edit_linked_madmp_fragments_url( + nil, + :parent_id => parent_id, + :schema_id => schema_id, + :template_locale => locale, + :source => "list-modal", + :property_name => property_name, + :query_id => query_id + ), { + :remote => true, + :target => "_self", + :class => "add-fragment", + 'data-toggle' => "tooltip", + 'data-original-title' => d_("dmpopidor", "Click here to add a new item") + } do %> + + <% end %> + + <% end %> +
+ + <% end %>
@@ -65,7 +67,7 @@ obj_list: value, parent_id: parent_id, schema_id: schema_id, - readonly: !overridable, + readonly: readonly || !overridable, deletable: true, template_locale: locale, property_name: property_name, diff --git a/app/views/branded/shared/dynamic_form/fields/registry/_single_complex.html.erb b/app/views/branded/shared/dynamic_form/fields/registry/_single_complex.html.erb index c14e254..d95c290 100644 --- a/app/views/branded/shared/dynamic_form/fields/registry/_single_complex.html.erb +++ b/app/views/branded/shared/dynamic_form/fields/registry/_single_complex.html.erb @@ -18,49 +18,51 @@ <%= intermediate_message unless readonly %> <% end %> -
-
- <%= select_tag "#{f.object_name}[#{field_name}]", - options_for_select( - select_values.map {|v| [ - v.to_s(locale), - select_value(v, locale) - ] - } - ), - data: { - "tags" => overridable - }, - disabled: readonly, - multiple: false, - include_blank: true, - "data-toggle": "tooltip", - title: ttip, - class: "form-control #{field_class}", - id: field_id %> - <% unless readonly %> - + <% unless readonly %> +
+
+ <%= select_tag "#{f.object_name}[#{field_name}]", + options_for_select( + select_values.map {|v| [ + v.to_s(locale), + select_value(v, locale) + ] + } + ), + data: { + "tags" => overridable + }, + disabled: readonly, + multiple: false, + include_blank: true, + "data-toggle": "tooltip", + title: ttip, + class: "form-control #{field_class}", + id: field_id %> + <% unless readonly %> + + <% end %> +
+ <% if overridable %> + <% + style = 'display: none;' + custom_value = nil + if value.present? && value.additional_info["custom_value"].present? + style = '' + custom_value = value.additional_info["custom_value"] + end + %> + <% other_field_name = defined?(form_prefix) ? "#{form_prefix}[#{property_name}_custom]" : "#{property_name}_custom" %> +
+ <%= f.label other_field_name, d_("dmpopidor", "Custom value: "), class: 'control-label' %> + <%= f.hidden_field other_field_name, + value: custom_value, + class: "form-control #{field_class}", + id: field_id %> + <%= custom_value %> +
<% end %>
- <% if overridable %> - <% - style = 'display: none;' - custom_value = nil - if value.present? && value.additional_info["custom_value"].present? - style = '' - custom_value = value.additional_info["custom_value"] - end - %> - <% other_field_name = defined?(form_prefix) ? "#{form_prefix}[#{property_name}_custom]" : "#{property_name}_custom" %> -
- <%= f.label other_field_name, d_("dmpopidor", "Custom value: "), class: 'control-label' %> - <%= f.hidden_field other_field_name, - value: custom_value, - class: "form-control #{field_class}", - id: field_id %> - <%= custom_value %> -
- <% end %> -
+ <% end %>
\ No newline at end of file diff --git a/app/views/branded/shared/dynamic_form/linked_fragment/_list.html.erb b/app/views/branded/shared/dynamic_form/linked_fragment/_list.html.erb index 22ff7b4..f5aeb9b 100644 --- a/app/views/branded/shared/dynamic_form/linked_fragment/_list.html.erb +++ b/app/views/branded/shared/dynamic_form/linked_fragment/_list.html.erb @@ -38,7 +38,7 @@ <% end %> <% end %> <% end %> - <% if deletable %> + <% if deletable && !readonly %>
- - - <% unless dmp_fragments.empty? %> - <% dmp_fragments.where(madmp_schema_id: sub_schema.id, parent_id: fragment.id).each do |val| %> - - <% end %> - <% end %> - -
<%= field_name.capitalize.pluralize(2) %>
- <%= render(partial: 'shared/fragments/display', locals: { - fragment: val, - schema: sub_schema, - classname: sub_schema.classname - } ) %> -
- <% end %> - <% else %> -
-
<%= field_name %>
- <% value.each do |val| %> -
<%= val %>
- <% end %> -
- <% end %> - <% when 'object' %> - <% if prop["schema_id"].present? %> - <% unless classname == "research_output" || value.nil? %> - <% - sub_schema = sub_schemas[prop["schema_id"]] - sub_fragment = dmp_fragments.find_by(madmp_schema_id: sub_schema.id, parent_id: fragment.id) unless dmp_fragments.empty? - %> -
-

<%= field_name.capitalize %>

-
- <%= render(partial: 'shared/fragments/display', locals: { - fragment: sub_fragment, #TODO : Implement Person fragments display - schema: sub_schema, - classname: sub_schema.classname - } ) %> -
- <% end %> - <% end %> - <% else%> -
<%= field_name %>
-
<%= value %>
- <% end %> - <% end %> - \ No newline at end of file