This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #509 from eregs/534-part-link
Link to print a whole part
- Loading branch information
Showing
10 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from regulations.generator.sidebar.base import SidebarBase | ||
from regulations.views.utils import regulation_meta | ||
|
||
|
||
class PrintPart(SidebarBase): | ||
shorthand = 'print_part' | ||
|
||
def context(self, http_client, request): | ||
meta = regulation_meta(self.cfr_part, self.version) | ||
|
||
return { | ||
'cfr_title': meta.get('cfr_title_number'), | ||
'cfr_part': self.cfr_part, | ||
'version': self.version, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<section id="print_part" class="regs-meta"> | ||
<header class="group"> | ||
<a href="{% url 'chrome_regulation_view' cfr_part version %}?print=true"> | ||
<h4> | ||
Print <strong>{{ cfr_title }} CFR Part {{ cfr_part }}</strong> | ||
<span class="cf-icon cf-icon-print" /> | ||
</h4> | ||
</a> | ||
</header> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from mock import Mock | ||
|
||
from regulations.generator.sidebar import print_part | ||
|
||
|
||
def test_print_part(monkeypatch): | ||
monkeypatch.setattr(print_part, 'regulation_meta', Mock()) | ||
print_part.regulation_meta.return_value = {'cfr_title_number': 12} | ||
|
||
sidebar = print_part.PrintPart('333-44', 'vvvv') | ||
assert sidebar.context(Mock(), Mock()) == { | ||
'cfr_title': 12, | ||
'cfr_part': '333', | ||
'version': 'vvvv', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters