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
Feature/crud admin user #17
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4489f73
Add activeadmin gem
LeandroSoria2 6d0b7a7
Setup Active Admin
LeandroSoria2 2b4d540
Add sass gem and fix applicationController.rb
LeandroSoria2 7a29fb3
Delete admin_user_spec.rb
LeandroSoria2 ab52eb9
Fix files with rubocop
LeandroSoria2 800ad92
Config active_admib.rb
LeandroSoria2 8b98c11
change seeds.rb
LeandroSoria2 9f2ab4a
Delete migration
LeandroSoria2 eb94685
Fix schema.rb
LeandroSoria2 9ae3d78
Fix schema version
LeandroSoria2 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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,27 @@ | ||
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,35 @@ | ||
# 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 | ||
# content | ||
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 @@ | ||
//= require active_admin/base |
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,17 @@ | ||
// Sass variable overrides must be declared before loading up Active Admin's styles. | ||
// | ||
// To view the variables that Active Admin provides, take a look at | ||
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the | ||
// Active Admin source. | ||
// | ||
// For example, to change the sidebar width: | ||
// $sidebar-width: 242px; | ||
|
||
// Active Admin's got SASS! | ||
@import "active_admin/mixins"; | ||
@import "active_admin/base"; | ||
|
||
// Overriding any non-variable Sass must be done after the fact. | ||
// For example, to change the default status-tag color: | ||
// | ||
// .status_tag { background: #6090DB; } |
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
class ApplicationController < ActionController::Base | ||
include DeviseTokenAuth::Concerns::SetUserByToken | ||
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,24 @@ | ||
# == Schema Information | ||
# | ||
# Table name: admin_users | ||
# | ||
# id :bigint not null, primary key | ||
# email :string default(""), not null | ||
# encrypted_password :string default(""), not null | ||
# reset_password_token :string | ||
# reset_password_sent_at :datetime | ||
# remember_created_at :datetime | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
# Indexes | ||
# | ||
# index_admin_users_on_email (email) UNIQUE | ||
# index_admin_users_on_reset_password_token (reset_password_token) UNIQUE | ||
# | ||
class AdminUser < ApplicationRecord | ||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | ||
devise :database_authenticatable, | ||
:recoverable, :rememberable, :validatable | ||
end |
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.
Why is this being removed? Don't we need to add it somewhere else?
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.
I have a problem with active admin and this is already in the API controller.
https://github.com/LeandroSoria2/TargetApi/blob/develop/app/controllers/api/v1/api_controller.rb
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.
@JulianPasquale It looks like including this line in the ApplicationController generates conflicts with active admin. He had another controller (ApiController) with this same DeviseTokenAuth inclusion already, which is the one he uses for endpoints, so he had to remove this line here in order to fix the issue he was having with active admin.
Here's a thread about the same issue Lean was having:
lynndylanhurley/devise_token_auth#47
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.
ah so this is in the ApiController as well. If that's the case then it's ok to remove this 👍