Sha256: b8ef5b80f0dfcb5cb188a5c58b6d62c9e6ed0c66e36d7691795695ac5acf7b86

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

- entity_name = controller.controller_name.singularize.underscore #account
- @entity = instance_variable_get("@#{entity_name}")
- id = called_from_landing_page? ? "edit_#{entity_name}" : dom_id(@entity)

- if @entity.errors.empty?
  - if called_from_landing_page?
    crm.flip_form('edit_#{entity_name}');
    crm.set_title('edit_#{entity_name}', '#{h @entity.name}');
    = refresh_sidebar(:show)
  - else
    $('##{id}').replaceWith('#{ j render(partial: entity_name, collection: [ @entity ]) }');
    $('##{id}').effect("highlight", { duration:1500 });
    - if called_from_index_page?
      = refresh_sidebar(:index)
    - elsif called_from_landing_page?(:accounts)
      = refresh_sidebar_for(:accounts, :show)
    - elsif called_from_landing_page?(:campaigns)
      = refresh_sidebar_for(:campaigns, :show)
    - else
      $('#recently').replaceWith('#{ j render(partial: "shared/recently") }');
- else
  $('##{id}').html('#{ j render(partial: "edit") }');
  crm.create_or_select_account(#{ request.referer =~ /\/accounts\// || @account.id.blank? });
  $('##{dom_id(@entity, :edit)} input[type!=hidden]').first().focus();

= hook(:entity_update, self, {entity: @entity})

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.22.0 app/views/opportunities/update.js.haml
fat_free_crm-0.21.0 app/views/opportunities/update.js.haml
fat_free_crm-0.20.1 app/views/opportunities/update.js.haml
fat_free_crm-0.20.0 app/views/opportunities/update.js.haml