-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add Import
form to db views
#98
Conversation
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.
Noticed a few things. All .import
methods should return a saved model.
Also, we might want to use .find_or_import
in case the user enters a value that's already in the database.
app/db.rb
Outdated
redirect "db/host_names" | ||
end | ||
|
||
if host_name.save |
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 think the host_name.save
is unnecessary, since HostName.import
calls create(...)
with the host name. Can probably simply the if statement to just a simple redirect "/db/host_names/#{host_name.id}"
.
app/db.rb
Outdated
post '/db/host_names/import' do | ||
begin | ||
host_name = Ronin::DB::HostName.import(params[:host_name]) | ||
rescue ArgumentError => e |
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 try to avoid single letter variable names and prefer to use error
instead of e
.
views/db/credentials/show.erb
Outdated
<h1>Credential: <%=h @password %></h1> | ||
<%= partial(:delete, record: @password, path: "credentials") %> | ||
<h1>Credential: <%=h @credential %></h1> | ||
<%= partial(:delete, record: @credential, path: "credentials") %> |
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.
This could probably be a separate commit.
views/db/organizations/index.erb
Outdated
<p><a href="/db/organizations/<%=h organization.id %>"><%=h organization %></a></p> | ||
<% end %> | ||
|
||
<%= partial(:pagination, pagy: @pagy) %> |
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'm guessing your editor automatically re-indented this code?
views/db/passwords/index.erb
Outdated
<li><a href="/">Home</a></li> | ||
<li><a href="/db">Database</a></li> | ||
</ul> | ||
</nav> | ||
<% end %> |
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'm guessing your editor automatically re-indented stuff?
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.
No, I did it intentionally :D
#93