Skip to content

Commit

Permalink
Merge pull request #5 from tamu-edu-students/revert-4-admin-managemen…
Browse files Browse the repository at this point in the history
…t-display-page

Revert "Admin management display page"
  • Loading branch information
LeoHsuProgrammingLab authored Oct 31, 2024
2 parents bfbc2a1 + 4f8ffd1 commit 7a95457
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 119 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,3 @@ heroku run rails db:seed
* Sai Nithin
* Vinayaka Hegde
* [Legacy Code](https://github.com/tamu-edu-students/csce606-ELRC-Synergistic-Leadership-Theory)


4 changes: 1 addition & 3 deletions rails_root/app/controllers/admins_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# frozen_string_literal: true

# admins_controller.rb
#admins_controller.rb
class AdminsController < ApplicationController
def index
@survey_responses = SurveyResponse.get_all_responses(page: params[:page], per_page: 20)
Expand Down
3 changes: 0 additions & 3 deletions rails_root/app/helpers/admins_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# frozen_string_literal: true

# helper method for the admin controller
module AdminsHelper
end
8 changes: 4 additions & 4 deletions rails_root/app/models/survey_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class SurveyResponse < ApplicationRecord
belongs_to :profile,
class_name: 'SurveyProfile'

has_many :invitations,
foreign_key: :parent_response_id,
class_name: 'Invitation',
dependent: :destroy
has_many :invitations,
foreign_key: :parent_response_id,
class_name: 'Invitation',
dependent: :destroy

def self.create_from_params(user_id, params)
# FIXME: When we look up things and fail, we should use more descriptive exceptions instead of ActiveRecord::RecordNotFound
Expand Down
28 changes: 12 additions & 16 deletions rails_root/app/views/admins/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,22 @@
<div class="table-responsive">
<table class = "table">
<thead>
<tr>
<th>ID</th>
<th>Profile</th>
<th>Share Code</th>
<th>Created At</th>
<th>View Survey</th>
</tr>
<tr>
<th>ID</th>
<th>Profile</th>
<th>Share Code</th>
<th>Created At</th>
</tr>
</thead>
<% if @survey_responses.present? %>
<tbody>
<% @survey_responses.each do |response| %>
<tr>
<td><%= response.id %></td>
<td><%= response.profile.user_id %></td>
<td><%= response.share_code %></td>
<td><%= response.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td>
<%= link_to 'View Survey', survey_response_path(response) %>
</td>
</tr>
<tr>
<td><%= response.id %></td>
<td><%= response.profile.user_id %></td>
<td><%= response.share_code %></td>
<td><%= response.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
</tr>
<% end %>
</tbody>
<% end %>
Expand Down
4 changes: 0 additions & 4 deletions rails_root/app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
<li class="nav-item">
<%= link_to "About", about_path, class: "nav-link #{'active' if current_page?(about_path)}" %>
</li>
<li class="nav-item">
<%= link_to "Admin Dashboard", admin_dashboard_path, class: "nav-link" %> <!-- Admin Dashboard Link -->
</li>

<li class="nav-item">
<%# <%= link_to "Survey Responses", survey_responses_path, class: "nav-link #{'active' if current_page?(survey_responses_path)}" %>
</li>
Expand Down
4 changes: 1 addition & 3 deletions rails_root/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

get 'home/index'
get 'about', to: 'about#index'
get '/admin', to: 'admins#index', as: 'admin_dashboard'
#get 'survey_responses/:id', to: 'survey_responses#show', as: 'survey_response'

get '/admin', to: 'admins#index'

# get 'survey', to: 'survey_responses#new', as: 'survey'
# get 'survey/page/:page', to: 'survey_responses#survey', as: 'survey_page'
Expand Down
12 changes: 0 additions & 12 deletions rails_root/features/admin_management.feature

This file was deleted.

29 changes: 0 additions & 29 deletions rails_root/features/step_definitions/admin_management_steps.rb

This file was deleted.

2 changes: 0 additions & 2 deletions rails_root/spec/helpers/admins_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

require 'rails_helper'

# Specs in this file have access to a helper object that includes
Expand Down
32 changes: 0 additions & 32 deletions rails_root/spec/requests/admin_dashboard_spec.rb

This file was deleted.

11 changes: 5 additions & 6 deletions rails_root/spec/requests/admins_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Admins', type: :request do
describe 'GET /index' do
it 'returns http success' do
get '/admins/index'
RSpec.describe "Admins", type: :request do
describe "GET /index" do
it "returns http success" do
get "/admins/index"
expect(response).to have_http_status(:success)
end
end

end
4 changes: 1 addition & 3 deletions rails_root/spec/views/admins/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'admins/index.html.erb', type: :view do
RSpec.describe "admins/index.html.erb", type: :view do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit 7a95457

Please sign in to comment.