-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathblog.html.erb
85 lines (73 loc) · 4.03 KB
/
blog.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<div class="col-lg-2">
</div>
<div class="col-lg-8 blog">
<div class="blog-header">
<h1><%= params[:id] == "blog" ? I18n.t('tag.blog.the_public_lab') : params[:id].split('-').join(' ').capitalize %> <%=raw translation('tag.blog.blog') %></h1>
<% if params[:id] == "blog" %>
<br />
<p><%=raw translation('tag.blog.stories_from_community') %></p>
<p>
<a href="/wiki/blog"><%=raw translation('tag.blog.about_the_blog') %> </a> |
<a href="/research"><%=raw translation('tag.research') %> </a> |
<a href="/tools"><%=raw translation('tag.methods') %></a>
</p>
<% if current_user %>
<a class="btn btn-outline-secondary btn-sm" href="/feed/tag/<%= params[:id] %>.rss"><i class="fa fa-rss"></i> RSS</a>
<% if current_user.following(params[:id]) %>
<a rel="tooltip" title="<%= translation('tag.blog.unfollow') %>" class="btn btn-outline-secondary btn-sm active" href="/unsubscribe/tag/<%= params[:id] %>"><i class="fa fa-user-plus" aria-hidden="true"></i> <%= translation('tag.blog.following') %> <b><%= params[:id] %></b></a>
<% else %>
<br><br>
<div class="alert alert-success" role="alert">
Want to get updates for new blog posts? <a class="btn btn-outline-secondary btn-sm" href="/subscribe/tag/<%= params[:id] %>">
<b><%=raw translation('Click here to subscribe!') %></b></a>
</div>
<% end %>
<% else %>
<div class="alert alert-info" role="alert">
<a data-toggle="modal" data-target="#loginModal">Log in</a> to get updates for new posts!
</div>
<% end %>
<% end %>
<br />
</div>
<hr />
<% if @notes.nil? || @notes.length == 0 %>
<p><%= raw translation('tag.blog.no_results', :search => params[:id]) %>:</p>
<%= render template: "search/new" %>
<% else %>
<% @notes.each_with_index do |node,i| %>
<div class="clearfix blog-entry">
<% if node.main_image %>
<a class="img" href="<%= node.path %>"><img src="<%= node.main_image.path(:default) %>" /></a>
<% end %>
<h1><a href="<%= node.path %>"><%= node.title %></a></h1>
<p class="meta" style="color:#888;"><small>
<%=raw translation('tag.blog.by') %> <a href="/profile/<%= node.author.name %>"><%= node.author.name %></a> <%= node.author.new_contributor %>
| <%= distance_of_time_in_words(node.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %>
| <a href="<%= node.path %>#comments"><i style="color:#888;" class="fa fa-comment-o"></i> <%= node.comments_viewable_by(current_user).length %></a>
<% if params[:controller] == "notes" && params[:action] == "popular" %>
| <%= number_with_delimiter(node.views) %> <%=raw translation('tag.blog.views') %>
<% else %>
| <i style="color:#888;" class="fa fa-star-o"></i> <%= node.likes %>
<% end %>
</small></p>
<p><%= raw auto_link(insert_extras(node.latest.render_body), :sanitize => false) %></p>
<p><a class="btn btn-outline-secondary btn-md" href="<%= node.path %>" style="color: black"><%=raw translation('tag.blog.read_more')%> <i class="fa fa-angle-double-right"></i></a><%= render partial: 'tag/subscribe_button', locals:{tags: node.tags} %></p>
<p>
<%= render :partial => "like/like", :locals => {:node => node, :tagnames => node.tags.collect(&:name) } %>
<% node.tags[0..3].each do |tag| %>
<a class="badge badge-primary" href="/tag/<%= tag.name %>"><%= tag.name %></a>
<% end %>
</p>
<% if params[:mod] %>
<a class="btn btn-outline-secondary btn-sm" href="#"><i class="fa fa-ban-circle"></i> <%=raw translation('tag.blog.spam') %></a>
<% end %>
</div>
<hr />
<% end %>
<div class="text-center">
<%= will_paginate @notes, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
</div>
<% end %>
<hr />
</div>