Skip to content

docs: improve documentation #34

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

Merged
merged 3 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ The following options are supported:
- `redirect` (String): alternative to _page_ option - redirects to a specific slug;
- `widgets` (Array): list of widgets (as View components) to present.

> 📚 [Wiki Root page](https://github.com/blocknotes/tiny_admin/wiki/Root) available

Example:

```yml
Expand All @@ -98,6 +100,8 @@ root:

`helper_class` (String): class or module with helper methods, used for attributes' formatters.

> 📚 [Wiki Helper methods page](https://github.com/blocknotes/tiny_admin/wiki/Helper-methods) available

`page_not_found` (String): a view object to render when a missing page is requested.

`record_not_found` (String): a view object to render when a missing record is requested.
Expand All @@ -113,11 +117,15 @@ root:

`extra_styles` (String): inline CSS styles.

> 📚 [Wiki Styles and scripts page](https://github.com/blocknotes/tiny_admin/wiki/Styles-and-scripts) available

`authentication` (Hash): define the authentication method, properties:

- `plugin` (String): a plugin class to use (ex. `TinyAdmin::Plugins::SimpleAuth`);
- `password` (String): a password hash used by _SimpleAuth_ plugin (generated with `Digest::SHA512.hexdigest("some password")`).

> 📚 [Wiki Authentication page](https://github.com/blocknotes/tiny_admin/wiki/Authentication) available

Example:

```yml
Expand All @@ -134,6 +142,8 @@ authentication:
- `widgets` (Array): list of widgets (as View components) to present;
- other properties depends on the section's type.

> 📚 [Wiki Pages page](https://github.com/blocknotes/tiny_admin/wiki/Pages) available

For _content_ sections:

- `content` (String): the HTML content to present.
Expand Down Expand Up @@ -186,6 +196,9 @@ For _resource_ sections:

- `model` (String): the class to use to fetch the data on an item of a collection;
- `repository` (String): the class to get the properties related to the model;

> 📚 [Wiki Repository page](https://github.com/blocknotes/tiny_admin/wiki/Repository) available

- `index` (Hash): collection's action options (see below);
- `show` (Hash): detail's action options (see below);
- `collection_actions` (Array of hashes): custom collection's actions;
Expand Down
2 changes: 1 addition & 1 deletion bin/rails
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ENV['RAILS_ENV'] ||= 'test'

ENGINE_ROOT = File.expand_path('..', __dir__)
APP_PATH = File.expand_path("../spec/dummy/config/application", __dir__)
APP_PATH = File.expand_path("../spec/dummy_rails/config/application", __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
Expand Down
11 changes: 11 additions & 0 deletions extra/hanami_app/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'rack'
gem 'webrick'

gem 'hanami-router'

gem 'tiny_admin', path: '../../'
22 changes: 3 additions & 19 deletions extra/hanami_app/app.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# frozen_string_literal: true

# --- dependencies -------------------------------------------------------------
begin
require 'bundler/inline'
rescue LoadError => e
abort "#{e} - Bundler version 1.10 or later is required. Please update your Bundler"
end

gemfile(true) do
source 'https://rubygems.org'

gem 'rack'
gem 'webrick'

gem 'hanami-router'

gem 'tiny_admin', path: '../../'
end
require 'bundler'
Bundler.require

# --- Hanami application -------------------------------------------------------
require_relative '../tiny_admin_settings'

app = Hanami::Router.new do
Expand All @@ -27,4 +11,4 @@
mount TinyAdmin::Router, at: '/admin'
end

Rack::Server.new(app: app, Port: 3000).start
Rack::Server.new(app: app, Port: 3000).start if __FILE__ == $PROGRAM_NAME
9 changes: 9 additions & 0 deletions extra/rails_app/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'rails', '~> 7.0'
gem 'webrick'

gem 'tiny_admin', path: '../../'
24 changes: 5 additions & 19 deletions extra/rails_app/app.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
# frozen_string_literal: true

# --- dependencies -------------------------------------------------------------
begin
require 'bundler/inline'
rescue LoadError => e
abort "#{e} - Bundler version 1.10 or later is required. Please update your Bundler"
end

gemfile(true) do
source 'https://rubygems.org'

gem 'rails', '~> 7.0'
gem 'webrick'

gem 'tiny_admin', path: '../../'
end
require 'bundler'
Bundler.require

# --- Rails application --------------------------------------------------------
require 'action_controller/railtie'
require_relative '../tiny_admin_settings'

class App < Rails::Application
class RailsApp < Rails::Application
routes.append do
root to: proc { [200, {}, ['Root page']] }

Expand All @@ -30,6 +16,6 @@ class App < Rails::Application
config.eager_load = false
end

App.initialize!
RailsApp.initialize!

Rack::Server.new(app: App, Port: 3000).start
Rack::Server.new(app: RailsApp, Port: 3000).start if __FILE__ == $PROGRAM_NAME
12 changes: 12 additions & 0 deletions extra/roda_app/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'rack'
gem 'rackup'
gem 'webrick'

gem 'roda'

gem 'tiny_admin', path: '../../'
25 changes: 4 additions & 21 deletions extra/roda_app/app.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
# frozen_string_literal: true

# --- dependencies -------------------------------------------------------------
begin
require 'bundler/inline'
rescue LoadError => e
abort "#{e} - Bundler version 1.10 or later is required. Please update your Bundler"
end

gemfile(true) do
source 'https://rubygems.org'

gem 'rack'
gem 'rackup'
gem 'webrick'

gem 'roda'

gem 'tiny_admin', path: '../../'
end
require 'bundler'
Bundler.require

# --- Roda application ---------------------------------------------------------
require_relative '../tiny_admin_settings'

class App < Roda
class RodaApp < Roda
route do |r|
r.root do
'Root page'
Expand All @@ -34,4 +17,4 @@ class App < Roda
end
end

Rackup::Server.new(app: App, Port: 3000).start
Rackup::Server.new(app: RodaApp, Port: 3000).start if __FILE__ == $PROGRAM_NAME
10 changes: 10 additions & 0 deletions extra/standalone_app/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'rack'
gem 'rackup'
gem 'webrick'

gem 'tiny_admin', path: '../../'
21 changes: 3 additions & 18 deletions extra/standalone_app/app.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
# frozen_string_literal: true

# --- dependencies -------------------------------------------------------------
begin
require 'bundler/inline'
rescue LoadError => e
abort "#{e} - Bundler version 1.10 or later is required. Please update your Bundler"
end

gemfile(true) do
source 'https://rubygems.org'

gem 'rack'
gem 'rackup'
gem 'webrick'

gem 'tiny_admin', path: '../../'
end
require 'bundler'
Bundler.require

# --- Standalone application ---------------------------------------------------
require_relative '../tiny_admin_settings'

TinyAdmin.configure do |settings|
settings.root_path = '/'
end

Rackup::Server.new(app: TinyAdmin::Router, Port: 3000).start
Rackup::Server.new(app: TinyAdmin::Router, Port: 3000).start if __FILE__ == $PROGRAM_NAME