fatfreecrm/fat_free_crm

View on GitHub
app/views/leads/_convert_permissions.html.haml

Summary

Maintainability
Test Coverage
- collapsed = session[:lead_convert_permissions].nil? # && @lead.errors.empty?
= subtitle :lead_convert_permissions, collapsed, t(:permissions)
.section
  %small#lead_convert_permissions_intro{ hidden_if(!collapsed) }
    = t(:convert_lead_permissions_intro)
  #lead_convert_permissions{ hidden_if(collapsed) }
    .radio_box
      = radio_button_tag "access", "Lead", true, onclick: "$('#people').hide(); $('#account_access').val('Lead'); $('#opportunity_access').val('Lead');"
      = label :access, :Lead, t(:copy_permissions, t(:lead_small)), style: "cursor:pointer"
    .radio_box
      = radio_button_tag "access", "Private", false, onclick: "$('#people').hide(); $('#account_access').val('Private'); $('#opportunity_access').val('Private');"
      = label :access, :Private, t(:keep_private), style: "cursor:pointer"
    .radio_box
      = radio_button_tag "access", "Public", false, onclick: "$('#people').hide(); $('#account_access').val('Public'); $('#opportunity_access').val('Public');"
      = label :access, :Public, t(:make_public), style: "cursor:pointer"
    .radio_box
      = radio_button_tag "access", "Shared", false, onclick: "$('#people').show(); $('#account_access').val('Shared'); $('#opportunity_access').val('Shared');"
      = label :access, :Shared, t(:share_with), style: "cursor:pointer"

    #people{ hidden_if(@lead.access != "Shared") }
      %table
        %tr
          %td
            = label_tag :lead_user_ids, "#{t(:users)}:"
            %br
            = select :lead, :user_ids, user_options, {}, multiple: true, class: 'select2'
        %tr
          %td
            = label_tag :lead_group_ids, "#{t(:groups)}:"
            %br
            = select :lead, :group_ids, group_options, {}, multiple: true, class: 'select2'