Skip to content

Commit

Permalink
Merge pull request #223 from commercekitchen/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Tom Reis authored Oct 30, 2019
2 parents 24ed91a + 74a596f commit f9944e6
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 27 deletions.
3 changes: 2 additions & 1 deletion app/controllers/course_completions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ def index
completed_ids = current_user.course_progresses.completed.collect(&:course_id)
@courses = Course.where(id: completed_ids)

enable_sidebar('shared/user/sidebar')

respond_to do |format|
enable_sidebar
format.html
format.json { render json: @courses }
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def safe_logo_tag(source, options = {})
end

def is_org_admin?(user)
user.has_role?(:admin, current_organization)
user.present? && user.has_role?(:admin, current_organization)
end

def include_search?
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/categories/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= content_for(:callout) { %><h1>Admin Dashboard</h1><% } %>

<h1>Categories</h1>
<h2>Categories</h2>

<div id="category_list">
<div class="sortable-list" data-page="categories">
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/courses/import_courses.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= content_for(:callout) { %><h1>Admin Dashboard</h1><% } %>

<h1>DigitalLearn Courses</h1>
<h2>Import DigitalLearn Courses</h2>

<div class="row">
<div class="sixcol">
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/courses/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= content_for(:callout) { %><h1>Admin Dashboard</h1><% } %>

<h2 class="text-color">Courses</h2>
<h2>Courses</h2>

<div class="row">
<div class="sixcol">
Expand Down
3 changes: 0 additions & 3 deletions app/views/admin/custom/branches/show.html.erb

This file was deleted.

4 changes: 3 additions & 1 deletion app/views/admin/custom/features/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% content_for(:callout) do %>
<h1>Manage Login Requirement for your organization.</h1>
<h1>Admin Dashboard</h1>
<% end %>

<h2>Login Requirement</h2>

<p class="emphasis no-top-margin">
Indicate whether or not login is required for users to access courses on your site.
<br>
Expand Down
4 changes: 3 additions & 1 deletion app/views/admin/custom/footers/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% content_for(:callout) do %>
<h1>Custom Footer Logo</h1>
<h1>Admin Dashboard</h1>
<% end %>

<h2>Footer Logo</h2>

<p class="emphasis no-top-margin">Add a custom logo to your footer to appear next to the PLA logo. Uploaded file should be in png or jpeg format and less than 2MB in size.</p>

<%= form_for @organization, url: admin_custom_footers_path, html: { multipart: true } do |f| %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/admin/custom/translations/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% content_for(:callout) do %>
<h1>Customizable Text Sections - <%= locale_string(@locale) %></h1>
<h1>Admin Dashboard</h1>
<% end %>

<h2>Custom Text - <%= locale_string(@locale) %></h2>

<p class="emphasis no-top-margin">Customize various text sections of your DigitalLearn site below. Select language in the header of this page to toggle between editable text sections in English and Spanish.</p>

<table class="translations-table">
Expand Down
4 changes: 3 additions & 1 deletion app/views/admin/custom/user_surveys/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% content_for(:callout) do %>
<h1>User Survey</h1>
<h1>Admin Dashboard</h1>
<% end %>

<h2>User Survey</h2>

<p class="emphasis no-top-margin">Add a button that will appear on all course completion pages to take your users to an external survey site of your choice.</p>

<%= form_for @organization, url: admin_custom_user_surveys_path do |f| %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/invites/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%= content_for(:callout) { %><h1>Admin Dashboard</h1><% } %>

<h2><%= t "devise.invitations.new.header" %></h2>

<%= form_for resource, as: resource_name, url: invitation_path(resource_name), html: {method: :post} do |f| %>
Expand Down
6 changes: 5 additions & 1 deletion app/views/admin/library_locations/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<%= content_for(:callout) { %><h1>Library Branches</h1><% } %>
<%= content_for(:callout) do %>
<h1>Admin Dashboard</h1>
<% end %>

<h2>Manage Library Branches</h2>

<div class="toggle-branches">
<p class="emphasis">
Expand Down
5 changes: 4 additions & 1 deletion app/views/admin/reports/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<h2 class="text-color">Admin Reports</h2>
<%= content_for(:callout) { %><h1>Admin Dashboard</h1><% } %>

