fatfreecrm/fat_free_crm

View on GitHub
app/views/opportunities/new.js.haml

Summary

Maintainability
Test Coverage
- entity_name = controller.controller_name.singularize
- create_id = "create_#{entity_name}"

crm.flick('empty', 'toggle');
crm.flip_form('#{create_id}');

- unless params[:cancel].true?
  $('##{create_id}').html('#{ j render(partial: "new") }');
  crm.set_title('#{create_id}', '#{ j t(create_id) }');
  -# this function call is the only difference to normal new.js.haml
  crm.create_or_select_account(#{ request.referer =~ /\/accounts\// || @account.id.blank? });
- else
  crm.set_title('#{create_id}', '#{ j t(entity_name.pluralize) }');