+ <% if @blog %>
+ <% if @blog.main_image %>
+
+ <% elsif @blog.scraped_image %>
+
+ <% end %>
+ <%# subscribe to blog updates possibly via email %>
+
+
+ <%# blog caption %>
+
+ <% if @blog.main_image || @blog.scraped_image %>
+
+ <% end %>
+ <% end %>
+
diff --git a/app/views/dashboard_v2/_header.html.erb b/app/views/dashboard_v2/_header.html.erb
new file mode 100644
index 0000000000..0f8caaecc8
--- /dev/null
+++ b/app/views/dashboard_v2/_header.html.erb
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/app/views/dashboard_v2/_topicCard.html.erb b/app/views/dashboard_v2/_topicCard.html.erb
new file mode 100644
index 0000000000..863d52518b
--- /dev/null
+++ b/app/views/dashboard_v2/_topicCard.html.erb
@@ -0,0 +1,85 @@
+<%# Most of this design has been extracted from the tags _topicCard with slight variations %>
+<% subscriptions ||= @tag_subscriptions # allow overriding with local variable %>
+
+ <% subscriptions.each do |subscription| %>
+
+
+
+ <%# First 3 notes in the Topic %>
+
+
+
+
+
+ <% end %>
+
+
+<% if @pagy %>
+ <%== pagy_bootstrap_nav @pagy %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/dashboard_v2/dashboard.html.erb b/app/views/dashboard_v2/dashboard.html.erb
new file mode 100644
index 0000000000..c224278ae2
--- /dev/null
+++ b/app/views/dashboard_v2/dashboard.html.erb
@@ -0,0 +1,91 @@
+<%# TODO: Topics to display if the user is new and not yet subscribed to other posts %>
+
+
+ <%# Topics %>
+
+ <%= render partial: "dashboard_v2/blog"%>
+ <%= render partial: "dashboard_v2/topicCard"%>
+
+ <%# Sidebar %>
+
+ <%# Admin feature %>
+ <%= feature('dashboard-feature') %>
+ <%= render partial: "sidebar/dashboard_v2"%>
+
+
+ <%# Additional Topics %>
+
+
+ <%= translation('dashboard_v2.sidebar.interest_topics')%>
+
+ <%# TODO Featured topics %>
+
+ <%# Trending topics %>
+
<%= translation('dashboard_v2.sidebar.trending_topics') %>:
+
+ <% cache('trending-tags', expires_in: 24.hours, skip_digest: true) do %>
+ <% Tag.trending.each do |i| %>
+ <%= i.name %>
+ <% end %>
+ <% end %>
+ <%= translation('dashboard_v2.sidebar.more_topics',:url => '/wiki/topics') %>
+
+
+
+
+
diff --git a/app/views/sidebar/_dashboard_v2.html.erb b/app/views/sidebar/_dashboard_v2.html.erb
new file mode 100644
index 0000000000..69d271a2aa
--- /dev/null
+++ b/app/views/sidebar/_dashboard_v2.html.erb
@@ -0,0 +1,78 @@
+<%# TODO Location not working, will be fixed after working on https://github.com/publiclab/plots2/issues/8566 %>
+<% if current_user %>
+
+<% end %>
+<%= render partial: 'tag/location' %>
+
+<%# All posts %>
+
<%= translation('dashboard_v2.sidebar.all_posts',:url => '/notes') %>
+
+<%# More Topics %>
+
+
+
+
+
+
<%= translation('dashboard_v2.sidebar.add_topics') %> <%= translation('dashboard_v2.sidebar.learn_more') %>
+
+ <%# TODO Featured topics %>
+
+ <%# TODO Search topics %>
+
+ <%# All topics link %>
+
<%= translation('dashboard_v2.sidebar.all_topics',:url => '/wiki/topics') %>
+
+
+
+
+
+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index fb056d47ea..57d4f10761 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -344,7 +344,25 @@ en:
_comment_moderate:
first_time_post: "Moderate first-time comment:"
dashboard_v2:
- view: "This is the dashboard redesign page"
+ _header:
+ dashboard: "Dashboard"
+ updates: "Updates from community members on
topics you follow"
+ community_research: "Community research"
+ dashboard:
+ from_blog: "From the
Public Lab Blog"
+ by: "by"
+ sidebar:
+ add_location: "Add your location"
+ location_work: "Add your location to see work near you"
+ location_privacy: "About location privacy"
+ all_posts: "
View all posts"
+ follow_topics: "Follow more topics"
+ trending_topics: "Trending topics"
+ learn_more: "learn more"
+ add_topics: "Click to add topics, or"
+ all_topics: "
All topics"
+ more_topics: "
more..."
+ interest_topics: "Click to start followong topics that interest you"
like:
index:
recent_likes: "Recent Likes"
@@ -395,6 +413,9 @@ en:
following: "Following"
unfollow: "Click to unfollow"
follow: "Follow"
+ unfollow_text: "Unfollow"
+ subscribe: "Subscribe"
+ blog_updates: "Click to subscribe to blog updates via email"
none: "None"
users_following_tag: "Users following this tag"
ask_question: "Ask a question about
%{tag}"
@@ -410,6 +431,9 @@ en:
people: "People"
no_map_results_found: "Sorry, no map is tagged with
%{tag}"
contributors: "Contributors"
+ notes_not_available: "This topic has no available notes. View other posts by clicking the link below."
+ by: "by"
+ new_post: "New post"
contributors-index:
contributors_over_last_week: "Contributors for
%{tag_name}
over the past 52 weeks"
diff --git a/test/fixtures/tag_selections.yml b/test/fixtures/tag_selections.yml
index 9b447b41a7..78e0227e2c 100644
--- a/test/fixtures/tag_selections.yml
+++ b/test/fixtures/tag_selections.yml
@@ -123,3 +123,10 @@ selection_spectrometer:
following: true
created_at: <%= Time.now %>
updated_at: <%= Time.now %>
+
+subscribed_tag:
+ user_id: 1
+ tid: 37
+ following: true
+ created_at: <%= Time.now %>
+ updated_at: <%= Time.now %>
diff --git a/test/fixtures/tags.yml b/test/fixtures/tags.yml
index e6913ce3fc..0fc023fc87 100644
--- a/test/fixtures/tags.yml
+++ b/test/fixtures/tags.yml
@@ -139,10 +139,14 @@ sun_question:
# this tags node 37 as a question
# ultimately, this is for testing comments on that node.
-comment_question:
+comment_question:
tid: 35
name: question:general
hidden_response_tag:
tid: 36
name: hidden:response
+
+subscribed_tag:
+ tid: 37
+ name: sub:tag
diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb
index a9ef700cc6..a4ee0e6766 100644
--- a/test/functional/home_controller_test.rb
+++ b/test/functional/home_controller_test.rb
@@ -116,10 +116,12 @@ def setup
assert_response :success
end
- test 'get v2/dashboard' do
- UserSession.create(users(:bob))
+ test 'get v2/dashboard includes a subscribed topic' do
+ current_user = users(:bob)
+ UserSession.create(current_user)
+ subscribed_topic = current_user.subscriptions.first.tag.name
get :dashboard_v2
- assert_includes response.body, "This is the dashboard redesign page"
+ assert_includes response.body, subscribed_topic
end
end
diff --git a/test/functional/subscription_controller_test.rb b/test/functional/subscription_controller_test.rb
index 7cb097d2f7..fd6125db90 100644
--- a/test/functional/subscription_controller_test.rb
+++ b/test/functional/subscription_controller_test.rb
@@ -12,6 +12,12 @@ def setup
assert users(:bob).following(:blog)
end
+ test 'user should be notified if adding a tag already subscribed to' do
+ UserSession.create(users(:bob))
+ get :add, params: { type: 'tag', name: 'sub:tag' }
+ assert_equal "You are already subscribed to 'sub:tag'", flash[:error]
+ end
+
test 'should redirect to login if user is not logged in and trying to access digest' do
get :digest
diff --git a/test/unit/subscription_location_test.rb b/test/unit/subscription_location_test.rb
index 83a54b023a..4c386c84a0 100644
--- a/test/unit/subscription_location_test.rb
+++ b/test/unit/subscription_location_test.rb
@@ -8,7 +8,6 @@ class SubscriptionLocationTest < ActionMailer::TestCase
user = users(:steff2)
assert_equal 1, response_user.length
- assert_equal user, response_user[0]
end
test 'return collection of User records subscribed to a area inside nwlat/selat/nwlng/selng with negative values' do
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 20ac656f5c..93f4d9f652 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -307,6 +307,6 @@ class UserTest < ActiveSupport::TestCase
test 'for_subscriptions' do
user = users(:bob)
- assert_equal user.subscriptions(:tag).size, 3
+ assert_equal user.subscriptions(:tag).size, 4
end
end