<commit_before><%
  @title = :show_name_title.t(:name => @name.display_name)

  description_links = list_descriptions(@name) || []
  Textile.register_name(@name)

  tabs = [
    link_with_query(:show_name_edit_name.t, :action => 'edit_name',
                    :id => @name.id),
    link_with_query(:show_name_bulk_name_edit.t,
                    :action => 'bulk_name_edit'),
    link_with_query(:show_name_add_name.t, :action => 'create_name'),
    link_with_query(:show_name_change_synonyms.t,
                    :action => 'change_synonyms', :id => @name.id)
  ]
  if @name.deprecated
    tabs << link_with_query(:APPROVE.t, :action => 'approve_name',
                            :id => @name.id)
  else
    tabs << link_with_query(:DEPRECATE.t, :action => 'deprecate_name',
                            :id => @name.id)
  end
  tabs += [
    link_with_query(:show_name_email_tracking.t, :action => 'email_tracking',
                    :id => @name.id),
    draw_interest_icons(@name)
  ]
  @tabsets = {
    pager_for: @name,
    right: draw_tab_set(tabs)
  }
%>

<div class="row">
  <div class="col-sm-5">
    <% if @first_four and @first_four.length > 0 %>
        <div class="list-group">
          <div class="list-group-item">
            <%= :show_name_most_confident.t %>
          </div>
          <% @first_four.each do |obs| %>
              <div class="list-group-item">
                <%= show_best_image(obs) %>
              </div>
          <% end %>
        </div>
    <% end %>
    <div>
      <%= show_previous_version(@name) %>
      <%= set_export_status_controls(@name) %>
      <br/>
      <br/>
    </div>
    <div class="list-group">
      <div class="list-group-item">
	<%= show_authors_and_editors(@name) %>
      </div>
    </div>
  </div>
  <div class="col-sm-7">
    <div class="list-group">
      <div class="list-group-item">
        <div class="row">
          <div class="col-sm-6">
            <%= name_section_link(:show_name_observations.t, @first_consensus, @consensus_query) %>
            <%= name_section_link(:show_name_all_observations.t, @has_consensus2, @consensus2_query) %>
            <%= name_section_link(:show_name_synonym_observations.t, @has_synonym, @synonym_query) %>
            <%= name_section_link(:show_name_other_observations.t, @has_other, @other_query) %>
            <%= name_section_link(:show_name_subtaxa_observations.t, @has_subtaxa, @subtaxa_query) %>
          </div>
          <div class="col-sm-6">
            <%= content_tag(:div, link_to('EOL', @name.eol_url)) if @name.eol_url %>
            <%= content_tag(:div, link_to(:google_images.t, "http://images.google.com/images?q=#{@name.real_text_name}")) %>
            <%= content_tag(:div, link_to("MyCoPortal", mycoportal_url(@name))) %>
            <%= content_tag(:div, link_with_query(:show_name_distribution_map.t, :action => 'map', :id => @name.id)) %>
          </div>
        </div>
      </div>
    </div>
    <strong><%= :show_name_nomenclature.t %>:</strong>

    <div class="list-group">
      <div class="list-group-item">
        <%= render(:partial => 'name', :object => @name, :locals => {synonyms: true}) %>
      </div>
    </div>

    <strong><%= :show_name_classification.t %>:</strong>
    <div>
      <%= link_with_query(:EDIT.t, {id: @name.description.id,
                                    controller: 'name', action: 'edit_name_description'},
                          {class: "pull-right"}) if @name.description %>
    </div>
    <div class="list-group">
      <div class="list-group-item">
        <%= classification_section(@classification, @parents, @first_child, @children_query) %>
      </div>
    </div>
    <div class="list-group">
      <% if @name.has_notes? %>
          <div class="list-group-item">
            <%= :show_name_notes.t %>:
            <%= link_with_query(:EDIT.t, {controller: 'name', action: 'edit_name', id: @name.id},
                                {class: "pull-right"}) %>
          </div>
          <div class="list-group-item">
            <%= @name.notes.tpl %>
          </div>
      <% end %>
    </div>

    <% if !@best_description.blank? %>
        <strong><%= :show_name_brief_description.t %>:</strong>
        <div>
          <span class="pull-right">
          <%= link_with_query(:show_name_see_more.t, :id => @name.description.id,
                              :controller => 'name',
                              :action => 'show_name_description') %> |
            <%= link_with_query(:EDIT.t, {id: @name.description.id,
                                          controller: 'name', action: 'edit_name_description'}) %>
                </span>
        </div>
        <div class="list-group">
          <div class="list-group-item">
            <%= @best_description.tpl %>
          </div>
        </div>
    <% end %>
    <strong><%= :show_name_descriptions.t %>:</strong>
    <div>
      <%= link_with_query(:show_name_create_description.t,
                          {
	                    controller: :name,
	                    action: :create_name_description,
	                    id: @name.id
                          }, {class: "pull-right"}) %>
    </div>
    <div class="list-group">
      <div class="list-group-item">
        <% description_links.each do |desc| %>
            <div><%= desc %></div>
        <% end %>
        <%= :show_name_no_descriptions.t if description_links.empty? %>
      </div>
    </div>
    <% if @projects && @projects.length > 0 %>
    <div>
      <strong><%= :show_name_create_draft.t %>:</strong>
    </div>
    <div class="list-group">
      <div class="list-group-item">
        <% @projects.each do |project| %>
          <%= link_with_query(project.title,
                              action: :create_name_description,
                              id: @name.id,
                              project: project.id,
                              source: 'project') %><br>
	<% end %>
      </div>
      <% end %>
    </div>
  </div>
</div>

<%
   # ----------------------------------------
   #  Show comments
   # ----------------------------------------
%>
<%= render(:partial => 'comment/show_comments', :locals =>
{object: @name, controls: true, limit: nil}) %>
<div class="col-xs-12">
  <%= show_object_footer(@name) %>
</div>
</div>
<commit_msg>Wasn't rendering the "Create" button for name descriptions in show_name.<commit_after><%
  @title = :show_name_title.t(:name => @name.display_name)

  description_links = list_descriptions(@name) || []
  Textile.register_name(@name)

  tabs = [
    link_with_query(:show_name_edit_name.t, :action => 'edit_name',
                    :id => @name.id),
    link_with_query(:show_name_bulk_name_edit.t,
                    :action => 'bulk_name_edit'),
    link_with_query(:show_name_add_name.t, :action => 'create_name'),
    link_with_query(:show_name_change_synonyms.t,
                    :action => 'change_synonyms', :id => @name.id)
  ]
  if @name.deprecated
    tabs << link_with_query(:APPROVE.t, :action => 'approve_name',
                            :id => @name.id)
  else
    tabs << link_with_query(:DEPRECATE.t, :action => 'deprecate_name',
                            :id => @name.id)
  end
  tabs += [
    link_with_query(:show_name_email_tracking.t, :action => 'email_tracking',
                    :id => @name.id),
    draw_interest_icons(@name)
  ]
  @tabsets = {
    pager_for: @name,
    right: draw_tab_set(tabs)
  }
%>

