Skip to content

Commit

Permalink
Revert "Merge branch 'add-forward-stat-page' of https://github.com/ke…
Browse files Browse the repository at this point in the history
…vinzluo/plots2 into add-forward-stat-page"

This reverts commit 64a51d8, reversing
changes made to c6ee704.
  • Loading branch information
kevinzluo committed Nov 1, 2018
1 parent 64a51d8 commit 2d5c256
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 180 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gem 'geokit-rails'
gem 'georuby', '2.0'
gem 'grape'
gem 'grape-entity'
gem 'grape-swagger', '~> 0.31.1'
gem 'grape-swagger', '~> 0.28.0'
gem 'grape-swagger-entity', '0.2.5'
gem 'grape-swagger-rails'
gem 'grape-swagger-ui'
Expand All @@ -41,11 +41,11 @@ gem "php-serialize", :require => "php_serialize"
gem 'progress_bar'
gem 'rack-cors', :require => 'rack/cors'
gem "rack-openid"
gem "rack-test", "1.1.0"
gem "rack-test", "1.0.0"
gem 'rails', '5.2.0'
gem 'rails-controller-testing'
gem 'rails-dom-testing'
gem 'rails-i18n', '~> 5.1.2'
gem 'rails-i18n', '~> 5.1.1'
gem 'rails_autolink'
gem 'rb-readline'
gem 'rdiscount', '~> 2.2', '>= 2.2.0.1'
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ GEM
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
grape-swagger (0.31.1)
grape-swagger (0.28.0)
grape (>= 0.16.2)
grape-swagger-entity (0.2.5)
grape-entity (>= 0.5.0)
Expand Down Expand Up @@ -193,7 +193,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.3)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
Expand Down Expand Up @@ -294,9 +294,9 @@ GEM
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-protection (2.0.4)
rack-protection (2.0.3)
rack
rack-test (1.1.0)
rack-test (1.0.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
Expand All @@ -320,7 +320,7 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-i18n (5.1.2)
rails-i18n (5.1.1)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
rails-perftest (0.0.7)
Expand Down Expand Up @@ -392,9 +392,9 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
scrypt (3.0.6)
scrypt (3.0.5)
ffi-compiler (>= 1.0, < 2.0)
sidekiq (5.2.2)
sidekiq (5.2.1)
connection_pool (~> 2.2, >= 2.2.2)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 5)
Expand Down Expand Up @@ -485,7 +485,7 @@ DEPENDENCIES
georuby (= 2.0)
grape
grape-entity
grape-swagger (~> 0.31.1)
grape-swagger (~> 0.28.0)
grape-swagger-entity (= 0.2.5)
grape-swagger-rails
grape-swagger-ui
Expand Down Expand Up @@ -520,11 +520,11 @@ DEPENDENCIES
progress_bar
rack-cors
rack-openid
rack-test (= 1.1.0)
rack-test (= 1.0.0)
rails (= 5.2.0)
rails-controller-testing
rails-dom-testing
rails-i18n (~> 5.1.2)
rails-i18n (~> 5.1.1)
rails-perftest
rails_autolink
rake (~> 12.3.1)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def range
end

def index
@title = 'Stats'
@time = if params[:time]
Time.parse(params[:time])
else
Expand Down
26 changes: 1 addition & 25 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,34 +332,10 @@ def trimmed_content?
comment.include?(COMMENT_FILTER)
end

def parse_quoted_text
match = body.match(/(.+)(On .+<.+@.+> wrote:)(.+)/m)
if match.nil?
false
else
{
body: match[1], # the new message text
boundary: match[2], # quote delimeter, i.e. "On Tuesday, 3 July 2018, 11:20:57 PM IST, RP <rp@email.com> wrote:"
quote: match[3] # quoted text from prior email chain
}
end
end

def scrub_quoted_text
parse_quoted_text[:body]
end

