suer/redmine_milkode

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

Summary

Maintainability
Test Coverage
<%= stylesheet_link_tag 'scm' %>
<style type="text/css">
.highlight-line {
  background-color: #FFD;
}
td.code {
  background-color: #fafafa;
}
.CodeRay .line-numbers {
  background-color: #eee;
  color: #555;
  text-align: right;
  border-right: 1px solid #D7D7D7;
}
.result {
  margin-bottom: 15px;
}
table.CodeRay {
  width: auto;
}
table.CodeRay {
  border-collapse: collapse;
  padding: 2px;
  width: 100%;
}
.CodeRay {
  background-color: #F2F2F2;
  border: 1px solid silver;
  color: black;
}
.CodeRay pre {
  margin: 0;
}
.CodeRay .code {
  width: 100%;
}
</style>
<div class="contextual">
  <%= link_to l(:label_settings), :action => :settings %>
</div>
<h2>Milkode</h2>

<%= form_tag({:action => 'index'}, {:method => 'get', :project_id => @project})  do %>
  <%= text_field_tag :keyword, @keyword, {:autofocus=>true, :style=>'width: 300px'} %>
<% end %>
<br>

<% if @results %>
  <hr/>

  <% @results.each do |result| %>
    <div class="result syntaxhl">
      <%= result[:repository_identifier] %>:
      <%= link_to(result[:path],
        :controller => 'repositories',
        :action => 'entry',
        :id => @project,
        :repository_id => result[:repository_identifier],
        :path => result[:path]) %><br/>
      <%= result[:content].html_safe %>
    </div>
  <% end %>

  <% if @results.size == 0 %>
    <p class="nodata"><%= l(:label_no_data) %></p>
  <% else %>
    <p class="pagination">
    <% if @page > 1 %>
      <%= link_to '«', :page => @page - 1, :keyword => @keyword, :per_page => @per_page %>
    <% end %>
    <% if @page * @per_page < @total %>
      <%= link_to '»', :page => @page + 1, :keyword => @keyword, :per_page => @per_page %>
    <% end %>
      (<%= @start_index + 1 %>-<%= @end_index + 1 %>/<%= @total %>)
    </p>
  <% end %>

<% end %>