├── .bumpversion.cfg ├── .gitignore ├── Changelog ├── LICENSE ├── README.html ├── README.md ├── jetstream ├── __init__.py ├── blocks.py ├── fields.py ├── static │ └── jetstream │ │ ├── css │ │ ├── admin.scss │ │ ├── blocks │ │ │ ├── action_button_bar.scss │ │ │ ├── callout.scss │ │ │ ├── column-sidebar.scss │ │ │ ├── column-standard.scss │ │ │ ├── fancy-rich-text.scss │ │ │ ├── generic.scss │ │ │ ├── hero-image-carousel.scss │ │ │ ├── hero_image.scss │ │ │ ├── iframe-block.scss │ │ │ ├── image-carousel.scss │ │ │ ├── image-gallery-gallery.scss │ │ │ ├── image-gallery-slider.scss │ │ │ ├── image-panel-caption.scss │ │ │ ├── image-panel-cards.scss │ │ │ ├── image-panel-hero.scss │ │ │ ├── image-panel-link.scss │ │ │ ├── image-panel-listing.scss │ │ │ ├── image-panel-rollover.scss │ │ │ ├── menu-listing.scss │ │ │ ├── related-links.scss │ │ │ ├── section-title.scss │ │ │ ├── spacer.scss │ │ │ └── video-block.scss │ │ ├── common.scss │ │ ├── globals.scss │ │ ├── hallo_icons.scss │ │ ├── layouts-v6.5.scss │ │ ├── layouts.scss │ │ └── mixins.scss │ │ ├── fonts │ │ └── wagtail.woff │ │ └── js │ │ ├── admin │ │ ├── dimensions-options-telepath.js │ │ ├── image-gallery-telepath.js │ │ └── image-panel-telepath.js │ │ ├── layouts.js │ │ └── utils.js ├── templates │ ├── jetstream │ │ ├── blocks │ │ │ ├── action_button_bar_block.html │ │ │ ├── action_button_block.html │ │ │ ├── callout_block.html │ │ │ ├── fancy_rich_text_block.html │ │ │ ├── hero_image_block.html │ │ │ ├── hero_image_carousel_block.html │ │ │ ├── iframe_block.html │ │ │ ├── image_carousel_block.html │ │ │ ├── image_gallery_block-gallery.html │ │ │ ├── image_gallery_block-slider.html │ │ │ ├── image_panel_block-caption.html │ │ │ ├── image_panel_block-card.html │ │ │ ├── image_panel_block-image.html │ │ │ ├── image_panel_block-image_square.html │ │ │ ├── image_panel_block-link.html │ │ │ ├── image_panel_block-listing.html │ │ │ ├── image_panel_block-rollover.html │ │ │ ├── layout │ │ │ │ ├── four_column_block.html │ │ │ │ ├── sidebar_layout_block.html │ │ │ │ ├── three_column_block.html │ │ │ │ └── two_column_block.html │ │ │ ├── menu_listing_block.html │ │ │ ├── related_link.html │ │ │ ├── related_links_block.html │ │ │ ├── section_title-block_header.html │ │ │ ├── section_title-section_divider.html │ │ │ ├── spacer_block.html │ │ │ └── video_block.tpl │ │ └── image_details.html │ └── wagtailadmin │ │ └── block_forms │ │ └── struct.html ├── templatetags │ ├── __init__.py │ └── jetstream_tags.py ├── utils.py └── wagtail_hooks.py ├── setup.cfg └── setup.py /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 2.3.0 3 | commit = True 4 | tag = True 5 | tag_name = {new_version} 6 | 7 | [bumpversion:file:jetstream/__init__.py] 8 | 9 | [bumpversion:file:setup.py] 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | 103 | # codekit 104 | *.codekit3 105 | 106 | # PyCharm & VSCode configs 107 | .idea 108 | .vscode -------------------------------------------------------------------------------- /Changelog: -------------------------------------------------------------------------------- 1 | Changelog 2 | 3 | * ImagePanelBlock rollover style used to not respect parent element height suggestions. 4 | Changed this to match the other image panel block styles. 5 | 6 | * ImagePanelBlock listing style says "When in a layout block with Fixed Dimensions as False, 7 | the image will be square, with its height and width equal to the suggested height on the 8 | parent layout block." But the code was actually using the height and width from the fixed 9 | dimensions field EVEN when 'use fixed dimensions' was not selected. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

This is a collection of useful blocks and layouts for use within Wagtail’s StreamField construct.

9 | 10 |

Usage

11 | 12 |

DEBUG For now just install from the git repository and then add jetstream to your INSTALLED_APPLICATIONS in Django settings.

13 | 14 |

As of version 1.4, we no longer pre-compile the scss to css. Users are expected to run some sort of automatic sass compiler, like django-sass-processor, in order to compile the scss files.

15 | 16 |

Column Layouts

17 | 18 |

Use of the column layouts requires some boilerplate from the developer because Wagtail currently does not have a mechanism for determining a block’s contents dynamically at runtime.

19 | 20 |

In the block declarations, subclass the desired block types as in the following example, adding to the column fields whichever blocks are desired to be added to the column’s internal StreamField.

21 | 22 |
class TwoColumnBlock(BaseTwoColumnBlock):
23 |     left_column = blocks.StreamBlock(
24 |         COLUMN_PERMITTED_BLOCKS + [
25 |             get_block_tuple(MyBlockType),
26 |             ...
27 |         ],
28 |         icon='arrow-left',
29 |         label='Left column content'
30 |     )
31 | 
32 |     right_column = blocks.StreamBlock(
33 |         COLUMN_PERMITTED_BLOCKS + [
34 |             get_block_tuple(MyBlockType),
35 |             ...
36 |         ],
37 |         icon='arrow-right',
38 |         label='Right column content'
39 |     )
40 | 
41 | 
42 | 43 |

Block Types

44 | 45 |

NOTE: Some classes require custom javascript, so it is important to include <script defer src="{% static 'jetstream/js/layouts.js' %}"></script> somewhere on your page template.

46 | 47 |

Several image-related blocks, e.g. HeroImageCarouselBlock, use Bootstrap.js to implement their slideshow functionality. You’ll need to install and load Bootstrap 4.1+ for that those to function.

48 | 49 |

We also assume that you are using jQuery 3.x and Moderizr.

50 | 51 |

TODO

52 | 53 |

Helpers

54 | 55 |

get_block_tuple()

56 | 57 |

Returns a standardized tuple of the block’s class name and one of it’s instances for use within the declarations of a StreamField’s elements. This is useful when writing data migrations for the block because it allows the type field for each block to be standardized.

58 | 59 |

BlockTupleMixin

60 | 61 |

A mixin class that, when included, allows the block to override the return of get_block_tuple for itself, allowing for customization of the block’s listing type.

