Skip to content

Commit aee70a7

Browse files
committed
rename idom_view to idom_component
1 parent 536968a commit aee70a7

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ def Hello(greeting_recipient): # component names are camelcase by convention
151151
## `example_app/templates/your-template.html`
152152

153153
In your templates, you may inject a view of an IDOM component into your templated HTML
154-
by using the `idom_view` template tag. This tag which requires the name of a component
154+
by using the `idom_component` template tag. This tag which requires the name of a component
155155
to render (of the form `module_name.ComponentName`) and keyword arguments you'd like to
156156
pass it from the template.
157157

158158
```python
159-
idom_view module_name.ComponentName param_1="something" param_2="something-else"
159+
idom_component module_name.ComponentName param_1="something" param_2="something-else"
160160
```
161161

162162
In context this will look a bit like the following...
@@ -170,7 +170,7 @@ In context this will look a bit like the following...
170170
<html>
171171
<body>
172172
...
173-
{% idom_view "your_app.example_app.components.Hello" greeting_recipient="World" %}
173+
{% idom_component "your_app.example_app.components.Hello" greeting_recipient="World" %}
174174
</body>
175175
</html>
176176
```

src/django_idom/templates/idom/view.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
mountPoint,
88
"{{ idom_websocket_url }}",
99
"{{ idom_web_modules_url }}",
10-
"{{ idom_view_id }}",
11-
"{{ idom_view_params }}"
10+
"{{ idom_component_id }}",
11+
"{{ idom_component_params }}"
1212
);
1313
</script>

src/django_idom/templatetags/idom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
@register.inclusion_tag("idom/view.html")
20-
def idom_view(_component_id_, **kwargs):
20+
def idom_component(_component_id_, **kwargs):
2121
_register_component(_component_id_)
2222

2323
json_kwargs = json.dumps(kwargs, separators=(",", ":"))
@@ -26,8 +26,8 @@ def idom_view(_component_id_, **kwargs):
2626
"idom_websocket_url": IDOM_WEBSOCKET_URL,
2727
"idom_web_modules_url": IDOM_WEB_MODULES_URL,
2828
"idom_mount_uuid": uuid4().hex,
29-
"idom_view_id": _component_id_,
30-
"idom_view_params": urlencode({"kwargs": json_kwargs}),
29+
"idom_component_id": _component_id_,
30+
"idom_component_params": urlencode({"kwargs": json_kwargs}),
3131
}
3232

3333

tests/test_app/templates/base.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515

1616
<body>
1717
<h1>IDOM Test Page</h1>
18-
<div>{% idom_view "test_app.components.HelloWorld" %}</div>
19-
<div>{% idom_view "test_app.components.Button" %}</div>
18+
<div>{% idom_component "test_app.components.HelloWorld" %}</div>
19+
<div>{% idom_component "test_app.components.Button" %}</div>
2020
<div>
21-
{% idom_view "test_app.components.ParametrizedComponent" x=123 y=456 %}
21+
{% idom_component "test_app.components.ParametrizedComponent" x=123 y=456
22+
%}
2223
</div>
23-
<div>{% idom_view "test_app.components.SimpleBarChart" %}</div>
24+
<div>{% idom_component "test_app.components.SimpleBarChart" %}</div>
2425
</body>
2526
</html>

0 commit comments

Comments
 (0)