Skip to content

Commit

Permalink
Merge pull request #580 from datamade/authenticated-download
Browse files Browse the repository at this point in the history
revert conditional rendering of download button
  • Loading branch information
fgregg authored Nov 18, 2021
2 parents 00f02f0 + 49a63a2 commit bfac16a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
12 changes: 2 additions & 10 deletions bga_database/static/js/employer.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ var Unit = {
ChartHelper.make_payroll_expenditure_chart(result.payroll_expenditure);

Employer.updateLink('#employee-search-link', year);

// check if it exists in case it's not on the page due to unauthenticated user
if ($('#employee-download-link').length) {
Employer.updateLink('#employee-download-link', year);
}
Employer.updateLink('#employee-download-link', year);

$('.entity-median-tp').text(result.median_tp);
$('#entity-median-bp').text(result.median_bp);
Expand Down Expand Up @@ -187,11 +183,7 @@ var Department = {
ChartHelper.make_payroll_expenditure_chart(result.payroll_expenditure);

Employer.updateLink('#employee-search-link', year);

// check if it exists in case it's not on the page due to unauthenticated user
if ($('#employee-download-link').length) {
Employer.updateLink('#employee-download-link', year);
}
Employer.updateLink('#employee-download-link', year);

$('.entity-median-tp').text(result.median_tp);
$('#entity-median-bp').text(result.median_bp);
Expand Down
7 changes: 0 additions & 7 deletions payroll/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ def dispatch(self, request, *args, **kwargs):
class EmployerView(RedirectDispatchMixin, DetailView, ChartHelperMixin):
context_object_name = 'entity'

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

context['authenticated'] = self.request.COOKIES.get(settings.SALSA_AUTH_COOKIE_NAME)

return context


class UnitView(EmployerView):
model = Unit
Expand Down
8 changes: 3 additions & 5 deletions templates/jinja2/partials/employee_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ <h3 class="card-title">
</h3>
<div class="d-flex justify-content-between w-75">
<a class="lead" id="employee-search-link" href="/search/?entity_type=person&employer={{ entity.slug }}&year={{ request.GET.get('data_year', data_years.0) }}">View all (<span class="entity-headcount"></span>)</a>
{% if authenticated %}
<div>
<a class="btn btn-download" id="employee-download-link" href="/download/?employer={{ entity.slug }}&year={{ request.GET.get('data_year', data_years.0) }}" rel="nofollow">Download Data</a>
</div>
{% endif %}
<div>
<a class="btn btn-download" id="employee-download-link" href="/download/?employer={{ entity.slug }}&year={{ request.GET.get('data_year', data_years.0) }}" rel="nofollow">Download Data</a>
</div>
</div>
</div>

Expand Down

0 comments on commit bfac16a

Please sign in to comment.