Skip to content

Commit

Permalink
Merge pull request #451 from commercekitchen/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
tmichaelreis authored Apr 13, 2020
2 parents 279b88c + 95acfe0 commit 4763fdc
Show file tree
Hide file tree
Showing 118 changed files with 2,165 additions and 1,255 deletions.
16 changes: 13 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-02-19 12:47:00 -0700 using RuboCop version 0.79.0.
# on 2020-03-04 11:06:04 -0700 using RuboCop version 0.79.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -9,11 +9,21 @@
# Offense count: 1
Naming/AccessorMethodName:
Exclude:
- "app/policies/organization_policy.rb"
- 'app/policies/organization_policy.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- "lib/capistrano/tasks/*"
- 'lib/capistrano/tasks/set_rollbar.rake'

# Offense count: 1
Style/MethodMissingSuper:
Exclude:
- 'spec/support/views/pundit_view_policy.rb'

# Offense count: 1
Style/MissingRespondToMissing:
Exclude:
- 'spec/support/views/pundit_view_policy.rb'
19 changes: 11 additions & 8 deletions app/assets/javascripts/admin/courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ $(document).ready(function() {
return false;
});

// If the user enters text in the topics textbox, mark the checkbox too.
$("body").on("change", "#course_other_topic_text", function() {
if (
$(this)
.val()
.trim() !== ""
) {
$("#course_other_topic").prop("checked", true);
// Only show other topic input if box is checked
$("#course_other_topic").on("change", function() {
if ($("#course_other_topic").prop("checked")) {
$(".topic-box")
.show()
.prop("required", true);
} else {
$(".topic-box")
.val("")
.hide()
.prop("required", false);
}
});

Expand Down
18 changes: 17 additions & 1 deletion app/assets/javascripts/lessons.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ $(document).ready(function() {
// match the event from the ASL file:
// window.parent.sendLessonCompletedEvent();
sendLessonCompletedEvent = function() {
var preview = getUrlParameter("preview");
var requestUrl = window.location.pathname + "/complete";

if (preview == "true") {
requestUrl = requestUrl + "?preview=true";
}

$.ajax({
url: window.location.pathname + "/complete",
url: requestUrl,
type: "POST",
dataType: "json"
}).always(function(data) {
Expand All @@ -14,6 +21,15 @@ $(document).ready(function() {
});
};

getUrlParameter = function(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
};

getDLCTransition = function(_) {
sendLessonCompletedEvent();
};
Expand Down
44 changes: 41 additions & 3 deletions app/assets/stylesheets/components/_course_form.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.course-form {
margin-top: 2em;
display: grid;
grid-template-columns: minmax(0, 50%) minmax(0, 50%);
grid-gap: 2em;
grid-template-areas:
"errors errors"
"title title"
"author author"
"summary summary"
Expand All @@ -12,13 +14,36 @@
"additional_content additional_content"
"topics categories"
"language format"
"course_level pub_status"
"access_level ."
"course_level access_level"
"seo_title seo_title"
"seo_meta seo_meta"
"propagation propagation"
"pub_status ."
"actions actions";

&.restricted {
grid-template-areas:
"errors errors"
"categories access_level"
"resources resources"
"additional_content additional_content"
"pub_status ."
"actions actions"
"title title"
"author author"
"summary summary"
"description description"
"text_copies text_copies"
"topics ."
"language format"
"course_level ."
"seo_title seo_title"
"seo_meta seo_meta";
}

.error_explanation {
grid-area: errors;
}

.title {
grid-area: title;
}
Expand Down Expand Up @@ -91,13 +116,26 @@
grid-area: seo_meta;
}

.pub-status {
grid-area: pub_status;
}

.propagation {
grid-area: propagation;
}

.actions {
grid-area: actions;
}

.imported-course-actions {
border-bottom: 1px solid $grey;

p {
margin-block-start: 2em;
margin-block-end: 0;
}
}
}

.attachment-upload-fields {
Expand Down
6 changes: 4 additions & 2 deletions app/assets/stylesheets/components/_lesson.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.story_line {
width: 1024px;
height: 716px;
width: 100%;
height: 80vw;
max-height: 820px;
border: none;
}
8 changes: 8 additions & 0 deletions app/assets/stylesheets/components/_preview_notice.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.preview-notice {
padding: 1em 0;
background-color: lightgoldenrodyellow;

a {
padding: 0 1em;
}
}
2 changes: 2 additions & 0 deletions app/assets/stylesheets/components/_sortable_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.list-titles {
font-size: 1em;
font-weight: 400;
display: table;
width: 100%;
}

.table-row {
Expand Down
20 changes: 13 additions & 7 deletions app/assets/stylesheets/mixins/_banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@
text-align: $slogan_alignment;
}

.callout {
flex-grow: 1;
}

.banner {
background-color: $background_color;
margin-bottom: 2em;
padding: 1em 0 2em 0;
min-height: 2em;

.banner-content {
display: flex;
justify-content: space-between;
align-content: center;
flex-wrap: wrap-reverse;
}

h1 {
font-family: $font-secondary;
color: $text_color;
font-size: 2em;
font-size: 3.3em;
font-weight: 100;
margin-bottom: 0;
margin-top: 13px;

@media (min-width: $breakpoint-tablet) {
font-size: 3.3em;
}
margin-top: 0.25em;

&.slogan {
@media (min-width: $breakpoint-tablet) {
Expand Down
8 changes: 8 additions & 0 deletions app/assets/stylesheets/mixins/_color_scheme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@

label {
color: $primary_color;

&.disabled {
color: $grey;

.required:after {
color: $grey;
}
}
}

table {
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/mixins/_course_widget.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
) {
.course-widget {
display: block;
width: 329px;
width: 310px;
border: 1px solid $medium-grey;
margin-bottom: 2em;
margin-right: 1.15em;
margin-right: 1em;
min-height: 175px;
overflow: hidden;
border-top-left-radius: 20px;
Expand Down
39 changes: 18 additions & 21 deletions app/assets/stylesheets/partials/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ label {
font-size: 1.5em;
margin-bottom: 0.5em;
display: block;
}

legend {
margin-bottom: 0.5em;
&.plain {
color: $dark-grey;
font-size: 1em;
margin-bottom: 0.5em;
display: inline-block;
padding-right: 1em;
}

&.disabled {
color: $grey;
}
}

label.plain {
color: $dark-grey;
font-size: 1em;
legend {
margin-bottom: 0.5em;
display: inline-block;
padding-right: 1em;
}

.required:after {
Expand Down Expand Up @@ -61,6 +65,7 @@ input[type="url"] {
&.topic-box {
width: 60%;
font-size: 14px;
display: none;
}
}

Expand Down Expand Up @@ -213,19 +218,6 @@ select {
outline: 0;
}

.inline-checkbox-row {
padding-top: 15px;

.plain-label {
font-size: 16px;
color: black;

span {
padding-left: 10px;
}
}
}

.inline-radio-group {
padding-top: 10px;
padding-left: 20px;
Expand Down Expand Up @@ -285,3 +277,8 @@ select {
.character-limit {
margin-bottom: -14px;
}

input:disabled,
select:disabled {
color: darken($medium-grey, 20%);
}
8 changes: 4 additions & 4 deletions app/assets/stylesheets/partials/_layout.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
main {
padding-top: 2em;
}

.content-grid {
display: grid;
grid-template-columns: 100%;
Expand All @@ -10,10 +14,6 @@
grid-template-areas: "sidebar main-content";
}

.main_content {
grid-area: main-content;
}

.sidebar {
grid-area: sidebar;
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def destroy
@attachment = Attachment.find(params[:id])
authorize @attachment
@attachment.destroy
redirect_back(fallback_location: root_path)
redirect_to edit_admin_course_path(@attachment.course)
end
end
end
7 changes: 0 additions & 7 deletions app/controllers/admin/cms_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Admin
class CmsPagesController < BaseController
before_action :set_page, only: %i[edit update destroy]
before_action :set_maximums, only: %i[new edit]

def index
@cms_pages = policy_scope(CmsPage)
Expand Down Expand Up @@ -95,12 +94,6 @@ def set_page
@cms_page = CmsPage.friendly.find(params[:id])
end

def set_maximums
@max_title = CmsPage.validators_on(:title).first.options[:maximum]
@max_seo = CmsPage.validators_on(:seo_page_title).first.options[:maximum]
@max_meta = CmsPage.validators_on(:meta_desc).first.options[:maximum]
end

def unescaped_cms_content
@cms_page.body.html_safe
end
Expand Down
Loading

0 comments on commit 4763fdc

Please sign in to comment.