Sha256: fed0303445aabb1b4c977c1ffa156b466ee90e5a3e832935c56b6bdf74aa3a3c

Contents?: true

Size: 1.48 KB

Versions: 19

Compression:

Stored size: 1.48 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 [Edit] form.

  - if params[:cancel].blank?                       # Called from index page...
    - if @previous                                  # Hide open [Edit] form if any.
      - if @previous.is_a?(@entity.class)
        $('##{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 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 @entity.name}");

Version data entries

19 entries across 13 versions & 1 rubygems

Version Path
fat_free_crm-0.22.1 app/views/campaigns/edit.js.haml
fat_free_crm-0.22.0 app/views/campaigns/edit.js.haml
fat_free_crm-0.21.0 app/views/campaigns/edit.js.haml
fat_free_crm-0.20.1 app/views/campaigns/edit.js.haml
fat_free_crm-0.20.0 app/views/campaigns/edit.js.haml
fat_free_crm-0.19.2 app/views/campaigns/edit.js.haml
fat_free_crm-0.19.0 app/views/campaigns/edit.js.haml
fat_free_crm-0.18.2 app/views/campaigns/edit.js.haml
fat_free_crm-0.18.2 app/views/accounts/edit.js.haml
fat_free_crm-0.17.3 app/views/accounts/edit.js.haml
fat_free_crm-0.17.3 app/views/campaigns/edit.js.haml
fat_free_crm-0.18.1 app/views/campaigns/edit.js.haml
fat_free_crm-0.18.1 app/views/accounts/edit.js.haml
fat_free_crm-0.18.0 app/views/campaigns/edit.js.haml
fat_free_crm-0.18.0 app/views/accounts/edit.js.haml
fat_free_crm-0.17.2 app/views/campaigns/edit.js.haml
fat_free_crm-0.17.2 app/views/accounts/edit.js.haml
fat_free_crm-0.17.1 app/views/accounts/edit.js.haml
fat_free_crm-0.17.1 app/views/campaigns/edit.js.haml