62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | THIS PROJECT IS DEPRECATED. PLEASE DO NOT USE IT. 2 | ================================================= 3 | 4 | This is a collection of useful blocks and layouts for use within Wagtail's StreamField. 5 | 6 | 7 | # Usage 8 | 9 | > This repository contains examples of some commonly requested blocks for 10 | > Wagtail but it is ***NOT*** a complete, installable package. The best way to use 11 | > this repository is as a place to find ideas. 12 | 13 | > For example, if you want a Bootstrap image carousel that is editable as a 14 | > StreamBlock, search blocks.py to locate a possible example. Copy this code 15 | > into your own project. Please note that some higher level blocks include 16 | > StructBlocks from elsewhere in blocks.py. Be sure to copy all the pieces you 17 | > need - including the template and scss files. 18 | 19 | > If you want a large number of blocks from this repository, please fork it and 20 | > remove `FeatureCustomizedStreamBlock` and replace all uses of that block with 21 | > Wagtail's own StreamBlock. This will remove the dependency on our unpublished 22 | > `features.registry` and on CrequestMiddleware for determining the site from 23 | > the request. 24 | 25 | As of version 1.4, we no longer pre-compile the scss to css. Users are expected to run some sort of automatic sass compiler, like django-sass-processor, in order to compile the scss files. 26 | 27 | As of version 2.0, the import paths only support Wagtail 3.0 or higher. 28 | 29 | ## Dependencies 30 | 31 | - jQuery: [we use 3.3.1](https://code.jquery.com/jquery-3.3.1.min.js) 32 | - Modernizr: [Customized version based on 3.6.0](https://modernizr.com/download/?cssanimations-csstransitions-addtest-mq-prefixed-prefixes-setclasses) 33 | - Bootstrap: [4.1.0](https://getbootstrap.com/docs/4.1/getting-started/introduction/) 34 | - django-bleach: [>=0.3.0](https://pypi.org/project/django-bleach/) 35 | - a SASS compiler. We use [django-compressor](https://pypi.org/project/django-compressor/) but whatever you currently use 36 | should work. 37 | 38 | ## Block Types 39 | 40 | **NOTE**: Some classes require custom javascript, so you may need to include `` somewhere on your page template. 41 | 42 | Several image-related blocks, e.g. HeroImageCarouselBlock, use Bootstrap.js to implement their slideshow functionality. You'll need to install and load Bootstrap 4.1+ for that those to function. 43 | 44 | We also assume that you are using jQuery 3.x and Modernizr. 45 | 46 | Example template fragment if you are using carousels or other blocks that depend 47 | on Bootstrap: 48 | 49 | ``` 50 | {# Intentionally loaded synchronously, since its a prereq for other scripts_.. #} 51 | 52 | 53 | 54 | {# This is a custom build of Modernizr created specifically for the features that we actually use in Multitenant. #} 55 | 56 | 57 | 58 | 59 | 60 | {% endcompress %} 61 | ``` 62 | 63 | 64 | ## Column Layouts 65 | 66 | Use of the column layouts requires some boilerplate from the developer because Wagtail currently does not have a mechanism for determining a block's contents dynamically at runtime. 67 | 68 | In the block declarations, subclass the desired block types as in the following example, adding to the column fields whichever blocks are desired to be added to the column's internal StreamField. 69 | 70 | 71 | ``` 72 | class TwoColumnBlock(BaseTwoColumnBlock): 73 | left_column = blocks.StreamBlock( 74 | COLUMN_PERMITTED_BLOCKS + [ 75 | get_block_tuple(MyBlockType), 76 | ... 77 | ], 78 | icon='arrow-left', 79 | label='Left column content' 80 | ) 81 | 82 | right_column = blocks.StreamBlock( 83 | COLUMN_PERMITTED_BLOCKS + [ 84 | get_block_tuple(MyBlockType), 85 | ... 86 | ], 87 | icon='arrow-right', 88 | label='Right column content' 89 | ) 90 | 91 | ``` 92 | 93 | ## Helpers 94 | 95 | ### get_block_tuple() 96 | 97 | Returns a standardized tuple of the block's class name and one of it's instances for use within the declarations of a StreamField's elements. This is useful when writing data migrations for the block because it allows the `type` field for each block to be standardized. 98 | 99 | ### BlockTupleMixin 100 | 101 | A mixin class that, when included, allows the block to override the return of 102 | `get_block_tuple` for itself, allowing for customization of the block's listing 103 | type. Primarily used so that TwoColumnBlock and BaseTwoColumnSubBlock can use 104 | the same template files. 105 | -------------------------------------------------------------------------------- /jetstream/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '2.3.0' 2 | -------------------------------------------------------------------------------- /jetstream/fields.py: -------------------------------------------------------------------------------- 1 | from wagtail.blocks import Block 2 | from wagtail.fields import StreamField 3 | 4 | from jetstream.blocks import FeatureCustomizedStreamBlock 5 | 6 | 7 | class FeatureCustomizedStreamField(StreamField): 8 | 9 | def __init__(self, block_types, use_json_field=None, **kwargs): 10 | # rrollins 2021-05-07: I updated this code to make it match the new StreamField__init__() changes that were 11 | # made in Wagtail 2.13. It sucks that we have to replace the entire function just to change that one line so it 12 | # creates a FeatureCustomizedStreamBlock instead of a StreamBlock, but I see no cleaner way to do it, due to the 13 | # block_opts stuff. 14 | 15 | # extract kwargs that are to be passed on to the block, not handled by super 16 | block_opts = {} 17 | for arg in ['min_num', 'max_num', 'block_counts', 'collapsed']: 18 | if arg in kwargs: 19 | block_opts[arg] = kwargs.pop(arg) 20 | 21 | # for a top-level block, the 'blank' kwarg (defaulting to False) always overrides the 22 | # block's own 'required' meta attribute, even if not passed explicitly; this ensures 23 | # that the field and block have consistent definitions 24 | block_opts['required'] = not kwargs.get('blank', False) 25 | 26 | # This calls Field.__init__(), NOT StreamField.__init__(). We do this because this override's purpose is 27 | # to skip StreamField.__init__() so we can _replace_ it's code with our own, rather than supplement it. 28 | super(StreamField, self).__init__(**kwargs) 29 | 30 | # Added to support use_json_field which was added in Wagtail 3.0. 31 | self.use_json_field = use_json_field 32 | 33 | if isinstance(block_types, Block): 34 | # use the passed block as the top-level block 35 | self.stream_block = block_types 36 | elif isinstance(block_types, type): 37 | # block passed as a class - instantiate it 38 | self.stream_block = block_types() 39 | else: 40 | # construct a top-level FeatureCustomizedStreamBlock from the list of block types 41 | self.stream_block = FeatureCustomizedStreamBlock(block_types, required=not self.blank) 42 | 43 | self.stream_block.set_meta_options(block_opts) 44 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/admin.scss: -------------------------------------------------------------------------------- 1 | @import "hallo_icons.scss"; 2 | 3 | // DimensionsOptionsBlock - Force the three settings to display inline. 4 | div.dimensions-options { 5 | ul.fields { 6 | display: flex; 7 | } 8 | 9 | li { 10 | width: 33.333%; 11 | padding: 10px; 12 | &:first-child { 13 | padding-left: 0; 14 | } 15 | &:last-child { 16 | padding-right: 0; 17 | } 18 | 19 | // Prevent the labels from being line-broken for no reason. 20 | label { 21 | width: 100%; 22 | } 23 | 24 | // Make the checkbox div as tall as the text inputs, which balances the whole display better. 25 | .boolean_field div.input { 26 | height: 4em; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/action_button_bar.scss: -------------------------------------------------------------------------------- 1 | .action-button-bar { 2 | margin-top: 2em; 3 | } 4 | 5 | .action-button { 6 | font-size: 1.2em; 7 | margin-right: 10px; 8 | border: none; 9 | 10 | // To overcome the ".content a" rule that makes them all orange, we need to use these rules to colorize the links' 11 | // text differently. 12 | &--btn-primary { 13 | .content & { 14 | @include link-always-color($white); 15 | } 16 | } 17 | 18 | &--btn-light { 19 | .content & { 20 | @include link-always-color($dkgray); 21 | } 22 | } 23 | 24 | // On phones, the buttons are placed below the image, instead of overlapping it, putting them on a white background. 25 | // This requires the color on "link" buttons to be different on portrait phones than on other size devices. 26 | &--btn-link { 27 | .content & { 28 | @include link-always-color($black-text); 29 | 30 | @include landscape-phone { 31 | @include link-always-color($white); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/callout.scss: -------------------------------------------------------------------------------- 1 | .callout { 2 | padding: 20px; 3 | font-family: $font-sans-serif-bold; 4 | &--fixed { 5 | overflow: hidden; 6 | } 7 | &.bg { 8 | background-size: cover; 9 | } 10 | 11 | @include desktop { 12 | padding: 40px 40px 0; 13 | } 14 | 15 | &__title { 16 | font-size: 25px; 17 | margin: 0 0 15px 0; 18 | text-transform: uppercase; 19 | font-weight: bold; 20 | line-height: 90%; 21 | 22 | @include portrait-tablet { 23 | font-size: 28px; 24 | } 25 | 26 | @include desktop { 27 | font-size: 35px; 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/column-sidebar.scss: -------------------------------------------------------------------------------- 1 | .sidebar-layout { 2 | &__sidebar { 3 | @include portrait-phone-only { 4 | // The markup sets a max-width and a user-defined float value in the markup, so we need !important to negate 5 | // them on portrait phones. 6 | max-width: unset !important; 7 | float: none !important; 8 | } 9 | 10 | & > section { 11 | // Apply some spacing between blocks in the sidebar. 12 | padding-bottom: 10px; 13 | &:last-child { 14 | padding-bottom: 40px; 15 | } 16 | } 17 | } 18 | 19 | // Must use margin on these, rather than padding, to avoid the images widening to overlap with the padding. 20 | &.right &__sidebar { 21 | @include landscape-phone { 22 | margin-left: 25px; 23 | } 24 | } 25 | &.left &__sidebar { 26 | @include landscape-phone { 27 | margin-right: 25px; 28 | } 29 | } 30 | 31 | &__rich-text { 32 | padding: 0 10px; 33 | 34 | @include desktop { 35 | padding: 0; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/column-standard.scss: -------------------------------------------------------------------------------- 1 | @mixin IE-compatible-flex-width($width) { 2 | flex: 1 1 auto; 3 | width: $width; 4 | } 5 | 6 | @mixin gutter($width) { 7 | $classname: "gutter-#{$width}"; 8 | $half: $width/2; 9 | 10 | .row.#{$classname} { 11 | margin-left: -$half; 12 | margin-right: -$half; 13 | } 14 | .row.#{$classname} .col-lg-1, 15 | .row.#{$classname} .col-lg-2, 16 | .row.#{$classname} .col-lg-3, 17 | .row.#{$classname} .col-lg-4, 18 | .row.#{$classname} .col-lg-5, 19 | .row.#{$classname} .col-lg-6, 20 | .row.#{$classname} .col-lg-7, 21 | .row.#{$classname} .col-lg-8, 22 | .row.#{$classname} .col-lg-9, 23 | .row.#{$classname} .col-lg-10, 24 | .row.#{$classname} .col-lg-11, 25 | .row.#{$classname} .col-lg-12, 26 | .row.#{$classname} .col-md-1, 27 | .row.#{$classname} .col-md-2, 28 | .row.#{$classname} .col-md-3, 29 | .row.#{$classname} .col-md-4, 30 | .row.#{$classname} .col-md-5, 31 | .row.#{$classname} .col-md-6, 32 | .row.#{$classname} .col-md-7, 33 | .row.#{$classname} .col-md-8, 34 | .row.#{$classname} .col-md-9, 35 | .row.#{$classname} .col-md-10, 36 | .row.#{$classname} .col-md-11, 37 | .row.#{$classname} .col-md-12, 38 | .row.#{$classname} .col-sm-1, 39 | .row.#{$classname} .col-sm-2, 40 | .row.#{$classname} .col-sm-3, 41 | .row.#{$classname} .col-sm-4, 42 | .row.#{$classname} .col-sm-5, 43 | .row.#{$classname} .col-sm-6, 44 | .row.#{$classname} .col-sm-7, 45 | .row.#{$classname} .col-sm-8, 46 | .row.#{$classname} .col-sm-9, 47 | .row.#{$classname} .col-sm-10, 48 | .row.#{$classname} .col-sm-11, 49 | .row.#{$classname} .col-sm-12, 50 | .row.#{$classname} .col-xs-1, 51 | .row.#{$classname} .col-xs-2, 52 | .row.#{$classname} .col-xs-3, 53 | .row.#{$classname} .col-xs-4, 54 | .row.#{$classname} .col-xs-5, 55 | .row.#{$classname} .col-xs-6, 56 | .row.#{$classname} .col-xs-7, 57 | .row.#{$classname} .col-xs-8, 58 | .row.#{$classname} .col-xs-9, 59 | .row.#{$classname} .col-xs-10, 60 | .row.#{$classname} .col-xs-11, 61 | .row.#{$classname} .col-xs-12 { 62 | padding-left: $half; 63 | padding-right: $half; 64 | 65 | // On portrait phones, ignore column layout rules and just stretch everything to the full width. 66 | @media (max-width: 499px) { 67 | @include IE-compatible-flex-width(100%); 68 | max-width: unset; 69 | } 70 | 71 | } 72 | } 73 | 74 | @include gutter(0px); 75 | @include gutter(12px); 76 | @include gutter(20px); 77 | @include gutter(30px); 78 | @include gutter(40px); 79 | 80 | 81 | .row-wrapper { 82 | &.full-width { 83 | position: relative; 84 | width: 100vw; 85 | left: 50%; 86 | right: 50%; 87 | margin-left: -50vw; 88 | margin-right: -50vw; 89 | 90 | @include desktop { 91 | .row { 92 | width: $responsive-grid-w; 93 | margin: 0 auto; 94 | } 95 | } 96 | } 97 | @include portrait-tablet { 98 | &.padded .row { 99 | padding-left: 50px; 100 | padding-right: 50px; 101 | } 102 | } 103 | 104 | &.bg { 105 | background-size: cover; 106 | } 107 | } 108 | 109 | .grid-item { 110 | height: 100%; 111 | overflow: hidden; 112 | } 113 | 114 | // TODO: What is this for? 115 | .row > .grid-item > section > .row:first-child { 116 | margin-top: 0; 117 | } 118 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/fancy-rich-text.scss: -------------------------------------------------------------------------------- 1 | .fancy-rich-text { 2 | position: relative; 3 | &.fixed { 4 | overflow: hidden; 5 | } 6 | 7 | // Give left and right padding to keep the text separated from the screen edges on mobile. 8 | .rich-text { 9 | padding-left: 10px; 10 | padding-right: 10px; 11 | } 12 | 13 | // When a FancyRichTextBlock is given a background, or lives in column layout that has a background, it's text area 14 | // needs all-around padding so the text doesn't butt up against the edge of the background. 15 | &.bg .rich-text, .row-wrapper.bg & .rich-text { 16 | padding: 10px; 17 | 18 | @include desktop { 19 | padding: 25px; 20 | } 21 | } 22 | 23 | .background-image-container { 24 | overflow: hidden; 25 | position: absolute; 26 | left: 0; 27 | top: 0; 28 | height: 100%; 29 | width: 100%; 30 | z-index: -100; 31 | } 32 | 33 | .background-image { 34 | width: 100%; 35 | 36 | // We only set height: auto on the desktop view because the block will change aspect ratios on smaller devices. 37 | // This results in stretched images on phones and portrait tablets, but that's better than having the background not 38 | // enclose the entire text area. 39 | @include desktop { 40 | height: auto; 41 | } 42 | } 43 | 44 | // Don't give margin-top to a heading in the block if it's the first element. 45 | .rich-text { 46 | @include desktop { 47 | // On desktop we want no left-padding, because that will pull the text away from the edge of the content area, 48 | // but we do want right-padding for those times when a rich text block has column content to its right. 49 | padding-left: 0; 50 | padding-right: 25px; 51 | } 52 | 53 | h1, h2, h3, h4 { 54 | &:first-child { 55 | margin-top: 0; 56 | } 57 | } 58 | } 59 | 60 | // Top-level (direct child of .content), non-background blocks need to have 0 padding, because we want them to reach 61 | // the edges of the layout, like a normal Page's text would. 62 | @include desktop { 63 | .content > .block-FancyRichTextBlock &:not(.bg) { 64 | .rich-text { 65 | padding: 0; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/generic.scss: -------------------------------------------------------------------------------- 1 | /******** Text block general settings **********/ 2 | 3 | // Background image for all listing types 4 | .listing-background-image { 5 | position: absolute; 6 | left: 0; 7 | top: 0; 8 | height: auto; 9 | width: 100%; 10 | z-index: -100; 11 | } 12 | 13 | .bg-color-white { background-color: $white; } 14 | .bg-color-black { background-color: $black; } 15 | .bg-color-orange { background-color: $orange; } 16 | .bg-color-ltgray { background-color: $ltgray; } 17 | .bg-color-midgray { background-color: $midgray; } 18 | .bg-color-darkergray { background-color: $darkergray; } 19 | .bg-color-dkgray { background-color: $dkgray; } 20 | .bg-color-olivegreen { background-color: $olivegreen; } 21 | .bg-color-purple { background-color: $purple; } 22 | .bg-color-darkteal { background-color: $darkteal; } 23 | 24 | .text-color-white { color: $white; } 25 | .text-color-dkgray { color: $dkgray; } 26 | .text-color-black { color: $black; } 27 | 28 | // The image_panel_block-image template renders a fallthrough responsive_image when it doesn't get dimensions from 29 | // fixed_dimensions or parent. Such images must size themselves to the device, as they are rendered at 1000px wide. 30 | .responsive-image-fallthrough { 31 | width: 100%; 32 | height: auto; 33 | } 34 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/hero-image-carousel.scss: -------------------------------------------------------------------------------- 1 | // These rules overrides several bootstrap components. 2 | .hero-image-carousel { 3 | overflow: hidden; 4 | position: relative; 5 | 6 | &__image { 7 | height: inherit; 8 | width: 100%; 9 | } 10 | 11 | &__wrapper-link { 12 | @include portrait-tablet { 13 | @include wrapper-link; 14 | } 15 | } 16 | 17 | &__text-gradient { 18 | @include portrait-tablet { 19 | @include text-gradient--right; 20 | } 21 | } 22 | 23 | &__carousel-caption { 24 | position: static; 25 | text-align: left; 26 | padding: 10px; 27 | 28 | @include portrait-tablet { 29 | position: absolute; 30 | left: 30%; 31 | right: auto; 32 | bottom: auto; 33 | top: 25%; 34 | padding: 0 10px; 35 | } 36 | } 37 | 38 | &__carousel-indicators { 39 | @include carousel_indicators; 40 | } 41 | 42 | &__caption-title { 43 | font-size: #{24px / $font-size-base}em; 44 | font-weight: bold; 45 | color: $goldenrod; 46 | 47 | @include portrait-tablet { 48 | font-size: 2.5em; 49 | } 50 | 51 | a, a:visited { 52 | color: inherit; 53 | text-decoration: none; 54 | } 55 | } 56 | 57 | &__caption-text { 58 | font-family: $font-vaud; 59 | color: $black-text; 60 | 61 | @include portrait-tablet { 62 | font-weight: bold; 63 | padding-right: 3em; 64 | color: white; 65 | } 66 | } 67 | 68 | &__carousel-control-prev, 69 | &__carousel-control-next { 70 | display: none; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/hero_image.scss: -------------------------------------------------------------------------------- 1 | .hero-image { 2 | position: relative; 3 | &.full-width { 4 | width: 100vw; 5 | left: 50%; 6 | right: 50%; 7 | margin-left: -50vw; 8 | margin-right: -50vw; 9 | overflow: hidden; 10 | @include desktop { 11 | .hero-image__body { 12 | left: 50%; 13 | width: $responsive-grid-w; 14 | margin-left: -$responsive-grid-w / 2; 15 | } 16 | } 17 | } 18 | &.white-translucent-serif &__inner { 19 | background-color: rgba(255, 255, 255, 0.3); 20 | } 21 | &.bare-sans-serif, &.white-translucent-sans-serif { 22 | font-family: $font-sans-serif; 23 | 24 | h1 { 25 | font-family: $font-sans-serif-bold; 26 | } 27 | h2, h3, h4, h5, h6 { 28 | font-family: $font-sans-serif; 29 | } 30 | } 31 | &.position-top-left &__inner { 32 | top: 5%; 33 | left: 0; 34 | text-align: left; 35 | } 36 | &.position-top-middle &__inner { 37 | top: 5%; 38 | left: 50%; 39 | transform: translateX(-50%); 40 | text-align: center; 41 | } 42 | &.position-top-right &__inner { 43 | top: 5%; 44 | right: 0; 45 | text-align: right; 46 | } 47 | &.position-left &__inner { 48 | top: 50%; 49 | left: 0; 50 | transform: translateY(-50%); 51 | text-align: left; 52 | } 53 | &.position-middle &__inner { 54 | top: 50%; 55 | left: 50%; 56 | transform: translateY(-50%) translateX(-50%); 57 | text-align: center; 58 | } 59 | &.position-right &__inner { 60 | top: 50%; 61 | right: 0; 62 | transform: translateY(-50%); 63 | text-align: right; 64 | } 65 | &.position-bottom-left &__inner { 66 | bottom: 5%; 67 | left: 0%; 68 | text-align: left; 69 | } 70 | &.position-bottom-middle &__inner { 71 | bottom: 5%; 72 | left: 50%; 73 | transform: translateX(-50%); 74 | text-align: center; 75 | } 76 | &.position-bottom-right &__inner { 77 | bottom: 5%; 78 | right: 0; 79 | text-align: right; 80 | } 81 | 82 | &__background { 83 | background-position: center; 84 | background-size: cover; 85 | } 86 | 87 | &__body { 88 | position: absolute; 89 | width: 100%; 90 | top: 0; 91 | left: 0; 92 | } 93 | 94 | &__inner { 95 | position: absolute; 96 | padding: 2em; 97 | max-width: 60%; 98 | } 99 | } 100 | 101 | // For landscape-mode phones: 102 | // rrollins 2017-10-19: Except, no, because these rules apply on portrait tablets, too. However, the behavior we get 103 | // with these rules IS what we want, even though it's applying to more than we say it should be. 104 | @media (min-width: $screen-phone) 105 | and (max-width: $screen-tablet) { 106 | .hero-image { 107 | height: 60vw !important; 108 | 109 | &__background { 110 | height: 60vw !important; 111 | } 112 | 113 | &__body { 114 | height: 60vw !important; 115 | width: 100%; 116 | margin: 0; 117 | left: 0; 118 | } 119 | } 120 | } 121 | 122 | @media (max-width: $small-viewport) { 123 | .hero-image { 124 | width: 100%; 125 | height: auto !important; 126 | margin: 0; 127 | left: 0; 128 | right: 0; 129 | 130 | &__background { 131 | height: 60vw !important; 132 | } 133 | 134 | &__body { 135 | position: static; 136 | height: auto !important; 137 | left: 0; 138 | margin: 0; 139 | width: 100%; 140 | } 141 | 142 | // On phones, push all body information below the image 143 | // We need to nest the hero-image__inner inside .hero-image.full-width and .hero-image.regular-width because 144 | // we need to overcome the specificity of selectors like .hero-image.position-left and .hero-image.white-bare-serif 145 | &.full-width, &.regular-width { 146 | .hero-image__inner { 147 | height: auto !important; 148 | max-width: 100%; 149 | left: 0; 150 | top: 0; 151 | position: static; 152 | transform: none; 153 | background-color: transparent; 154 | text-align: center; 155 | // except lists look weird centered. 156 | ol, ul { 157 | text-align: left; 158 | } 159 | } 160 | } 161 | } 162 | } 163 | 164 | // The h & p changes below us nested selectors because the html comes from user entered data wihch we can't mark up 165 | // with extra classes. 166 | .hero-image { 167 | &__body { 168 | font-size: 0.8em; 169 | } 170 | 171 | h1 { 172 | font-size: 1.8em; 173 | font-family: $font-serif; 174 | } 175 | 176 | h2 { 177 | font-size: 1.2em; 178 | font-family: $font-serif; 179 | } 180 | 181 | h3, h4, h5, h6 { 182 | font-size: 1em; 183 | font-family: $font-serif; 184 | margin-top: 0; // .rich-text h3 has a margin top of 2em that we don't want here. 185 | } 186 | 187 | // Text in the hero_image body is black (default color) when shown below the image; white when on top of the image. 188 | @include landscape-phone { 189 | &__body { 190 | color: $white; 191 | } 192 | } 193 | 194 | @include portrait-tablet { 195 | &__body { 196 | font-size: 1em; 197 | } 198 | 199 | h1, h2, h3, h4, h5, h6 { 200 | margin-top: 0; 201 | margin-bottom: 0; 202 | line-height: 1.5em; 203 | font-weight: normal; 204 | } 205 | } 206 | 207 | @include desktop { 208 | &__body { 209 | font-size: 1.3em; 210 | } 211 | h1 { 212 | font-size: 2.4em; 213 | } 214 | h2 { 215 | font-size: 1.6em; 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/iframe-block.scss: -------------------------------------------------------------------------------- 1 | .iframe-block { 2 | padding: 0 10px; 3 | 4 | @include desktop { 5 | padding: 0; 6 | } 7 | 8 | iframe { 9 | max-width: 100%; 10 | border: none; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-carousel.scss: -------------------------------------------------------------------------------- 1 | .image-carousel { 2 | // On phones, the images get resized to a different size, but the carousel markup still has style="max-height: 350px", 3 | // or whatever, to size the block correctly for the layout its in. We must forcibly ignore that on phones because they 4 | // ignore the specified layout and convert it into a single column flow with different sizes. 5 | @include portrait-phone-only { 6 | max-height: unset !important; 7 | } 8 | 9 | &__banner { 10 | position: absolute; 11 | top: 0; 12 | width: 100%; 13 | height: 42px; 14 | background-color: rgba(0, 0, 0, 0.3); 15 | z-index: 5; 16 | 17 | &__header { 18 | position: absolute; 19 | margin: 10px 0 10px 25px; 20 | font-family: $font-sans-serif; 21 | color: $white; 22 | font-weight: normal; 23 | font-size: 1.17em; 24 | } 25 | } 26 | 27 | // We need to use nesting here to override Bootstrap 4's default fade transition rules. 28 | & &__item { 29 | transition-duration: 0.8s; 30 | transition-timing-function: ease-out; 31 | } 32 | 33 | &__item { 34 | &__wrapper-link { 35 | @include wrapper-link; 36 | } 37 | 38 | &__image { 39 | // Ensures that images resize themselves properly on phones. 40 | width: 100%; 41 | height: auto; 42 | } 43 | 44 | &__text-wrapper { 45 | @include text-gradient--bottom; 46 | } 47 | 48 | &__text { 49 | font-size: 16px; 50 | font-family: $font-sans-serif-bold; 51 | position: absolute; 52 | bottom: 0; 53 | right: 0; 54 | padding: 0 15px 10px 20px; 55 | text-align: right; 56 | color: white; 57 | 58 | &__link-icon { 59 | height: 25px; 60 | width: 25px; 61 | margin-bottom: -6px; 62 | margin-left: -5px; 63 | fill: $orange-accessible; 64 | } 65 | } 66 | } 67 | 68 | // Only display the controls when the user hovers them. And replace the gradiant background with a solid black 30% 69 | // opacity block. 70 | &__control { 71 | background: none; 72 | &:hover { 73 | background: rgba(0, 0, 0, 0.3); 74 | } 75 | 76 | // Hide the component by default. This style of hiding is needed because if we just hide the control itself, the 77 | // user can't hover it in order to make the background and component appear. 78 | &__component { 79 | visibility: hidden; 80 | } 81 | 82 | // When the component's parent is hovered, show the component. 83 | &:hover &__component { 84 | visibility: visible; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-gallery-gallery.scss: -------------------------------------------------------------------------------- 1 | .image-gallery-gallery { 2 | &__item { 3 | display: block; 4 | // Matches the default Bootstrap padding for left/right. 5 | padding-bottom: 12px; 6 | } 7 | 8 | // Has no effect on desktop because we build the main rendition pixel-perfect. But it's needed on phones and tablets. 9 | img { 10 | width: 100%; 11 | height: auto; 12 | } 13 | 14 | &__image-details { 15 | @include image-details; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-gallery-slider.scss: -------------------------------------------------------------------------------- 1 | .image-gallery-slider { 2 | &__inner { 3 | a:hover { 4 | text-decoration: none; 5 | } 6 | } 7 | 8 | &__item { 9 | img { 10 | // Ensures that images resize themselves properly on phones. 11 | width: 100%; 12 | height: auto; 13 | } 14 | } 15 | 16 | &__image-details { 17 | @include image-details; 18 | } 19 | 20 | &__carousel-indicators-container { 21 | width: 100%; 22 | position: relative; 23 | margin-top: 15px; 24 | } 25 | 26 | // These rules override a bunch of stuff from bootstrap. 27 | &__carousel-indicators { 28 | position: static; 29 | width: auto; 30 | margin-left: 0; 31 | margin-right: 0; 32 | flex-wrap: wrap; 33 | justify-content: left; 34 | 35 | li { 36 | text-indent: 0; 37 | border-radius: 0; 38 | border: none; 39 | margin: 0; 40 | width: 75px; 41 | height: 75px; 42 | margin: 5px 5px 0 0; 43 | } 44 | } 45 | 46 | &__carousel-control-prev, 47 | &__carousel-control-next { 48 | display: none; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-panel-caption.scss: -------------------------------------------------------------------------------- 1 | .image-panel-caption { 2 | overflow: hidden; 3 | margin-bottom: 2em; 4 | position: relative; 5 | @include responsive-images-inside; 6 | 7 | &__image-link { 8 | span { 9 | position: absolute; 10 | width: 100%; 11 | height: 100%; 12 | top: 0; 13 | left: 0; 14 | z-index: 11; 15 | cursor: pointer; 16 | } 17 | } 18 | 19 | &__image-details { 20 | @include image-details; 21 | } 22 | } 23 | 24 | @media (min-width: $small-viewport) { 25 | .image-panel-caption { 26 | margin-bottom: 1em; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-panel-cards.scss: -------------------------------------------------------------------------------- 1 | // This CSS is loosely based on https://bootsnipp.com/snippets/featured/bootstrap-4-card 2 | 3 | // Image Cards -- title and description on bottom 4 | .image-panel-card { 5 | font-size: 1em; 6 | overflow: hidden; 7 | padding: 0; 8 | border: none; 9 | 10 | & img { 11 | display: block; 12 | width: 100%; 13 | height: auto; 14 | } 15 | 16 | &__block { 17 | font-size: 1em; 18 | margin: 0; 19 | padding: 1em; 20 | border: none; 21 | } 22 | 23 | &__title { 24 | font-size: 1.28571429em; 25 | font-weight: 700; 26 | line-height: 1.2857em; 27 | color: $dkgray; 28 | 29 | a { 30 | color: $dkgray; 31 | } 32 | } 33 | 34 | &__text { 35 | margin-top: .5em; 36 | line-height: 1.7; 37 | color: rgba(0, 0, 0, .68); 38 | } 39 | 40 | &__image-details { 41 | @include image-details; 42 | } 43 | } 44 | 45 | // For landscape-mode phones: 46 | // rrollins 2017-10-19: Except, no, because these rules apply on portrait tablets, too. However, the behavior we get 47 | // with these rules IS what we want, even though it's applying to more than we say it should be. 48 | @media (min-width: $screen-phone) 49 | and (max-width: $responsive-grid-w) { 50 | .image-panel-card img { 51 | width: 100%; 52 | height: auto; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-panel-hero.scss: -------------------------------------------------------------------------------- 1 | .block-ImagePanelBlock { 2 | .hero { 3 | background-size: cover; 4 | display: table-cell; 5 | vertical-align: middle; 6 | text-align: center; 7 | } 8 | 9 | .hero-body { 10 | color: $white; 11 | width: 60%; 12 | margin: 0 auto; 13 | 14 | @include portrait-phone-only { 15 | width: 90%; 16 | } 17 | } 18 | 19 | h1 { 20 | font-family: $font-sans-serif-bold; 21 | font-size: 4em; 22 | } 23 | 24 | h2 { 25 | font-family: $font-sans-serif; 26 | font-size: 1.5em; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-panel-link.scss: -------------------------------------------------------------------------------- 1 | .image-panel-link { 2 | position: relative; 3 | @include responsive-images-inside; 4 | 5 | &__image-link { 6 | span { 7 | position: absolute; 8 | width: 100%; 9 | height: 100%; 10 | top: 0; 11 | left: 0; 12 | z-index: 11; 13 | cursor: pointer; 14 | } 15 | } 16 | 17 | &__text-gradient { 18 | @include text-gradient--bottom; 19 | } 20 | 21 | &__title { 22 | position: absolute; 23 | bottom: 0; 24 | right: 0; 25 | text-align: right; 26 | color: white; 27 | margin: 0 15px 10px 20px; 28 | font-family: $font-sans-serif-bold; 29 | font-size: 16px; 30 | 31 | .icon { 32 | height: 25px; 33 | width: 25px; 34 | margin-bottom: -6px; 35 | margin-left: -5px; 36 | fill: $orange-accessible; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-panel-listing.scss: -------------------------------------------------------------------------------- 1 | // Image Listing -- title and description on left or right sides 2 | 3 | .image-panel-listing { 4 | flex-wrap: wrap; 5 | 6 | @include portrait-tablet { 7 | flex-wrap: unset; 8 | } 9 | 10 | &__body { 11 | padding-left: 10px; 12 | padding-right: 10px; 13 | padding-bottom: 2em; 14 | @include IE-compatible-flex-width(100%); 15 | 16 | @include portrait-tablet { 17 | @include IE-compatible-flex-width(50%); 18 | } 19 | 20 | @include desktop { 21 | // Matches bootstrap's .media-body. We only want this on desktop because only smaller devices need it to be 50%. 22 | flex: 1; 23 | 24 | // The "right" vs "left" refers to the image, so the body is opposite. 25 | &--right { 26 | padding-left: 0; 27 | } 28 | } 29 | 30 | &--left { 31 | padding-left: 25px; 32 | } 33 | 34 | h4 { 35 | margin-top: 10px; 36 | font-family: $font-serif; 37 | } 38 | } 39 | &__image-details { 40 | @include image-details; 41 | } 42 | 43 | &__image { 44 | img { 45 | width: 100%; 46 | height: auto; 47 | } 48 | 49 | @include desktop { 50 | flex: unset; 51 | 52 | img { 53 | width: auto; 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/image-panel-rollover.scss: -------------------------------------------------------------------------------- 1 | .image-panel-rollover { 2 | @include our_clearfix; 3 | position: relative; 4 | 5 | &__entry { 6 | display: inline-block; 7 | position: relative; 8 | overflow: hidden; 9 | &:hover { 10 | .image-panel-rollover__drawer { 11 | top: 0; 12 | } 13 | } 14 | } 15 | 16 | &__image-link { 17 | span { 18 | position: absolute; 19 | width: 100%; 20 | height: 100%; 21 | top: 0; 22 | left: 0; 23 | z-index: 11; 24 | cursor: pointer; 25 | } 26 | } 27 | 28 | img { 29 | display: block; 30 | width: 100%; 31 | height: auto; 32 | } 33 | 34 | // On phones, we don't do the rollover, we put the title, description, and link below the image 35 | &__drawer { 36 | padding-top: 1.5em; 37 | padding-bottom: 1.5em; 38 | // line-height: 24px; 39 | color: $black; 40 | background-color: transparent; 41 | } 42 | 43 | @media (hover) { 44 | &__drawer { 45 | width: 100%; 46 | line-height: 14px; 47 | height: 100%; 48 | position: absolute; 49 | background-color: rgba(0, 0, 0, 0.65); 50 | color: $white; 51 | top: 70%; 52 | // Tells the browser to animate the "top" property whenever it changes, which happens when the .entry is hovered. 53 | transition: top 0.5s ease-in-out 0.5s; 54 | } 55 | } 56 | 57 | &__title { 58 | font-size: 1.4em; 59 | padding: 0 15px; 60 | margin-bottom: 0.5em; 61 | font-family: $font-serif; 62 | font-weight: normal; 63 | } 64 | 65 | @media (hover) { 66 | &__title { 67 | position: relative; 68 | // margin: 0; 69 | height: 30%; 70 | font-size: #{16px / $font-size-base}em; 71 | 72 | &--vertically-centered { 73 | position: absolute; 74 | top: 50%; 75 | transform: translateY(-50%); 76 | } 77 | } 78 | } 79 | 80 | &__blurb, .read-more-link { 81 | padding: 0 15px; 82 | font-size: #{14px / $font-size-base}em; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/menu-listing.scss: -------------------------------------------------------------------------------- 1 | // menu listing colors 2 | @include linksbgdark(menu-listing, 'white', $white); 3 | .menu-listing.bg-color-white h2 { 4 | color: $black; 5 | } 6 | @include linksbglight(menu-listing, 'black', $black); 7 | .menu-listing.bg-color-black h2 { 8 | color: $ltgray; 9 | } 10 | .menu-listing.bg-color-black .list-group-item.active { 11 | color: $ltgray; 12 | } 13 | @include linksbglight(menu-listing, 'orange', $orange-accessible); 14 | @include linksbgdark(menu-listing, 'ltgray', $ltgray); 15 | @include linksbgdark(menu-listing, 'midgray', $midgray); 16 | @include linksbglight(menu-listing, 'darkergray', $darkergray); 17 | @include linksbglight(menu-listing, 'dkgray', $dkgray); 18 | @include linksbgdark(menu-listing, 'olivegreen', $olivegreen); 19 | @include linksbglight(menu-listing, 'purple', $purple); 20 | .menu-listing.bg-color-purple h2 { 21 | color: $white; 22 | } 23 | @include linksbglight(menu-listing, 'darkteal', $darkteal); 24 | 25 | // menu listings are just related links blocks with different data, so the rest of the css is in related-links.scss 26 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/related-links.scss: -------------------------------------------------------------------------------- 1 | // Override the bootstrap defaults so we can set different backgrounds and colors 2 | .list-group-item { 3 | background-color: transparent; 4 | border: 0; 5 | &.active { 6 | background-color: transparent; 7 | color: $black; 8 | &:hover { 9 | background-color: transparent; 10 | color: $black; 11 | } 12 | } 13 | } 14 | 15 | // related link colors 16 | @include linksbgdark(related-links, 'white', $white); 17 | .related-links.bg-color-white h2 { 18 | color: $black; 19 | } 20 | @include linksbglight(related-links, 'black', $black); 21 | .related-links.bg-color-black h2 { 22 | color: $ltgray; 23 | } 24 | @include linksbglight(related-links, 'orange', $orange-accessible); 25 | @include linksbgdark(related-links, 'ltgray', $ltgray); 26 | @include linksbgdark(related-links, 'midgray', $midgray); 27 | @include linksbglight(related-links, 'darkergray', $darkergray); 28 | @include linksbglight(related-links, 'dkgray', $dkgray); 29 | @include linksbgdark(related-links, 'olivegreen', $olivegreen); 30 | @include linksbglight(related-links, 'purple', $purple); 31 | .related-links.bg-color-purple h2 { 32 | color: $white; 33 | } 34 | @include linksbglight(related-links, 'darkteal', $darkteal); 35 | 36 | .related-links, 37 | .menu-listing { 38 | border: 1px solid rgba(34, 36, 38, .1); 39 | position: relative; 40 | min-height: fit-content; 41 | max-width: 100%; 42 | @include portrait-phone-only { 43 | // On phones, we are going to just make these menu blocks fill screen width and be as tall as they need to be. 44 | width: 100% !important; 45 | height: fit-content !important; 46 | } 47 | 48 | .list-group { 49 | .list-group-item { 50 | padding: 5px 25px; 51 | border-bottom: 1px solid darken($white, 5%); 52 | } 53 | } 54 | 55 | h2 { 56 | padding: 12px 25px 10px 25px; 57 | font-size: 1.3em; 58 | font-family: $font-serif; 59 | margin: 0; 60 | background-color: $ltbrngray; 61 | color: $crimson; 62 | } 63 | 64 | // Don't change the color and hover behavior of the active one, since it's not a link. 65 | .list-group-item:not(.active) { 66 | color: $dkgray; 67 | &:hover { 68 | color: $dkgray; 69 | text-decoration: underline; 70 | } 71 | } 72 | 73 | &.text-color-white { 74 | a, a:hover { 75 | color: $white; 76 | } 77 | } 78 | 79 | &.text-color-dkgray { 80 | a, a:hover { 81 | color: $dkgray; 82 | } 83 | } 84 | 85 | &.text-color-black { 86 | a, a:hover { 87 | color: $black; 88 | } 89 | } 90 | 91 | &.text-color-dkgray.bgimage a:hover, 92 | &.text-color-black.bgimage a:hover { 93 | color: $white !important; 94 | } 95 | 96 | &.bgimage { 97 | h2 { 98 | background-color: rgba(0, 0, 0, 0.7); 99 | color: $white; 100 | } 101 | 102 | a.list-group-item:hover { 103 | background-color: rgba(0, 0, 0, 0.8); 104 | color: $white !important; 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/section-title.scss: -------------------------------------------------------------------------------- 1 | .section-header { 2 | position: relative; 3 | height: 50px; 4 | padding-left: 10px; 5 | margin-top: 20px; 6 | font-size: 1.2em; 7 | font-family: $font-serif; 8 | color: $crimson; 9 | background-color: $ltbrngray; 10 | 11 | @include desktop { 12 | padding-left: 25px; 13 | font-size: 1.6em; 14 | } 15 | 16 | &__text { 17 | position: absolute; 18 | font-weight: normal; 19 | top: 50%; 20 | transform: translateY(-45%); 21 | } 22 | } 23 | 24 | .block-header { 25 | color: $orange-accessible; 26 | font-size: 1.1em; 27 | font-family: $font-sans-serif-bold; 28 | padding: 0 10px 10px; 29 | margin-top: 20px; 30 | 31 | @include desktop { 32 | padding: 0 0 10px; 33 | } 34 | } 35 | 36 | // Remove the top margin from both types of SectionTitleBlocks if they're the first element in a column/sidebar. 37 | .grid-item, .sidebar-layout__sidebar { 38 | .block-SectionTitleBlock:first-child { 39 | .section-header, .block-header { 40 | margin-top: 0; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/spacer.scss: -------------------------------------------------------------------------------- 1 | 2 | $spacer-increment: 25px; 3 | .spacer { 4 | // Sometimes the block before us will end with a float, which makes the spacer block not appear to be its full height. 5 | clear: both; 6 | 7 | // On portrait phones, we want the spacers to collapse, so we only define their heights on larger devices. 8 | @include landscape-phone { 9 | &--12 { height: 12px; } 10 | &--20 { height: 20px; } 11 | &--25 { height: $spacer-increment; } 12 | &--30 { height: 30px; } 13 | &--40 { height: 40px; } 14 | &--50 { height: 2 * $spacer-increment; } 15 | &--75 { height: 3 * $spacer-increment; } 16 | &--100 { height: 4 * $spacer-increment; } 17 | &--125 { height: 5 * $spacer-increment; } 18 | &--150 { height: 6 * $spacer-increment; } 19 | &--175 { height: 7 * $spacer-increment; } 20 | &--200 { height: 8 * $spacer-increment; } 21 | &--225 { height: 9 * $spacer-increment; } 22 | &--250 { height: 10 * $spacer-increment; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/blocks/video-block.scss: -------------------------------------------------------------------------------- 1 | .video-block { 2 | position: relative; 3 | background-color: $black; 4 | 5 | &__video { 6 | display: block; 7 | margin: auto; 8 | } 9 | 10 | // This overlay sits on top of the video, so that when a user clicks, the title can be removed via javascript. 11 | &__overlay { 12 | width: 100%; 13 | height: 100%; 14 | position: absolute; 15 | bottom: 0; 16 | left: 0; 17 | z-index: 11; 18 | cursor: pointer; 19 | &.js-no-touch { 20 | // Prevent tap actions and mouse clicks when the overlay has this class. Can't use "touch-actions: none" because 21 | // iOS Safari doesn't support that. This is probably better anyway, because it allows scroll events that 22 | // start on the video overlay to still function. 23 | touch-action: manipulation; 24 | pointer-events: none; 25 | } 26 | } 27 | 28 | &__title-banner { 29 | position: absolute; 30 | bottom: 0; 31 | left: 0; 32 | right: 0; 33 | height: 80px; 34 | width: 100%; 35 | background-color: rgba(0, 0, 0, 0.7); 36 | // Ensures that even if the main overlay has its interactivity disabled, this div will still be clickable/tappable. 37 | touch-action: auto; 38 | pointer-events: auto; 39 | } 40 | 41 | &__title { 42 | color: $white; 43 | font-family: $font-serif; 44 | font-size: 18px; 45 | position: absolute; 46 | top: 50%; 47 | transform: translateY(-50%); 48 | -webkit-transform: translateY(-50%); 49 | padding: 0 50px; 50 | width: 100%; 51 | text-align: center; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/common.scss: -------------------------------------------------------------------------------- 1 | @import "globals.scss"; 2 | @import "mixins.scss"; 3 | 4 | /****** Generic CSS For Similar Blocks *********/ 5 | 6 | @import "blocks/generic.scss"; 7 | 8 | /************** Column Layouts *****************/ 9 | 10 | @import "blocks/column-standard.scss"; 11 | @import "blocks/column-sidebar.scss"; 12 | 13 | 14 | /*************** Spacer Block ******************/ 15 | 16 | @import "blocks/spacer.scss"; 17 | 18 | /************* Image Gallery Blocks ************/ 19 | 20 | @import "blocks/image-gallery-gallery.scss"; 21 | @import "blocks/image-gallery-slider.scss"; 22 | 23 | /************ Image Carousel Blocks ************/ 24 | 25 | @import "blocks/image-carousel.scss"; 26 | @import "blocks/hero-image-carousel.scss"; 27 | 28 | /************** Hero Image Blocks **************/ 29 | 30 | // button bars appear overlaid on hero images 31 | @import "blocks/action_button_bar.scss"; 32 | @import "blocks/hero_image.scss"; 33 | 34 | /************** Image Panel Blocks *************/ 35 | 36 | @import "blocks/image-panel-caption.scss"; 37 | @import "blocks/image-panel-link.scss"; 38 | @import "blocks/image-panel-cards.scss"; 39 | @import "blocks/image-panel-listing.scss"; 40 | @import "blocks/image-panel-hero.scss"; 41 | @import "blocks/image-panel-rollover.scss"; 42 | 43 | /************* Menu Listing Blocks *************/ 44 | 45 | @import "blocks/menu-listing.scss"; 46 | 47 | /**************** Section Title Blocks ***************/ 48 | 49 | @import "blocks/section-title.scss"; 50 | 51 | /**************** Text Blocks ***************/ 52 | 53 | @import "blocks/fancy-rich-text.scss"; 54 | @import "blocks/callout.scss"; 55 | 56 | /**************** Video Block ***************/ 57 | 58 | @import "blocks/video-block.scss"; 59 | @import "blocks/iframe-block.scss"; 60 | 61 | /*************** Related Links Block ******************/ 62 | 63 | @import "blocks/related-links.scss"; 64 | 65 | @media (max-width: $small-viewport) { 66 | .richtext-image { 67 | &.Small { 68 | width:100%; 69 | } 70 | &.Medium { 71 | width:100%; 72 | } 73 | &.Large { 74 | width:100%; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/globals.scss: -------------------------------------------------------------------------------- 1 | $white: #ffffff; 2 | $ltgray: #c8c8c8; 3 | $gray: #aaa99f; 4 | $medgray: #76777b; 5 | $midgray: #afafaf; 6 | $dkgray: #616265; 7 | $darkergray: #696b73; 8 | $ltbrngray: #e9e7e4; 9 | $crimson: #731936; 10 | $black: #000000; 11 | $black-text: #333333; 12 | $goldenrod: #ecaa00; 13 | $maroon: #7a303f; 14 | $olivegreen: #a9b734; 15 | $purple: #95348d; 16 | $darkteal: #005e5c; 17 | $grey-800: #333333; 18 | 19 | // #ff6e1e is the exact shade of orange that the Caltech wordmark has. Unfortunately, that shade is too light on a 20 | // white background to satisfy the WAVE accessibility tool. So we switched the theme's main color to $orange-accessible. 21 | $orange: #ff6e1e; 22 | $orange-accessible: #D14900; 23 | 24 | // Media Query Breakpoints 25 | $small-viewport: 500px; 26 | $medium-viewport: 768px; 27 | $desktop-viewport: 1000px; 28 | 29 | $screen-phone: 480px; 30 | $screen-tablet: 768px; 31 | 32 | // To pixel-bitch the width for something, use width: px / $responsive-grid-w * 100%; 33 | $responsive-grid-w: 1000px; 34 | 35 | // Fonts 36 | $font-size-base: 14px; 37 | $line-height-base: 1.7; 38 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/hallo_icons.scss: -------------------------------------------------------------------------------- 1 | // This file is a bunch of junk I copied out of the Wagtail 2.16 repo to restore the original wagtail font-based icons 2 | // that were removed in Wagtail 5... or 6. Or something. Hallo.js needs them, so we still need them. 3 | 4 | $icons: ( 5 | 'arrow-down-big': '\e030', 6 | 'arrow-down': '\e01a', 7 | 'arrow-left': '\e022', 8 | 'arrow-right': '\e017', 9 | 'arrow-up-big': '\e02f', 10 | 'arrow-up': '\e010', 11 | 'arrows-up-down': '\e016', 12 | 'bin': '\e038', 13 | 'bold': '\e026', 14 | 'chain-broken': '\e047', 15 | 'code': '\e001', 16 | 'cog': '\e020', 17 | 'cogs': '\e00c', 18 | 'collapse-down': '\e03f', 19 | 'collapse-up': '\e03e', 20 | 'cross': '\e012', 21 | 'date': '\e045', 22 | 'doc-empty-inverse': '\e00d', 23 | 'doc-empty': '\e00e', 24 | 'doc-full-inverse': '\e01b', 25 | 'doc-full': '\e018', 26 | 'download': '\e044', 27 | 'duplicate': '\e902', 28 | 'edit': '\e00f', 29 | 'folder-inverse': '\e014', 30 | 'folder-open-1': '\e013', 31 | 'folder-open-inverse': '\e01f', 32 | 'folder': '\e01c', 33 | 'form': '\e00b', 34 | 'grip': '\e03b', 35 | 'group': '\e031', 36 | 'help': '\e041', 37 | // help-inverse directly renders the corresponding character. 38 | 'help-inverse': '?', 39 | 'home': '\e035', 40 | // horizontalrule is not rendered as an icon font – it uses a unicode dash character rendered with a fallback font. 41 | 'horizontalrule': '\2014', 42 | 'image': '\e019', 43 | 'italic': '\e027', 44 | 'link': '\e02c', 45 | 'list-ol': '\e029', 46 | 'list-ul': '\e028', 47 | 'locked': '\e009', 48 | 'logout': '\e049', 49 | 'mail': '\e015', 50 | 'media': '\e032', 51 | 'no-view': '\e006', 52 | 'openquote': '\e000', 53 | 'order-down': '\e036', 54 | 'order-up': '\e037', 55 | 'order': '\e034', 56 | 'password': '\e033', 57 | 'pick': '\e03d', 58 | 'pilcrow': '\e002', 59 | 'placeholder': '\e003', 60 | 'plus-inverse': '\e024', 61 | 'plus': '\e01d', 62 | 'radio-empty': '\e02e', 63 | 'radio-full': '\e02d', 64 | 'redirect': '\e03c', 65 | 'repeat': '\e02b', 66 | 'search': '\e011', 67 | 'site': '\e007', 68 | 'snippet': '\e025', 69 | 'spinner': '\e03a', 70 | 'strikethrough': '\e04a', 71 | 'subscript': '\e04c', 72 | 'success': '\e043', 73 | 'superscript': '\e04b', 74 | 'table': '\e048', 75 | 'tag': '\e01e', 76 | 'tick-inverse': '\e023', 77 | 'tick': '\e021', 78 | 'time': '\e008', 79 | 'title': '\e046', 80 | 'undo': '\e02a', 81 | 'unlocked': '\e00a', 82 | 'user': '\e004', 83 | 'view': '\e005', 84 | 'wagtail-inverse': '\e040', 85 | 'wagtail': '\e039', 86 | 'warning': '\e042', 87 | ); 88 | 89 | $icons-after: ( 90 | 'arrow-down-after': map-get($icons, 'arrow-down'), 91 | 'arrow-right-after': map-get($icons, 'arrow-right'), 92 | 'arrow-up-after': map-get($icons, 'arrow-up'), 93 | ); 94 | 95 | $color-white: #fff; 96 | $color-black: #000; 97 | 98 | // darker to lighter 99 | $color-grey-1: darken($color-white, 80); 100 | $color-grey-2: darken($color-white, 70); 101 | $color-grey-3: darken($color-white, 15); 102 | $color-grey-4: darken($color-white, 10); 103 | $color-grey-5: darken($color-white, 2); 104 | $color-red: #cd3238; 105 | $system-color-link-text: LinkText; 106 | $media-forced-colours: active; 107 | 108 | @font-face { 109 | font-family: wagtail; 110 | src: url('../fonts/wagtail.woff') format('woff'); 111 | font-weight: normal; 112 | font-style: normal; 113 | } 114 | 115 | // Turns on font-smoothing when used. Use sparingly. 116 | @mixin font-smoothing { 117 | -webkit-font-smoothing: antialiased; 118 | -moz-osx-font-smoothing: grayscale; 119 | } 120 | 121 | @mixin icon () { 122 | @include font-smoothing; 123 | font-family: 'wagtail'; 124 | font-style: normal; 125 | font-weight: normal; 126 | font-variant: normal; 127 | text-transform: none; 128 | speak: none; 129 | text-decoration: none; 130 | width: 1.3em; 131 | line-height: 1em; 132 | text-align: left; 133 | vertical-align: middle; 134 | margin-right: 0.2em; 135 | } 136 | 137 | @mixin svg-icon ($size: 1.5em, $position: text-top) { 138 | width: $size; 139 | height: $size; 140 | vertical-align: $position; 141 | } 142 | 143 | // Limit these rules to applying ONLY inside the Hallo editor, because Wagtail's global admin CSS use several of the 144 | // same classes, and we don't want to mess with those. 145 | .hallotoolbar { 146 | // Set SVG icons to use the current text color in the location they appear as 147 | // their default fill color. Can be overridden for a specific icon by either 148 | // the color or fill properties. 149 | .icon { 150 | fill: currentColor; 151 | } 152 | 153 | //.icon.teal { 154 | // color: $color-teal; 155 | //} 156 | 157 | .icon.white { 158 | color: #fff; 159 | } 160 | 161 | .icon:before, 162 | .icon:after, 163 | .hallotoolbar [class^='icon-'], 164 | .hallotoolbar [class*=' icon-']:before, 165 | .hallotoolbar [class^='icon-']:before { 166 | @include icon(); // from _mixins.scss 167 | } 168 | 169 | .icon:after, 170 | .hallotoolbar [class^='icon-']:after, 171 | .hallotoolbar [class^='icon-']:after { 172 | text-align: right; 173 | } 174 | 175 | .hallotoolbar [class^='icon-'], 176 | .hallotoolbar [class*=' icon-']:before, 177 | .hallotoolbar [class*=' icon-']:before, 178 | .hallotoolbar [class^='icon-']:before { 179 | vertical-align: -10%; 180 | margin-right: 0; 181 | } 182 | 183 | 184 | // ============================================================================= 185 | // Icon factory methods 186 | // ============================================================================= 187 | 188 | @each $icon, $content in $icons { 189 | .icon-#{$icon}:before { 190 | content: quote(#{$content}); 191 | } 192 | } 193 | 194 | @each $icon, $content in $icons-after { 195 | .icon-#{$icon}:after { 196 | content: quote(#{$content}); 197 | } 198 | } 199 | 200 | 201 | // ============================================================================= 202 | // Custom config for various icons 203 | // ============================================================================= 204 | .icon-download { 205 | // Credit: Icon made by Freepik from Flaticon.com 206 | } 207 | 208 | .icon-view:before, 209 | .icon-no-view:before { // icon-font 210 | vertical-align: -3.5px; 211 | font-size: 1.1rem; 212 | } 213 | 214 | .icon-spinner:after, 215 | .icon-spinner:before { // iconfont 216 | width: 1em; 217 | animation: spin-wag 0.5s infinite linear; 218 | display: inline-block; 219 | } 220 | 221 | svg.icon-spinner { 222 | animation: spin-wag 0.5s infinite linear; 223 | } 224 | 225 | .icon-horizontalrule:before { 226 | font-family: Open Sans, Arial, sans-serif; 227 | } 228 | 229 | 230 | .icon-larger:before { 231 | font-size: 1.5em; 232 | } 233 | 234 | .icon.text-replace { // iconfont 235 | font-size: 0; 236 | line-height: 0; 237 | overflow: hidden; 238 | 239 | &:before { 240 | margin-right: 0; 241 | font-size: 1rem; 242 | display: inline-block; 243 | width: 100%; 244 | line-height: 1.2em; 245 | text-align: center; 246 | vertical-align: middle; 247 | } 248 | } 249 | 250 | .text-replace { 251 | font-size: 0; 252 | line-height: 0; 253 | overflow: hidden; 254 | 255 | .icon { 256 | @include svg-icon(1rem, middle); 257 | } 258 | } 259 | 260 | @keyframes spin-wag { 261 | 0% { 262 | transform: rotate(0deg); 263 | } 264 | 265 | 100% { 266 | transform: rotate(360deg); 267 | } 268 | } 269 | 270 | 271 | .icon-spinner:after { 272 | display: inline-block; 273 | line-height: 1; 274 | } 275 | 276 | // CSS-only circled question mark. 277 | // 278 | .icon-help-inverse { 279 | $size: 15px; 280 | 281 | &:before { 282 | display: inline-block; 283 | width: $size; 284 | height: $size; 285 | line-height: $size; 286 | font-size: 1.1em; 287 | text-align: center; 288 | border-radius: 100%; 289 | color: $color-grey-2; 290 | border: 1px solid currentColor; 291 | } 292 | } 293 | 294 | .icon { 295 | &.initial { 296 | @include svg-icon(1em); 297 | vertical-align: initial; 298 | } 299 | 300 | &.default { 301 | @include svg-icon(1.5em); 302 | } 303 | 304 | &--flipped { 305 | transform: scaleX(-1); 306 | } 307 | } 308 | 309 | .icon.locale-error { 310 | vertical-align: text-top; 311 | margin-right: 0.5em; 312 | width: 1.5em; 313 | height: 1.5em; 314 | color: $color-red; 315 | } 316 | 317 | // Media for Windows High Contrast mode 318 | 319 | @media (forced-colors: $media-forced-colours) { 320 | .icon { 321 | fill: $system-color-link-text; 322 | } 323 | } 324 | } 325 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/layouts-v6.5.scss: -------------------------------------------------------------------------------- 1 | // Split these out so we can change them in layouts.v6.5.css 2 | $font-serif: 'Helvetica', 'Arial', sans-serif; 3 | $font-sans-serif: 'Helvetica', 'Arial', sans-serif; 4 | $font-sans-serif-bold: 'Helvetica', 'Arial', sans-serif; 5 | $font-vaud: 'Helvetica', 'Arial', sans-serif; 6 | 7 | @import "common.scss"; -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/layouts.scss: -------------------------------------------------------------------------------- 1 | // Split these out so we can change them in layouts.v6.5.css 2 | $font-serif: Times, serif; 3 | $font-sans-serif: Helvetica, sans-serif; 4 | $font-sans-serif-bold: Helvetica, sans-serif; 5 | $font-vaud: Vaud, sans-serif; 6 | 7 | @import "common.scss"; -------------------------------------------------------------------------------- /jetstream/static/jetstream/css/mixins.scss: -------------------------------------------------------------------------------- 1 | // =================== 2 | // Media Query Mixins 3 | // =================== 4 | 5 | // Breakpoints 6 | // $small-viewport: 500px; # aka landscape_phone_viewport 7 | // $medium-viewport: 768px; # aka portrait_tablet_viewport 8 | // $desktop-viewport: 1000px; 9 | 10 | @mixin landscape-phone { 11 | @media (min-width: $small-viewport) { 12 | @content; 13 | } 14 | } 15 | 16 | @mixin portrait-tablet { 17 | @media (min-width: $medium-viewport) { 18 | @content; 19 | } 20 | } 21 | 22 | @mixin desktop { 23 | @media (min-width: $desktop-viewport) { 24 | @content; 25 | } 26 | } 27 | 28 | // For those times when you want behavior to apply ONLY on desktops, and NOT on landscape tablets. 29 | @mixin real-desktop { 30 | @media (min-width: 1025px) { 31 | @content; 32 | } 33 | } 34 | 35 | // For those times when you need to use a non-mobile-first media query to apply rules ONLY on portrait phones. 36 | // Only use when you ABSOLUTELY have to! 37 | @mixin portrait-phone-only { 38 | @media (max-width: $small-viewport - 1) { 39 | @content; 40 | } 41 | } 42 | 43 | // There's a bug in IE11 that makes it ignore box-sizing: border-box when flex elements are sized via their flex-basis. 44 | // The workaround for this is to convert the use of "flex: $width" to "flex: 1 1 auto; width: $width". 45 | @mixin IE-compatible-flex-width($width) { 46 | flex: 1 1 auto; 47 | width: $width; 48 | } 49 | 50 | // =================== 51 | // Functions 52 | // =================== 53 | 54 | @mixin our_clearfix() { 55 | &:before, 56 | &:after { 57 | content: " "; 58 | display: table; 59 | } 60 | &:after { 61 | clear: both; 62 | } 63 | } 64 | 65 | @mixin link-never-underline { 66 | // Mix this into a link's CSS to prevent that link from ever being underlined. 67 | &, &:visited, &:active, &:hover, &:focus { 68 | text-decoration: none; 69 | } 70 | } 71 | 72 | @mixin link-always-color($color) { 73 | // Mix this into a link's CSS to make it stay the same color under all circumstances. 74 | &, &:visited, &:active, &:hover, &:focus { 75 | color: $color; 76 | } 77 | } 78 | 79 | @mixin linksbglight($wrapper-class, $color-name, $color) { 80 | $classname: "bg-color-" + $color-name; 81 | $selector: ".#{$wrapper-class}.#{$classname}"; 82 | 83 | #{$selector} { 84 | // We are adding a border to each $wrapper-class and then turning it off whenever we set a bg-color 85 | box-shadow: none; 86 | border: none; 87 | background-color: $color; 88 | h2 { 89 | color: darken($color, 20%); 90 | background-color: lighten($color, 10%); 91 | } 92 | .list-group-item { 93 | border-bottom: 1px solid lighten($color, 5%); 94 | &:hover { 95 | background-color: lighten($color, 10%); 96 | } 97 | } 98 | .list-group-item.active { 99 | color: darken($color, 10%); 100 | background-color: lighten($color, 5%); 101 | } 102 | } 103 | } 104 | 105 | @mixin linksbgdark($wrapper-class, $color-name, $color) { 106 | $classname: "bg-color-" + $color-name; 107 | $selector: ".#{$wrapper-class}.#{$classname}"; 108 | 109 | #{$selector} { 110 | // We are adding a border to each $wrapper-class and then turning it off whenever we set a bg-color 111 | box-shadow: none; 112 | border: none; 113 | background-color: $color; 114 | h2 { 115 | color: lighten($color, 20%); 116 | background-color: darken($color, 10%); 117 | } 118 | .list-group-item { 119 | border-bottom: 1px solid lighten($color, 5%); 120 | &:hover { 121 | background-color: darken($color, 10%); 122 | } 123 | } 124 | .list-group-item.active { 125 | color: darken($color, 30%); 126 | background-color: darken($color, 5%); 127 | } 128 | } 129 | } 130 | 131 | // used in Image Panel/Carousel/etc. 132 | @mixin text-gradient--bottom { 133 | position: absolute; 134 | bottom: 0; 135 | width: 100%; 136 | height: 50%; 137 | background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7)); 138 | } 139 | 140 | @mixin text-gradient--right { 141 | position: absolute; 142 | right: 0; 143 | top: 0; 144 | background-image: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.6) 30%, rgba(0,0,0,0.6)); 145 | width: 75%; 146 | height: 100%; 147 | } 148 | 149 | // make this match the Bootstrap 3 styles 150 | @mixin carousel_indicators { 151 | left: auto; 152 | right: 3%; 153 | bottom: 3%; 154 | position: static; 155 | margin: 1rem 0; 156 | 157 | @include portrait-tablet { 158 | position: absolute; 159 | margin-right: 0; 160 | margin-left: 0; 161 | } 162 | 163 | li { 164 | width: 15px; 165 | height: 15px; 166 | margin: 0 10px; 167 | cursor: pointer; 168 | background-color: rgba(0,0,0,0); 169 | border: 1px solid $black; 170 | border-radius: 10px; 171 | 172 | &.active { 173 | background-color: black; 174 | } 175 | 176 | @include portrait-tablet { 177 | border-color: white; 178 | width: 10px; 179 | height: 10px; 180 | margin: 0 5px; 181 | 182 | &.active { 183 | background-color: white; 184 | } 185 | } 186 | } 187 | } 188 | 189 | @mixin wrapper-link { 190 | // This provides a 100% x 100% link overlay so that the background image in the element has an overlay. 191 | // Mainly used to make links that overlay background images. 192 | // NOTE: When using this mixin, ensure that the direct parent of the mixed-in class has "position: relative". 193 | .wrapper-expander { 194 | position: absolute; 195 | width: 100%; 196 | height: 100%; 197 | top: 0; 198 | left: 0; 199 | z-index: 100; 200 | } 201 | } 202 | 203 | @mixin responsive-images-inside { 204 | // This mixin makes all tags inside the mixed-in class act responsively. 205 | 206 | // Always size up imgs to fill their parent... 207 | img { 208 | width: 100%; 209 | height: auto; 210 | } 211 | // ... unless it's a top-level image on a larger-than-phone device... 212 | &.top-level { 213 | @include landscape-phone { 214 | img { 215 | width: auto; 216 | } 217 | } 218 | } 219 | // or it's being displayed on a desktop device. 220 | @include desktop { 221 | img { 222 | // We use "width: auto" here because of the ceil() call in the {% width_from_arbitrary_parent %} tag. If we didn't 223 | // do this, the fact that the image is a partial pixel wider than it's supposed to be will cause "width: 100%" to 224 | // shrink the height of the image by just a tiny bit, ruining the clean layout. With "width: auto" instead, the 225 | // image stays its original size, and the "overflow: hidden" rule on the column elements hides the extra partial 226 | // pixel. 227 | width: auto; 228 | } 229 | } 230 | // TODO: We have not yet solved the problem that the above CSS causes with different-size images on portait tablets. 231 | // There's a trello card (https://trello.com/c/0ZPkDZfx) with a potential solution, but we will likely not be doing 232 | // that until theme 7.0. 233 | } 234 | /*************** Image Caption ***************/ 235 | @mixin image-details { 236 | line-height: 1.5; 237 | margin-top: 10px; 238 | display: block; 239 | color: $grey-800; 240 | 241 | @media (max-width: $medium-viewport) { 242 | padding-left: 10px; 243 | padding-right: 10px; 244 | } 245 | 246 | .image-caption { 247 | font-size: 12px; 248 | display: block; 249 | } 250 | 251 | .image-credit { 252 | font-size: 11px; 253 | font-style: italic; 254 | display: block; 255 | } 256 | } 257 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/fonts/wagtail.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caltechads/wagtail-jetstream/f38a817f8d737f80aec497e0567ca2ad94f8732f/jetstream/static/jetstream/fonts/wagtail.woff -------------------------------------------------------------------------------- /jetstream/static/jetstream/js/admin/dimensions-options-telepath.js: -------------------------------------------------------------------------------- 1 | class DimensionsOptionsBlockDefinition extends window.wagtailStreamField.blocks.StructBlockDefinition { 2 | /** 3 | * This function gets called by wagtail's StreamField javascript each time a new DimensionsOptionsBlock is generated 4 | * within the form. The 'prefix' argument is a string that uniquely identifies the instance of the 5 | * DimensionsOptionsBlock that was just generated. 6 | */ 7 | render(placeholder, prefix, initialState, initialError) { 8 | // 1. Render the block. This needs to happen before the extra behavior is added, because otherwise there will be 9 | // nothing to attach that behavior to. 10 | const block = super.render(placeholder, prefix, initialState, initialError); 11 | 12 | // 2. Set up extra behavior. 13 | function toggle_height_and_width_editability(target) { 14 | // To get at the Height and Width fields, we traverse up the DOM to the .struct-block object that parents 15 | // this entire block. 16 | var parent_ul = target.closest('.struct-block'); 17 | // On each number input within this DimensionsOptionsBlock, set the readOnly property to True when the "Use" 18 | // checkbox is unchecked, and False when it's checked. Since the checkbox defaults to unchecked, these properties 19 | // are not editable by default. 20 | parent_ul.find('input[type="number"]').prop('readOnly', !target.prop('checked')); 21 | } 22 | 23 | // Get the "Use Fixed Dimensions" checkbox for this instance of the DimensionsOptionsBlock. 24 | var target = $('#' + prefix + '-use'); 25 | // Initialize existing elements to correct editability state. 26 | toggle_height_and_width_editability(target); 27 | // Re-toggle editability each time the checkbox is clicked. 28 | target.change(function() { 29 | toggle_height_and_width_editability($(this)); 30 | }); 31 | 32 | // 3. Return the block that was rendered at the top of this function. 33 | return block; 34 | } 35 | } 36 | // This connects the above javascript to the Python Adapter code: js_constructor = 'jetstream.DimensionsOptionsBlock' 37 | window.telepath.register('jetstream.DimensionsOptionsBlock', DimensionsOptionsBlockDefinition); 38 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/js/admin/image-gallery-telepath.js: -------------------------------------------------------------------------------- 1 | class ImageGalleryBlockDefinition extends window.wagtailStreamField.blocks.StructBlockDefinition { 2 | /** 3 | * This function gets called by wagtail's StreamField javascript each time a new ImageGalleryBlock is generated 4 | * within the form. The 'prefix' argument is a string that uniquely identifies the instance of the 5 | * ImageGalleryBlock that was just generated. 6 | */ 7 | render(placeholder, prefix, initialState, initialError) { 8 | // 1. Render the block. This needs to happen before the extra behavior is added, because otherwise there will be 9 | // nothing to attach that behavior to. 10 | const block = super.render(placeholder, prefix, initialState, initialError); 11 | 12 | // 2. Set up extra behavior. 13 | var field = null, field_sibling = null; 14 | 15 | /** 16 | * Sets up the Columns field to only appear when an appropriate Style is selected. 17 | */ 18 | function configure_columns_dropdown(current_style) { 19 | var columns_dropdown = jQuery(`#${prefix}-columns`); 20 | // If the Style dropdown is set to a style with columns (e.g. gallery), show the Columns field. 21 | if (current_style != 'gallery') { 22 | // If there's no dropdown, we've already stored and removed the field, so we can't do it again. 23 | if (!columns_dropdown.length) { 24 | return; 25 | } 26 | // If we use .show()/.hide(), the striping for the fields in the form won't update, which looks ugly. 27 | // Thus, we convert the dropdown into a hidden input with the same value. 28 | var parent_block = columns_dropdown.closest('.struct-block'); 29 | var hidden_id = prefix + '-columns-hidden'; 30 | var hidden_name = columns_dropdown.attr('name'); 31 | var hidden_value = columns_dropdown.val(); 32 | parent_block.append( 33 | jQuery('') 34 | ); 35 | field = columns_dropdown.closest('.field').parent(); 36 | field_sibling = field.prev(); 37 | field.detach(); 38 | } 39 | else if (field) { 40 | field_sibling.after(field); 41 | field = null; 42 | field_sibling = null; 43 | jQuery(`#${prefix}-columns-hidden`).remove(); 44 | } 45 | } 46 | 47 | // Get the "Style" dropdown for this instance of ImagePanelBlock. 48 | var style_select = jQuery(`#${prefix}-style`); 49 | // Initialize the Columns dropdown appropriately. 50 | configure_columns_dropdown(style_select.val()); 51 | // Re-toggle the Columns dropdown each time the Style is changed. 52 | style_select.change(function() { 53 | configure_columns_dropdown(jQuery(this).val()); 54 | }); 55 | 56 | // 3. Return the block that was rendered at the top of this function. 57 | return block; 58 | } 59 | } 60 | // This connects the above javascript to the Python Adapter code: js_constructor = 'jetstream.ImageGalleryBlock' 61 | window.telepath.register('jetstream.ImageGalleryBlock', ImageGalleryBlockDefinition); 62 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/js/admin/image-panel-telepath.js: -------------------------------------------------------------------------------- 1 | class ImagePanelBlockDefinition extends window.wagtailStreamField.blocks.StructBlockDefinition { 2 | /** 3 | * This function gets called by wagtail's StreamField javascript each time a new ImagePanelBlock is generated 4 | * within the form. The 'prefix' argument is a string that uniquely identifies the instance of the 5 | * ImagePanelBlock that was just generated. 6 | */ 7 | render(placeholder, prefix, initialState, initialError) { 8 | // 1. Render the block. This needs to happen before the extra behavior is added, because otherwise there will be 9 | // nothing to attach that behavior to. 10 | const block = super.render(placeholder, prefix, initialState, initialError); 11 | 12 | // 2. Set up extra behavior. 13 | var field = null, field_sibling = null; 14 | 15 | /** 16 | * Sets up the Display Caption checkbox to only appear when an appropriate Style is selected. 17 | */ 18 | function configure_display_caption_checkbox(prefix, current_style) { 19 | var checkbox = $(`#${prefix}-display_caption`); 20 | // If the Style dropdown is set to a style where optionally displaying the caption doesn't make sense, don't 21 | // show the Display Caption field. 22 | if (['rollover', 'hero', 'captioned', 'link'].indexOf(current_style) > -1) { 23 | // If there's no checkbox, we've already stored and removed the field, so we can't do it again. 24 | if (!checkbox.length) { 25 | return; 26 | } 27 | // If we use .show()/.hide(), the alternating striping for the fields won't update, which looks ugly. 28 | // This method actually removes the Display Caption field from the DOM while an inappropriate Style is set. 29 | // This is safe while submitting because a missing checkbox isn't sent as POST data anyway, meaning Django 30 | // will treat the value as False. 31 | // 2021-04-28 rrollins: NOTE, the reasoning for this is currently moot, as fields no longer have alternating 32 | // striping. We might add it in the future, though, so I'm leaving this as-is. 33 | field = checkbox.closest('.field').parent(); 34 | field_sibling = field.prev(); 35 | field.detach(); 36 | } 37 | else if (field) { 38 | field_sibling.after(field); 39 | field = null; 40 | field_sibling = null; 41 | } 42 | } 43 | 44 | // Get the "Style" dropdown for this instance of ImagePanelBlock. 45 | var style_select = $(`#${prefix}-style`); 46 | // Initialize the Display Caption checkbox appropriately. 47 | configure_display_caption_checkbox(prefix, style_select.val()); 48 | // Re-toggle the Display Caption checkbox each time the Style is changed. 49 | style_select.change(function() { 50 | configure_display_caption_checkbox(prefix, $(this).val()); 51 | }); 52 | 53 | // 3. Return the block that was rendered at the top of this function. 54 | return block; 55 | } 56 | } 57 | // This connects the above javascript to the Python Adapter code: js_constructor = 'jetstream.ImagePanelBlock' 58 | window.telepath.register('jetstream.ImagePanelBlock', ImagePanelBlockDefinition); 59 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/js/layouts.js: -------------------------------------------------------------------------------- 1 | /*global Modernizr, jQuery */ 2 | 3 | (function ($, window, document) { 4 | function make_image_cards_same_height_in_same_row() { 5 | var max_height = 0; 6 | $('.row').each(function() { 7 | $('.image-panel-card.equal', this).each(function() { 8 | if ($(this).outerHeight(true) > max_height) { 9 | max_height = $(this).outerHeight(true); 10 | } 11 | }); 12 | $('.image-panel-card.equal', this).height(max_height); 13 | }); 14 | } 15 | 16 | function set_up_video_blocks() { 17 | if (!Modernizr.mobile) { 18 | // The .video-block-overlay div covers the entire video block. On desktop, we need to translate clicks through 19 | // it and onto the iframe. 20 | $('.video-block__overlay').on('click', function() { 21 | // Hide the overlay so that video's controls are fully accessible. 22 | $(this).hide(); 23 | 24 | var $iframe = $('.video-block__video', $(this).parent()); 25 | var iframe = $iframe[0]; 26 | // YouTube and Vimeo videos require different actions to make this work. 27 | if ($iframe.data('provider') == 'YouTube') { 28 | iframe.src = iframe.src.replace('showinfo=0', 'showinfo=0&autoplay=1'); 29 | } 30 | else if ($iframe.data('provider') == 'Vimeo') { 31 | iframe.src = iframe.src.replace('portrait=0', 'portrait=0&autoplay=1'); 32 | } 33 | }); 34 | } 35 | else { 36 | // On mobile, we set up the overlay to be untouchable; clicks will pass through it and hit the iframe directly. 37 | // This doesn't hide the title, but that's OK on phones because the video plays in full screen. 38 | $('.video-block__overlay').addClass('js-no-touch'); 39 | } 40 | 41 | // Rergardless of whether we're on mobile, make clicks/taps on the title itself hide the overlay. 42 | // This lets tablet users hide the title with a second click. 43 | $('.video-block__title-banner').on('click', function() { 44 | $(this).parent().hide(); 45 | }); 46 | } 47 | 48 | function image_carousel_block_mobile_helper() { 49 | // On mobile, the ImageCarouselBlocks need some extra help to remain "pretty". 50 | if (Modernizr.mobile) { 51 | $('.block-ImageCarouselBlock .image-carousel').removeAttr('style'); 52 | } 53 | } 54 | 55 | $(document).ready(function() { 56 | set_up_video_blocks(); 57 | image_carousel_block_mobile_helper(); 58 | }); 59 | 60 | $(window).on('load', function() { 61 | make_image_cards_same_height_in_same_row(); 62 | }); 63 | }(jQuery, this, this.document)); 64 | -------------------------------------------------------------------------------- /jetstream/static/jetstream/js/utils.js: -------------------------------------------------------------------------------- 1 | // Adds a simplified "Is this a mobile device?" test to Modernizer. This covers all older tablets and phones, plus 2 | // the iPad Pro, without (hopefully) picking up any laptops. 3 | if (Modernizr) { 4 | Modernizr.addTest( 5 | 'mobile', 6 | Modernizr.touch && Modernizr.mq("(max-width: 1024px), (max-width: 1366px) and (min-device-pixel-ratio: 2.0)") 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/action_button_bar_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailcore_tags %} 2 | 3 | {% if self.actions %} 4 |
5 | {% for action in self.actions %} 6 | {% include_block action %} 7 | {% endfor %} 8 |
9 | {% endif %} 10 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/action_button_block.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | {% link_url self.link as the_url %} 3 | {{ self.text }} 4 | 5 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/callout_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags wagtailcore_tags %} 2 | 3 |
21 |

