forked from eagerworks/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Admin panel #16
Open
brunoLombardo
wants to merge
3
commits into
main
Choose a base branch
from
admin_panel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Admin panel #16
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ActiveAdmin.register AdminUser do | ||
permit_params :email, :password, :password_confirmation | ||
index do | ||
selectable_column | ||
id_column | ||
column :email | ||
column :current_sign_in_at | ||
column :sign_in_count | ||
column :created_at | ||
actions | ||
end | ||
|
||
filter :email | ||
filter :current_sign_in_at | ||
filter :sign_in_count | ||
filter :created_at | ||
|
||
form do |f| | ||
f.inputs do | ||
f.input :email | ||
f.input :password | ||
f.input :password_confirmation | ||
end | ||
f.actions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ActiveAdmin.register Category do | ||
menu label: 'Categorías' | ||
remove_filter :gift_categorizations | ||
filter :name, label: 'Nombre' | ||
filter :created_at, label: 'Fecha de creación' | ||
filter :updated_at, label: 'Última actualización' | ||
permit_params :name | ||
|
||
show do | ||
attributes_table do | ||
row 'Nombre', &:name | ||
row 'Fecha de creación', &:created_at | ||
row 'Última actualización', &:updated_at | ||
end | ||
active_admin_comments | ||
end | ||
|
||
index do | ||
selectable_column | ||
id_column | ||
column 'Nombre', :name | ||
column 'Fecha de creación', :created_at | ||
column 'Última actualización', :updated_at | ||
|
||
actions | ||
end | ||
|
||
form do |f| | ||
f.inputs 'Detalles' do | ||
f.input :name, label: 'Nombre' | ||
end | ||
f.actions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ActiveAdmin.register Customization do | ||
permit_params :name, :price | ||
menu label: 'Personalizaciones' | ||
filter :name, label: 'Nombre' | ||
filter :price, label: 'Precio' | ||
|
||
index do | ||
selectable_column | ||
id_column | ||
column 'Nombre', :name | ||
column 'Precio', :price | ||
column 'Fecha de creación', :created_at | ||
column 'Última actualización', :updated_at | ||
actions | ||
end | ||
|
||
show do | ||
attributes_table do | ||
row 'Nombre', &:name | ||
row 'Precio', &:price | ||
row 'Fecha de creación', &:created_at | ||
row 'Última actualización', &:updated_at | ||
end | ||
active_admin_comments | ||
end | ||
|
||
form do |f| | ||
f.inputs 'Detalles' do | ||
f.input :name, label: 'Nombre' | ||
f.input :price, label: 'Precio' | ||
end | ||
f.actions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register_page 'Dashboard' do | ||
menu priority: 1, label: proc { I18n.t('active_admin.dashboard') } | ||
|
||
content title: proc { I18n.t('active_admin.dashboard') } do | ||
div class: 'blank_slate_container', id: 'dashboard_default_message' do | ||
span class: 'blank_slate' do | ||
span I18n.t('active_admin.dashboard_welcome.welcome') | ||
small I18n.t('active_admin.dashboard_welcome.call_to_action') | ||
end | ||
end | ||
|
||
# Here is an example of a simple dashboard with columns and panels. | ||
# | ||
# columns do | ||
# column do | ||
# panel "Recent Posts" do | ||
# ul do | ||
# Post.recent(5).map do |post| | ||
# li link_to(post.title, admin_post_path(post)) | ||
# end | ||
# end | ||
# end | ||
# end | ||
|
||
# column do | ||
# panel "Info" do | ||
# para "Welcome to ActiveAdmin." | ||
# end | ||
# end | ||
# end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
ActiveAdmin.register Gift do | ||
permit_params :name, :price, :valoration, :supplier_id, :image, :content, category_ids: [], | ||
customization_ids: [] | ||
|
||
menu label: 'Regalos' | ||
remove_filter :gift_customizations, :gift_categorizations, :purchases, | ||
:image_attachment, :image_blob, :rich_text_content | ||
|
||
filter :name, label: 'Nombre' | ||
filter :price, label: 'Precio' | ||
filter :valoration, label: 'Valoración' | ||
filter :supplier, label: 'Proveedor' | ||
filter :categories, label: 'Categorías', multiple: true | ||
filter :customizations, label: 'Personalizaciones', multiple: true | ||
filter :created_at, label: 'Fecha de creación' | ||
filter :updated_at, label: 'Última actualización' | ||
|
||
controller do | ||
def scoped_collection | ||
super.includes(:supplier) | ||
end | ||
end | ||
|
||
index do | ||
selectable_column | ||
id_column | ||
column 'Nombre', :name | ||
column 'Precio', :price | ||
column 'Valoración', :valoration | ||
column 'Proveedor', :supplier | ||
column 'Fecha de creación', :created_at | ||
column 'Última actualización', :updated_at | ||
actions | ||
end | ||
|
||
show do | ||
attributes_table do | ||
row 'Nombre', &:name | ||
row 'Precio', &:price | ||
row 'Valoración', &:valoration | ||
row 'Proveedor', &:supplier | ||
row 'Imagen' do |gift| | ||
image_tag gift.image_resized_for_purchase | ||
end | ||
row 'Contenido' do |gift| | ||
gift.content.to_s | ||
end | ||
row 'Categorías' do |gift| | ||
dropdown_menu '' do | ||
gift.categories.each do |category| | ||
item category.name | ||
end | ||
end | ||
end | ||
row 'Personalizaciones' do |gift| | ||
dropdown_menu '' do | ||
gift.customizations.each do |customization| | ||
item customization.name, admin_customization_path(customization) | ||
end | ||
end | ||
end | ||
row 'Fecha de creación', &:created_at | ||
row 'Última actualización', &:updated_at | ||
end | ||
active_admin_comments | ||
end | ||
|
||
form do |f| | ||
f.inputs 'Detalles' do | ||
f.input :name, label: 'Nombre' | ||
f.input :price, label: 'Precio' | ||
f.input :valoration, label: 'Valoración' | ||
f.input :supplier, label: 'Proveedor' | ||
f.input :image, label: 'Imagen', as: :file | ||
f.input :content, label: 'Contenido' | ||
f.input :categories, label: 'Categorías' | ||
f.input :customizations, label: 'Personalizaciones' | ||
end | ||
f.actions | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to do translations, I suggest that we use i18n. I believe active admin automatically uses it, so we probably just need to add an
es.yml
file with the translations. For more info, check https://guides.rubyonrails.org/i18n.html