Skip to content

Commit

Permalink
Merge branch 'release/6.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Sep 19, 2022
2 parents 27f5307 + f425410 commit 9ac2981
Show file tree
Hide file tree
Showing 84 changed files with 2,441 additions and 323 deletions.
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ gem 'devise', '~>4.8.1'
gem 'ruby-saml', '~> 1.14.0'

# omniauth
gem 'omniauth-google-oauth2', '~> 0.8.2'
gem 'omniauth-oauth2', '~> 1.7.2'
gem 'omniauth-google-oauth2', '~> 1.1.1'
gem 'omniauth-oauth2', '~> 1.8.0'
gem 'omniauth_openid_connect', '~> 0.4.0'
gem 'omniauth-rails_csrf_protection', '~> 1.0.1'

# Json webtokens
gem 'jwt', '~> 2.5.0'
Expand Down Expand Up @@ -120,9 +121,6 @@ gem 'has_scope', '~> 0.8.0'
# generating zip files
gem 'rubyzip', '~> 2.3.2'

# add request server timings to the devtools
gem 'rails_server_timings', '~> 1.0.8'

# bootstrap tokenizer
gem 'bootstrap_tokenfield_rails', '~> 0.12.1'

Expand Down
43 changes: 25 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ GEM
railties (>= 5.0.0)
faker (2.23.0)
i18n (>= 1.8.11, < 2)
faraday (2.3.0)
faraday-net_http (~> 2.0)
faraday (2.5.2)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (2.0.3)
faraday-net_http (3.0.0)
ffi (1.15.5)
flamegraph (0.9.5)
glob (0.3.0)
Expand Down Expand Up @@ -283,23 +283,28 @@ GEM
nio4r (2.5.8)
nokogiri (1.13.8-x86_64-linux)
racc (~> 1.4)
oauth2 (1.4.9)
oauth2 (2.0.8)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.9.2)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
omniauth (2.1.0)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
omniauth-google-oauth2 (0.8.2)
rack (>= 2.2.3)
rack-protection
omniauth-google-oauth2 (1.1.1)
jwt (>= 2.0)
oauth2 (~> 1.1)
omniauth (~> 1.1)
omniauth-oauth2 (>= 1.6)
omniauth-oauth2 (1.7.3)
oauth2 (~> 2.0.6)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.8.0)
omniauth-oauth2 (1.8.0)
oauth2 (>= 1.4, < 3)
omniauth (>= 1.9, < 3)
omniauth (~> 2.0)
omniauth-rails_csrf_protection (1.0.1)
actionpack (>= 4.2)
omniauth (~> 2.0)
omniauth_openid_connect (0.4.0)
addressable (~> 2.5)
omniauth (>= 1.9, < 3)
Expand Down Expand Up @@ -372,8 +377,6 @@ GEM
rails-i18n (7.0.5)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
rails_server_timings (1.0.8)
railties (>= 3.0.0)
railties (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
Expand Down Expand Up @@ -434,6 +437,9 @@ GEM
rack-protection (= 2.2.2)
tilt (~> 2.0)
slack-notifier (2.4.0)
snaky_hash (2.0.0)
hashie
version_gem (~> 1.1)
sprockets (4.1.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand Down Expand Up @@ -465,6 +471,7 @@ GEM
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
version_gem (1.1.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
Expand Down Expand Up @@ -542,8 +549,9 @@ DEPENDENCIES
mocha (~> 1.14.0)
mysql2 (~> 0.5.4)
nokogiri (~> 1.13.8)
omniauth-google-oauth2 (~> 0.8.2)
omniauth-oauth2 (~> 1.7.2)
omniauth-google-oauth2 (~> 1.1.1)
omniauth-oauth2 (~> 1.8.0)
omniauth-rails_csrf_protection (~> 1.0.1)
omniauth_openid_connect (~> 0.4.0)
premailer-rails (~> 1.11.1)
pretender (~> 0.4.0)
Expand All @@ -553,7 +561,6 @@ DEPENDENCIES
rails (~> 7.0.4)
rails-controller-testing (~> 1.0.5)
rails-i18n (~> 7.0.5)
rails_server_timings (~> 1.0.8)
rb-readline (~> 0.5.5)
rouge (= 4.0.0)
rubocop-rails (~> 2.16.0)
Expand Down
54 changes: 45 additions & 9 deletions app/assets/javascripts/code_listing/annotation.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { NewSavedAnnotation } from "components/saved_annotations/new_saved_annotation";
import { isBetaCourse } from "saved_annotation_beta";
import { SavedAnnotationIcon } from "components/saved_annotations/saved_annotation_icon";

export type AnnotationType = "error" | "info" | "user" | "warning" | "question";
export type QuestionState = "unanswered" | "answered" | "in_progress";

Expand All @@ -10,6 +14,7 @@ export abstract class Annotation {
public readonly line: number | null;
public readonly text: string;
public readonly type: AnnotationType;
public readonly id: number;

protected constructor(line: number | null, text: string, type: AnnotationType) {
this.__html = null;
Expand Down Expand Up @@ -54,7 +59,7 @@ export abstract class Annotation {

if (!this.visible) {
const icon = document.createElement("i");
icon.classList.add("mdi", "mdi-eye-off", "mdi-18", "annotation-visibility");
icon.classList.add("mdi", "mdi-eye-off", "mdi-18", "annotation-meta-icon");
icon.title = I18n.t("js.user_annotation.not_released");
meta.appendChild(icon);
}
Expand All @@ -81,16 +86,38 @@ export abstract class Annotation {

// Update button.
if (this.modifiable) {
const link = document.createElement("a");
link.addEventListener("click", () => this.edit());
link.classList.add("btn", "btn-icon", "annotation-control-button", "annotation-edit");
link.title = this.editTitle;
const editLink = document.createElement("a");
editLink.addEventListener("click", () => this.edit());
editLink.classList.add("btn", "btn-icon", "annotation-control-button", "annotation-edit");
editLink.title = this.editTitle;

const icon = document.createElement("i");
icon.classList.add("mdi", "mdi-pencil");
link.appendChild(icon);
const editIcon = document.createElement("i");
editIcon.classList.add("mdi", "mdi-pencil");
editLink.appendChild(editIcon);

header.appendChild(link);
header.appendChild(editLink);

// REMOVE IF AFTER CLOSED BETA
if (isBetaCourse(this.courseId)) {
// Add button to create saved annotation
const saveLink = new NewSavedAnnotation();
saveLink.fromAnnotationId = this.id;
saveLink.annotationText = this.rawText;
saveLink.savedAnnotationId = this.savedAnnotationId;

header.appendChild(saveLink);

// Add icon to signify saved annotation
const icon = new SavedAnnotationIcon();
icon.savedAnnotationId = this.savedAnnotationId;

// update icon if annotation is saved
saveLink.addEventListener("created", (e: CustomEvent) => {
icon.savedAnnotationId = e.detail.id;
});

meta.appendChild(icon);
}
}

if (this.transitionable("answered")) {
Expand Down Expand Up @@ -174,6 +201,10 @@ export abstract class Annotation {
return this.text;
}

public get savedAnnotationId(): number | null {
return null;
}

public get removable(): boolean {
return false;
}
Expand Down Expand Up @@ -212,6 +243,11 @@ export abstract class Annotation {
return true;
}

// REMOVE AFTER CLOSED BETA
protected get courseId(): number {
return undefined;
}

public async update(data): Promise<Annotation> {
// Do nothing.
return data;
Expand Down
Loading

0 comments on commit 9ac2981

Please sign in to comment.