diff --git a/.gitignore b/.gitignore index 31b9df2..1a37534 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ *.swp *~ dump.rdb +/db diff --git a/app.rb b/app.rb index 5088ae9..4788e72 100644 --- a/app.rb +++ b/app.rb @@ -731,6 +731,26 @@ class App < Sinatra::Base end end + get '/db/organization_departments/:id' do + @organization_department = Ronin::DB::OrganizationDepartment.find(params[:id]) + + if @organization_department + erb :"db/organizations/departments/show" + else + halt 404 + end + end + + get '/db/organization_members/:id' do + @organization_member = Ronin::DB::OrganizationMember.find(params[:id]) + + if @organization_member + erb :"db/organizations/members/show" + else + halt 404 + end + end + get '/db/people' do @pagy, @people = pagy(Ronin::DB::Person) diff --git a/scripts/console b/scripts/console index 683fa2d..053772d 100755 --- a/scripts/console +++ b/scripts/console @@ -1,3 +1,7 @@ #!/usr/bin/env bash +if [[ -z "$DATABASE_URL" ]] && [[ -n "$DATABASE_NAME" ]]; then + export DATABASE_URL="sqlite3:db/dev.sqlite3" +fi + bundle exec irb -Ilib -r ./app.rb diff --git a/views/db/organizations/departments/show.erb b/views/db/organizations/departments/show.erb new file mode 100644 index 0000000..074e161 --- /dev/null +++ b/views/db/organizations/departments/show.erb @@ -0,0 +1,82 @@ +<% content_for :breadcrumbs do %> + +<% end %> + +

Organization Department: <%=h @organization_department %>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Organization:<%=h @organization_department.organization %>
Parent Department: + <% if @organization_department.parent_department %> + <%=h @organization_department.parent_department %> + <% end %> +
Street Address: + <% if @organization_department.street_address %> + <%=h @organization_department.street_address %> + <% end %> +
Email Address: + <% if @organization_department.email_address %> + <%=h @organization_department.email_address %> + <% end %> +
Phone Number: + <% if @organization_department.phone_number %> + <%=h @organization_department.phone_number %> + <% end %> +
Subdepartments: + <% @organization_department.subdepartments.each do |subdepartment| %> +

<%=h subdepartment %>

+ <% end %> +
Members: + <% @organization_department.members.each do |member| %> +

<%=h member %>

+ <% end %> +
Created:<%=h @organization_department.created_at %>
diff --git a/views/db/organizations/members/show.erb b/views/db/organizations/members/show.erb new file mode 100644 index 0000000..3bd0de9 --- /dev/null +++ b/views/db/organizations/members/show.erb @@ -0,0 +1,87 @@ +<% content_for :breadcrumbs do %> + +<% end %> + +

Organization Member: <%=h @organization_member.person %>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Active:<%=h @organization_member.active %>
Type:<%=h @organization_member.type %>
Role:<%=h @organization_member.role %>
Title:<%=h @organization_member.title %>
Rank:<%=h @organization_member.rank %>
Person:<%=h @organization_member.person %>
Department: + <% if @organization_member.department %> + <%=h @organization_member.department %> + <% end %> +
Organization:<%=h @organization_member.organization %>
Email Address: + <% if @organization_member.email_address %> + <%=h @organization_member.email_address %> + <% end %> +
Phone Number: + <% if @organization_member.phone_number %> + <%=h @organization_member.phone_number %> + <% end %> +
Created at:<%=h @organization_member.created_at %>
Updated at:<%=h @organization_member.updated_at %>
diff --git a/views/db/organizations/show.erb b/views/db/organizations/show.erb index dd077de..300f28c 100644 --- a/views/db/organizations/show.erb +++ b/views/db/organizations/show.erb @@ -57,7 +57,7 @@ Members: <% @organization.members.each do |member| %> -

<%=h member %>

+

<%=h member.person %>

<% end %>