Sha256: 96a8706173f6a401984772abb3d0c4e6da86dc94ee1d24eae52ec71af3462e6c

Contents?: true

Size: 1.71 KB

Versions: 4

Compression:

Stored size: 1.71 KB

Contents

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

- if params[:cancel].true? # <--------------------- Hide [Edit]

  - if called_from_landing_page?
    crm.flip_form('edit_#{entity_name}');
    crm.set_title('edit_#{entity_name}', '#{h @entity.name}');
  - else                                            # Called from index page...
    $('##{id}').replaceWith('#{ j render(:partial => entity_name, :collection => [ @entity ]) }');

- else # <----------------------------------------- Show requested [Edit Opportunity] form.

  - if params[:cancel].blank?                       # Called from opportunities list item...
    - if @previous                                  # Hide open [Edit Opportunity] form if any.
      - if @previous.is_a?(Opportunity)
        $('##{dom_id(@previous)}').replaceWith('#{ j render(:partial => entity_name, :collection => [ @previous ]) }');
      - else
        crm.flick('#{entity_name}_#{@previous}', 'remove');

    -# Disable onMouseOver for the list item.
    crm.highlight_off('#{id}');
    -# Hide [Create] form if any.
    crm.hide_form('create_#{entity_name}');
    -# Show [Edit] form.
    $('##{id}').html('#{ j render(:partial => "edit") }');

  - elsif params[:cancel].false?                    # Called from title of the opportunity landing page...
    $('#edit_#{entity_name}').html('#{ j render(:partial => "edit") }');
    crm.flip_form('edit_#{entity_name}');
    crm.set_title('edit_#{entity_name}', "#{t :edit} #{h @opportunity.name}");

  crm.create_or_select_account(#{ request.referer =~ /\/accounts\// || @account.id.blank? });
  $('#new_#{entity_name} input[type!=hidden]').first().focus();

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 app/views/opportunities/edit.js.haml
fat_free_crm-0.13.5 app/views/opportunities/edit.js.haml
fat_free_crm-0.13.4 app/views/opportunities/edit.js.haml
fat_free_crm-0.13.3 app/views/opportunities/edit.js.haml