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

Documentation updates for release v1.7 #46

Merged
merged 32 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c7b1c23
Fix docs/Gemfile
varyonic Aug 1, 2023
6fdd65b
Inline includes for the home page.
varyonic Aug 5, 2023
6fda641
Convert documentation from custom layout and style to JustTheDocs.
varyonic Aug 5, 2023
3e3d1ff
Fork project.
varyonic Aug 7, 2023
58746f5
Don't feature DSL on the landing page.
varyonic Aug 7, 2023
1d384d7
Simplify permitted params (#18)
varyonic Aug 7, 2023
6124396
Don't clobber defined controller action method if action DSL block no…
varyonic Aug 7, 2023
d498a76
Invoke named batch action method if defined in controller. (#19)
varyonic Aug 7, 2023
3caca64
Make rendering a partial the default behavior for show (#20)
varyonic Aug 7, 2023
f7d906a
Make rendering a partial the default behavior for new and edit (#21)
varyonic Aug 7, 2023
d9e9d65
Make rendering a partial the default behavior for render index as: ta…
varyonic Aug 7, 2023
de951cb
Make rendering a partial the default behavior for page content (#23)
varyonic Aug 7, 2023
86029e4
Accept content_for(:page_title) (#26)
varyonic Aug 7, 2023
43b9621
Use Rails partial _action_items.html.arb instead of Views::ActionItem…
varyonic Aug 7, 2023
868f72a
Extract partial resource/filters_form (#28)
varyonic Aug 7, 2023
23531e3
Extract protected method ResourceController::csv_builder. (#29)
varyonic Aug 7, 2023
e11a654
Use Arbo (#31)
varyonic Aug 8, 2023
4ebaf01
Configure default finder in resource controller.
varyonic Sep 22, 2023
4541868
Use config.belongs_to
varyonic Aug 23, 2023
a39a292
Use config.scope and config.scope_to
varyonic Aug 23, 2023
6554ce8
Use config.decorator_class_name.
varyonic Aug 24, 2023
3f177ef
Use config.menu_item_options =
varyonic Aug 9, 2023
b3e2a10
Use config.set_page_options
varyonic Aug 29, 2023
825242d
Use config.add_page_route
varyonic Sep 6, 2023
970df80
Document use of ResourceController#apply_includes in preference to #s…
varyonic Aug 28, 2023
659bbe5
Use active_admin_comments_for(resource)
varyonic Sep 20, 2023
8944731
Use config.add_sidebar_section (#36)
varyonic Sep 22, 2023
7fd743f
Use ActiveAdmin.configure_resource (#40)
varyonic Sep 22, 2023
9b47e1b
Admin template is now mostly empty.
varyonic Sep 22, 2023
126276d
Fix codeclimate_badge
varyonic Oct 10, 2023
63ce59f
Change default branch to `main`
varyonic Oct 3, 2023
12ac49e
Update CONTRIBUTING.
varyonic Oct 12, 2023
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
44 changes: 25 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
## Contributing

First off, thank you for considering contributing to Active Admin. It's people
like you that make Active Admin such a great tool.
This is probably not a beginner friendly project: it has a long history, complex functionality,
and too much cleverness, eg. metaprogramming.

If you are using, or intending to use this project in production it would be great to hear about that in the discussions area.
Fixes are welcome, if you have ideas for improvements reach out to the maintainer first.

Translations and documentation tweaks are welcome, but not a priority, don't expect a quick response.

Linting has become very popular in recent years, eg. rubocop, but depending on the team or project it can quickly
become a couterproductive distraction. By all means make suggestions, but don't expect a quick response.

### 1. Where do I go from here?

Expand All @@ -23,13 +31,12 @@ git checkout -b 325-add-japanese-translations

### 3. Get the test suite running

Make sure you're using a recent ruby and have the `bundler` gem installed, at
least version `1.14.3`.
Make sure you're using a recent ruby and have the `bundler` gem installed.

Select the Gemfile for your preferred Rails version, preferably the latest:

```sh
export BUNDLE_GEMFILE=gemfiles/rails_51.gemfile
export BUNDLE_GEMFILE=gemfiles/rails_71.gemfile
```

Now install the development dependencies:
Expand All @@ -47,7 +54,7 @@ bundle exec rake
The test run will generate a sample Rails application in `spec/rails` to run the
tests against.

If your tests are passing locally but they're failing on Travis, reset your test
If your tests are passing locally but they're failing on GitHub, reset your test
environment:

```sh
Expand All @@ -68,12 +75,11 @@ rm -rf spec/rails && bundle update
Simply copy the content of the appropriate template into a .rb file, make the
necessary changes to demonstrate the issue, and **paste the content into the
issue description**:
* [**ActiveAdmin** master issues][master template]
* [**ActiveAdmin** main issues][main template]

### 5. Implement your fix or feature

At this point, you're ready to make your changes! Feel free to ask for help;
everyone is a beginner at first :smile_cat:
At this point, you're ready to make your changes! Feel free to ask for help.

### 6. View your changes in a Rails application

Expand Down Expand Up @@ -117,20 +123,20 @@ it locally using [Codeclimate's CLI][codeclimate cli], via `codeclimate analyze`

### 8. Make a Pull Request

At this point, you should switch back to your master branch and make sure it's
up to date with Active Admin's master branch:
At this point, you should switch back to your main branch and make sure it's
up to date with Active Admin's main branch:

```sh
git remote add upstream [email protected]:activeadmin/activeadmin.git
git checkout master
git pull upstream master
git checkout main
git pull upstream main
```

Then update your feature branch from your local copy of master, and push it!
Then update your feature branch from your local copy of main, and push it!

```sh
git checkout 325-add-japanese-translations
git rebase master
git rebase main
git push --set-upstream origin 325-add-japanese-translations
```

Expand All @@ -153,19 +159,19 @@ To learn more about rebasing in Git, there are a lot of [good][git rebasing]

```sh
git checkout 325-add-japanese-translations
git pull --rebase upstream master
git pull --rebase upstream main
git push --force-with-lease 325-add-japanese-translations
```

### 10. Merging a PR (maintainers only)

A PR can only be merged into master by a maintainer if:
A PR can only be merged into main by a maintainer if:

* It is passing CI.
* It has been approved by at least two maintainers. If it was a maintainer who
opened the PR, only one extra approval is needed.
* It has no requested changes.
* It is up to date with current master.
* It is up to date with current main.

Any maintainer is allowed to merge a PR if all of these conditions are
met.
Expand All @@ -176,7 +182,7 @@ met.
[new issue]: https://github.com/activeadmin/activeadmin/issues/new
[fork Active Admin]: https://help.github.com/articles/fork-a-repo
[searching all issues]: https://github.com/activeadmin/activeadmin/issues?q=
[master template]: https://github.com/activeadmin/activeadmin/blob/master/lib/bug_report_templates/active_admin_master.rb
[main template]: https://github.com/varyonic/activeadmin/blob/main/lib/bug_report_templates/active_admin_main.rb
[codeclimate]: https://codeclimate.com
[codeclimate cli]: https://github.com/codeclimate/codeclimate
[make a pull request]: https://help.github.com/articles/creating-a-pull-request
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ We try not to reinvent the wheel, so Active Admin is built with other open sourc

Tool | Description
--------------------- | -----------
[Arbre] | Ruby -> HTML, just like that.
[Arbo] | HTML Views in Ruby.
[Devise] | Powerful, extensible user authentication
[Formtastic] | A Rails form builder plugin with semantically rich and accessible markup
[Inherited Resources] | Simplifies controllers with pre-built RESTful controller actions
[Kaminari] | Elegant pagination for any sort of collection
[Ransack] | Provides a simple search API to query your data

[Arbre]: https://github.com/activeadmin/arbre
[Arbo]: https://github.com/varyonic/arbo
[Devise]: https://github.com/plataformatec/devise
[Formtastic]: https://github.com/justinfrench/formtastic
[Inherited Resources]: https://github.com/activeadmin/inherited_resources
Expand All @@ -61,15 +61,15 @@ Tool | Description
[rubygems]: https://rubygems.org/gems/activeadmin-rb
[actions_badge]: https://github.com/varyonic/activeadmin/workflows/ci/badge.svg
[actions]: https://github.com/varyonic/activeadmin/actions
[codeclimate_badge]: https://api.codeclimate.com/v1/badges/779e407d22bacff19733/maintainability
[codeclimate_badge]: https://api.codeclimate.com/v1/badges/1698787497cc7d4c7c88/maintainability
[codeclimate]: https://codeclimate.com/github/varyonic/activeadmin/maintainability
[codecov_badge]: https://codecov.io/gh/varyonic/activeadmin/branch/master/graph/badge.svg
[codecov_badge]: https://codecov.io/gh/varyonic/activeadmin/branch/main/graph/badge.svg
[codecov]: https://codecov.io/gh/varyonic/activeadmin
[inch_badge]: http://inch-ci.org/github/varyonic/activeadmin.svg?branch=master
[inch_badge]: http://inch-ci.org/github/varyonic/activeadmin.svg?branch=main
[inch]: http://inch-ci.org/github/varyonic/activeadmin

[docs]: http://activeadmin.info/0-installation.html
[demo]: http://demo.activeadmin.info/admin
[wiki]: https://github.com/varyonic/activeadmin/wiki
[stackoverflow]: http://stackoverflow.com/questions/tagged/activeadmin
[contributing]: https://github.com/varyonic/activeadmin/blob/master/CONTRIBUTING.md
[contributing]: https://github.com/varyonic/activeadmin/blob/main/CONTRIBUTING.md
11 changes: 7 additions & 4 deletions docs/0-installation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
layout: default
nav_order: 0
title: Installation
redirect_from: /docs/0-installation.html
---

Expand All @@ -7,7 +10,7 @@ redirect_from: /docs/0-installation.html
Active Admin is a Ruby Gem.

```ruby
gem 'activeadmin'
gem 'activeadmin-rb'

# Plus integrations with:
gem 'devise'
Expand Down Expand Up @@ -112,7 +115,7 @@ Draper::CollectionDecorator.send :delegate, :per_page_kaminari

If you're getting the error `wrong number of arguments (6 for 4..5)`, [read #2703].

[CHANGELOG]: https://github.com/activeadmin/activeadmin/blob/master/CHANGELOG.md
[dashboard.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/dashboard.rb
[active_admin.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/active_admin.rb.erb
[CHANGELOG]: https://github.com/varyonic/activeadmin/blob/main/CHANGELOG.md
[dashboard.rb]: https://github.com/varyonic/activeadmin/blob/main/lib/generators/active_admin/install/templates/dashboard.rb
[active_admin.rb]: https://github.com/varyonic/activeadmin/blob/main/lib/generators/active_admin/install/templates/active_admin.rb.erb
[read #2703]: https://github.com/activeadmin/activeadmin/issues/2703#issuecomment-38140864
15 changes: 9 additions & 6 deletions docs/1-general-configuration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
layout: default
nav_order: 1
title: General Configuration
redirect_from: /docs/1-general-configuration.html
---

Expand Down Expand Up @@ -47,17 +50,17 @@ config.site_title_image = ->(context) { context.current_user.company.logo_url }
## Internationalization (I18n)

Active Admin comes with translations for a lot of
[locales](https://github.com/activeadmin/activeadmin/blob/master/config/locales/).
[locales](https://github.com/varyonic/activeadmin/blob/main/config/locales/).
Active Admin does not provide the translations for the kaminari gem it uses for pagination,
to get these you can use the
[kaminari-i18n](https://github.com/tigrish/kaminari-i18n) gem.

To translate Active Admin to a new language or customize an existing
translation, you can copy
[config/locales/en.yml](https://github.com/activeadmin/activeadmin/blob/master/config/locales/en.yml)
[config/locales/en.yml](https://github.com/varyonic/activeadmin/blob/main/config/locales/en.yml)
to your application's `config/locales` folder and update it. We welcome
new/updated translations, so feel free to
[contribute](https://github.com/activeadmin/activeadmin/blob/master/CONTRIBUTING.md)!
[contribute](https://github.com/varyonic/activeadmin/blob/main/CONTRIBUTING.md)!

When using [devise](https://github.com/plataformatec/devise) for authentication,
you can use the [devise-i18n](https://github.com/tigrish/devise-i18n)
Expand All @@ -79,7 +82,7 @@ The default namespace is "admin".

```ruby
# app/admin/posts.rb
ActiveAdmin.register Post do
ActiveAdmin.configure_resource Post do |config|
# ...
end
```
Expand Down Expand Up @@ -139,7 +142,7 @@ ActiveAdmin.setup do |config|
end

# For a given resource:
ActiveAdmin.register Post do
ActiveAdmin.configure_resource Post do |config|
config.comments = false
end
```
Expand Down Expand Up @@ -172,7 +175,7 @@ config.comments_menu = { parent: 'Admin', priority: 1 }
Remember to indicate where to place the comments and form with:

```ruby
active_admin_comments
active_admin_comments_for(resource)
```

## Utility Navigation
Expand Down
60 changes: 29 additions & 31 deletions docs/10-custom-pages.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
layout: default
nav_order: 10
title: Custom Pages
redirect_from: /docs/10-custom-pages.html
---

Expand All @@ -19,23 +22,12 @@ Creating a page is as simple as calling `register_page`:
```ruby
# app/admin/calendar.rb
ActiveAdmin.register_page "Calendar" do
content do
para "Hello World"
end
end
```

Anything rendered within `content` will be the main content on the page.
Partials behave exactly the same way as they do for resources:
and defining a partial:

```ruby
# app/admin/calendar.rb
ActiveAdmin.register_page "Calendar" do
content do
render partial: 'calendar'
end
end

# app/views/admin/calendar/_calendar.html.arb
table do
thead do
Expand Down Expand Up @@ -80,9 +72,9 @@ ActiveAdmin.register_page "Calendar", namespace: false
To nest the page within another resource, you can use the `belongs_to` method:

```ruby
ActiveAdmin.register Project
ActiveAdmin.configure_resource Project
ActiveAdmin.register_page "Status" do
belongs_to :project
config.belongs_to :project
end
```

Expand All @@ -93,14 +85,15 @@ and examples.

See the [Sidebars](7-sidebars.md) documentation.

## Add an Action Item
## Add an Action Link

Just like other resources, you can add action items. The difference here being that
`:only` and `:except` don't apply because there's only one page it could apply to.
Just like other resources, you can add action links.

```ruby
action_item :view_site do
link_to "View Site", "/"
# app/views/admin/calendar/action_item.html.arb
div(class: :action_items) do
...
action_link "View Site", "/"
end
```

Expand All @@ -110,25 +103,32 @@ Page actions are custom controller actions (which mirror the resource DSL for
the same feature).

```ruby
page_action :add_event, method: :post do
# ...
redirect_to admin_calendar_path, notice: "Your event was added"
# admin/calendar.rb
# Defines the route `/admin/calendar/add_event` which can handle HTTP POST requests.
config.add_page_route :add_event, method: :post

# app/controllers/admin/calendar_controller
class Admin::CalendarController < ActiveAdmin::PageController
def add_event
# ...
redirect_to admin_calendar_path, notice: "Your event was added"
end
end

action_item :add do
link_to "Add Event", admin_calendar_add_event_path, method: :post
# app/views/admin/calendar/action_item.html.arb
div(class: :action_items) do
...
action_link "Add Event", admin_calendar_add_event_path, method: :post
end
```

This defines the route `/admin/calendar/add_event` which can handle HTTP POST requests.

Clicking on the action item will reload page and display the message "Your event
was added"

Page actions can handle multiple HTTP verbs.

```ruby
page_action :add_event, method: [:get, :post] do
config.add_page_route :add_event, method: [:get, :post] do
# ...
end
```
Expand All @@ -140,10 +140,8 @@ See also the [Custom Actions](8-custom-actions.md#http-verbs) example.
You can use custom parameter instead of id

```ruby
ActiveAdmin.register User do
controller do
defaults :finder => :find_by_name
end
class Admin::User < ActiveAdmin::ResourceController
defaults finder: :find_by_name
end
```

Expand Down
Loading