lib/generators/mdwa/templates/templates/scaffold/views/_form_fields.html.erb in mdd-3.1.0 vs lib/generators/mdwa/templates/templates/scaffold/views/_form_fields.html.erb in mdd-3.1.1
- old
+ new
@@ -1,11 +1,11 @@
===entity_code===
<%- @model.attributes.select{|a| !['id', 'created_at', 'updated_at'].include?(a.name)}.each do |attr| -%>
<div class="field">
<%%= f.label :<%= attr.name %>, t('<%= @model.plural_name %>.edit.<%= attr.name %>') %>
<%- if attr.type.to_sym == :file -%>
- <%% unless @<%= @model.singular_name %>.new_record? %>
+ <%% if !@<%= @model.singular_name %>.new_record? and !@<%= @model.singular_name %>.<%= attr.name %>.blank? %>
<span><%%= link_to image_tag(file_icon_path(@<%= @model.singular_name %>.<%= attr.name %>_file_name)), @<%= @model.singular_name %>.<%= attr.name %>.url, :target => '_blank' %></span>
<%% end %>
<%- end -%>
<%%= f.<%= attr.form_field %> :<%= attr.name %> %>
</div>
@@ -16,10 +16,10 @@
<%- if assoc.belongs_to? -%>
<div class="field">
<%%= f.label :<%= assoc.model2.singular_name.foreign_key %>, t('<%= @model.plural_name %>.edit.<%= assoc.model2.singular_name %>') %>
<%%= f.select :<%= assoc.model2.singular_name.foreign_key %>,
options_for_select( <%= assoc.model2.klass %>.order('<%= assoc.reference_field %> ASC').collect{ |c| [c.<%= assoc.reference_field %>, c.id] }, f.object.<%= assoc.model2.singular_name.foreign_key %> ),
- :prompt => '-- Select --' %>
+ :prompt => t('<%= @model.plural_name %>.edit.<%= assoc.model2.singular_name %>_select') %>
</div>
<%- end # if -%>
<%- if assoc.has_and_belongs_to_many? and assoc.composition? -%>
<div class="nested">
\ No newline at end of file