{{ self.title }}

22 | {{ self.body | richtext }} 23 |
24 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/fancy_rich_text_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags wagtailcore_tags %} 2 | 3 |
13 | {{ self.text|richtext }} 14 | {% if self.color.background_image %} 15 |
16 | {% image self.color.background_image original class="background-image" %} 17 |
18 | {% endif %} 19 |
20 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/hero_image_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailcore_tags wagtailimages_tags jetstream_tags %} 2 | 3 | {% image self.image original as img_data %} 4 |
5 |
6 | {% if self.desc.source or self.actions.actions or self.title %} 7 |
8 |
9 |

{{ self.title }}

10 | {{ self.desc | richtext }} 11 | {% include_block self.actions %} 12 |
13 |
14 | {% endif %} 15 |
16 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/hero_image_carousel_block.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags wagtailcore_tags bleach_tags %} 2 | 3 | {% generate_unique_id as backup_block_id %} 4 | 60 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/iframe_block.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | 3 |
8 | {{ self.html|safe }} 9 |
10 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_carousel_block.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags wagtailimages_tags wagtailcore_tags wagtailadmin_tags bleach_tags %} 2 | 3 | {% generate_unique_id as backup_block_id %} 4 | 69 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_gallery_block-gallery.html: -------------------------------------------------------------------------------- 1 | {% load static jetstream_tags wagtailimages_tags %} 2 | 3 | {% generate_unique_id as backup_block_id %} 4 | 18 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_gallery_block-slider.html: -------------------------------------------------------------------------------- 1 | {% load static jetstream_tags wagtailimages_tags %} 2 | 3 | {% generate_unique_id as backup_block_id %} 4 | 47 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-caption.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags jetstream_tags %} 2 | 3 |
4 | {% link_url self.link as url %} 5 | {% if url %} 6 | 7 | {% endif %} 8 | {% include 'jetstream/blocks/image_panel_block-image.html' with image=self.image %} 9 | {% include 'jetstream/image_details.html' with image=self.image parent_block="image-panel-caption" %} 10 |
11 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-card.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags jetstream_tags %} 2 | 3 | {# This markup is loosely based on https://bootsnipp.com/snippets/featured/bootstrap-4-card #} 4 |
5 |
6 | {% link_url self.link as link_url %} 7 | {% if link_url %} 8 | 9 | {% endif %} 10 | {% include 'jetstream/blocks/image_panel_block-image_square.html' with image=self.image %} 11 | {% if link_url %} 12 | 13 | {% endif %} 14 | {% if self.display_caption %} 15 | {% include 'jetstream/image_details.html' with image=self.image parent_block="image-panel-card" %} 16 | {% endif %} 17 | {% if self.title or self.desc %} 18 |
19 | {% if self.title %} 20 |

21 | {% if link_url %} 22 | {{ self.title }} 23 | {% else %} 24 | {{ self.title }} 25 | {% endif %} 26 |

27 | {% endif %} 28 | {% if self.desc %} 29 |
{{ self.desc }}
30 | {% endif %} 31 |
32 | {% endif %} 33 |
34 |
35 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-image.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags jetstream_tags %} 2 | 3 | {# un-template-comment the HTML comments to see them in the inspector when debugging this template. #} 4 | {% if self.fixed_dimensions.use %} 5 | {# #} 6 | {% responsive_image image 'fill' self.fixed_dimensions.width self.fixed_dimensions.height %} 7 | {% elif parent_width %} 8 | {% if parent_height %} 9 | {# #} 10 | {% responsive_image image 'fill' parent_width parent_height %} 11 | {% else %} 12 | {# #} 13 | {% responsive_image image 'width' parent_width %} 14 | {% endif %} 15 | {% else %} 16 | {# #} 17 | {% responsive_image image 'width' 1000 class="responsive-image-fallthrough" %} 18 | {% endif %} 19 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-image_square.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags jetstream_tags %} 2 | 3 | {% if self.fixed_dimensions.use %} 4 | {% responsive_image self.image 'fill' self.fixed_dimensions.width self.fixed_dimensions.height %} 5 | {% else %} 6 | {% if parent_width %} 7 | {% responsive_image self.image 'fill' parent_width parent_width %} 8 | {% endif %} 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-link.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags jetstream_tags bleach_tags wagtailadmin_tags %} 2 | 3 | 23 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-listing.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | 3 | {% comment %} 4 | 2018-07-18 rrollins/cnk: 5 | NOTE: The {% arbitrary_image %} tags use the fixed dimension values even when fixed_dimensions.use is not True. 6 | This is a bug that the layout actually relies on, so we're not fixing it now. 7 | {% endcomment %} 8 | 9 |
10 | {% if extra_classes == "left" %} 11 |
12 | {% link_url self.link as link_url %} 13 | {% if link_url %} 14 | 15 | {% arbitrary_image self.image 'fill' self.fixed_dimensions.width self.fixed_dimensions.height %} 16 | 17 | {% else %} 18 | {% arbitrary_image self.image 'fill' self.fixed_dimensions.width self.fixed_dimensions.height %} 19 | {% endif %} 20 | {% if self.display_caption %} 21 | {% include 'jetstream/image_details.html' with image=self.image parent_block="image-panel-listing" %} 22 | {% endif %} 23 |
24 | {% endif %} 25 |
26 |

27 | {% link_url self.link as link_url %} 28 | {% if link_url %} 29 | {{ self.title }} 30 | {% else %} 31 | {{ self.title }} 32 | {% endif %} 33 |

34 | {{ self.desc }} 35 |
36 | {% if extra_classes == "right" %} 37 |
38 | {% link_url self.link as link_url %} 39 | {% if link_url %} 40 | 41 | {% arbitrary_image self.image 'fill' self.fixed_dimensions.width self.fixed_dimensions.height %} 42 | 43 | {% else %} 44 | {% arbitrary_image self.image 'fill' self.fixed_dimensions.width self.fixed_dimensions.height %} 45 | {% endif %} 46 | {% if self.display_caption %} 47 | {% include 'jetstream/image_details.html' with image=self.image parent_block="image-panel-listing" %} 48 | {% endif %} 49 |
50 | {% endif %} 51 |
52 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/image_panel_block-rollover.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | 3 |
4 |
5 | {% link_url self.link as link_url %} 6 | {% if link_url %} 7 | {{ self.title }} 8 | {% endif %} 9 | {% include 'jetstream/blocks/image_panel_block-image_square.html' with image=self.image %} 10 | {% if self.title or self.desc or link_url %} 11 |
12 | {% if self.title %} 13 |
{{ self.title }}
14 | {% endif %} 15 | {% if self.desc %} 16 |
{{ self.desc }}
17 | {% endif %} 18 | {% if link_url %} 19 | Read more... 20 | {% endif %} 21 |
22 | {% endif %} 23 |
24 |
25 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/layout/four_column_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailcore_tags wagtailimages_tags jetstream_tags %} 2 | 3 |
12 |
13 | {% subtract_from_twelve self.column_one_width self.column_two_width self.column_three_width as fill_width %} 14 |
15 | {% for block in self.column_one %} 16 | {% if block.block_type == 'heading' %} 17 |

