Skip to content

Commit

Permalink
Merge d127d0d into ba7b7bd
Browse files Browse the repository at this point in the history
  • Loading branch information
imajit authored Jun 23, 2021
2 parents ba7b7bd + d127d0d commit d12a468
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 85 deletions.
13 changes: 11 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,20 @@ def translation(key, options = {}, html = true)
translated_string2 = t(key, options)

if html && current_user&.has_tag('translation-helper') && translated_string2.include?("translation missing") && !translated_string.include?("<")
raw(%(<span>#{translated_string} <a class="translationIcon" style='display: none;' href="https://www.transifex.com/publiclab/publiclaborg/translate/#de/$?q=text%3A#{translated_string}">
<i data-toggle='tooltip' data-placement='top' title='Needs translation? Click to help translate this text.' style='position:relative; right:2px; color:#bbb; font-size: 15px;' class='fa fa-globe'></i></a>
raw(%(<span>#{translated_string} <a class="translationIcon" style='display: none; padding-left: 3px;' href="https://www.transifex.com/publiclab/publiclaborg/translate/#de/$?q=text%3A#{translated_string}">
<i data-toggle='tooltip' data-placement='top' title='Needs translation? Click to help translate the text \" #{translated_string} \" .' style='position:relative; right:2px; color:#bbb; font-size: 15px;' class='fa fa-globe'></i></a>
</span>))
else
raw(translated_string)
end
end

def create_nav_dropdown_item(href, text)
translated_string = translation(text)
if current_user&.has_tag('translation-helper') && I18n.locale != :en
raw(%(<div class="dropdown-item"> <a class="text-body" href="/#{href}"> #{translated_string}</a> </div>))
else
raw(%(<a class="dropdown-item" href="/#{href}"> #{translated_string} </a>))
end
end
end
19 changes: 13 additions & 6 deletions app/views/dashboard/_wiki.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@
</div>
</div>

<div class="col-xl-4 col-lg-5 col-md-5 col-5 btn btn-primary btn-sm" type="button" >
<a href="/wiki/new" class="text-white">
<i class="fa fa-plus-circle text-white" ></i>

<% 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>
</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>

<div class="wikis">

<% wikis.each_with_index do |wiki, index| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/subscriptions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<a rel="tooltip" title="Once per day" class="btn btn-default btn-xs" href="javascript:void(0)"><i class="fa fa-list"></i> Digest</a>
-->
<script> input_<%= subscription.tid %> = '#share-<%= subscription.tid %>'</script>
<a class="btn btn-outline-secondary btn-sm" rel="popover" data-toggle="popover" data-placement="left" title="<%= translation('home.subscriptions.share_subscription_link',{},false) %>" data-html="true" data-content="<div style='margin-top:10px;'><a style='padding-left:3px;' href='https://twitter.com/intent/tweet?text=🎈 Public Lab: Subscriptions&url=https://publiclab.org/subscriptions/tag/<%= subscription.tagname %>' class='twitter-share-button'>Tweet</a></div> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');</script>
<a class="btn btn-outline-secondary btn-sm text-body" rel="popover" data-toggle="popover" data-placement="left" title="<%= translation('home.subscriptions.share_subscription_link',{},false) %>" data-html="true" data-content="<div style='margin-top:10px;'><a style='padding-left:3px;' href='https://twitter.com/intent/tweet?text=🎈 Public Lab: Subscriptions&url=https://publiclab.org/subscriptions/tag/<%= subscription.tagname %>' class='twitter-share-button'>Tweet</a></div> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');</script>
<i class="fa fa-share"></i> <%= translation('home.subscriptions.share') %></a>
<a class="btn btn-outline-secondary btn-sm" href="/unsubscribe/tag/<%= subscription.tagname %>" data-method="delete"><i class="fa fa-remove"></i> <%= translation('home.subscriptions.unsubscribe') %></a>
</div>
Expand Down
120 changes: 50 additions & 70 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,20 @@
<%= translation('layout._header.community.community_title') %>
</div>
<div class="dropdown-menu">
<div class="dropdown-item">
<a class="text-body" href="/getting-started"><b><%= translation('layout._header.community.get_started') %> &raquo;</b></a>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<a class="text-body" href="/people"><%= translation('layout._header.community.people') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/map"><%= translation('layout._header.community.places') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/projects"><%= translation('layout._header.community.projects') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/events"><%= translation('layout._header.community.events') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/questions"><%= translation('layout._header.community.questions') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/chat"><%= translation('layout._header.community.chat') %></a>
</div>
<% if current_user&.has_tag('translation-helper') && I18n.locale != :en %>
<div class="dropdown-item">
<a class="text-body" href="/getting-started"><b><%= translation('layout._header.community.get_started') %> &raquo;</b></a>
</div>
<% else %>
<a class="dropdown-item" href="/getting-started"><b><%= translation('layout._header.community.get_started') %> &raquo;</b></a>
<% end %>
<div class="dropdown-divider"></div>
<%= create_nav_dropdown_item("people","layout._header.community.people") %>
<%= create_nav_dropdown_item("map","layout._header.community.places") %>
<%= create_nav_dropdown_item("projects","layout._header.community.projects") %>
<%= create_nav_dropdown_item("events","layout._header.community.events") %>
<%= create_nav_dropdown_item("questions","layout._header.community.questions") %>
<%= create_nav_dropdown_item("chat","layout._header.community.chat") %>
</div>
</li>

Expand All @@ -67,31 +59,23 @@
</div>

<div class="dropdown-menu">
<div class="nav-link dropdown-item">
<a class="text-body" href="/methods"><%= translation('layout._header.tools.methods') %></a>
</div>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">Kits</h6>
<div class="dropdown-item">
<a class="text-body" href="/kits"><%= translation('layout._header.tools.kits_initiative') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="//store.publiclab.org"><%= translation('layout._header.tools.store') %></a>
</div>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">Software</h6>
<div class="dropdown-item">
<a class="text-body" href="https://mapknitter.org"><%= translation('layout._header.tools.map_knitter') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="https://infragram.org"><%= translation('layout._header.tools.infragram') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="https://spectralworkbench.org"><%= translation('layout._header.tools.spectral_workbench') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="https://code.publiclab.org#r=all"><%= translation('layout._header.tools.code_community') %></a>
</div>
<% if current_user&.has_tag('translation-helper') && I18n.locale != :en %>
<div class="nav-link dropdown-item">
<a class="text-body" href="/methods"><%= translation('layout._header.tools.methods') %></a>
</div>
<% else %>
<a class="dropdown-item" href="/methods"><%= translation('layout._header.tools.methods') %></a>
<% end %>

<div class="dropdown-divider"></div>
<h6 class="dropdown-header">Kits</h6>
<%= create_nav_dropdown_item("kits","layout._header.tools.kits_initiative") %>
<%= create_nav_dropdown_item("//store.publiclab.org","layout._header.tools.store") %>
<h6 class="dropdown-header">Software</h6>
<%= create_nav_dropdown_item("https://mapknitter.org","layout._header.tools.map_knitter") %>
<%= create_nav_dropdown_item("https://infragram.org","layout._header.tools.infragram") %>
<%= create_nav_dropdown_item("https://spectralworkbench.org","layout._header.tools.spectral_workbench") %>
<%= create_nav_dropdown_item("https://code.publiclab.org#r=all","layout._header.tools.code_community") %>
</div>
</li>

Expand All @@ -102,19 +86,10 @@
<!-- </a> -->
</div>
<div class="dropdown-menu">
<div class="dropdown-item">
<a class="text-body" href="/about"><%= translation('layout._header.about.about_public_lab') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/blog"><%= translation('layout._header.about.blog') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/newsletter"><%= translation('Newsletter') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/wiki/contact">
<%= translation(' layout._header.about.contact') %></a>
</div>
<%= create_nav_dropdown_item("about","layout._header.about.about_public_lab") %>
<%= create_nav_dropdown_item("blog","layout._header.about.blog") %>
<%= create_nav_dropdown_item("newsletter","Newsletter") %>
<%= create_nav_dropdown_item("wiki/contact","layout._header.about.contact") %>
</div>
</li>

Expand Down Expand Up @@ -161,23 +136,24 @@
- logged in as <%= current_user.role %>
<% end %>
</h5>

<% if current_user&.has_tag('translation-helper') && I18n.locale != :en %>
<div class="dropdown-item">
<a class="text-body" href="/profile/<%= current_user.username %>"><%= translation('layout._header.profile') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/profile/edit"><%= translation('layout._header.edit_profile') %></a>
</div>
<div class="dropdown-item">
<a class="text-body" href="/settings" >Notifications</a>
</div>
<% else %>
<a class="dropdown-item" href="/profile/<%= current_user.username %>"><%= translation('layout._header.profile') %></a>
<% end %>
<%= create_nav_dropdown_item("profile/edit","layout._header.edit_profile") %>
<%= create_nav_dropdown_item("settings","Notifications") %>
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<a class="text-body" href="/subscriptions"><%= translation('layout._header.subscriptions') %></a>
</div>
<%= create_nav_dropdown_item("subscriptions","layout._header.subscriptions") %>
<% if current_user&.has_tag('translation-helper') && I18n.locale != :en %>
<div class="dropdown-item">
<a class="text-body" href="/profile/<%= current_user.username %>/likes"><%= translation('layout._header.notes_liked') %></a>
</div>
<% else %>
<a class="dropdown-item" href="/profile/<%= current_user.username %>/likes"><%= translation('layout._header.notes_liked') %></a>
<% end %>
<div class="dropdown-divider"></div>
<% if logged_in_as(['admin']) %>
<a class="dropdown-item" href="/useremail">Email search</a>
Expand All @@ -187,9 +163,13 @@
<a class="dropdown-item" href="/features">Features</a>
<div class="dropdown-divider"></div>
<% end %>
<% if current_user&.has_tag('translation-helper') && I18n.locale != :en %>
<div class="dropdown-item">
<%= link_to translation('layout._header.logout'), logout_path, class: "text-body" %>
</div>
<% else %>
<%= link_to translation('layout._header.logout'), logout_path, class: "dropdown-item" %>
<% end %>
<a class="dropdown-item" href="/logoutRemotely">Logout from all devices</a>
</div>
</li>
Expand Down
12 changes: 6 additions & 6 deletions app/views/sidebar/_dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<span class="sr-only">Toggle Dropdown</span>
</a>
<div class="dropdown-menu dropdown-menu-right mt-2">
<a class="dropdown-item" href="/post?n=15322&title=How%20to%20...&tags=activity:new,draft"><%= translation('dashboard._header.dropdown.share_activity') %></a>
<a class="dropdown-item" href="/post"><%= translation('dashboard._header.dropdown.share_research_note') %></a>
<a class="dropdown-item" href="/questions/new?tags=question:general"><%= translation('dashboard._header.dropdown.ask_question') %></a>
<a class="dropdown-item" href="/post?template=event&tags=event"><%= translation('dashboard._header.dropdown.post_event') %></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/post?tags=blog-submission"><%= translation('dashboard._header.dropdown.tell_story_blog') %></a>
<%= create_nav_dropdown_item("post?n=15322&title=How%20to%20...&tags=activity:new,draft","dashboard._header.dropdown.share_activity") %>
<%= create_nav_dropdown_item("post","dashboard._header.dropdown.share_research_note") %>
<%= create_nav_dropdown_item("questions/new?tags=question:general","dashboard._header.dropdown.ask_question") %>
<%= create_nav_dropdown_item("post?template=event&tags=event","dashboard._header.dropdown.post_event") %>
<div class="dropdown-divider"></div>
<%= create_nav_dropdown_item("post?tags=blog-submission","dashboard._header.dropdown.tell_story_blog") %>
</div>
</div>
</div>
Expand Down

0 comments on commit d12a468

Please sign in to comment.