Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,11 @@ div[style*="color: red"],
text-align: left;
}

.dashboard-community-pulse-anchor {
margin-top: 2rem;
margin-bottom: 2rem;
}

.community-pulse-panel {
border: 1px solid var(--border-color);
border-radius: 0.75rem;
Expand Down Expand Up @@ -1543,17 +1548,19 @@ div[style*="color: red"],
.community-pulse-options {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.45rem;
gap: 0.4rem;
}

.community-pulse-option {
border: 1px solid var(--border-color);
border-radius: 0.55rem;
border-radius: 0.48rem;
background: var(--bg-secondary);
color: var(--text-primary);
padding: 0.55rem 0.65rem;
padding: 0.48rem 0.57rem;
font-size: 0.82rem;
font-weight: 600;
width: 100%;
text-align: center;
cursor: pointer;
transition: background-color 0.15s ease, transform 0.15s ease;
}
Expand Down Expand Up @@ -1681,6 +1688,7 @@ div[style*="color: red"],

.community-pulse-options {
grid-template-columns: 1fr;
gap: 0.32rem;
}

.community-pulse-bar-row {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/community_pulse_votes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create

format.html do
flash[:alert] = error_message if error_message.present?
redirect_to new_user_session_path(anchor: "community-pulse")
redirect_to dashboard_path(anchor: "community-pulse")
end
end
end
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/companies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class CompaniesController < ApplicationController

# GET /companies or /companies.json
def index
@companies = current_or_demo_user.companies.includes(:opportunities)
@companies = current_or_demo_user.companies
@technologies = Technology.order(:name)

# Filter by company name search
Expand All @@ -22,9 +22,6 @@ def index
@selected_technology = params[:technology]
end

# Always include technologies for display
@companies = @companies.includes(opportunities: :technologies)

# Skip sorting for tech_stack since it's aggregated data, but allow other columns
if params[:sort].present? && params[:sort] != "tech_stack"
direction = params[:direction] == "desc" ? "desc" : "asc"
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ def index
0.0
end

pulse_vote_cookie = cookies.encrypted[:community_pulse_daily_votes]
pulse_daily_count = if pulse_vote_cookie.is_a?(Hash) && (pulse_vote_cookie["date"] || pulse_vote_cookie[:date]) == Date.current.iso8601
(pulse_vote_cookie["count"] || pulse_vote_cookie[:count]).to_i
else
0
end
@pulse_votes_remaining = [ CommunityPulseVotesController::DAILY_LIMIT_MAX - pulse_daily_count, 0 ].max

# Role-based focus insights
focus_analyzer = RoleFocusAnalyzer.new(opportunities)
@focus_insights = focus_analyzer.generate_insights(limit: 4)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/opportunities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class OpportunitiesController < ApplicationController

# GET /opportunities or /opportunities.json
def index
@opportunities = current_or_demo_user.opportunities.includes(:company, :technologies)
@opportunities = current_or_demo_user.opportunities.includes(:company, :technologies, :rich_text_other_tech_stack)

if params[:company_query].present?
company_query = "%#{params[:company_query].strip}%"
Expand Down
7 changes: 7 additions & 0 deletions app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,10 @@
</div>
</div>
<% end %>

<div id="community-pulse" class="dashboard-community-pulse-anchor">
<%= render "community_pulse_votes/panel",
votes_remaining: @pulse_votes_remaining,
daily_limit_reached: @pulse_votes_remaining.zero?,
error_message: nil %>
</div>
15 changes: 0 additions & 15 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,5 @@
<%= link_to "Continue as Guest", dashboard_path, class: "btn-guest" %>

<p class="sign-in-guest-note">Browse in read-only demo mode</p>

<% pulse_vote_cookie = cookies.encrypted[:community_pulse_daily_votes] %>
<% pulse_daily_count = if pulse_vote_cookie.is_a?(Hash) && (pulse_vote_cookie["date"] || pulse_vote_cookie[:date]) == Date.current.iso8601
(pulse_vote_cookie["count"] || pulse_vote_cookie[:count]).to_i
else
0
end %>
<% pulse_remaining = [CommunityPulseVotesController::DAILY_LIMIT_MAX - pulse_daily_count, 0].max %>

<div id="community-pulse" class="sign-in-community-pulse-anchor">
<%= render "community_pulse_votes/panel",
votes_remaining: pulse_remaining,
daily_limit_reached: pulse_remaining.zero?,
error_message: nil %>
</div>
</div>
</div>
11 changes: 5 additions & 6 deletions spec/requests/community_pulse_votes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
params: { community_pulse_vote: { topic: "getting_interviews" } }
end.to change(CommunityPulseVote, :count).by(1)

expect(response).to redirect_to(new_user_session_path(anchor: "community-pulse"))
expect(response).to redirect_to(dashboard_path(anchor: "community-pulse"))
expect(response.headers["Set-Cookie"]).to include("community_pulse_daily_votes")
end

Expand All @@ -35,7 +35,7 @@
params: { community_pulse_vote: { topic: "passing_screens" } }
end.to change(CommunityPulseVote, :count).by(1)

expect(response).to redirect_to(new_user_session_path(anchor: "community-pulse"))
expect(response).to redirect_to(dashboard_path(anchor: "community-pulse"))
end

it "blocks the sixth vote in the same day for the same connection" do
Expand All @@ -44,7 +44,7 @@
params: { community_pulse_vote: { topic: "getting_interviews" } },
headers: { "HTTP_USER_AGENT" => "DailyLimitSpec/1", "REMOTE_ADDR" => "203.0.113.10" }

expect(response).to redirect_to(new_user_session_path(anchor: "community-pulse"))
expect(response).to redirect_to(dashboard_path(anchor: "community-pulse"))
end

travel_to(Time.current + 11.minutes) do
Expand All @@ -55,9 +55,8 @@
end.not_to change(CommunityPulseVote, :count)
end

expect(response).to redirect_to(new_user_session_path(anchor: "community-pulse"))
follow_redirect!
expect(response.body).to include("You have reached today&#39;s vote limit")
expect(response).to redirect_to(dashboard_path(anchor: "community-pulse"))
expect(flash[:alert]).to eq("You have reached today's vote limit. Please come back tomorrow.")
end

it "rate limits burst submissions from the same connection" do
Expand Down
Loading