{{ block.value }}

18 | {% else %} 19 |
20 | {% if parent_width %} 21 | {% width_from_arbitrary_parent parent_width self.column_one_width self.gutter_width as my_width %} 22 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 23 | {% else %} 24 | {% width_from_arbitrary_parent 1000 self.column_one_width self.gutter_width as my_width %} 25 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 26 | {% endif %} 27 |
28 | {% endif %} 29 | {% endfor %} 30 |
31 |
32 | {% for block in self.column_two %} 33 | {% if block.block_type == 'heading' %} 34 |

{{ block.value }}

35 | {% else %} 36 |
37 | {% if parent_width %} 38 | {% width_from_arbitrary_parent parent_width self.column_two_width self.gutter_width as my_width %} 39 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 40 | {% else %} 41 | {% width_from_arbitrary_parent 1000 self.column_two_width self.gutter_width as my_width %} 42 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 43 | {% endif %} 44 |
45 | {% endif %} 46 | {% endfor %} 47 |
48 |
49 | {% for block in self.column_three %} 50 | {% if block.block_type == 'heading' %} 51 |

{{ block.value }}

52 | {% else %} 53 |
54 | {% if parent_width %} 55 | {% width_from_arbitrary_parent parent_width self.column_three_width self.gutter_width as my_width %} 56 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 57 | {% else %} 58 | {% width_from_arbitrary_parent 1000 self.column_three_width self.gutter_width as my_width %} 59 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 60 | {% endif %} 61 |
62 | {% endif %} 63 | {% endfor %} 64 |
65 |
66 | {% for block in self.column_four %} 67 | {% if block.block_type == 'heading' %} 68 |

