From 7b7a3427d91cd09d2e40e7e463caf52daf193cc3 Mon Sep 17 00:00:00 2001 From: Jay Zoldak Date: Tue, 11 Jun 2013 15:16:12 -0400 Subject: [PATCH 01/10] Fix broken lettuce tests --- lms/djangoapps/courseware/features/problems.feature | 6 +++--- lms/djangoapps/courseware/features/problems.py | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/features/problems.feature b/lms/djangoapps/courseware/features/problems.feature index 9a2e908438..4a5e64e9f4 100644 --- a/lms/djangoapps/courseware/features/problems.feature +++ b/lms/djangoapps/courseware/features/problems.feature @@ -113,9 +113,9 @@ Feature: Answer problems Scenario: I can view and hide the answer if the problem has it: Given I am viewing a "numerical" that shows the answer "always" When I press the button with the label "Show Answer(s)" - Then The "Hide Answer(s)" button does appear - And The "Show Answer(s)" button does not appear + Then the button with the label "Hide Answer(s)" does appear + And the button with the label "Show Answer(s)" does not appear And I should see "4.14159" somewhere in the page When I press the button with the label "Hide Answer(s)" - Then The "Show Answer(s)" button does appear + Then the button with the label "Show Answer(s)" does appear And I should not see "4.14159" anywhere on the page diff --git a/lms/djangoapps/courseware/features/problems.py b/lms/djangoapps/courseware/features/problems.py index 0ad005d70a..4245e7ca86 100644 --- a/lms/djangoapps/courseware/features/problems.py +++ b/lms/djangoapps/courseware/features/problems.py @@ -126,6 +126,15 @@ def press_the_button_with_label(step, buttonname): @step(u'The "([^"]*)" button does( not)? appear') def action_button_present(step, buttonname, doesnt_appear): + button_css = 'section.action input[value*="%s"]' % buttonname + if doesnt_appear: + assert world.is_css_not_present(button_css) + else: + assert world.is_css_present(button_css) + + +@step(u'the button with the label "([^"]*)" does( not)? appear') +def button_with_label_present(step, buttonname, doesnt_appear): button_css = 'button span.show-label' elem = world.css_find(button_css).first if doesnt_appear: From d380c76df628258f91a9f2db6acce1f87397f9cf Mon Sep 17 00:00:00 2001 From: e0d Date: Tue, 11 Jun 2013 14:42:39 -0400 Subject: [PATCH 02/10] Adding a new env to handle escalating privileges to run db migrations. (cherry picked from commit d2554909d8d67a58c962a693ef3b3e5a0d3f3ee8) --- lms/envs/aws_migrate.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lms/envs/aws_migrate.py diff --git a/lms/envs/aws_migrate.py b/lms/envs/aws_migrate.py new file mode 100644 index 0000000000..6ba81f04e0 --- /dev/null +++ b/lms/envs/aws_migrate.py @@ -0,0 +1,8 @@ +from .aws import * +import os + +USER = os.environ.get('DB_MIGRATION_USER', 'root') +PASSWORD = os.environ.get('DB_MIGRATION_PASS', None) + +DATABASES['default']['USER'] = USER +DATABASES['default']['PASSWORD'] = PASSWORD From 3ae11e860ca900ecbda19c6c5eb36e832e9ef2f9 Mon Sep 17 00:00:00 2001 From: e0d Date: Tue, 11 Jun 2013 15:00:39 -0400 Subject: [PATCH 03/10] Better error handling. (cherry picked from commit 1511ec841a30a7a8adbec2d700502a1e685f6103) --- lms/envs/aws_migrate.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lms/envs/aws_migrate.py b/lms/envs/aws_migrate.py index 6ba81f04e0..fae928868e 100644 --- a/lms/envs/aws_migrate.py +++ b/lms/envs/aws_migrate.py @@ -4,5 +4,9 @@ import os USER = os.environ.get('DB_MIGRATION_USER', 'root') PASSWORD = os.environ.get('DB_MIGRATION_PASS', None) +if not PASSWORD: + raise ImproperlyConfigured("No database password was provided for running " + "migrations. This is fatal.") + DATABASES['default']['USER'] = USER DATABASES['default']['PASSWORD'] = PASSWORD From bcc92ef8ef93eb65394cccba3fa3f6e251af08ff Mon Sep 17 00:00:00 2001 From: e0d Date: Tue, 11 Jun 2013 16:37:37 -0400 Subject: [PATCH 04/10] Adding comments. (cherry picked from commit c96511a278ad86cbcc5353ea7e3ea74519b73634) --- lms/envs/aws_migrate.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lms/envs/aws_migrate.py b/lms/envs/aws_migrate.py index fae928868e..595da6d78f 100644 --- a/lms/envs/aws_migrate.py +++ b/lms/envs/aws_migrate.py @@ -1,3 +1,10 @@ +""" +A Django settings file for use on AWS while running +database migrations, since we don't want to normally run the +LMS with enough privileges to modify the database schema. +""" + +# Import everything from .aws so that our settings are based on those. from .aws import * import os From 9acab2de703a437f8d5db19616df5324e8a9e2b6 Mon Sep 17 00:00:00 2001 From: e0d Date: Wed, 12 Jun 2013 11:24:28 -0400 Subject: [PATCH 05/10] added pylint ignores, fixed missing import (cherry picked from commit 273df4e11399d01c5dd5bb9ea1fcef9adf0414e5) --- lms/envs/aws_migrate.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lms/envs/aws_migrate.py b/lms/envs/aws_migrate.py index 595da6d78f..726b09874c 100644 --- a/lms/envs/aws_migrate.py +++ b/lms/envs/aws_migrate.py @@ -4,9 +4,14 @@ database migrations, since we don't want to normally run the LMS with enough privileges to modify the database schema. """ +# We intentionally define lots of variables that aren't used, and +# want to import all variables from base settings files +# pylint: disable=W0401, W0614 + # Import everything from .aws so that our settings are based on those. from .aws import * import os +from django.core.exceptions import ImproperlyConfigured USER = os.environ.get('DB_MIGRATION_USER', 'root') PASSWORD = os.environ.get('DB_MIGRATION_PASS', None) From 04bfa01644a13f063dce75a32a528504faa7f4bd Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Tue, 11 Jun 2013 17:07:59 -0400 Subject: [PATCH 06/10] resolves height issue when display the check and show answer actions alongside problems (cherry picked from commit a17bf5e2ceafdc96fe85ad90a6a39bfc6655329e) --- common/lib/xmodule/xmodule/css/capa/display.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index bd131a9ff6..5dc0bdb171 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -555,10 +555,14 @@ section.problem { @extend .blue-button; } + input.check { + height: ($baseline*2); + } + button.show { height: ($baseline*2); - span { + .show-label { font-size: 1.0em; font-weight: 600; } From a684c6f679f84aed5f769c3223e5d5bd25763ef5 Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Tue, 11 Jun 2013 17:10:38 -0400 Subject: [PATCH 07/10] removes HTML elemements from problem action Sass selectors (cherry picked from commit 664efb988756aa2c1a6080f5f29c246c4e7b891b) --- common/lib/xmodule/xmodule/css/capa/display.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index 5dc0bdb171..c9f300c966 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -555,11 +555,11 @@ section.problem { @extend .blue-button; } - input.check { + .check { height: ($baseline*2); } - button.show { + .show { height: ($baseline*2); .show-label { From cb46cc6ac6089b35cfdfd1bda07ab80e9c574997 Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Wed, 12 Jun 2013 10:12:20 -0400 Subject: [PATCH 08/10] abstracts height rule to apply to the capa check, show, save actions (cherry picked from commit 050846af711ca3c86c7a309322c1db0f31973f84) --- common/lib/xmodule/xmodule/css/capa/display.scss | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index c9f300c966..6c61d6dd77 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -551,16 +551,16 @@ section.problem { section.action { margin-top: 20px; - input.save { + .save, .check, .show { + height: ($baseline*2); + font-weight: 600; + } + + .save { @extend .blue-button; } - .check { - height: ($baseline*2); - } - .show { - height: ($baseline*2); .show-label { font-size: 1.0em; From 10fd401157004f8e62671697fe31d6de2ce24fab Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Wed, 12 Jun 2013 11:00:15 -0400 Subject: [PATCH 09/10] syncs styling rules for buttons/inputs to ensure consistency (cherry picked from commit 832da3ad48b4e869e369be014c30f71732000679) --- cms/static/sass/_base.scss | 2 +- common/lib/xmodule/xmodule/css/capa/display.scss | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cms/static/sass/_base.scss b/cms/static/sass/_base.scss index e0e7543b8e..3713f83ae3 100644 --- a/cms/static/sass/_base.scss +++ b/cms/static/sass/_base.scss @@ -14,7 +14,7 @@ body { color: $gray-d2; } -body, input { +body, input, button { font-family: 'Open Sans', sans-serif; } diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index 6c61d6dd77..a46dec8d2f 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -553,7 +553,8 @@ section.problem { .save, .check, .show { height: ($baseline*2); - font-weight: 600; + font-weight: 500; + vertical-align: middle; } .save { @@ -564,7 +565,7 @@ section.problem { .show-label { font-size: 1.0em; - font-weight: 600; + font-weight: 500; } } From 45c1109c72d149f7baf530bf9388efffb2976ddc Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Wed, 12 Jun 2013 11:04:12 -0400 Subject: [PATCH 10/10] syncs up font-weight across problem button/input actions (cherry picked from commit 14100ba14c8323e61f60775cee7b7d64dc186a45) --- common/lib/xmodule/xmodule/css/capa/display.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index a46dec8d2f..819499cbe5 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -553,7 +553,7 @@ section.problem { .save, .check, .show { height: ($baseline*2); - font-weight: 500; + font-weight: 600; vertical-align: middle; } @@ -565,7 +565,7 @@ section.problem { .show-label { font-size: 1.0em; - font-weight: 500; + font-weight: 600; } }