From 4620300ad62c929d79ee3e94baebaa233cd25c94 Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Tue, 7 May 2019 16:41:03 -0400 Subject: [PATCH 1/4] fix logged_in_as in controllers --- app/controllers/application_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2d59ff2484..c648854de0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -194,4 +194,15 @@ def signed_in? def page_not_found render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found end + + # TODO: make less redundant with https://github.com/publiclab/plots2/blob/master/app/helpers/application_helper.rb#L3 + def logged_in_as(roles) + return false unless current_user + + has_valid_role = false + roles.each do |role| + has_valid_role = true if current_user.role == role + end + has_valid_role + end end From 918815de376d90c360ce02d7e2f5136dd698afc2 Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Tue, 7 May 2019 17:38:51 -0400 Subject: [PATCH 2/4] add wait 4 to system test... odd --- test/system/post_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/post_test.rb b/test/system/post_test.rb index 8f244a5400..4d19e133bf 100644 --- a/test/system/post_test.rb +++ b/test/system/post_test.rb @@ -17,7 +17,7 @@ def setup visit '/post' - fill_in("Title", with: "My new post") + fill_in("Title", with: "My new post", wait: 4) el = find(".wk-wysiwyg") # rich text input el.set("All about this interesting stuff") From 019a526f6236d316c91c04ac14ab8d116af20b61 Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Tue, 7 May 2019 18:29:50 -0400 Subject: [PATCH 3/4] Update subscriptions.html.erb --- app/views/stats/subscriptions.html.erb | 55 ++++++++++++-------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/app/views/stats/subscriptions.html.erb b/app/views/stats/subscriptions.html.erb index 75e0f61e40..8cd9644473 100644 --- a/app/views/stats/subscriptions.html.erb +++ b/app/views/stats/subscriptions.html.erb @@ -1,33 +1,30 @@
-

About this page

-

People subscribe to tags so that they can be updated when a research is posted with the tag they are subscribed to. This page shows the number of subscriptions and subscription rates on different tags.

+

About this page

+

People subscribe to tags so that they can be updated when a research is posted with the tag they are subscribed to. This page shows the number of subscriptions and subscription rates on different tags.

-

Subscriptions

- - - - - - - - <% @tags.each do |range,tags| %> - - - - - - - <% end %> -
SubscriptionsTags
- <%= range * 10 %> - - <%= range * 10 + 9 %> - - <% tags.each do |tag| %> -

- <%= tag[0]%>: - <%=tag[1] %> -

- <%end%> -
+

Subscriptions

+ + + + + + + + <% @tags.each do |range,tags| %> + + + + + <% end %> +
SubscriptionsTags
+ <%= range * 10 %> - <%= range * 10 + 9 %> + + <% tags.each do |tag| %> + + <%= tag[0]%> + <%= tag[1] %> + + <% end %> +
From ce0c4489c150300ac455ceef174fca576e30c84b Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Tue, 7 May 2019 18:33:00 -0400 Subject: [PATCH 4/4] Update subscriptions.html.erb --- app/views/stats/subscriptions.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stats/subscriptions.html.erb b/app/views/stats/subscriptions.html.erb index 8cd9644473..feb62546e5 100644 --- a/app/views/stats/subscriptions.html.erb +++ b/app/views/stats/subscriptions.html.erb @@ -11,7 +11,7 @@ Tags - <% @tags.each do |range,tags| %> + <% @tags.reverse_each do |range,tags| %> <%= range * 10 %> - <%= range * 10 + 9 %>