Display tag "new" on actions

An author will see a "new" tag on each action or resource that has appeared on his dashboard since his last login.
Too add "new" tag on dashbord menu when there are new resources.
This commit is contained in:
taitus
2019-03-13 23:30:38 +01:00
parent 8b1c458fdf
commit a1de5b2334
8 changed files with 99 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
class Dashboard::BaseController < ApplicationController
before_action :authenticate_user!
before_action :authenticate_user!, :detect_new_actions_after_last_login
include Dashboard::HasProposal
@@ -35,4 +35,9 @@ class Dashboard::BaseController < ApplicationController
def next_goal
@next_goal ||= Dashboard::Action.next_goal_for(proposal)
end
def detect_new_actions_after_last_login
author_last_login = proposal.author.last_sign_in_at.to_date
@new_actions_since_last_login = Dashboard::Action.detect_new_actions_since(author_last_login, proposal)
end
end