Sha256: 4115a210186298a966359b6e761077ef0e426161b336ea02710aa548e8c36dc3

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

<%# This is used through the helper method dynaspan_update_field %>
<%= hidden_field_tag "last_dyna_span_val_#{unique_ref_id}", attr_object.try(attrib) || master_ds_object.try(attrib), id: "last_dyna_span_val_#{unique_ref_id}" %>
<div id="<%= "dyna_span_div#{unique_ref_id}" %>" class='dyna-span' style="display:none;">
  <%= form_for(master_ds_object, method: :patch, remote: true, authenticity_token: true) do |f| %>
    <% if master_ds_object.nested_attributes_options.keys.any? {|i| i.to_s.=~(/#{attr_object.class.try(:model_name).try(:i18n_key).to_s}/) || i.to_s.=~(/#{attr_object.class.try(:table_name)}/) } and !attr_object.nil? %>
      <%= f.fields_for master_ds_object.nested_attributes_options.keys.select {|i| i.to_s.=~(/#{attr_object.class.model_name.i18n_key.to_s}/) || i.to_s.=~(/#{attr_object.class.table_name}/) }.first, attr_object do |a|%>
        <%= a.hidden_field :id, value: attr_object.id %>
        <%= a.text_area attrib, id: "dyna_span_field_val_#{unique_ref_id}", class: 'dyna-span form-control', onfocus: "$().dynaSpan.upLast('#{unique_ref_id}');", onblur: "$().dynaSpan.upHide('#{unique_ref_id}');" %>
      <% end %>
    <% else %>
      <%= f.text_area attrib, id: "dyna_span_field_val_#{unique_ref_id}", class: 'dyna-span form-control', onfocus: "$().dynaSpan.upLast('#{unique_ref_id}');", onblur: "$().dynaSpan.upHide('#{unique_ref_id}');" %>
    <% end %>
  <% end %>
</div>
<%= content_tag 'span', attr_object.try(attrib) || master_ds_object.try(attrib), id: "dyna_span_span#{unique_ref_id}", onclick: "$().dynaSpan.upShow('#{unique_ref_id}');", class: 'dyna-span dyna-span-text', style: 'display:block;' %>
<%= content_tag('div', dyna_span_edit_text, class: 'dyna-span-edit-text pull-right', onclick: "$().dynaSpan.upShow('#{unique_ref_id}');", style: 'cursor:pointer;')  %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dynaspan-0.0.2 app/views/dynaspan/_dynaspan_text_area.html.erb
dynaspan-0.0.1 app/views/dynaspan/_dynaspan_text_area.html.erb