{{ block.value }}

69 | {% else %} 70 |
71 | {% if parent_width %} 72 | {% width_from_arbitrary_parent parent_width fill_width self.gutter_width as my_width %} 73 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 74 | {% else %} 75 | {% width_from_arbitrary_parent 1000 fill_width self.gutter_width as my_width %} 76 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 77 | {% endif %} 78 |
79 | {% endif %} 80 | {% endfor %} 81 |
82 |
83 |
84 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/layout/sidebar_layout_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailcore_tags wagtailimages_tags jetstream_tags %} 2 | 16 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/layout/three_column_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailcore_tags wagtailimages_tags jetstream_tags %} 2 | 3 |
12 |
13 | {% subtract_from_twelve self.left_column_width self.right_column_width as fill_width %} 14 |
15 | {% for block in self.left_column %} 16 | {% if block.block_type == 'heading' %} 17 |

{{ block.value }}

18 | {% else %} 19 |
20 | {% if parent_width %} 21 | {% width_from_arbitrary_parent parent_width self.left_column_width self.gutter_width as my_width %} 22 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 23 | {% else %} 24 | {% width_from_arbitrary_parent 1000 self.left_column_width self.gutter_width as my_width %} 25 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 26 | {% endif %} 27 |
28 | {% endif %} 29 | {% endfor %} 30 |
31 |
32 | {% for block in self.middle_column %} 33 | {% if block.block_type == 'heading' %} 34 |