<div class="row">
  <div class="col-sm-5">
    <% if @first_four and @first_four.length > 0 %>
        <div class="list-group">
          <div class="list-group-item">
            <%= :show_name_most_confident.t %>
          </div>
          <% @first_four.each do |obs| %>
              <div class="list-group-item">
                <%= show_best_image(obs) %>
              </div>
          <% end %>
        </div>
    <% end %>
    <div>
      <%= show_previous_version(@name) %>
      <%= set_export_status_controls(@name) %>
      <br/>
      <br/>
    </div>
    <div class="list-group">
      <div class="list-group-item">
	<%= show_authors_and_editors(@name) %>
      </div>
    </div>
  </div>
  <div class="col-sm-7">
    <div class="list-group">
      <div class="list-group-item">
        <div class="row">
          <div class="col-sm-6">
            <%= name_section_link(:show_name_observations.t, @first_consensus, @consensus_query) %>
            <%= name_section_link(:show_name_all_observations.t, @has_consensus2, @consensus2_query) %>
            <%= name_section_link(:show_name_synonym_observations.t, @has_synonym, @synonym_query) %>
            <%= name_section_link(:show_name_other_observations.t, @has_other, @other_query) %>
            <%= name_section_link(:show_name_subtaxa_observations.t, @has_subtaxa, @subtaxa_query) %>
          </div>
          <div class="col-sm-6">
            <%= content_tag(:div, link_to('EOL', @name.eol_url)) if @name.eol_url %>
            <%= content_tag(:div, link_to(:google_images.t, "http://images.google.com/images?q=#{@name.real_text_name}")) %>
            <%= content_tag(:div, link_to("MyCoPortal", mycoportal_url(@name))) %>
            <%= content_tag(:div, link_with_query(:show_name_distribution_map.t, :action => 'map', :id => @name.id)) %>
          </div>
        </div>
      </div>
    </div>
    <strong><%= :show_name_nomenclature.t %>:</strong>

    <div class="list-group">
      <div class="list-group-item">
        <%= render(:partial => 'name', :object => @name, :locals => {synonyms: true}) %>
      </div>
    </div>

    <strong><%= :show_name_classification.t %>:</strong>
    <div>
      <%= link_with_query(:EDIT.t, {id: @name.description.id,
                                    controller: 'name', action: 'edit_name_description'},
                          {class: "pull-right"}) if @name.description %>
    </div>
    <div class="list-group">
      <div class="list-group-item">
        <%= classification_section(@classification, @parents, @first_child, @children_query) %>
      </div>
    </div>
    <div class="list-group">
      <% if @name.has_notes? %>
          <div class="list-group-item">
            <%= :show_name_notes.t %>:
            <%= link_with_query(:EDIT.t, {controller: 'name', action: 'edit_name', id: @name.id},
                                {class: "pull-right"}) %>
          </div>
          <div class="list-group-item">
            <%= @name.notes.tpl %>
          </div>
      <% end %>
    </div>

    <% if !@best_description.blank? %>
        <strong><%= :show_name_brief_description.t %>:</strong>
        <div>
          <span class="pull-right">
          <%= link_with_query(:show_name_see_more.t, :id => @name.description.id,
                              :controller => 'name',
                              :action => 'show_name_description') %> |
            <%= link_with_query(:EDIT.t, {id: @name.description.id,
                                          controller: 'name', action: 'edit_name_description'}) %>
                </span>
        </div>
        <div class="list-group">
          <div class="list-group-item">
            <%= @best_description.tpl %>
          </div>
        </div>
    <% end %>
    <strong><%= :show_name_descriptions.t %>:</strong>
      [<%= link_with_query(:show_name_create_description.t, controller: :name,
	                        action: :create_name_description, id: @name.id) %>]
    <div class="list-group">
      <div class="list-group-item">
        <% description_links.each do |desc| %>
            <div><%= desc %></div>
        <% end %>
        <%= :show_name_no_descriptions.t if description_links.empty? %>
      </div>
    </div>
    <% if @projects && @projects.length > 0 %>
    <div>
      <strong><%= :show_name_create_draft.t %>:</strong>
    </div>
    <div class="list-group">
      <div class="list-group-item">
        <% @projects.each do |project| %>
          <%= link_with_query(project.title,
                              action: :create_name_description,
                              id: @name.id,
                              project: project.id,
                              source: 'project') %><br>
	<% end %>
      </div>
      <% end %>
    </div>
  </div>
</div>

<%
   # ----------------------------------------
   #  Show comments
   # ----------------------------------------
%>
<%= render(:partial => 'comment/show_comments', :locals =>
{object: @name, controls: true, limit: nil}) %>
<div class="col-xs-12">
  <%= show_object_footer(@name) %>
</div>
</div>

{'fraction_non_alphanumeric': 0.18587953729557238, 'fraction_numerical': 0.0015955325089748703, 'mean_word_length': 1.9954599761051375, 'pattern_counts': {'":': 0, '<': 273, '<?xml version=': 0, '>': 315, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4532812', 'n_tokens_mistral': 4285, 'n_tokens_neox': 4030, 'n_words': 635}