Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge new version #3

Open
wants to merge 150 commits into
base: new_kaffy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
6172cea
include search support for id, integer, and decimal fields.
aesmail Nov 3, 2021
a2601f4
Support hiding menu entries
pirvudoru Sep 16, 2022
0fce480
Update phoenix_html
Feb 22, 2023
37d369e
Update edit form
Feb 22, 2023
855b4e2
Fix complition error
Feb 23, 2023
c34e086
Fix delete form also
Feb 23, 2023
b99e145
Fix delete form
Feb 23, 2023
3f7d8de
fix changeset errors
kelostrada Mar 13, 2023
38a89d3
add missing cases for delete and update
kelostrada Mar 13, 2023
36b210c
Updated readme
drobban Mar 23, 2023
36bdb99
additional update in readme
drobban Mar 23, 2023
db633a2
Document running Kaffy with Phoenix 1.7
aesmail Apr 10, 2023
44dbb56
Switch to ubuntu-20.04 in our CI to get OTP 21 back as per https://gi…
ghenry Apr 17, 2023
101c2ee
Add a statement to our README.md regarding what minimum version of El…
ghenry Apr 17, 2023
68a0875
Merge pull request #262 from kelostrada/bugfix/proper-errors-display
ghenry Apr 17, 2023
ccc5f7d
Merge pull request #248 from reasig/resource-visibility-support
ghenry Apr 17, 2023
506e9e5
Merge pull request #260 from reasig/update-phoenix-html
ghenry Apr 17, 2023
4636a84
Add latest 3 pull requests to Unreleased section of CHANGELOG.md
ghenry Apr 17, 2023
497e06c
preload resources before trying to convert resource to existing atom.
aesmail Apr 17, 2023
519a11f
lazy load default kaffy field value
kelostrada Dec 2, 2022
cdcfb2b
Merge pull request #255 from kelostrada/bugfix/default-field-value-la…
ghenry Apr 18, 2023
1fb73ed
PR https://github.com/aesmail/kaffy/pull/255 added to CHANGELOG.md
ghenry Apr 18, 2023
3af57c3
Merge pull request #266 from aesmail/fix-nonexisting-atom
ghenry Apr 18, 2023
bfb7a28
Add https://github.com/aesmail/kaffy/pull/266 to CHANGELOG.md
ghenry Apr 18, 2023
3de3581
use schema primary keys
nullpilot Sep 6, 2020
0a61076
use serialized id in templates
nullpilot Sep 6, 2020
eabd4fe
support list actions
nullpilot Apr 27, 2023
e74ba6c
change serialize separator to ":"
nullpilot Apr 27, 2023
1bb1780
add ETF example to serialize_id docs
nullpilot Apr 27, 2023
2c7f426
let specify the full 'path' for FontAwesome fonts
manuel-rubio Nov 30, 2020
4c92f34
fix custom_link to use custom_link.full_icon
manuel-rubio Dec 22, 2020
2be0b2c
add empty root layout (Phoenix 1.6)
manuel-rubio Jan 26, 2022
ebb81bf
ensure the extension module is loaded
manuel-rubio Jan 26, 2022
968ce96
removing scaffolding test for a module which does nothing
manuel-rubio Apr 28, 2023
404751b
Merge pull request #186 from manuel-rubio/master
ghenry Apr 28, 2023
8ed0a2d
Add https://github.com/aesmail/kaffy/pull/186 to CHANGELOG.md
ghenry Apr 28, 2023
cdb607e
fix resource redirects
nullpilot May 2, 2023
d952949
add serialization tests
nullpilot May 4, 2023
55fac9a
Merge branch 'master' into feature/dynamic-primary-keys
nullpilot May 5, 2023
77bc367
fix etf deserialization test
nullpilot May 5, 2023
fc54f1c
bump version to 0.10.0-rc.0
aesmail May 11, 2023
7296518
add decoding for array JSON fields
kevinschweikert May 25, 2023
8c799cb
Use left_join when building search query. This allows more consisten…
aglassman Jun 12, 2023
de31fca
Add ability to provide a string, or :safe tuple containing HTML to be…
aglassman Jun 12, 2023
7581c45
The :admin_footer can be specified in app config as nil, or String.t(…
aglassman Jun 12, 2023
ab4464a
update copyright year.
aesmail Sep 1, 2023
765e971
allow admin_logo to have absolute urls.
aesmail Sep 1, 2023
4adf6d6
include many_to_many fields in fields_to_be_removed/1 function
aesmail Sep 1, 2023
d43385a
increase minimum elixir version to 1.11, add :phoenix_view to deps.
aesmail Sep 1, 2023
913304d
mix.lock changes.
aesmail Sep 1, 2023
270cd57
allow more flexibility for admin_logo.
aesmail Sep 1, 2023
1fae4e6
remove the "- Kaffy" suffix from page title, apply the same flexibili…
aesmail Sep 1, 2023
26b6e60
option to hide admin footer
aesmail Sep 1, 2023
e899af4
Merge pull request #274 from aglassman/add_index_description
aesmail Sep 1, 2023
a7d660b
Merge pull request #273 from aglassman/resource_query_left_join
aesmail Sep 1, 2023
a2e20b0
Merge pull request #272 from intermediateengineering/master
aesmail Sep 1, 2023
bbbdad7
Merge branch 'master' into feature/dynamic-primary-keys
aesmail Sep 1, 2023
f66ce2a
update elixir/erlang versions in CI
aesmail Sep 1, 2023
e855c1d
use ubuntu-latest
aesmail Sep 1, 2023
cce2d27
include only OTP 24-26
aesmail Sep 1, 2023
020302a
limit CI to the last 3 releases of elixir and otp
aesmail Sep 1, 2023
862a6b7
update CI according to docs.
aesmail Sep 1, 2023
136736a
Merge pull request #270 from nullpilot/feature/dynamic-primary-keys
aesmail Sep 1, 2023
724f403
fix conflicts.
aesmail Sep 1, 2023
db2b89c
add default delete action.
aesmail Sep 1, 2023
9ea022f
hide save and delete buttons on show page based on available actions.
aesmail Sep 1, 2023
7d60fd9
apply :readonly and :editable to datetime fields.
aesmail Sep 1, 2023
93a237d
add 'auto_detect_resources/0 which returns Kaffy's attempt at discove…
aesmail Sep 1, 2023
a2b5100
default to nil for belongs_to assoc fields.
aesmail Sep 1, 2023
c3b1375
fix issue with datetime fields updating unexpectedly.
aesmail Sep 1, 2023
32552bd
fix tests.
aesmail Sep 2, 2023
a0deb1d
Merge pull request #284 from aesmail/wip-v0.10
aesmail Sep 2, 2023
2cba05c
update changelog.
aesmail Sep 2, 2023
ea75efa
update README.
aesmail Sep 3, 2023
09fb1da
docs fixes.
aesmail Sep 3, 2023
3a24a1c
support filtering {:array, :string} fields.
aesmail Sep 3, 2023
fc4c39c
Merge pull request #285 from aesmail/filter-array-fields
aesmail Sep 3, 2023
0395dee
prepare for v0.10.0-rc1 release
aesmail Sep 3, 2023
ab12573
Merge branch 'master' of github.com:aesmail/kaffy
aesmail Sep 3, 2023
4ca6426
update kaffy image in readme.
aesmail Sep 3, 2023
8014405
update readme.
aesmail Sep 4, 2023
d564189
fix crash when updating a resource fails.
aesmail Sep 6, 2023
ec61436
Merge branch 'master' of github.com:aesmail/kaffy
aesmail Sep 6, 2023
bb5fa90
update changelog.
aesmail Sep 7, 2023
bfb4c6e
remove funding options.
aesmail Sep 7, 2023
6104735
remove funding options.
aesmail Sep 7, 2023
8444902
preparing for per-context dashboards.
aesmail Sep 7, 2023
371e211
improve check for showing context dashboard.
aesmail Sep 7, 2023
b1cd3ef
fix function name.
aesmail Sep 7, 2023
e78a564
add changes to changelog.
aesmail Sep 7, 2023
35fcd6d
update README.
aesmail Sep 7, 2023
133c68e
allow more customizations to widgets.
aesmail Sep 7, 2023
b6d10be
remove deprecation warnings, remove support for phx1.4 layout.
aesmail Sep 9, 2023
e247cbf
update changelog.
aesmail Sep 9, 2023
d9648e8
importing Phoenix.ConnTest instead of using it, and other deprecation…
aesmail Sep 9, 2023
fe9846f
update support policy and minimum requirements.
aesmail Sep 9, 2023
f171d9e
update ci
aesmail Sep 9, 2023
9aaed6c
Merge pull request #287 from aesmail/context-dashboard
aesmail Sep 9, 2023
52929be
Merge pull request #288 from aesmail/better-version-check
aesmail Sep 9, 2023
4f52323
document default_actions
aesmail Sep 9, 2023
78517f0
Merge pull request #289 from aesmail/document-default-actions
aesmail Sep 9, 2023
79bee2b
update changelog.
aesmail Sep 9, 2023
3ada6e3
Merge branch 'master' of github.com:aesmail/kaffy
aesmail Sep 9, 2023
5206190
Merge branch 'master' of github.com:aesmail/kaffy
aesmail Sep 10, 2023
99b2bbb
fix crash when deleting a resource from the resource page.
aesmail Sep 10, 2023
e0a77fb
bump to v0.10.0-rc.2
aesmail Sep 10, 2023
d4e3387
update changelog.
aesmail Sep 10, 2023
ab41f64
bump version to 0.10.0-rc.3
aesmail Sep 13, 2023
dea4eaa
fix array field regression, closes #294
aesmail Sep 18, 2023
53e9e5b
changing name allows tests to run
Sep 24, 2023
0239e7a
Merge pull request #295 from roryfahy/fix/test-naming-typo
aesmail Sep 28, 2023
23de878
Merge branch 'master' into allow-searching-numbers
aesmail Sep 28, 2023
545e0a5
Merge pull request #226 from aesmail/allow-searching-numbers
aesmail Sep 28, 2023
3cadd0f
update changelog.
aesmail Sep 28, 2023
d56d9aa
linguist ignore all files except elixir files.
aesmail Oct 5, 2023
21de0d3
approved by GitHub Sponsors
aesmail Oct 6, 2023
456fd4c
fix select/belongs_to fields sometimes not respecting the readonly op…
aesmail Oct 6, 2023
90c1d25
Merge pull request #297 from aesmail/readonly-fields
aesmail Oct 6, 2023
3afc298
prepare for the v0.10.0 release.
aesmail Oct 6, 2023
0870fa8
Merge branch 'master' of github.com:aesmail/kaffy
aesmail Oct 6, 2023
1987c6c
update README
aesmail Oct 6, 2023
78154cf
doc: phoenix_view is no longer needed for v0.10.0
aesmail Oct 6, 2023
d159160
doc: admin_logo accepts url and style options.
aesmail Oct 6, 2023
07dffa7
filter erlang modules out.
aesmail Oct 9, 2023
625a53b
update readme.
aesmail Oct 9, 2023
0a3e00b
Merge pull request #300 from aesmail/elixir-module-validation
aesmail Oct 9, 2023
c4f7192
v0.10.2 fix regression from v0.10.1
aesmail Oct 9, 2023
ca4a463
Bug fix pagination
ByeongUkChoi Nov 12, 2023
987cd8d
Merge pull request #304 from ByeongUkChoi/feature/fix_pagination
aesmail Nov 13, 2023
72acdc3
Update README.md
drobban Jan 26, 2024
66d0c7d
Phx.1.7.10 fix - no version bump
drobban Jan 26, 2024
409d899
Merge pull request #307 from drobban/patch-2
ghenry Apr 25, 2024
d864ea1
Merge pull request #306 from drobban/phx_1.7.10_breaking
ghenry Apr 25, 2024
30be962
add color input
kevinschweikert May 24, 2024
314fedb
Merge pull request #311 from intermediateengineering/feature/color-input
aesmail May 29, 2024
0f30a1f
Geo Point support
Jaza Jul 28, 2024
6065ddf
Password field type
Jaza Jul 29, 2024
cbc7c97
Base64 for binary fields
Jaza Jul 29, 2024
e1fced1
ULID form belongs_to
Jaza Jul 29, 2024
a9cbd66
deprecate decimal version 1
kevinschweikert Dec 10, 2024
f1dea1d
fix various compiler warnings and errors
kevinschweikert Dec 10, 2024
73419a5
Merge pull request #323 from intermediateengineering/fix/compilation
ghenry Dec 11, 2024
b0aeb45
Merge pull request #322 from intermediateengineering/fix/decimal
ghenry Dec 11, 2024
0ad98b8
Merge pull request #317 from Jaza/geo-point-support
ghenry Dec 11, 2024
5f6bdbe
Bump version to 0.10.3
kelcecil Dec 13, 2024
6efe2d0
Merge pull request #319 from Jaza/base64-for-binary-fields
ghenry Dec 15, 2024
36c18ad
Merge pull request #320 from Jaza/ulid-form-belongs-to
ghenry Dec 15, 2024
c89f9cd
Merge pull request #318 from Jaza/password-field-type
ghenry Dec 15, 2024
9096c41
Fix bug related to search field across association
anhnk Dec 15, 2024
87e2d5e
Merge pull request #325 from anhnk/bug/search-field-association
ghenry Dec 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* linguist-vendored
*.ex linguist-vendored=false
*.exs linguist-vendored=false

7 changes: 4 additions & 3 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: aesmail
patreon: # Replace with a single Patreon username
open_collective: # kaffy
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: aesmail
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
34 changes: 20 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Kaffy CI (Elixir 1.10)
name: Kaffy CI (Elixir)

on:
push:
Expand All @@ -9,26 +9,32 @@ on:
jobs:
test:
name: Test ${{matrix.otp}} / Elixir ${{matrix.elixir}}
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
otp: ['21', '22', '23', '24']
elixir: ['1.10.3', '1.11.4', '1.12']
otp: ['22', '23', '24', '25']
elixir: ['1.12.3', '1.13.4', '1.14.5', '1.15.5']
# Exclude invalid combinations of Elixir and OTP
exclude:
- otp: '21'
elixir: '1.12'
- otp: '24'
elixir: '1.10.3'
# Include the release candidate for the next Elixir, but don't
- otp: '22'
elixir: '1.14.5'
- otp: '22'
elixir: '1.15.5'
- otp: '23'
elixir: '1.15.5'
- otp: '25'
elixir: '1.12.3'
- otp: '25'
elixir: '1.13.4'
# Include the release candidate for the next Elixir, but don't
# fail CI.
include:
- elixir: '1.13'
otp: '24'
experimental: true
# include:
# - elixir: '1.13'
# otp: '24'
# experimental: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
Expand Down
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,79 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.10.2 (2023-10-09)

### Fixes
- Fix regression introduced in v0.10.1 which made Kaffy ignore all admin modules.

## v0.10.1 (2023-10-09)

### Fixes
- Fix a crash when Kaffy mistakenly treats erlang modules as Elixir modules (PR #300)

## v0.10.0 (2023-10-06)

### Fixes
- belongs_to fields didn't respect the `:readonly` option (PR #297).

## v0.10.0-rc.3 (2023-09-28)

### Fixes
- Fix regression when trying to save a resource with an array field.

### Added
- Support searching fields with `id`, `integer` and `decimal` types.

## v0.10.0-rc.2 (2023-09-10)

### Fixes
- Fix a crash when deleting resources from the resource page through the "Delete" button.

## v0.10.0-rc.1 (2023-09-09)

### Fixes
- Crash when updating records.
- Removes elixir and phoenix deprecation warnings [PR#288](https://github.com/aesmail/kaffy/pull/288)

### Added
- Support for filtering `{:array, :string}` fields [PR#285](https://github.com/aesmail/kaffy/pull/262)
- Per-context dashboard [PR#287](https://github.com/aesmail/kaffy/pull/287)

### Changed
- Minimum phoenix version is now 1.6. This means that the minimum Elixir version is now 1.12 (see support policy).

## v0.10.0-rc.0 (2023-09-02)

### Fixes
- Fix changeset errors [PR#262](https://github.com/aesmail/kaffy/pull/262)
- Preload resources before trying to convert resource to existing atom. [PR#266](https://github.com/aesmail/kaffy/pull/266)
- Include `many_to_many` fields in `fields_to_be_removed/1`.
- Fix array fields not being saved properly.
- Fix `:readonly` and `:editable` options for datetime fields.
- Default to `nil` for `belongs_to` fields.
- Fix issue with datetime fields sometimes being updated unexpectedly.

### Changed
- Minimum Elixir version is now 1.11.4.
- Add `phoenix_view` package to deps.
- Let specify the full 'path' for FontAwesome fonts [PR#186](https://github.com/aesmail/kaffy/pull/186)
- Lazy load default kaffy field value [PR#255](https://github.com/aesmail/kaffy/pull/255)
- Update phoenix html to address deprecated form_for [PR#260](https://github.com/aesmail/kaffy/pull/260)
- Use left_join when building search query [PR#273](https://github.com/aesmail/kaffy/pull/273)
- Remove the "- Kaffy" suffix from page titles.

### Added
- Support hiding menu entries [PR#248](https://github.com/aesmail/kaffy/pull/248)
- Add support for composite primary keys [PR#270](https://github.com/aesmail/kaffy/pull/270)
- Index page description [PR#274](https://github.com/aesmail/kaffy/pull/274)
- Footer can be specified in config [PR#275](https://github.com/aesmail/kaffy/pull/275)
- Provide more flexibility for customizing the `admin_logo` and `admin_logo_mini` options.
- Add the ability to "bulk delete" resources from the index page.
- Hide save and delete buttons on the show page based on available actions.
- Add `Kaffy.Utils.auto_detect_resources/0` which returns the list of auto-detected resources (Kaffy's attempt at discovering the list of schema/admin modules).



## v0.9.4 (2022-10-31)

### Fixed
Expand Down
98 changes: 83 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Kaffy

[![Sponsor](https://opencollective.com/kaffy/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen)](https://opencollective.com/kaffy)
[![Module Version](https://img.shields.io/hexpm/v/kaffy.svg)](https://hex.pm/packages/kaffy)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/kaffy/)
[![Total Download](https://img.shields.io/hexpm/dt/kaffy.svg)](https://hex.pm/packages/kaffy)
Expand Down Expand Up @@ -52,24 +51,44 @@ without the need to touch the current codebase. It was inspired by django's love

## Sponsors

Become a sponsor through Kaffy's [OpenCollective](https://opencollective.com/kaffy) page.
Sponsor the [development of Kaffy](https://github.com/sponsors/aesmail) through GitHub Sponsors.

## Demo

[Check out the simple demo here](https://kaffy.fly.dev/admin/)

## Minimum Requirements

- Elixir 1.10.0
- Phoenix 1.5.0
Starting with v0.10.0, Kaffy will officially support the latest two phoenix versions.

| Kaffy | Supported phoenix versions |
|---------|----------------------------|
| v0.10.0 | 1.6, 1.7.0 |
| v0.9.X | 1.5, 1.6, 1.7.0 |
| | |


## Support Policy

The latest released `major.minor` version will be supported. For example, if the latest version is `0.9.0`, then `0.9.1` will be released with bug fixes. If a new version `0.10.0` is released, then `0.9.1` will no longer receive bug fixes or security patches.

## Installation

#### Add `:kaffy` as a dependency
```elixir
def deps do
[
{:kaffy, "~> 0.9.2"}
{:kaffy, "~> 0.10.0"}
]
end
```

If you are using `kaffy` v0.9.x with `phoenix` 1.7, you need to add `phoenix_view` to your dependencies:
```elixir
def deps do
[
{:phoenix_view, "~> 2.0.2"},
{:kaffy, "~> 0.9.4"}
]
end
```
Expand All @@ -96,9 +115,21 @@ plug Plug.Static,

# in your config/config.exs
config :kaffy,
otp_app: :my_app,
ecto_repo: MyApp.Repo,
router: MyAppWeb.Router
# required keys
otp_app: :my_app, # required
ecto_repo: MyApp.Repo, # required
router: MyAppWeb.Router, # required
# optional keys
admin_title: "My Awesome App",
admin_logo: [
url: "https://example.com/img/logo.png",
style: "width:200px;height:66px;"
],
admin_logo_mini: "/images/logo-mini.png",
hide_dashboard: true,
home_page: [schema: [:accounts, :user]],
enable_context_dashboards: true, # since v0.10.0
admin_footer: "Kaffy © 2023" # since v0.10.0
```

Note that providing pipelines with the `:pipe_through` option will add those pipelines to kaffy's `:kaffy_browser` pipeline which is defined as follows:
Expand All @@ -112,6 +143,17 @@ pipeline :kaffy_browser do
plug :put_secure_browser_headers
end
```
### Phoenix version 1.7
Note that if you use Phoenix version 1.7 you also need to manually add the use of phoenix views in your project.
Follow the instructions at https://hexdocs.pm/phoenix_view/Phoenix.View.html

You will also need to change `helpers: false` to `true` in the `myapp_web.ex` file as shown in example below.
```elixir
# lib/myapp_web.ex
def router do
quote do
use Phoenix.Router, helpers: true # <- set to true
```

## Customizations

Expand All @@ -131,7 +173,9 @@ config :kaffy,
admin_title: "My Awesome App",
admin_logo: "/images/logo.png",
admin_logo_mini: "/images/logo-mini.png",
admin_footer: "Kaffy &copy; 2023",
hide_dashboard: false,
enable_context_dashboards: true,
home_page: [kaffy: :dashboard],
ecto_repo: MyApp.Repo,
router: MyAppWeb.Router,
Expand All @@ -146,7 +190,7 @@ defmodule MyApp.Kaffy.Config do
resources: [ # this line used to be "schemas" in pre v0.9
post: [schema: MyApp.Blog.Post, admin: MyApp.SomeModule.Anywhere.PostAdmin],
comment: [schema: MyApp.Blog.Comment],
tag: [schema: MyApp.Blog.Tag]
tag: [schema: MyApp.Blog.Tag, in_menu: false]
]
],
inventory: [
Expand Down Expand Up @@ -226,7 +270,8 @@ Widgets have shared options:
- `:order` (optional) is the displaying order of the widget. Widgets are display in order based on this value. The default value is 999.
- `:width` (optional) is the width the widget should occupy on the page. Valid values are 1 to 12. The default for tidbits is 3 and the others 6.
- `:percentage` (required for progress widgets) is the percentage value for the progress. This must be an integer.
- `:icon` (optional for tidbit widgets) is the icon displayed next to the tidbit's `content`. Any FontAwesome-valid icon is valid here. For example: `thumbs-up`.
- `:full_icon` (optional for tidbit widgets) is the icon displayed next to the tidbit's `content`. You have to specify the full name given by FontAwesome like `fas fa-thumbs-up`.
- `:icon` (optional for tidbit widgets) is the icon displayed next to the tidbit's `content`. Any FontAwesome-valid icon is valid here. For example: `thumbs-up`. But it's limited to the `fas` group. For full defintion see `:full_icon`.

When defining a chart widget, the content must be a map with the following required keys:

Expand Down Expand Up @@ -414,6 +459,16 @@ defmodule MyApp.Blog.PostAdmin do
end
```

If you need to hide the "New <Schema>" button, you can define the `default_actions/1` function in your admin module:

```elixir
defmodule MyApp.Blog.PostAdmin do
def default_actions(_schema) do
# default actions are [:new, :edit, :delete] by default.
[:delete] # cannot create or edit posts, can only delete.
end
end
```

### Form Pages

Expand Down Expand Up @@ -477,12 +532,25 @@ def form_fields(_schema) do
end
}
]
```
end
```

If you don't want users to be able to edit or delete records, you can define the `default_actions/1` function in your admin module:

```elixir
defmodule MyApp.Blog.PostAdmin do
def default_actions(_schema) do
# default actions are [:new, :edit, :delete] by default.
[:new] # only create records, cannot edit or delete.
end
end
```

#### Association Forms

A `belongs_to` association should be referenced by the field name, *not* the association name. For example, a schema with the following association:


```elixir
schema "my_model" do
...
Expand Down Expand Up @@ -666,14 +734,14 @@ Kaffy has support for Ecto's [embedded schemas](https://hexdocs.pm/ecto/Ecto.Sch

Kaffy provides very basic search capabilities.

Currently, only `:string` and `:text` fields are supported for search.
Supported field types are: `:string`, `:textarea`, `:richtext`, `:id`, `:integer`, and `:decimal`.

If you need to customize the list of fields to search against, define the `search_fields/1` function.

```elixir
defmodule MyApp.Blog.PostAdmin do
def search_fields(_schema) do
[:title, :slug, :body]
[:id, :title, :body, :views]
end
end
```
Expand All @@ -687,16 +755,16 @@ defmodule MyApp.Blog.PostAdmin do
[
:title,
:body,
:view,
category: [:name, :description]
]
end
end
```

This function takes a schema and returns a list of schema fields that you want to search.
All the fields must be of type `:string` or `:text`.

If this function is not defined, Kaffy will return all `:string` and `:text` fields by default.
If this function is not defined, Kaffy will return all fields with supported types by default.

### Authorization

Expand Down
Binary file modified assets/kaffy_index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/kaffy_index_220812.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# Use Jason for JSON parsing in Phoenix
# config :phoenix, :json_library, Jason
7 changes: 0 additions & 7 deletions lib/kaffy.ex

This file was deleted.

2 changes: 1 addition & 1 deletion lib/kaffy/pagination.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Kaffy.Pagination do
# number of pages to show on the showleft/right of the current page
@pagination_delta 2

def get_pages(0, 0), do: []
def get_pages(1, 0), do: []

def get_pages(current_page, total_page) do
showleft = current_page - @pagination_delta
Expand Down
Loading