{{ block.value }}

35 | {% else %} 36 |
37 | {% if parent_width %} 38 | {% width_from_arbitrary_parent parent_width fill_width self.gutter_width as my_width %} 39 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 40 | {% else %} 41 | {% width_from_arbitrary_parent 1000 fill_width self.gutter_width as my_width %} 42 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 43 | {% endif %} 44 |
45 | {% endif %} 46 | {% endfor %} 47 |
48 |
49 | {% for block in self.right_column %} 50 | {% if block.block_type == 'heading' %} 51 |

{{ block.value }}

52 | {% else %} 53 |
54 | {% if parent_width %} 55 | {% width_from_arbitrary_parent parent_width self.right_column_width self.gutter_width as my_width %} 56 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 57 | {% else %} 58 | {% width_from_arbitrary_parent 1000 self.right_column_width self.gutter_width as my_width %} 59 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 60 | {% endif %} 61 |
62 | {% endif %} 63 | {% endfor %} 64 |
65 |
66 |
67 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/layout/two_column_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailcore_tags wagtailimages_tags jetstream_tags %} 2 | 3 |
12 |
13 | {% subtract_from_twelve self.left_column_width as fill_width %} 14 |
15 | {% for block in self.left_column %} 16 | {% if block.block_type == 'heading' %} 17 |