def render_body
body = RDiscount.new(
RDiscount.new(
title_suggestion(self),
:autolink
).to_html
# if it has quoted email text that wasn't caught by the yahoo and gmail filters,
# manually insert the comment filter delimeter:
parsed = parse_quoted_text
if !trimmed_content? && parsed != false
body = parsed[:body] + COMMENT_FILTER + parsed[:boundary] + parsed[:quote]
end
body
end
end
20 changes: 10 additions & 10 deletions app/models/concerns/node_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def liked_by(uid)

# rubular regex: http://rubular.com/r/hBEThNL4qd
def self.graph_grid(body, _page = 1)
body.gsub(/(?<![\>`])(\<p\>)?\[graph\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[graph\:(\S+)\]/) do |_tagname|
url = Regexp.last_match(2)
a = ActionController::Base.new
randomSeed = rand(1000).to_s
Expand All @@ -29,7 +29,7 @@ def self.graph_grid(body, _page = 1)

# rubular regex: http://rubular.com/r/hBEThNL4qd
def self.notes_grid(body, _page = 1)
body.gsub(/(?<![\>`])(\<p\>)?\[notes\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[notes\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
exclude = nil
if tagname.include?('!')
Expand Down Expand Up @@ -68,7 +68,7 @@ def self.notes_grid(body, _page = 1)

# rubular regex: http://rubular.com/r/hBEThNL4qd
def self.questions_grid(body, _page = 1)
body.gsub(/(?<![\>`])(\<p\>)?\[questions\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[questions\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
exclude = nil
if tagname.include?('!')
Expand Down Expand Up @@ -104,7 +104,7 @@ def self.questions_grid(body, _page = 1)
end

def self.activities_grid(body)
body.gsub(/(?<![\>`])(\<p\>)?\[activities\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[activities\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
exclude = nil
if tagname.include?('!')
Expand Down Expand Up @@ -137,7 +137,7 @@ def self.activities_grid(body)
end

def self.upgrades_grid(body)
body.gsub(/(?<![\>`])(\<p\>)?\[upgrades\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[upgrades\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
exclude = nil
if tagname.include?('!')
Expand Down Expand Up @@ -172,7 +172,7 @@ def self.upgrades_grid(body)

# Blank map loaded only , markers will be loaded using API call .
def self.notes_map(body)
body.gsub(/(?<![\>`])(\<p\>)?\[map\:content\:(\S+)\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[map\:content\:(\S+)\:(\S+)\]/) do |_tagname|
lat = Regexp.last_match(2)
lon = Regexp.last_match(3)
a = ActionController::Base.new
Expand All @@ -187,7 +187,7 @@ def self.notes_map(body)
end

def self.notes_map_by_tag(body)
body.gsub(/(?<![\>`])(\<p\>)?\[map\:tag\:(\S+)\:(\S+)\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[map\:tag\:(\S+)\:(\S+)\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
lat = Regexp.last_match(3)
lon = Regexp.last_match(4)
Expand Down Expand Up @@ -218,7 +218,7 @@ def self.notes_map_by_tag(body)

# in our interface, "users" are known as "people" because it's more human
def self.people_map(body, _page = 1)
body.gsub(/(?<![\>`])(\<p\>)?\[map\:people\:(\S+)\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[map\:people\:(\S+)\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
lat = Regexp.last_match(2)
lon = Regexp.last_match(3)
Expand All @@ -238,7 +238,7 @@ def self.people_map(body, _page = 1)

# in our interface, "users" are known as "people" because it's more human
def self.people_grid(body, current_user = nil, _page = 1)
body.gsub(/(?<![\>`])(\<p\>)?\[people\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[people\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
exclude = nil
if tagname.include?('!')
Expand Down Expand Up @@ -276,7 +276,7 @@ def self.people_grid(body, current_user = nil, _page = 1)
end

def self.wikis_grid(body, _page = 1)
body.gsub(/(?<![\>`])(\<p\>)?\[wikis\:(\S+)\]/) do |_tagname|
body.gsub(/[^\>`](\<p\>)?\[wikis\:(\S+)\]/) do |_tagname|
tagname = Regexp.last_match(2)
exclude = nil
if tagname.include?('!')
Expand Down
4 changes: 2 additions & 2 deletions app/models/drupal_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ def first_time_poster

def new_author_contributor
@uid = uid
return "<a href='/tag/first-time-poster' class='label label-success'><i>new contributor</i></a>".html_safe if Node.where(:uid => @uid).length === 1
return "<span class = 'label label-success'><i>New Contributor</i></span>".html_safe if Node.where(:uid => @uid).length === 1
end

def new_contributor
@uid = id
return "<a href='/tag/first-time-poster' class='label label-success'><i>new contributor</i></a>".html_safe if Node.where(:uid => @uid).length === 1
return "<span class = 'label label-success'><i>New Contributor</i></span>".html_safe if Node.where(:uid => @uid).length === 1
end

def likes
Expand Down
2 changes: 1 addition & 1 deletion app/models/node_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def author

def new_author_contributor
@uid = uid
return "<a href='/tag/first-time-poster' class='label label-success'><i>new contributor</i></a>".html_safe if Node.where(:uid => @uid).length === 1
return "<span class = 'label label-success'><i>New Contributor</i></span>".html_safe if Node.where(:uid => @uid).length === 1
end

def user
Expand Down
3 changes: 1 addition & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def self.search_by_username(query)

def new_contributor
@uid = id
return "<a href='/tag/first-time-poster' class='label label-success'><i>new contributor</i></a>".html_safe if Node.where(:uid => @uid).length === 1

return "<span class = 'label label-success'><i>New Contributor</i></span>".html_safe if Node.where(:uid => @uid).length === 1
end

def create_drupal_user
Expand Down
6 changes: 0 additions & 6 deletions app/views/editor/questionRich.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@
</div>
</div>

<style>
.ple-module {
border-top: none;
}
</style>

<script>

var editor;
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<a class="hidden-sm" href="#" class="dropdown-toggle" data-toggle="dropdown">
<%= t('layout._header.login.login_title') %>
</a>
<ul id="login-dropdown" class="dropdown-menu" style="width:245px; color: white;">
<ul id="login-dropdown" class="dropdown-menu" style="width:245px;">
<li style="padding:6px;">
<%= form_for :user_session, :as => :user_session, :url => { :controller => "user_sessions", :action => "create" }, :html => {:class => "form"} do |f| %>
<div class="form-group">
Expand Down
32 changes: 0 additions & 32 deletions app/views/notes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@
<span class="hidden-xs hidden-sm">
<%= @node.created_at.to_s(:long) %>
</span>
<a class="hidden-md hidden-lg hidden-xl collapse-btn" data-toggle="collapse" href="#collapse-info" role="button" aria-expanded="false" aria-controls="collapse-info" id="collapse-button">...</a>
<span class="collapse collapse-info" id="collapse-info">
| <%= number_with_delimiter(@node.totalviews) %> <%= t('notes.show.views') %>
<% if @node.comments %>
| <i class="fa fa-comment"></i>
<a href="#comments"> <%= @node.comments.length %> <%= t('notes.show.comments') %> </a>
<% end %>
| <a href="/n/<%= @node.id %>"><i class="fa fa-link"></i></a> <span class="hidden-xs hidden-sm hidden-md"><a href="/n/<%= @node.id %>">#<%= @node.id %></a></span>
</span>
<span class="hidden-xs hidden-sm hidden-print">
| <%= number_with_delimiter(@node.totalviews) %> <%= t('notes.show.views') %>
<% if @node.comments %>
Expand Down Expand Up @@ -125,26 +116,3 @@
</div><!--/span-->

<%= render partial: "sidebar/related" %>

<style>
.collapse.in {
display: unset;
}
@media (min-width: 1000px){
.collapse-info {
display: none !important;
}
}
.collapse-btn{
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
background-color: rgba(27, 31, 35, 0.14);
border-radius: 3px;
}
</style>
<script>
$("#collapse-button").click(function(){
$(this).remove();
});
</script>
1 change: 0 additions & 1 deletion app/views/tag/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<% end %>
<%= render :partial => "notes/format_toggle" if @node_type == "note" %>
<%= render :partial => "tag/show/user_controls" %>
<% if current_user && current_user.role == 'admin' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/wiki/_wikis.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
</tr>
<% end %>
</table>
<div class="text-center"><%= will_paginate @wikis, :renderer => BootstrapPagination::Rails if @paginated %></div>
<%= will_paginate @wikis, :renderer => BootstrapPagination::Rails if @paginated %>
38 changes: 0 additions & 38 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,41 +103,3 @@ en:
month: Month
second: Seconds
year: Year
notes:
stats:
about_this_page: |
<h4>About this page</h4>
<p>Public Lab is built on the contributions of community members, and this website represents our collective open source work.</p>
contributors_statistics: "Contributor statistics"
looking_back: "Looking back from <i>%{time}</i>."
try_time_further_back: |
Try
<a href='%{url1}'>one year</a>,
<a href='%{url2}'>one month</a>, or
<a href='%{url3}'>one week</a>
further back.
try_time_further_forward: |
Or try
<a href='%{url1}'>one year</a>,
<a href='%{url2}'>one month</a>, or
<a href='%{url3}'>one week</a>
further forward.
notes_and_wiki_edits_past_week: |
<a href='%{url1}'>%{note_count} notes</a>
and <a href='%{url2}'>%{wiki_count} wiki edits</a> posted in the past week.
people_joined_past_week: "<b>%{people_count} people</b> joined in the past week."
notes_and_wiki_edits_past_month: |
<a href='%{url1}'>%{note_count} notes</a>
and <a href='%{url2}'>%{wiki_count} wiki edits</a> posted in the past month.
people_joined_past_month: "<b>%{people_count} people</b> joined in the past month."
research_notes_posted_by_contributors: "%{note_count} research notes have been posted by %{contributors_count} contributors since %{time} ago"
total_contributors: "%{all_contributors_count} Total Contributors (Tallied weekly)"
notes_per_week_past_year: "%{note_count} notes per week over the past year."
note_posting_52_weeks: "Note posting for the past 52 weeks:"
wiki_pages_posted: "%{count} wiki pages have been posted, total"
wiki_page_posting_52_weeks: "Wiki page posting for the past 52 weeks:"
comments_posted: "%{count} comments have been posted, total"
comments_posted_52_weeks: "Comments posted for the past 52 weeks:"
wiki_page_edits: "%{count} wiki page edits have been made, total"
edits_per_week: "%{count} edits per week over the past year."
Loading

0 comments on commit 2d5c256

Please sign in to comment.