woese/guara-crm

View on GitHub
app/views/contacts/_list.html.erb

Summary

Maintainability
Test Coverage

<ul>
<% items.each do |item|  %>
    <li id="contact<%= item.id %>" onClick="contact_show(<%= item.id %>)">
        <h5><%= item.name %> <small>Fone: <%= item.phone %></small></h5>
        <span class="email"><%= concat_emails(item.emails) %></span>
        <%= item.business_function %> - <%= name_or_empty(item.department) %>
    </li>
<% end %>
<ul>
    
<div class="modal-contact modal hide fade" style="display:none">
    <div class="modal-body">
    </div>
    <div class="modal-footer">
        <a id="close" class="btn btn-primary"><%= t("helpers.close") %></a>
    </div>
</div>
<script>

var reg = new RegExp("\\999999", "gm");

function contact_show(id) {    
    $(".modal-contact").modal({
      "backdrop"  : "static",
      "keyboard"  : true,
      "show"      : true,
      "scrollbars": true
    });
    
    path = "<%= customer_contact_path(@customer,0) %>"+id+".json"

    //path = path.replace(reg, id);
    
    $('.modal-contact .modal-body').html("<div></div>");
    $('.modal-contact .modal-body').load(path);
}

$(function() {    
   $(".modal-contact #close").click(function(e) {
       $(".modal-contact").modal('hide');
   });   
});


</script>