{{ block.value }}

18 | {% else %} 19 |
20 | {% if parent_width %} 21 | {% width_from_arbitrary_parent parent_width self.left_column_width self.gutter_width as my_width %} 22 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 23 | {% else %} 24 | {% width_from_arbitrary_parent 1000 self.left_column_width self.gutter_width as my_width %} 25 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 26 | {% endif %} 27 |
28 | {% endif %} 29 | {% endfor %} 30 |
31 |
32 | {% for block in self.right_column %} 33 | {% if block.block_type == 'heading' %} 34 |

{{ block.value }}

35 | {% else %} 36 |
37 | {% if parent_width %} 38 | {% width_from_arbitrary_parent parent_width fill_width self.gutter_width as my_width %} 39 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 40 | {% else %} 41 | {% width_from_arbitrary_parent 1000 fill_width self.gutter_width as my_width %} 42 | {% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %} 43 | {% endif %} 44 |
45 | {% endif %} 46 | {% endfor %} 47 |
48 |
49 |
50 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/menu_listing_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags jetstream_tags %} 2 | 3 | 39 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/related_link.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | 3 | {% link_url self.link as url %} 4 | {% if url %} 5 | {{ self.text }} 6 | {% endif %} 7 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/related_links_block.html: -------------------------------------------------------------------------------- 1 | {% load wagtailimages_tags wagtailcore_tags jetstream_tags %} 2 | 3 | 30 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/section_title-block_header.html: -------------------------------------------------------------------------------- 1 |

2 | {{ self.text }} 3 |

4 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/section_title-section_divider.html: -------------------------------------------------------------------------------- 1 |

2 | {{ self.text }} 3 |

4 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/spacer_block.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/blocks/video_block.tpl: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | 3 | {% image_dimensions self.fixed_dimensions parent_width parent_height 1350 759 as dimensions %} 4 |
15 | {% responsive_video self.video.url dimensions.width extra_classes="video-block__video" %} 16 |
17 | {% if self.title %} 18 |
19 |
{{ self.title }}
20 |
21 | {% endif %} 22 |
23 |
24 | -------------------------------------------------------------------------------- /jetstream/templates/jetstream/image_details.html: -------------------------------------------------------------------------------- 1 | {% load jetstream_tags %} 2 | 3 | {% if image.caption or image.photo_credit %} 4 | 5 | {% if image.caption %} 6 | {{ image.caption | custom_bleach:"a,b,i,em,strong,br,sup,sub" }} 7 | {% endif %} 8 | {% if image.photo_credit %} 9 | Credit: {{ image.photo_credit | custom_bleach:"a,b,i,em,strong,br,sup,sub" }} 10 | {% endif %} 11 | 12 | {% endif %} 13 | -------------------------------------------------------------------------------- /jetstream/templates/wagtailadmin/block_forms/struct.html: -------------------------------------------------------------------------------- 1 |
2 | {% if help_text %} 3 |
{{ help_text }}
4 | {% endif %} 5 | 6 |
    7 | {% for child in children.values %} 8 | 9 | {% if child.block.label and not child.block.meta.no_label %} 10 | {{ child.block.label }}: 11 | {% endif %} 12 | {{ child.render_form }} 13 | 14 | {% endfor %} 15 |
