-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
_related.html.erb
103 lines (79 loc) · 4.76 KB
/
_related.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<div class="col-md-3 hidden-print">
<a style="margin-top:-16px;margin-bottom:0;" class="btn btn-mini btn-block btn-link visible-xs visible-sm" href="javascript:void()" onClick="toggle_sidebar()"><i class="fa fa-chevron-down"></i></a>
<div id="sidebar" class="hidden-xs hidden-sm">
<a style="margin-bottom:6px;white-space: normal;" rel="tooltip" title="<%= t('sidebar._related.share_your_work') %>" data-placement="bottom" href="/post" class="btn btn-primary btn-lg btn-block hidden-sm"><i class="fa fa-pencil fa fa-white"></i> <%= t('sidebar._related.write_research_note') %></a>
<a style="white-space: normal;" rel="tooltip" title="Post <% if @tagnames %>about <%= (@tagnames.uniq.delete_if{|x| x.match(":") }).join(',') %><% else %>research<% end %>" data-placement="bottom" href="/post<%= '?template=question&tags=question:general,'+(@tagnames.uniq.delete_if{|x| x.match(":") }).join(',') if @tagnames %><% if params[:controller] == 'notes' && params[:action] == 'show' %>,response:<%= @node.id %><% end %>" class="btn btn-primary btn-lg btn-block"><i class="fa fa-pencil fa fa-white"></i> <%= t('sidebar._related.ask_a_question') %> »</a>
<% cache('related_sidebar-feature', skip_digest: true) do %>
<%= feature('sidebar') %>
<% end %>
<% if @node %>
<br />
<%= render :partial => "sidebar/list" %>
<br />
<%= render :partial => "sidebar/events" %>
<% end %>
<% if @node && (@node.has_power_tag('iso') || @node.has_power_tag('lang')) %>
<h4><%= t('sidebar._related.translation') %></h4>
<p>
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false, multilanguagePage: true}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</p>
<% end %>
<% responses = @node.responses if @node %>
<% if @node && responses.length > 0 %>
<%= render partial: 'sidebar/notes', locals: { notes: @node.responded_to, title: I18n.t('sidebar._related.response_to'), node: @node } %>
<% end %>
<% if @node && @node.has_power_tag('response') %>
<%= render partial: 'sidebar/notes', locals: { notes: @node.responses, title: I18n.t('sidebar._related.responses_to_note'), node: @node } %>
<% end %>
<% if params[:action] != "contributors" %>
<% if @notes && @notes.length > 0 %>
<h4><%= t('sidebar._related.recent_topic_contributors') %></h4>
<% @notes.collect(&:author).collect(&:name).uniq.each do |author| %>
<p>
<i class="fa fa-user"></i>
<a href="/profile/<%= author %>"><%= author %></a>
</p>
<% end %>
<% if params[:controller] == "tag" || (@node && @node.type == "page") %><a href="/contributors/<%= params[:id] %>"><i class="fa fa-list"></i> <%= t('sidebar._related.view_all') %> »</a><% end %>
<% end %>
<% if @users && @users.length > 0 %>
<h4><%= t('sidebar._related.contributors') %></h4>
<% @users.each do |author| %>
<p>
<i class="fa fa-user"></i>
<a href="/profile/<%= author.name %>"><%= author.name %></a>
</p>
<% end %>
<p><a href="/contributors/<%= params[:id] %>"><i class="fa fa-list"></i> <%= t('sidebar._related.view_all') %> »</a></p>
<% end %>
<% end %>
<% if (params[:controller] != "tag") && @node && !@node.has_tag('tabbed:wikis') %>
<% if params[:controller] == "notes" && params[:action] == "index" %>
<%= render partial: 'sidebar/wikis', locals: { wikis: @wikis, title: I18n.t('sidebar._related.recent_wiki_edits'), node: @node } %>
<% else %>
<%= render partial: 'sidebar/wikis', locals: { wikis: @wikis, title: I18n.t('sidebar._related.recent_wiki_pages'), node: @node } %>
<% end %>
<% end %>
<% if params[:controller] != "tag" && params[:controller] != "search" %>
<%= render partial: 'sidebar/notes', locals: { notes: @notes, title: I18n.t('sidebar._related.related_research_notes'), node: @node } %>
<% end %>
<% if @maps && @maps.length > 0 && params[:controller] != "search" %>
<br />
<% if @node && @maps && @node.lat %>
<%= render_map(@node.lat, @node.lon, @maps) %>
<% elsif @maps && @maps.first %>
<%= render_map(@maps.first.lat, @maps.first.lon, @maps) %>
<% end %>
<br style="clear:both;" />
<% if params[:controller] != "tag" && params[:controller] != "search" %>
<%= render partial: 'sidebar/notes', locals: { notes: @maps, title: I18n.t('sidebar._related.related_maps'), node: @node } %>
<% end %>
<% end %>
<hr style="margin-bottom:6px;" />
</div>
</div>
<%= javascript_include_tag 'sidebar' %>