Skip to content

Commit

Permalink
Merge branch 'Simon-Initiative:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
dtiwarATS authored Aug 5, 2024
2 parents e13273f + f5527c7 commit 54824af
Show file tree
Hide file tree
Showing 14 changed files with 148 additions and 104 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cp oli.example.env oli.env
- name: 🗄 Start test database
run: docker-compose up -d postgres
run: docker compose up -d postgres

- name: 💾 Restore the deps cache
id: mix-deps-cache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Modal, OverlayTrigger, Tooltip } from 'react-bootstrap';
import { useDispatch } from 'react-redux';
import ScreenAuthor from 'components/activities/adaptive/components/authoring/ScreenAuthor';
import { setCurrentPartPropertyFocus } from 'apps/authoring/store/parts/slice';
import { FeedbackAction } from 'apps/authoring/types';
import guid from 'utils/guid';
import { AdvancedAuthoringModal } from '../AdvancedAuthoringModal';
Expand All @@ -19,7 +21,7 @@ const ActionFeedbackEditor: React.FC<ActionFeedbackEditorProps> = ({
}) => {
const [fakeFeedback, setFakeFeedback] = useState<string>('');
const uuid = guid();

const dispatch = useDispatch();
const [feedback, setFeedback] = useState<any>(action.params?.feedback || {});
const [showConfirmDelete, setShowConfirmDelete] = useState<boolean>(false);

Expand Down Expand Up @@ -58,11 +60,13 @@ const ActionFeedbackEditor: React.FC<ActionFeedbackEditorProps> = ({
// TODO: this revert causes infinite loop
// setFeedback(action.params?.feedback || {});
setShowEditor(false);
dispatch(setCurrentPartPropertyFocus({ focus: true }));
}, [feedback]);

const handleSaveEdit = useCallback(() => {
setShowEditor(false);
onChange({ feedback });
dispatch(setCurrentPartPropertyFocus({ focus: true }));
}, [feedback]);

const handleScreenAuthorChange = (screen: any) => {
Expand Down Expand Up @@ -94,6 +98,7 @@ const ActionFeedbackEditor: React.FC<ActionFeedbackEditorProps> = ({
disabled={false}
readOnly={true}
onClick={handleShowFeedbackClick}
onFocus={(e) => dispatch(setCurrentPartPropertyFocus({ focus: false }))}
defaultValue={fakeFeedback}
// onChange={(e) => setFakeFeedback(e.target.value)}
// onBlur={(e) => handleTargetChange(e)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
import { useDispatch } from 'react-redux';
import { setCurrentPartPropertyFocus } from 'apps/authoring/store/parts/slice';
import { MutateStateAction, MutateStateActionParams } from 'apps/authoring/types';
import guid from 'utils/guid';
import { CapiVariableTypes } from '../../../../adaptivity/capi';
Expand All @@ -20,7 +22,7 @@ interface ActionMutateEditorProps {

const ActionMutateEditor: React.FC<ActionMutateEditorProps> = (props) => {
const { action, onChange, onDelete } = props;

const dispatch = useDispatch();
const [target, setTarget] = useState(action.params.target);
const [targetType, setTargetType] = useState(action.params.targetType);
const [operator, setOperator] = useState(action.params.operator);
Expand Down Expand Up @@ -114,7 +116,11 @@ const ActionMutateEditor: React.FC<ActionMutateEditorProps> = (props) => {
id={`action-mutate-target-${uuid}`}
value={target}
onChange={(e) => setTarget(e.target.value)}
onBlur={(e) => handleTargetChange(e.target.value)}
onBlur={(e) => {
handleTargetChange(e.target.value);
dispatch(setCurrentPartPropertyFocus({ focus: true }));
}}
onFocus={(e) => dispatch(setCurrentPartPropertyFocus({ focus: false }))}
title={target}
placeholder="Target"
/>
Expand Down Expand Up @@ -172,7 +178,11 @@ const ActionMutateEditor: React.FC<ActionMutateEditorProps> = (props) => {
id={`action-mutate-value-${uuid}`}
value={value}
onChange={(e) => handleValueChange(e)}
onBlur={() => setIsDirty(true)}
onBlur={() => {
setIsDirty(true);
dispatch(setCurrentPartPropertyFocus({ focus: true }));
}}
onFocus={(e) => dispatch(setCurrentPartPropertyFocus({ focus: false }))}
title={value}
placeholder="Value"
/>
Expand Down
4 changes: 2 additions & 2 deletions assets/src/apps/delivery/Delivery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ const Delivery: React.FC<DeliveryProps> = ({
const dialogMessage = content?.custom?.logoutMessage;
const fullscreen = !content?.displayApplicationChrome;

// this is something SS does...
// this is something SS does....
const { width: windowWidth } = useWindowSize();
const isLessonEnded = useSelector(selectLessonEnd);
return (
<div className={parentDivClasses.join(' ')}>
<div className={`${parentDivClasses.join(' ')} ${localStorage?.theme || ''}`}>
{previewMode && <PreviewTools model={content?.model} />}
<div className="mainView" role="main" style={{ width: windowWidth }}>
<LayoutView pageTitle={pageTitle} previewMode={previewMode} pageContent={content} />
Expand Down
Binary file added assets/static/images/enrollment_info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
160 changes: 83 additions & 77 deletions lib/oli_web/backgrounds.ex

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions lib/oli_web/controllers/pow/session_html/new.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
<div class="text-center text-white text-xl font-normal font-['Open Sans'] leading-7 py-8">
Course Author Sign In
</div>
<%= for link <- OliWeb.Pow.PowHelpers.provider_links(@conn), do: raw(link) %>
<div class="my-4 text-center text-white text-base font-normal font-['Open Sans'] leading-snug">
<% provider_links = OliWeb.Pow.PowHelpers.provider_links(@conn) %>
<%= for link <- provider_links, do: raw(link) %>
<div
:if={provider_links != []}
class="my-4 text-center text-white text-base font-normal font-['Open Sans'] leading-snug"
>
OR
</div>
<%= form_for @changeset, @action, [as: :user], fn f -> %>
Expand Down Expand Up @@ -147,8 +151,12 @@
<div class="text-center text-white text-xl font-normal font-['Open Sans'] leading-7 py-8">
Instructor Sign In
</div>
<%= for link <- OliWeb.Pow.PowHelpers.provider_links(@conn), do: raw(link) %>
<div class="my-4 text-center text-white text-base font-normal font-['Open Sans'] leading-snug">
<% provider_links = OliWeb.Pow.PowHelpers.provider_links(@conn) %>
<%= for link <- provider_links, do: raw(link) %>
<div
:if={provider_links != []}
class="my-4 text-center text-white text-base font-normal font-['Open Sans'] leading-snug"
>
OR
</div>
<%= form_for @changeset, @action, [as: :user], fn f -> %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule OliWeb.Sections.InvalidSectionInviteView do
def render(assigns) do
~H"""
<div class="p-10">
This enrollment link has expired or is invalid. If you already have a student account, please <a href="/session/new">sign in</a>.
This enrollment link has expired or is invalid. If you already have a student account, please <a href="/">sign in</a>.
</div>
"""
end
Expand Down
2 changes: 1 addition & 1 deletion lib/oli_web/templates/delivery/enroll.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<a
:if={!assigns[:auto_enroll_as_guest]}
href={
~p"/session/new?#{[section: @section.slug, from_invitation_link?: assigns[:from_invitation_link?]]}"
~p"/?#{[section: @section.slug, from_invitation_link?: assigns[:from_invitation_link?]]}"
}
class="btn btn-md btn-outline-primary btn-block mt-2"
>
Expand Down
2 changes: 1 addition & 1 deletion lib/oli_web/templates/layout/authoring.html.heex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" xmlns:m="http://www.w3.org/1998/Math/MathML">
<html lang="en" xmlns:m="http://www.w3.org/1998/Math/MathML" class="scroll-smooth">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down
22 changes: 13 additions & 9 deletions lib/oli_web/templates/static_page/index.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@
<div class="lg:mt-6 text-white text-xl font-normal leading-normal">
Easily access and participate in your enrolled courses
</div>
<a href="#enrollment_info" class="w-auto h-[18.56px] text-white text-xl font-normal font-['Inter'] leading-normal mt-4 lg:mt-10 underline underline-offset-4 hover:text-zinc-300">Need an account?</a>
</div>
</div>
<div class="w-full lg:w-1/2 flex items-center justify-center">
<div class="w-96 bg-neutral-700 rounded-md">
<div class="text-center text-white text-xl font-normal font-['Open Sans'] leading-7 py-8">
Student Sign In
</div>
<%= for link <- OliWeb.Pow.PowHelpers.provider_links(@conn), do: raw(link) %>
<div class="my-4 text-center text-white text-base font-normal font-['Open Sans'] leading-snug">
OR
</div>
<% provider_links = OliWeb.Pow.PowHelpers.provider_links(@conn) %>
<%= for link <- provider_links, do: raw(link) %>
<%= if provider_links != [] do %>
<div class="my-4 text-center text-white text-base font-normal font-['Open Sans'] leading-snug">
OR
</div>
<% end %>
<%= form_for @conn, Routes.session_path(@conn, :signin), [as: :user], fn f -> %>
<div class="flex flex-col gap-y-2">
<div class="w-80 h-11 m-auto form-label-group border-none">
Expand Down Expand Up @@ -99,7 +103,7 @@
</div>
</div>
</div>
<div class="relative h-screen flex justify-center items-center">
<div id="enrollment_info" class="relative h-screen flex justify-center items-center">
<div class="absolute h-screen w-full top-0 left-0">
<div class="flex flex-col w-full bg-black h-full">
<%= OliWeb.Backgrounds.enrollment_info(%{}) %>
Expand All @@ -115,11 +119,11 @@
</div>
<div class="w-auto lg:w-1/3 h-auto bg-white rounded-md py-8 px-10">
<div class="text-black text-xl !font-bold font-['Inter']">Still need an account?</div>
<div class="pt-10">
<p class="text-stone-900 text-base font-medium font-['Inter']">
<a href="<%= Oli.VendorProperties.company_faq_url() %>" target="_blank" class="!text-blue-400 text-base font-bold font-['Inter']">Visit our FAQs document</a>
<div class="pt-10 pb-8 md:pb-0">
<p class="text-stone-900 font-medium text-base font-['Inter']">
<a href="<%= Oli.VendorProperties.company_faq_url() %>" target="_blank" class="!text-[#4CA6FF] text-base font-bold font-['Inter'] hover:text-[#4CA6FF]">Visit our FAQs document</a>
for help enrolling or setting up your Torus student account. If you require further assistance, please
<a onclick="window.showHelpModal();" class="text-blue-400 text-base font-bold font-['Inter']">contact our support team.</a>
<a onclick="window.showHelpModal();" class="text-[#4CA6FF] text-base font-bold font-['Inter'] hover:text-[#4CA6FF]">contact our support team.</a>
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/oli_web/controllers/delivery_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ defmodule OliWeb.DeliveryControllerTest do
assert html_response(conn, 200) =~ "Enroll in Course Section"

assert html_response(conn, 200) =~
~s(<a href="/session/new?section=#{section.slug}&amp;from_invitation_link%3F=true" )
~s(<a href="/?section=#{section.slug}&amp;from_invitation_link%3F=true" )
end

test "shows enroll view and Sign Up link", %{conn: conn} do
Expand Down
11 changes: 11 additions & 0 deletions test/oli_web/controllers/static_page_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ defmodule OliWeb.StaticPageControllerTest do
end
end

describe "student login" do
test "shows student login view", %{conn: conn} do
conn = get(conn, Routes.static_page_path(conn, :index))

assert response(conn, 200) =~ "OLI Torus"

assert response(conn, 200) =~ "Easily access and participate in your enrolled courses"
assert response(conn, 200) =~ "Need an account?"
end
end

describe "enrollment info" do
test "shows enrollment info in students login", %{conn: conn} do
conn = get(conn, Routes.static_page_path(conn, :index))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ defmodule OliWeb.Sections.InvalidSectionInviteViewTest do
{:ok, view, _html} = live(conn, redirect_to)

assert render(view) =~
"This enrollment link has expired or is invalid. If you already have a student account, please <a href=\"/session/new\">sign in</a>.\n</div></div>"
"This enrollment link has expired or is invalid. If you already have a student account, please <a href=\"/\">sign in</a>.\n</div></div>"

assert element(view, "a[href=\"/session/new\"]") |> render() =~ "sign in"
assert element(view, "a[href=\"/\"]") |> render() =~ "sign in"
end

test "redirects to the Student Sign In page if the invitation link is valid", %{conn: conn} do
Expand Down Expand Up @@ -51,7 +51,7 @@ defmodule OliWeb.Sections.InvalidSectionInviteViewTest do
{:ok, view, _html} = live(conn, redirect_to)

assert render(view) =~
"This enrollment link has expired or is invalid. If you already have a student account, please <a href=\"/session/new\">sign in</a>.\n</div></div>"
"This enrollment link has expired or is invalid. If you already have a student account, please <a href=\"/\">sign in</a>.\n</div></div>"
end

test "shows enroll view", %{conn: conn} do
Expand Down

0 comments on commit 54824af

Please sign in to comment.