media3-0/apki.org

View on GitHub
app/views/main/view_news.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, " - " + @news.title %>

<div id="staticContent">

  <!-- Blog Post -->

  <!-- Title -->
  <h1 class="text-center"><%= @news.title -%></h1>

    <hr>

  <!-- Post Content -->
  <%- if @news.educator_news -%>
    <%= raw parse_markdown(@news.content)-%>
  <%- else -%>
    <%= raw @news.content -%>
  <%- end -%>

  <%- if current_user and current_user.is_admin? -%>
      <%= link_to 'Edytuj newsa', rails_admin.edit_path(model_name: 'News', id: @news.id.to_s) -%>
  <%- end -%>

  <%- if current_user and current_user.account_type == :teacher -%>
    <%= link_to 'Edytuj newsa', school_educator_news_path + '?id=' + @news.id.to_s -%>
  <%- end -%>


    <hr>
    <!-- Date/Time -->
    <p style="float:left; margin-left:20px"><span class="glyphicon glyphicon-time"></span> Opublikowane <%= @news.created_at.strftime('%F %T') -%></p>
    <p style="float: right; margin-right:20px">
        <span class="glyphicon glyphicon-user"></span> Autor: <%- if @news.user.name.present? -%><%= @news.user.name -%><%- else -%><%= @news.user.nickname -%><%- end -%>
    </p>

    <div class="clearfix"></div>
    <hr style="margin-top: 12px;">
</div>