support-foo/web

View on GitHub
app/views/canned_responses/index.html.erb

Summary

Maintainability
Test Coverage
<%= render 'shared/navbar' %>

<div class="container">

  <div>
    <a class="btn btn-success pull-right" href="<%= new_account_canned_response_path(@account) %>">
      <%= t('.create_canned_response') %>
    </a>

    <h1 class="page-title">
      <%= t('.canned_responses') %>
    </h1>
  </div>

  <% if @account.canned_responses.empty? %>

    <div class="panel panel-default">
      <div class="panel-title">
        <%= t('canned_responses.none_yet.header') %>
      </div>
      <div class="panel-body">
        <%= t('canned_responses.none_yet.body') %>
        <br>
        <a class="btn btn-success btn-sm" href="<%= new_account_canned_response_path(@account) %>">
          <%= t('canned_responses.none_yet.button') %>
        </a>
      </div>
    </div>

  <% else %>

    <div class="list">
      <% @account.canned_responses.each do |canned_response| %>
        <div class="list-item clearfix">
          <div class="pull-left">
            <strong><%= canned_response.key %></strong>
            <p><%= strip_tags(stripdown(canned_response.message)).truncate(140) %></p>
          </div>
          <div class="btn-group pull-right">
            <a href="<%= edit_account_canned_response_path(canned_response.account, canned_response) %>" class="btn btn-default"><%= t('edit') %></a>
          </div>
        </div>
      <% end %>
    </div>

  <% end %>

</div>