This repository has been archived by the owner on Feb 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented basic variants of list group as includable template
- Loading branch information
1 parent
76ba08d
commit 36b91a8
Showing
9 changed files
with
171 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% load bootstrap_ui_tags %} | ||
|
||
{% if type == 'list' %} | ||
{% listgroup %} | ||
{% for text in items %} | ||
{% listgroupitem %} | ||
{{ text }} | ||
{% endlistgroupitem %} | ||
{% endfor %} | ||
{% endlistgroup %} | ||
{% elif type == 'linklist' %} | ||
{% listgroup use_tag='div' %} | ||
{% for text, url in items %} | ||
{% with link=url|default:'#' %} | ||
{% listgroupitem use_tag='a' link=link %} | ||
{{ text }} | ||
{% endlistgroupitem %} | ||
{% endwith %} | ||
{% endfor %} | ||
{% endlistgroup %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Bootstrap component templates | ||
============================= | ||
|
||
Render complete Bootstrap components by including our default implementations. | ||
|
||
List group | ||
---------- | ||
|
||
This template (``listgroup.html``) renders a list group. Two parameters are required: | ||
|
||
* type | ||
* items | ||
|
||
Basic example | ||
************* | ||
|
||
Given a list of strings ``['alpha', 'beta', 'gamma']`` as template variable ``items``: | ||
|
||
.. code:: Django | ||
{% include 'bootstrap_ui/listgroup.html' with type='list' items=items only %} | ||
This renders the following html code: | ||
|
||
.. code:: HTML | ||
|
||
<ul class="list-group"> | ||
<li class="list-group-item"> | ||
alpha | ||
</li> | ||
<li class="list-group-item"> | ||
beta | ||
</li> | ||
<li class="list-group-item"> | ||
gamma | ||
</li> | ||
</ul> | ||
|
||
Linked items | ||
************ | ||
|
||
Given a list of 2-tuples containing ``[('alpha', 'http://example.org'), ('beta', 'local.html'), ('gamma', '#')]`` as template variable ``items``: | ||
|
||
.. code:: Django | ||
{% include 'bootstrap_ui/listgroup.html' with type='linklist' items=items only %} | ||
This renders the following html code: | ||
|
||
.. code:: HTML | ||
|
||
<div class="list-group"> | ||
<a class="list-group-item" href="http://example.org"> | ||
alpha | ||
</a> | ||
<a class="list-group-item" href="local.html"> | ||
beta | ||
</a> | ||
<a class="list-group-item" href="#"> | ||
gamma | ||
</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
Templates | ||
========= | ||
|
||
django-bootstrap-ui enables you to quickly get started through a set of predefined templates. | ||
django-bootstrap-ui enables you to quickly get started through a set of predefined templates. There are two sort of templates: | ||
|
||
#. :doc:`skeletons/index` | ||
|
||
These templates render entire html pages. They are meant to serve as base templates to be extended and provide HTML5 and Bootstrap skeletons. | ||
|
||
#. :doc:`components/index` | ||
|
||
These templates encapsulate Bootstrap components. Included and parameterized as a one-liner within your page templates they will return completely rendered UI components. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
skeletons/index | ||
components/index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
{% load bootstrap_ui_tags %} | ||
|
||
{% listgroup %} | ||
{% listgroupitem %} | ||
{{ content }} | ||
{% endlistgroupitem %} | ||
{% endlistgroup %} | ||
{% if not items %} | ||
{% listgroup %} | ||
{% listgroupitem %} | ||
{{ content }} | ||
{% endlistgroupitem %} | ||
{% endlistgroup %} | ||
|
||
{% if use_tag == 'a' %} | ||
{% listgroupitem use_tag=use_tag link=link %} | ||
{{ label }} | ||
{% endlistgroupitem %} | ||
{% endif %} | ||
{% if use_tag == 'a' %} | ||
{% listgroupitem use_tag=use_tag link=link %} | ||
{{ label }} | ||
{% endlistgroupitem %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% include 'bootstrap_ui/listgroup.html' with type=type items=items only %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters