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
2. Run the `bundle install` command to install the gem:
40
+
```bash
41
+
bundle install
42
+
```
43
+
44
+
3. Generate the necessary resources and controllers by running:
45
+
```bash
46
+
rails generate avo:kanban install
47
+
```
48
+
49
+
This command will create pre-configured resources and controllers for managing boards, columns, and items in your application. You can further customize the generated code to suit your needs.
50
+
51
+
This command will also generate the item's partial and a migration.
52
+
53
+
4. Run the migration to apply the database changes:
@@ -54,8 +82,6 @@ We can configure what kind of resources can be added to the board.
54
82
55
83
Similar we can change the column names and the value from the settings screen.
56
84
57
-
Only the admins (`user.is_admin?`) can see the setting button and screen.
58
-
59
85
## Adding items to the board
60
86
61
87
This is best done on the board. Under each column you'll find the new field. This will search throught the resources that you've selected in the configuration.
@@ -107,12 +133,12 @@ Now, if we move the item to the `In progress` column, it will change the status
107
133
### Items without that property
108
134
109
135
Some models might belong on the same board but have different properties to show the status.
110
-
Some omodels might use a timestamp like `published_at` to show the status.
136
+
Somemodels might use a timestamp like `published_at` to show the status.
111
137
Or some models might belong to a a status but that isn't dictated by a single property but a collection of properties.
112
138
113
-
In order to mititgate that we can create virtual properties on the model.
139
+
In order to mitigate that we can create virtual properties on the model.
114
140
115
-
Let's imagine that a new baord that displays the posts in columns based on their "published" status. the board uses the `status` property to but the `Post` model doesn't have the `status` property as a column in the database.
141
+
Let's imagine that a newboard that displays the posts in columns based on their "published" status. the board uses the `status` property to but the `Post` model doesn't have the `status` property as a column in the database.
116
142
We can create a virtual property on the model.
117
143
118
144
```ruby
@@ -157,3 +183,34 @@ In order to customize the card, you can add this partial to your `app/views/avo/
157
183
```
158
184
159
185
The `item` is the `Avo::Kanban::Item` and the `record` is the actual record from the database.
186
+
187
+
## Authorization
188
+
189
+
This section assumes that you have already set up [authorization](authorization.html) in your application using Pundit.
190
+
191
+
1. Generate a policy for the `Board` resource by running:
192
+
```bash
193
+
rails generate pundit:policy board
194
+
```
195
+
196
+
### Authorization Methods
197
+
198
+
You can control access to various parts of the Kanban board by defining the following methods in your `BoardPolicy`:
199
+
200
+
- `manage_column?`
201
+
202
+
Controls the visibility of the three-dot menu on each column (used for column management).
203
+
204
+
- `edit?`
205
+
206
+
Controls the "Edit board" button on the board itself.
207
+
:::warning
208
+
Also controls the ability to edit the board in the resource view.
209
+
:::
210
+
211
+
- `add_item?`
212
+
213
+
Controls the visibility of the "Add item" button on the board, which allows users to add new items to a column.
214
+
:::warning
215
+
Doesn't impact the ability to add items via the bottom of each column.
0 commit comments