noosfero | Custom fields (#708)

Joenio Costa gitlab at gitlab.com
Mon Oct 19 18:03:43 BRST 2015


New comment for Merge Request 708

https://gitlab.com/noosfero/noosfero/merge_requests/708#note_2438490


Joenio Costa

Please, do not add this `ternary if` here, it is preferable remove the `labelled_form_for` from `_form.html.erb` and repeat it in the `edit.html.erb` and `new.html.erb`, example:

**`app/views/features/custom_fields/edit.html.erb`**:
```erb
<div>
  <%= labelled_form_for(@field, :url => {:controller => 'features', :action => "update_custom_field", :
id => @field.id}) do |f| %>
    <%= render :partial => 'features/custom_fields/form' %>
  <% end %>
</div>
```

**`app/views/features/custom_fields/new.html.erb`**:
```erb
<div>
  <%= labelled_form_for(@field, :url => {:controller => 'features', :action => "create_custom_field", :
id => @field.id}) do |f| %>
    <%= render :partial => 'features/custom_fields/form' %>
  <% end %>
</div>
```

_(sometimes it's better choose code readability instead of avoid duplication, this is the case here in my opinion)_

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151019/ebbdd140/attachment.html>


More information about the Noosfero-dev mailing list