<h2>Reports</h2>

<% if subdomain? %>
<li><%= link_to "Completions Report (by Library)", admin_export_completions_path(format: "csv", version: "lib") %></li>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/users/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= content_for(:callout) { %><h1>Admin Dashboard</h1><% } %>

<h1>Users</h1>
<h2>User Accounts</h2>

<div class="row">
<div class="sixcol">
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/admin/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<% if current_organization.has_student_programs? %>
<li><%= link_to "Manage Schools", admin_schools_path %></li>
<% end %>
<li><%= link_to "Customizable Text Sections", admin_custom_translations_path %></li>
<li><%= link_to "Custom Text", admin_custom_translations_path %></li>
<li><%= link_to "User Survey", admin_custom_user_surveys_path %></li>
<% if subdomain? %>
<li><%= link_to "Footer", admin_custom_footers_path %></li>
<li><%= link_to "Footer Logo", admin_custom_footers_path %></li>
<li><%= link_to "Login Requirement", admin_custom_features_path %></li>
<li><%= link_to "Manage Library Branches", admin_library_locations_path %></li>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/user/_sidebar.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="sidebar">
<ul class="sidebar-links">
<li><%= link_to "#{t('account.profile')}", profile_path %></li>
<% if current_user.has_role?(:trainer, current_organization) %>
<% if current_user && current_user.has_role?(:trainer, current_organization) %>
<li><%= link_to "Cyber Navigator Dashboard", trainer_dashboard_index_path %></li>
<% end %>
<% if !current_organization.library_card_login? || current_user.has_role?(:admin, current_organization) %>
Expand Down
4 changes: 2 additions & 2 deletions config/locales/devise_invitable.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ en:
no_invitations_remaining: "No invitations remaining"
invitation_removed: "Your invitation was removed."
new:
header: "Send invitation"
submit_button: "Send an invitation"
header: "Invite Admin"
submit_button: "Send Invitation"
edit:
header: "Set your password"
submit_button: "Set my password"
Expand Down
4 changes: 2 additions & 2 deletions config/locales/devise_invitable.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ es:
no_invitations_remaining: "No quedan más invitaciones"
new:
header: "Enviar Invitación"
submit_button: "Envia una invitación"
submit_button: "Envia la invitación"
edit:
header: "Establecer contraseña"
submit_button: "Guardar mi contraseña"
mailer:
invitation_instructions:
subject: "Instruciones de la invitación"
subject: "Instruciones de la invitación"
2 changes: 1 addition & 1 deletion spec/features/admin/account_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
end

context 'sees correct sidebar options at /my_courses' do
before { visit my_courses_path }
before { visit course_completions_path }
it_behaves_like 'User Sidebar Links'
end

Expand Down
10 changes: 8 additions & 2 deletions spec/features/admin/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
'Invite Admin' => admin_dashboard_admin_invitation_path,
'Manage Library Branches' => admin_library_locations_path,
'Categories' => admin_categories_path,
'Customizable Text Sections' => admin_custom_translations_path,
'Custom Text' => admin_custom_translations_path,
'User Survey' => admin_custom_user_surveys_path,
'Footer' => admin_custom_footers_path,
'Footer Logo' => admin_custom_footers_path,
'Login Requirement' => admin_custom_features_path }.each do |link, path|
expect(page).to have_link(link)
click_link(link)
expect(current_path).to eq(path)
within(:css, '.callout') do
expect(page).to have_content('Admin Dashboard')
end
within(:css, '.main-content') do
expect(page).to have_css('h2', text: link)
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/new_organization_walkthrough_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
select 'Denver Public Library', from: :user_organization_id

count_before = User.count
click_on 'Send an invitation'
click_on 'Send Invitation'
count_after = User.count
expect(count_after).to eq(count_before + 1)

Expand Down Expand Up @@ -99,7 +99,7 @@
click_on 'Invite Admin'
fill_in :user_email, with: '[email protected]'
select 'Denver Public Library', from: :user_organization_id
click_on 'Send an invitation'
click_on 'Send Invitation'

expect(page).to have_content('The user already exists')
expect(current_path).to eq(admin_dashboard_admin_invitation_path)
Expand Down

0 comments on commit f9944e6

Please sign in to comment.