16 |
17 | -------------------------------------------------------------------------------- /jetstream/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/caltechads/wagtail-jetstream/f38a817f8d737f80aec497e0567ca2ad94f8732f/jetstream/templatetags/__init__.py -------------------------------------------------------------------------------- /jetstream/templatetags/jetstream_tags.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | import math 3 | import re 4 | import uuid 5 | import bleach 6 | from django import template 7 | from django.utils.safestring import mark_safe 8 | from django_bleach.utils import get_bleach_default_options 9 | from wagtail.embeds.exceptions import EmbedException 10 | from wagtail.models import Page 11 | from wagtail.embeds import embeds 12 | from wagtail.images.models import Filter 13 | from wagtail.images.shortcuts import get_rendition_or_not_found 14 | 15 | register = template.Library() 16 | 17 | PHONE_WIDTH = 768 18 | TABLET_WIDTH = 992 19 | DESKTOP_WIDTH = 1200 20 | # We order these large to small to get sizing rules to order correctly. 21 | VIEWPORT_WIDTHS = [DESKTOP_WIDTH, TABLET_WIDTH, PHONE_WIDTH] 22 | 23 | 24 | @register.simple_tag(name='arbitrary_video') 25 | def arbitrary_video(video, width, height, classes=None): 26 | """ 27 | Renders an embedded video with the given width and height. 28 | 29 | If passed in, 'classes' must be a string of CSS class names. 30 | """ 31 | try: 32 | embed = embeds.get_embed(video.url, width) 33 | html = embed.html 34 | # Replace the calculated height value with what the user specified. 35 | html = re.sub(r'height="(\d+)"', 'height="{}"'.format(height), html) 36 | # Add the provider name as a data attr, so that the javascript can determine how to interact with this iframe. 37 | html = re.sub(r' 2: 83 | return '21x9' 84 | else: 85 | return '16by9' 86 | else: 87 | # Really should not be here but let's charge on 88 | return '16by9' 89 | 90 | 91 | @register.simple_tag(name='responsive_video') 92 | def responsive_video(video_url, width, extra_classes=None): 93 | """ 94 | Renders an embedded video appropriate bootstrap responsive video tags based on a spec ration. See 95 | https://getbootstrap.com/docs/4.1/utilities/embed/ 96 | 97 | If passed in, 'extra_classes' must be a string of CSS class names. 98 | """ 99 | try: 100 | embed = embeds.get_embed(video_url, width) 101 | html = embed.html 102 | # Remove the calculated height and width values 103 | html = re.sub(r' height="(\d+)"', '', html) 104 | html = re.sub(r' width="(\d+)"', '', html) 105 | # Add the provider name as a data attr, so that the javascript can determine how to interact with this iframe. 106 | html = re.sub(r'{}'.format( 131 | " ".join(wrapper_classes), 132 | html) 133 | ) 134 | except EmbedException: 135 | # Silently ignore failed embeds, rather than letting them crash the page. 136 | return '' 137 | 138 | 139 | @register.simple_tag(name='image_dimensions') 140 | def image_dimensions(fixed_dimensions, parent_width, parent_height, default_width=600, default_height=400): 141 | if fixed_dimensions and fixed_dimensions['use']: 142 | return {'width': fixed_dimensions['width'], 'height': fixed_dimensions['height']} 143 | elif parent_height: 144 | return {'width': parent_width, 'height': parent_height} 145 | else: 146 | return {'width': default_width, 'height': default_height} 147 | 148 | 149 | @register.tag(name='responsive_image') 150 | def responsive_image(parser, token): 151 | """ 152 | Usage: {% responsive_image self.image __MODE__ __WIDTH__ __HEIGHT__ [ custom-attr="value" ... ] %} 153 | {% responsive_image self.image __MODE__ __DIMENSION__ [ custom-attr="value" ... ] %} 154 | 155 | This tag works just like arbitrary_image, but generates a tag with a few responsive s, instead of 156 | an tag. Because more than one rendition is generated, using the "as var_name" functionality would be 157 | ambiguous, so {% responsive_image %} doesn't support it. 158 | """ 159 | return parse_image_tag('responsive_image', parser, token, ResponsiveImageNode) 160 | 161 | 162 | class ImageNode(template.Node): 163 | 164 | def __init__(self, image_expr, mode_expr, width_expr=None, height_expr=None, output_var_name=None, attrs=None): 165 | self.image_expr = image_expr 166 | self.mode_expr = mode_expr 167 | self.width_expr = width_expr 168 | self.height_expr = height_expr 169 | self.output_var_name = output_var_name 170 | self.attrs = attrs or {} 171 | 172 | def render(self, context): 173 | raise NotImplementedError 174 | 175 | 176 | class ResponsiveImageNode(ImageNode): 177 | 178 | def render(self, context): 179 | try: 180 | image = self.image_expr.resolve(context) 181 | mode = self.mode_expr.resolve(context) 182 | # We call abs() just in case the user set one of the dimensions to a negative number. 183 | width = abs(int(self.width_expr.resolve(context))) if self.width_expr else 1 184 | height = abs(int(self.height_expr.resolve(context))) if self.height_expr else 1 185 | except template.VariableDoesNotExist: 186 | return '' 187 | 188 | if not image: 189 | return '' 190 | 191 | # Build a filter spec based on the specified mode, height, and width for the base rendition. 192 | if mode == 'width': 193 | base_spec = "width-{}".format(width) 194 | elif mode == 'height': 195 | base_spec = "height-{}".format(height) 196 | else: 197 | base_spec = "{}-{}x{}-c100".format(mode, width, height) 198 | base_rendition = get_rendition_or_not_found(image, Filter(spec=base_spec)) 199 | 200 | # Build the fallback tag for browsers that don't support . 201 | custom_attrs = {attr_name: expression.resolve(context) for attr_name, expression in self.attrs.items()} 202 | img_tag = base_rendition.img_tag(custom_attrs) 203 | 204 | # If the image is wider than a phone, add an additional, smaller rendition with the same aspect ratio. 205 | small_width = 425 206 | # Two notes here: 207 | # 1) We used 'from __future__ import division' to make this use floating point division. 208 | # 2) Filter specs don't accept floats, so we need to cast back to int at the end. 209 | small_height = int(height * (small_width / width)) 210 | if mode == 'width': 211 | small_spec = "width-{}".format(small_width) 212 | else: 213 | # TODO: If the mode is 'height', this might not look right. I'm not really sure, though. 214 | small_spec = "fill-{}x{}-c100".format(small_width, small_height) 215 | small_rendition = get_rendition_or_not_found(image, Filter(spec=small_spec)) 216 | 217 | return """ 218 | 219 | 220 | 221 | {img_tag} 222 | 223 | """.format(img_tag=img_tag, full=base_rendition, small=small_rendition) 224 | 225 | 226 | class ArbitraryImageNode(ImageNode): 227 | 228 | def render(self, context): 229 | try: 230 | image = self.image_expr.resolve(context) 231 | mode = self.mode_expr.resolve(context) 232 | # We call abs() just in case the user set one of the dimensions to a negative number. 233 | width = abs(int(self.width_expr.resolve(context))) if self.width_expr else 0 234 | height = abs(int(self.height_expr.resolve(context))) if self.height_expr else 0 235 | except template.VariableDoesNotExist: 236 | return '' 237 | 238 | if not image: 239 | return '' 240 | 241 | # Build a filter spec based on the specified mode, height, and width for the base rendition. 242 | if mode == 'width': 243 | spec = "width-{}".format(width) 244 | elif mode == 'height': 245 | spec = "height-{}".format(height) 246 | else: 247 | spec = "{}-{}x{}-c100".format(mode, width, height) 248 | rendition = get_rendition_or_not_found(image, Filter(spec=spec)) 249 | 250 | if self.output_var_name: 251 | # Save the rendition into the context, instead of outputting a tag. 252 | context[self.output_var_name] = rendition 253 | return '' 254 | else: 255 | # Resolve custom attrs to their value in this context, then print them within this rendition's tag. 256 | custom_attrs = {attr_name: expression.resolve(context) for attr_name, expression in self.attrs.items()} 257 | return rendition.img_tag(custom_attrs) 258 | 259 | 260 | @register.simple_tag() 261 | def subtract_from_twelve(*numbers): 262 | """ 263 | Math tag for calculating the width in Bootstrap's column delineations because we can't do arithmetic 264 | in Django templates. 265 | """ 266 | return 12 - sum(int(x) for x in numbers) 267 | 268 | 269 | @register.simple_tag() 270 | def width_from_arbitrary_parent(parent_px, number_of_column_units, gutter_width): 271 | """ 272 | Math tag for calculating the pixel width of certain column blocks because we can't do arithmetic 273 | within Django templates. 274 | 275 | Here's how the math logic works: 276 | The actual parent column is (parent_px + gutter_width) wide, due to the negative margins that pull in the left-most 277 | and right-most gutter padding. So each unit of width within the column is (parent_px + gutter_width) / 12.0. 278 | We then multiply the unit width by the specified number of columns units, and subtract the gutter width to account 279 | for the column's padding. 280 | Finally, we ceil() the width value because Wagtail doesn't render derivatives with partial pixel widths. If we 281 | didn't do this, a three-column row with no padding would have one single pixel of whitespace between two of the 282 | images due to the images being only 333px wide. By sizing them up to 334, and then relying on the column layout's 283 | "overflow: hidden" CSS, we get rid of the white pixel. 284 | """ 285 | single_unit_of_column_width = (parent_px + gutter_width) / 12.0 286 | width_of_column = (single_unit_of_column_width * number_of_column_units) - gutter_width 287 | return math.ceil(width_of_column) 288 | 289 | 290 | @register.simple_tag() 291 | def link_url(block): 292 | """ 293 | Accessory tag to our LinkBlock sub component that returns the linked page if it exists, or the linked document, or 294 | the URL. If none are specified, returns None. 295 | """ 296 | if block.get('page'): 297 | return block['page'].get_url_parts()[2] 298 | elif block.get('document'): 299 | return block['document'].url 300 | elif block.get('url'): 301 | return block['url'] 302 | else: 303 | return None 304 | 305 | 306 | @register.simple_tag() 307 | def page_descendants(page, only_published=True): 308 | queryset = Page.objects.child_of(page) 309 | if only_published: 310 | queryset = queryset.live() 311 | return queryset 312 | 313 | 314 | @register.simple_tag() 315 | def page_siblings(page, only_published=True): 316 | # Results don't include itself, so need to add a non-hyperlink dummy listing 317 | queryset = page.get_siblings(inclusive=True) 318 | if only_published: 319 | queryset = queryset.live() 320 | return queryset 321 | 322 | 323 | @register.simple_tag() 324 | def relative_url(page): 325 | # Results don't include itself, so need to add a non-hyperlink dummy listing 326 | site_id, root_url, page_path = page.get_url_parts() 327 | return page_path 328 | 329 | @register.simple_tag(takes_context=True) 330 | def get_gallery_image_width(context): 331 | parent_width = context.get('parent_width', None) 332 | if parent_width is None: 333 | parent_width = 1000 334 | 335 | number_of_gutters = context['self']['columns'] - 1 336 | available_pixels = parent_width - (12 * number_of_gutters) 337 | return available_pixels / context['self']['columns'] 338 | 339 | 340 | @register.simple_tag() 341 | def generate_unique_id(): 342 | """ 343 | Used by the carousel block templates to generate unique IDs when they can't get one from the block itself. 344 | """ 345 | unique_id = uuid.uuid4() 346 | return unique_id 347 | 348 | 349 | @register.filter(name='custom_bleach') 350 | def custom_bleach(value, allowed_tags): 351 | """ 352 | Works just like the 'bleach' tempalte filter, but takes an argument of a comma-separated string of the tags that 353 | should be allowed through the filter. This list of tags *overrides* the list in the settings, so be thorough. 354 | """ 355 | # Use the bleach_args built from the settings, but replace the 'tags' arg with the supplied comma-separated list. 356 | bleach_args = get_bleach_default_options() 357 | kwargs = dict(**bleach_args) 358 | kwargs['tags'] = [tag.strip() for tag in allowed_tags.split(',')] 359 | bleached_value = bleach.clean(value, **kwargs) 360 | return mark_safe(bleached_value) 361 | 362 | 363 | # --------------- 364 | # UTIL FUNCTIONS 365 | # --------------- 366 | def parse_image_tag(tag_name, parser, token, node_class): 367 | """ 368 | Send this function the name of the tag it's parsing for, the arguments to the tag function, and the class of 369 | ImageNode that you want to be constructed from the parsed data. 370 | """ 371 | bits = token.split_contents()[1:] 372 | image_expr = parser.compile_filter(bits[0]) 373 | mode_expr = parser.compile_filter(bits[1]) 374 | 375 | # The mode comes in as a string like "'width'", so we need to strip the surrounding quotes. 376 | mode_string = bits[1].strip("\"\'") 377 | if mode_string == 'width': 378 | # The width mode has only one dimension argument. 379 | width_expr = parser.compile_filter(bits[2]) 380 | height_expr = None 381 | # The leftovers are custom-attrs and the "as var" code, if they exist. 382 | leftovers = bits[3:] 383 | elif mode_string == 'height': 384 | # The width mode has only one dimension argument. 385 | width_expr = None 386 | height_expr = parser.compile_filter(bits[2]) 387 | leftovers = bits[3:] 388 | else: 389 | # Other modes take two dimension arguments: width, then height. 390 | width_expr = parser.compile_filter(bits[2]) 391 | height_expr = parser.compile_filter(bits[3]) 392 | leftovers = bits[4:] 393 | 394 | attrs = {} 395 | output_var_name = None 396 | # If True, the next bit to be read is the output variable name. 397 | as_context = False 398 | # Set to False if any invalid formatting is detected. 399 | is_valid = True 400 | 401 | # Defined here because the same exception is used multiple times. 402 | error = template.TemplateSyntaxError( 403 | """ 404 | '{0}' tag should be of the form 405 | {{% {0} self.photo 'max' 320 200 [ custom-attr="value" ... ] %}} or 406 | {{% {0} self.photo 'max' 320 200 as img %}} or 407 | {{% {0} self.photo 'width' 320 as img %}}. 408 | You CANNOT use both custom-attr="value" and 'as img'! 409 | """.format(tag_name) 410 | ) 411 | 412 | for bit in leftovers: 413 | if bit == 'as': 414 | # Indicate that 'token' is of the form {% arbitrary_image self.photo 'max' 320 200 as img %} 415 | as_context = True 416 | elif as_context: 417 | if output_var_name is None: 418 | output_var_name = bit 419 | else: 420 | # More than one item exists after 'as' - reject as invalid. 421 | is_valid = False 422 | else: 423 | try: 424 | name, value = bit.split('=') 425 | # Resolve context variables as value. 426 | attrs[name] = parser.compile_filter(value) 427 | except ValueError: 428 | raise error 429 | 430 | if as_context and output_var_name is None: 431 | # Context was introduced but no variable given, which is invalid. 432 | is_valid = False 433 | 434 | if output_var_name and attrs: 435 | # Extra attrs are not valid when using the 'as img' form of the tag, because we can't include them in the 436 | # returned Rendition object. 437 | is_valid = False 438 | 439 | if is_valid: 440 | return node_class( 441 | image_expr, mode_expr, width_expr, height_expr, output_var_name=output_var_name, attrs=attrs 442 | ) 443 | else: 444 | raise error 445 | -------------------------------------------------------------------------------- /jetstream/utils.py: -------------------------------------------------------------------------------- 1 | def get_block_tuple(block_inst): 2 | """ 3 | Returns the canned block tuple for use in StreamField and StreamBlock definitions (but NOT in StructBlocks!). 4 | We use this everywhere so that our code consistently generates the same tuple at every organiziational level. 5 | """ 6 | try: 7 | return block_inst.get_block_tuple() 8 | except AttributeError: 9 | # If the block instance hasn't got a get_block_tuple() method, build the default tuple. 10 | return (block_inst.__class__.__name__, block_inst) 11 | 12 | 13 | class BlockTupleMixin(object): 14 | """ 15 | All our custom block classes need to mixin this class so that our code consistently generates the same tuple at 16 | every organiziational level (e.g. the Page.body level and the TwoColumnBlock level). 17 | 18 | Classes that need to use a custom string for their block tuple (e.g. TwoColumnBlock and BaseTwoColumnSubblock, which 19 | both need the same tuple) can override get_block_tuple(). 20 | """ 21 | 22 | @classmethod 23 | def get_block_machine_name(cls): 24 | return cls.__name__ 25 | 26 | def get_block_tuple(self): 27 | return (self.__class__.__name__, self) 28 | 29 | 30 | # Used for the "choices" param on StreamField blocks that can list a variable 31 | # number of items 32 | SHOW_CHOICES = [ 33 | (2, 2), 34 | (3, 3), 35 | (4, 4), 36 | (5, 5), 37 | (6, 6), 38 | (7, 7), 39 | (10, 10), 40 | (15, 15), 41 | (20, 20), 42 | (25, 25), 43 | ] 44 | 45 | BACKGROUND_COLORS = [ 46 | (None, 'Transparent'), 47 | ('white', 'White'), 48 | ('black', 'Black'), 49 | ('orange', 'Orange'), 50 | ('ltgray', 'Light Gray'), 51 | ('midgray', 'Mid Gray'), 52 | ('darkergray', 'Dark Gray'), 53 | ('dkgray', 'Very Dark Gray'), 54 | ('olivegreen', 'Olive Green'), 55 | ('purple', 'Purple'), 56 | ('darkteal', 'Dark Teal'), 57 | ] 58 | 59 | FOREGROUND_COLORS = [ 60 | (None, 'Default'), 61 | ('dkgray', 'Dark Gray'), 62 | ('black', 'Black'), 63 | ('white', 'White') 64 | ] 65 | -------------------------------------------------------------------------------- /jetstream/wagtail_hooks.py: -------------------------------------------------------------------------------- 1 | from django.utils.html import format_html 2 | from django.templatetags.static import static 3 | from sass_processor.processor import sass_processor 4 | 5 | from wagtail import hooks 6 | 7 | 8 | @hooks.register('insert_global_admin_css') 9 | def global_admin_css(): 10 | return format_html('', sass_processor('jetstream/css/admin.scss')) 11 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length: 120 3 | filename: *.py 4 | exclude: *.cfg, *.js, *.json, *.bak, *.md, *.sql, *.sh, *.txt, *.yml, simple_test_db, Makefile, Dockerfile, MANIFEST.in 5 | # E221: multiple spaces before operator 6 | # E241: multiple spaces after : 7 | # E265: block comment should start with '# ' 8 | # E266: too many leading '#' for block comment 9 | # E401: multiple imports on one line 10 | ignore = E221,E241,E265,E266,E401 11 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='wagtail-jetstream', 5 | version='2.3.0', 6 | description='A set of complex layout blocks for use in Wagtail Streamfields.', 7 | url='https://github.com/caltechads/wagtail-jetstream', 8 | author='Caltech ADS', 9 | author_email='imss-ads@caltech.edu', 10 | license='GPL-3.0', 11 | install_requires=['django-bleach>=0.3.0'], 12 | classifiers=[ 13 | "Environment :: Web Environment", 14 | "Framework :: Django", 15 | "Programming Language :: Python", 16 | "Programming Language :: Python 2.7", 17 | "Programming Language :: Python 3.6", 18 | "Topic :: Internet :: WWW/HTTP", 19 | "Topic :: Internet :: WWW/HTTP :: Dynamic Content", 20 | ], 21 | ) 22 | --------------------------------------------------------------------------------