iplemented rails admin

This commit is contained in:
2016-04-22 11:10:40 +02:00
parent b2b0c7c22c
commit 1482d3d4ec
9 changed files with 258 additions and 34 deletions
+58
View File
@@ -0,0 +1,58 @@
RailsAdmin.config do |config|
config.authorize_with do
unless Rails.env.development?
authenticate_or_request_with_http_basic('Administration') do |username, password|
username == 'admin' && password == ENV['ADMIN_PASSWORD']
end
end
end
config.model 'Supporter' do
list do
field :duplicate
field :first_name
field :last_name
field :zip
field :city
field :email
field :language
field :support
field :li_membership
end
end
### Popular gems integration
## == Devise ==
# config.authenticate_with do
# warden.authenticate! scope: :user
# end
# config.current_user_method(&:current_user)
## == Cancan ==
# config.authorize_with :cancan
## == Pundit ==
# config.authorize_with :pundit
## == PaperTrail ==
# config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
config.actions do
dashboard # mandatory
index # mandatory
new
# export
# bulk_delete
show
edit
delete
# show_in_app
## With an audit adapter, you can add:
# history_index
# history_show
end
end
+150
View File
@@ -0,0 +1,150 @@
de:
admin:
js:
true: True
false: False
is_present: Is present
is_blank: Is blank
date: Date ...
between_and_: Between ... and ...
today: Today
yesterday: Yesterday
this_week: This week
last_week: Last week
number: Number ...
contains: Contains
is_exactly: Is exactly
starts_with: Starts with
ends_with: Ends with
too_many_objects: "Too many objects, use search box above"
no_objects: "No objects found"
loading: "Loading..."
toggle_navigation: Toggle navigation
home:
name: "Home"
pagination:
previous: "« Prev"
next: "Next »"
truncate: "…"
misc:
search: "Search"
filter: "Filter"
refresh: "Refresh"
show_all: "Show all"
add_filter: "Add filter"
bulk_menu_title: "Selected items"
remove: "Remove"
add_new: "Add new"
chosen: "Chosen %{name}"
chose_all: "Choose all"
clear_all: "Clear all"
up: "Up"
down: "Down"
navigation: "Navigation"
navigation_static_label: "Links"
log_out: "Log out"
ago: "ago"
flash:
successful: "%{name} successfully %{action}"
error: "%{name} failed to be %{action}"
noaction: "No actions were taken"
model_not_found: "Model '%{model}' could not be found"
object_not_found: "%{model} with id '%{id}' could not be found"
table_headers:
model_name: "Model name"
last_created: "Last created"
records: "Records"
username: "User"
changes: "Changes"
created_at: "Date/Time"
item: "Item"
message: "Message"
actions:
dashboard:
title: "Site Administration"
menu: "Dashboard"
breadcrumb: "Dashboard"
index:
title: "List of %{model_label_plural}"
menu: "List"
breadcrumb: "%{model_label_plural}"
show:
title: "Details for %{model_label} '%{object_label}'"
menu: "Show"
breadcrumb: "%{object_label}"
show_in_app:
menu: "Show in app"
new:
title: "New %{model_label}"
menu: "Add new"
breadcrumb: "New"
link: "Add a new %{model_label}"
done: "created"
edit:
title: "Edit %{model_label} '%{object_label}'"
menu: "Edit"
breadcrumb: "Edit"
link: "Edit this %{model_label}"
done: "updated"
delete:
title: "Delete %{model_label} '%{object_label}'"
menu: "Delete"
breadcrumb: "Delete"
link: "Delete '%{object_label}'"
done: "deleted"
bulk_delete:
title: "Delete %{model_label_plural}"
menu: "Multiple delete"
breadcrumb: "Multiple delete"
bulk_link: "Delete selected %{model_label_plural}"
export:
title: "Export %{model_label_plural}"
menu: "Export"
breadcrumb: "Export"
link: "Export found %{model_label_plural}"
bulk_link: "Export selected %{model_label_plural}"
done: "exported"
history_index:
title: "History for %{model_label_plural}"
menu: "History"
breadcrumb: "History"
history_show:
title: "History for %{model_label} '%{object_label}'"
menu: "History"
breadcrumb: "History"
form:
cancel: "Cancel"
basic_info: "Basic info"
required: "Required"
optional: "Optional"
one_char: "character"
char_length_up_to: "length up to"
char_length_of: "length of"
save: "Save"
save_and_add_another: "Save and add another"
save_and_edit: "Save and edit"
all_of_the_following_related_items_will_be_deleted: "? The following related items may be deleted or orphaned:"
are_you_sure_you_want_to_delete_the_object: "Are you sure you want to delete this %{model_name}"
confirmation: "Yes, I'm sure"
bulk_delete: "The following objects will be deleted, which may delete or orphan some of their related dependencies:"
new_model: "%{name} (new)"
export:
confirmation: "Export to %{name}"
select: "Select fields to export"
select_all_fields: "Select All Fields"
fields_from: "Fields from %{name}"
fields_from_associated: "Fields from associated %{name}"
display: "Display %{name}: %{type}"
options_for: "Options for %{name}"
empty_value_for_associated_objects: "<empty>"
click_to_reverse_selection: 'Click to reverse selection'
csv:
header_for_root_methods: "%{name}" # 'model' is available
header_for_association_methods: "%{name} [%{association}]"
encoding_to: "Encode to"
encoding_to_help: "Choose output encoding. Leave empty to let current input encoding untouched: (%{name})"
skip_header: "No header"
skip_header_help: "Do not output a header (no fields description)"
default_col_sep: ","
col_sep: "Column separator"
col_sep_help: "Leave blank for default ('%{value}')" # value is default_col_sep
+2 -2
View File
@@ -1,8 +1,8 @@
development:
clients:
default:
database: ch420_development
# database: heroku_t242kdp0
# database: ch420_development
database: heroku_t242kdp0
hosts:
- localhost:27017
+3 -2
View File
@@ -3,9 +3,10 @@ Rails.application.routes.draw do
namespace :admin do
get '/map', to: 'pages#map', as: :map
resources :supporters, only: :index
# resources :supporters, only: :index
end
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
get '/cities_autocomplete', to: 'cities_autocomplete#index', as: :cities_autocomplete
scope '/:locale' do
get '/', to: 'supporters#new'