publiclab/plots2

View on GitHub
app/views/dashboard/_wiki.html.erb

Summary

Maintainability
Test Coverage
<p class="meta"><%= raw translation('dashboard._wiki.shared_knowledge_base', :url => '/wiki') %><!-- | <a href="">Your pages</a>--></p>

<div class="meta row">
  <div class="col-lg-8 col-md-7 col-sm-7 col-7">
    <div class="input-group">
      <form class="search-form-wiki form-inline" role="search" autocomplete="off">
        <input type="text" class="search-wiki form-control form-control-sm" id="sidebar-searchform-input" style="width:70%;" placeholder="<%= translation('dashboard._wiki.search',{},false) %>" required>
        <div class="input-group-append">
          <button class="btn btn-sm btn-outline-secondary" type="submit"><i class="fa fa-search"></i></button>
        </div>
      </form>

    </div>
  </div>

  
    <% if current_user&.has_tag('translation-helper') && I18n.locale != :en %>
      <a href="/wiki/new" class=" btn btn-primary btn-sm text-white">
        <i class="fa fa-plus-circle text-white" ></i> 
        <%= translation('dashboard._wiki.new_page') %>
      </a>
    <% else %>
    <div class="col-xl-4 col-lg-5 col-md-5 col-5" type="button" >
      <a href="/wiki/new" class=" btn btn-primary btn-sm text-white">
        <i class="fa fa-plus-circle text-white" ></i> 
        <%= translation('dashboard._wiki.new_page') %>
      </a>
    </div>
    <% end %>
  </div>

<div class="wikis">

  <% wikis.each_with_index do |wiki, index| %>

    <div class="wiki" data-index="<%= index %>">
      <p>
        <small style="color:#888;">
          <% if wiki.is_a?(Node) %>
            <i class="fa fa-book"></i>
            <%= translation('dashboard._wiki.new_page_by') %> <a href="/profile/<%= wiki.latest.author.name %>"><%= wiki.latest.author.name %></a>
          <% else %>
            <i class="fa fa-pencil"></i>
            <%= translation('dashboard._wiki.new_edit_by') %> <a href="/profile/<%= wiki.author.name %>"><%= wiki.author.name %></a>
          <% end %>

      <%= distance_of_time_in_words(wiki.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %>

          <% if wiki.is_a?(Revision) && wiki.previous %>
           - <a class="btn-diff btn-diff-<%= index %>" style="cursor:pointer;"><%= translation('dashboard._wiki.changes') %></a>
          <% end %>

        </small>
      </p>

      <h4>
        <a href="<%= wiki.path %>">
          <% if wiki.is_a?(Node) %>
            <%= wiki.latest.title %>
          <% else %>
            <%= wiki.parent.latest.title %>
          <% end %>
        </a> 
      </h4>

      <% if wiki.is_a?(Revision) && wiki.previous %>
        <div data-diff-a="<%= wiki.previous.vid %>" 
             data-diff-b="<%= wiki.vid %>" 
             class="well wiki-diff wiki-diff-<%= index %>" 
             style="display:none;">
          <i class="fa fa-circle-o-notch fa-spin"></i>
        </div>
      <% end %>
    </div>
  <% end %>

  <p><small><a href="/wiki/"><%= translation('dashboard._wiki.more') %> &raquo;</a></small></p>

</div>