Skip to content

Commit

Permalink
reorg nav menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Oct 18, 2024
1 parent 3ada472 commit 038b38b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 46 deletions.
23 changes: 3 additions & 20 deletions app/views/layouts/navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

<div class="collapse navbar-collapse" id="navbarsExample09">
<ul class="navbar-nav me-auto mb-2 mb-lg-0 nav-underline">
<% if can? :create, Thesis %>
<li class="nav-item">
<%= active_link_to 'Overview', root_path, active: /\A\/\z|(\/\?which=+)/, class:"nav-link" %>
</li>
<% end %>

<% if can? :update, Student %>
<li class="nav-item">
<%= active_link_to "Students", students_path, class:"nav-link" %>
Expand All @@ -26,6 +22,8 @@
<li class="nav-item">
<%= active_link_to "Reports", reports_dashboard_path, class:"nav-link", active: /(by_status\?status)|dashboard/ %>
</li>
<li class="nav-item"><%= active_link_to "Users", users_path, class: "nav-link" %></li>
<li class="nav-item"><%= active_link_to "Settings", edit_settings_path, class: "nav-link" %></li>
<% end %>
<% if @current_user.role == User::STUDENT %>
<%= render partial: "student_view/student_navbar" %>
Expand All @@ -37,21 +35,6 @@
<input name="sisid" class="form-control" placeholder="Enter SISID or Name">
<% end %>
<% end %>
<ul class="navbar-nav mt-2 mt-md-0">
<% if @current_user.role == User::ADMIN || @current_user.role == User::MANAGER %>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-cog"></i></a>
<ul class="dropdown-menu dropdown-menu-end">
<li><%= link_to "App Settings", edit_settings_path, class: "dropdown-item" %></li>
<li><hr class="dropdown-divider"></li>
<li><%= link_to "DSpace Export", export_logs_path, class: "dropdown-item" %></li>
<li><%= link_to "DSpace Settings", dspace_settings_path, class: "dropdown-item" %></li>
<li><hr class="dropdown-divider"></li>
<li><%= link_to "Users", users_path, class: "dropdown-item" %></li>
</ul>
</li>
<% end %>
</ul>
</div>
<ul class="navbar-nav mt-2 mt-md-0">
<li class="nav-item dropdown">
Expand Down
16 changes: 5 additions & 11 deletions test/system/app_settings_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class AppSettingsTest < ApplicationSystemTestCase

visit root_url

find('i.fa.fa-cog').click

click_link("App Settings")
click_link("Settings")

find('trix-editor#app_settings_student_begin_submission').click.set('Welcome Message Text Test')

Expand Down Expand Up @@ -54,8 +52,7 @@ class AppSettingsTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("App Settings")
click_link("Settings")
click_button('Update details')
find('trix-editor#app_settings_student_update_details_initial').click.set('Initial Text Test')
find('#app_settings_student_update_details_abstract').click.set('Abstract Text Test')
Expand Down Expand Up @@ -87,8 +84,7 @@ class AppSettingsTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("App Settings")
click_link("Settings")
click_button('Upload files')
find('trix-editor#app_settings_student_upload_files').click.set('Upload Files Text Test')
find('trix-editor#app_settings_student_supplementary_upload_files').click.set('Supplementary Upload files Text Test')
Expand Down Expand Up @@ -122,8 +118,7 @@ class AppSettingsTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("App Settings")
click_link("Settings")
click_button('Review Licences')
find('trix-editor#app_settings_student_review_license_info').click.set('Review Licence Info Text Test')
find('trix-editor#app_settings_student_review_license_lac').click.set('LAC licence Text Test')
Expand Down Expand Up @@ -160,8 +155,7 @@ class AppSettingsTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("App Settings")
click_link("Settings")
click_button('Submit for Review')
find('trix-editor#app_settings_student_submit_for_review').click.set('Submit for Review Text Test')
click_button('Save Settings')
Expand Down
2 changes: 1 addition & 1 deletion test/system/theses_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ThesesTest < ApplicationSystemTestCase
visit root_url
assert_selector 'h2', text: (/#{Regexp.escape("#{@thesis_01.title}")}/i)
click_link(@thesis_01.title)
click_link('Overview')
click_link('ETD')
click_link('Under Review')
assert_selector 'h2', text: (/#{Regexp.escape("#{@thesis_02.title}")}/i)
click_link(@thesis_02.title)
Expand Down
14 changes: 0 additions & 14 deletions test/system/users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class UsersTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("Users")
click_link("New User")
fill_in('Name *', with: "Test User")
Expand All @@ -34,7 +33,6 @@ class UsersTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("Users")
click_link(@user1.name)
fill_in('Name *', with: "Test User")
Expand All @@ -51,7 +49,6 @@ class UsersTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("Users")
find(:xpath, ".//a[@href='/users/#{@user1.id}/block']").click
page.accept_alert
Expand All @@ -64,7 +61,6 @@ class UsersTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("Users")
find(:xpath, ".//a[@href='/users/#{@user1.id}/block']").click
page.accept_alert
Expand All @@ -80,19 +76,9 @@ class UsersTest < ApplicationSystemTestCase
user = FactoryGirl.create(:user, role: User::ADMIN)
login_as(user)
visit root_url
find('i.fa.fa-cog').click
click_link("Users")
find(:xpath, ".//a[@href='/users/#{@user1.id}/activity']").click

assert_selector 'h1', text: "#{@user1.name} - Activity"
end
end

########################################
## For Debugging and building tests ##
# page.driver.browser.manage.window.resize_to(1920, 2500)
# save_screenshot()
## HTML Save
# File.open("tmp/test-screenshots/error.html", "w") { |file| file.write(page.html) }
# save_page()
########################################

0 comments on commit 038b38b

Please sign in to comment.