You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The CellJS adapter no longer accepts a `closing_tag` attribute as added in the
10
+
previous release. The CellJS adapter no automatically closes self closing tags
11
+
(#31)
12
+
1
13
# v0.0.8
14
+
2
15
## Changed
3
-
- Use Phoenix.content_tag instead of Phoenix.tag by default and add option to remove the closing tag by adding `closing_tag: false` to the options (#27)
4
-
- The attribute name is now used to set the `data-cell` attribute and can be overridden to allow prefixing (#28)
16
+
17
+
* Use Phoenix.content_tag instead of Phoenix.tag by default and add option to
18
+
remove the closing tag by adding `closing_tag: false` to the options (#27)
19
+
* The attribute name is now used to set the `data-cell` attribute and can be
20
+
overridden to allow prefixing (#28)
5
21
6
22
# v0.0.7
23
+
7
24
## Changed
8
-
- Added a cell render method to ExCell.Controller to directly render cells as a view (#23)
25
+
26
+
* Added a cell render method to ExCell.Controller to directly render cells as a
27
+
view (#23)
9
28
10
29
## Fixed
11
-
- Removed unused Base alias in `lib/ex_cell/base.ex` (#22)
30
+
31
+
* Removed unused Base alias in `lib/ex_cell/base.ex` (#22)
12
32
13
33
# v0.0.6
14
34
15
35
## Changed
16
-
- Updated `README.md` with more elaborate examples and install instructions (#19)
17
-
- Removed the need for a `MockCellAdapter` in tests (#18)
18
-
- Restructured the code to allow documentation (#18)
36
+
37
+
* Updated `README.md` with more elaborate examples and install instructions
38
+
(#19)
39
+
* Removed the need for a `MockCellAdapter` in tests (#18)
40
+
* Restructured the code to allow documentation (#18)
19
41
20
42
## Removed
21
-
- The option to provide a `MockCellAdapter` in the configuration (#18)
43
+
44
+
* The option to provide a `MockCellAdapter` in the configuration (#18)
22
45
23
46
# v0.0.5
24
47
25
48
## Changed
26
-
- Cell module didn't use a fallback adapter for the `__using__` macro (#16)
27
-
- Added back the `View.relative_path` method (#15)
49
+
50
+
* Cell module didn't use a fallback adapter for the `__using__` macro (#16)
51
+
* Added back the `View.relative_path` method (#15)
28
52
29
53
# v0.0.4
30
54
31
55
## Changed
32
-
- Fixed a bug where the Mix configuration wasn't allowing empty configurations (#13)
56
+
57
+
* Fixed a bug where the Mix configuration wasn't allowing empty configurations
58
+
(#13)
33
59
34
60
# v0.0.3
35
61
36
62
## Added
37
-
- Adapters can are now in a `config.ex` (#10)
63
+
64
+
* Adapters can are now in a `config.ex` (#10)
38
65
39
66
## Changed
40
-
- Removed the need to specify an adapter for views and controllers (#10)
41
-
- ExCell.Controller is imported instead of using the `__using__` macro (#10)
67
+
68
+
* Removed the need to specify an adapter for views and controllers (#10)
69
+
* ExCell.Controller is imported instead of using the `__using__` macro (#10)
42
70
43
71
## Removed
44
-
- It's no longer possible to specify the adapter through the `__using__` Macro (#10)
72
+
73
+
* It's no longer possible to specify the adapter through the `__using__` Macro
A module for creating coupled modules of CSS, Javascript and Views in Phoenix
6
7
7
8
## Installation
8
9
9
10
Add the following to the dependencies in `mix.exs`
11
+
10
12
```ex
11
-
{:ex_cell, "~> 0.0.8"}
13
+
{:ex_cell, "~> 0.0.9"}
12
14
```
13
15
14
16
In Phoenix 1.3.0+ add the following to `lib/app_web/web.ex`:
15
17
16
18
```ex
17
-
18
19
defcontrollerdo
19
20
quotedo
20
21
...
@@ -37,7 +38,8 @@ end
37
38
38
39
defcell(opts \\ []) do
39
40
quotedo
40
-
useExCell.Cell, namespace:AppWeb
41
+
useExCell.Cell, namespace:AppWeb,
42
+
adapter:ExCell.Adapters.CellJS
41
43
42
44
usePhoenix.View, root:"lib/app_web/cells",
43
45
path:ExCell.View.relative_path(__MODULE__AppWeb)
@@ -55,12 +57,16 @@ def cell(opts \\ []) do
55
57
end
56
58
```
57
59
58
-
Now you can add a cells/ directory in lib/app_web and place cells in that directory.
60
+
Now you can add a cells/ directory in lib/app_web and place cells in that
61
+
directory.
59
62
60
-
Every cell should contain a view.ex and a template.html.eex. The view and template are tightly linked together by the Cell.
63
+
Every cell should contain a view.ex and a template.html.eex. The view and
64
+
template are tightly linked together by the Cell.
61
65
62
66
## CSS
63
-
To ensure all the CSS can be placed next to your cell you need to add the following to your `brunch-config.js`:
67
+
68
+
To ensure all the CSS can be placed next to your cell you need to add the
69
+
following to your `brunch-config.js`:
64
70
65
71
```js
66
72
...
@@ -75,10 +81,15 @@ stylesheets: {
75
81
...
76
82
```
77
83
78
-
If you use something other than `brunch` to manage your assets, you need to add the files to the assets manager of choice.
84
+
If you use something other than `brunch` to manage your assets, you need to add
85
+
the files to the assets manager of choice.
79
86
80
87
## Javascript
81
-
If you wish to use the accompanying `cell-js` library you can install [cell-js](https://github.com/DefactoSoftware/cells-js) with your package manager. After you installed the Javascript package, add the following to your `brunch-config.js`:
88
+
89
+
If you wish to use the accompanying `cell-js` library you can install
90
+
[cell-js](https://github.com/DefactoSoftware/cells-js) with your package
91
+
manager. After you installed the Javascript package, add the following to your
92
+
`brunch-config.js`:
82
93
83
94
```js
84
95
...
@@ -94,9 +105,10 @@ javascripts: {
94
105
...
95
106
```
96
107
97
-
98
108
## Usage
109
+
99
110
A cell consists of a couple of files:
111
+
100
112
```
101
113
cells
102
114
|- avatar
@@ -108,7 +120,9 @@ cells
108
120
...
109
121
```
110
122
111
-
You can render the cell in a view, controller or another cell by adding the following code:
123
+
You can render the cell in a view, controller or another cell by adding the
@@ -121,10 +135,12 @@ This would generate the following HTML when you render the cell:
121
135
</span>
122
136
```
123
137
124
-
125
138
### view.ex
126
139
127
-
Views of cells behave like normal views in Phoenix, except that they have provide a container method that can be used in a template to render the appropiate HTML needed to initialize the Javascript for a cell and have a predefined class that is the same as the cell name minus the namespace.
140
+
Views of cells behave like normal views in Phoenix, except that they have
141
+
provide a container method that can be used in a template to render the
142
+
appropiate HTML needed to initialize the Javascript for a cell and have a
143
+
predefined class that is the same as the cell name minus the namespace.
128
144
129
145
```ex
130
146
# lib/app_web/cell/avatar/view.ex
@@ -154,7 +170,9 @@ end
154
170
```
155
171
156
172
### template.html.eex
157
-
The template behave like any other template in Phoenix except that they have access to a container method to render the appropiate cell HTML container:
173
+
174
+
The template behave like any other template in Phoenix except that they have
175
+
access to a container method to render the appropiate cell HTML container:
@@ -166,7 +184,11 @@ The template behave like any other template in Phoenix except that they have acc
166
184
```
167
185
168
186
### style.css
169
-
This can be any type of CSS file that you wish (preprocessed or other wise). Because cells provides methods to namespace your CSS you are advised to use a similar namespace or use something like `postcss-modules` to ensure all classses defined are unique.
187
+
188
+
This can be any type of CSS file that you wish (preprocessed or other wise).
189
+
Because cells provides methods to namespace your CSS you are advised to use a
190
+
similar namespace or use something like `postcss-modules` to ensure all classses
191
+
defined are unique.
170
192
171
193
```css
172
194
.AvatarCell {
@@ -182,18 +204,19 @@ This can be any type of CSS file that you wish (preprocessed or other wise). Bec
182
204
```
183
205
184
206
### index.js
185
-
If you use `cells-js` you can create Javascript that is tightly coupled to the cell.
207
+
208
+
If you use `cells-js` you can create Javascript that is tightly coupled to the
0 commit comments