From 45a665c7c757f59fe5cbc2d0b7f58d54cbfdc53b Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 29 Apr 2013 10:18:56 -0400 Subject: [PATCH 001/117] added mode bar up top --- cms/static/sass/views/_unit.scss | 13 +++++++++++++ cms/templates/component.html | 8 ++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 06849f851c..317247e886 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -423,6 +423,19 @@ body.course.unit { padding: 20px; border-radius: 2px 2px 0 0; + .component-edit-modes { + @include box-sizing(border-box); + list-style: none; + position: absolute; + width: 100%; + padding: 15px; + top: 0; + right: 0; + border-bottom: 1px solid $lightBluishGrey2; + background: $lightGrey; + + } + .metadata_edit { margin-bottom: 20px; font-size: 13px; diff --git a/cms/templates/component.html b/cms/templates/component.html index dad407ff7b..46a0880f35 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,11 +1,15 @@
+ + Editor + Settings +
${editor}
From 94390e4314f88bf217032550b0039161288b2c48 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 29 Apr 2013 14:20:37 -0400 Subject: [PATCH 002/117] aria tabs v1 --- cms/templates/component.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cms/templates/component.html b/cms/templates/component.html index 46a0880f35..c2b1f856f1 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,9 +1,15 @@
- - Editor - Settings - +
+ +
${editor}
From 30240ff01aa6bd8c363b1f2318f652e047ae6c81 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 29 Apr 2013 19:53:16 -0400 Subject: [PATCH 003/117] non revision --- cms/templates/component.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cms/templates/component.html b/cms/templates/component.html index c2b1f856f1..318e75c197 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -5,11 +5,12 @@ -
+
${editor}
From d55527b693564a0f126463615b3b0cdce13364ac Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 1 May 2013 17:22:09 -0400 Subject: [PATCH 004/117] changes with aria --- cms/static/sass/views/_unit.scss | 60 +++++++++++++++++++++++++++++--- cms/templates/component.html | 56 +++++++++++++++++++---------- 2 files changed, 92 insertions(+), 24 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 317247e886..7a9cc42af3 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -13,6 +13,10 @@ body.course.unit { } //end problem selector reqs + + // Unit Page Main Column + // ==================== + .main-column { clear: both; float: left; @@ -31,6 +35,9 @@ body.course.unit { .unit-body { + // Unit Page Name + // ==================== + .unit-name-input { padding: 20px 40px; @@ -73,6 +80,10 @@ body.course.unit { letter-spacing: 1px; text-transform: uppercase; } + + // Component List Meta + // ==================== + // TODO: clean up organization of this page, to many levels/duplication .components { @@ -81,8 +92,6 @@ body.course.unit { z-index: 10; margin: 20px 40px; - - .title { margin: 0 0 15px 0; color: $mediumGrey; @@ -91,6 +100,9 @@ body.course.unit { } } + // New Components + // ==================== + &.new-component-item { margin: 20px 0px; border-top: 1px solid $mediumGrey; @@ -355,6 +367,9 @@ body.course.unit { } } + // Component Drag and Drop, Non-Edit Module Rendering, Styling + // ==================== + .component { border: 1px solid $lightBluishGrey2; border-radius: 3px; @@ -410,6 +425,9 @@ body.course.unit { } } + // Component Editing + // ==================== + .wrapper-component-editor { z-index: 9999; position: relative; @@ -423,9 +441,11 @@ body.course.unit { padding: 20px; border-radius: 2px 2px 0 0; - .component-edit-modes { + + // Edit Menu (Component Name, Mode-Editor, Mode-Settings) + + .component-edit-menu { @include box-sizing(border-box); - list-style: none; position: absolute; width: 100%; padding: 15px; @@ -434,8 +454,33 @@ body.course.unit { border-bottom: 1px solid $lightBluishGrey2; background: $lightGrey; + //Component Name + h3 { + //TO-DO ? + } + + //Nav-Edit Modes + .nav-edit-modes { + //TODO + + .tab { + display: inline; + } + } } + // Module Editors + .editor-wrapper{ + //TO-DO ? + } + + // Module Settings + .settings-wrapper{ + //TO-DO ? + } + + //OLD Meta-data Styling + //TO-DO port over old styling .metadata_edit { margin-bottom: 20px; font-size: 13px; @@ -469,6 +514,9 @@ body.course.unit { } } + // Unit Page Sidebar + // ==================== + .unit-settings { .window-contents { padding: 10px 20px; @@ -669,7 +717,9 @@ body.course.unit { } } -// editing units from courseware +// Editing Units from Courseware +// ==================== + body.unit { .component { diff --git a/cms/templates/component.html b/cms/templates/component.html index 318e75c197..1782c41b7c 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,24 +1,42 @@
-
- -
-
- ${editor} -
-
- Save - Cancel -
-
+
+

Name of Component

+ + +
+ +
+
+ ${editor} +
+ + + + + + + + + + + + + + + +
+ Save + Cancel +
+
From fbaed2e28b772cf82d45c2b5b032d8d346f5e5be Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 3 May 2013 00:00:10 -0700 Subject: [PATCH 005/117] added shell of css and html organization --- cms/static/sass/views/_unit.scss | 58 +++++++++++++++++++++++++++----- cms/templates/component.html | 39 ++++++++++----------- 2 files changed, 70 insertions(+), 27 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 7a9cc42af3..ae45c29fb5 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -456,27 +456,69 @@ body.course.unit { //Component Name h3 { - //TO-DO ? + //TO-DO + //determine proper h-level } //Nav-Edit Modes .nav-edit-modes { - //TODO + list-style: none; + //move to the right, - .tab { - display: inline; + li { + //TO-DO + //inherit button styling + //no idea what it currently inherits... + + &:hover { + //TO-DO + //opacity change + } + + &.is-active { + //TO-DO + //inherit button styling + } } + } } - // Module Editors + // Editor Wrapper .editor-wrapper{ - //TO-DO ? + //TO-DO } - // Module Settings + // Settings Wrapper .settings-wrapper{ - //TO-DO ? + //TO-DO + + .settings-row { + // general row sizing stuff + width: 100%; + padding: 10px; + border-bottom: 1px solid $gray; + + //SettingsLabel + li > label { + //Text all aligned left + //this sets height of .settings-row to allow for long help strings. + } + + //SettingsInput + li > input { + width: 100px; + //TO-DO + + + } + + //SettingsHelp + li > span { + //Text all aligned left + } + + } } //OLD Meta-data Styling diff --git a/cms/templates/component.html b/cms/templates/component.html index 1782c41b7c..95e5d6915b 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,36 +1,37 @@
-

Name of Component

- - +
${editor} +
- -
Setting LabelSetting InputSetting Help
Example DropdownInput/Form stuff to be children here. Example Numerical Input
- - - - - - - - - - - - +
    + +
  • + + + ${helpstring} +
  • + +
  • + + + ${helpstring} +
  • ≈ +
Save From c842a5fc7c7b3e6fc6068e1462d83f2ecbcdfa5c Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 3 May 2013 00:33:58 -0700 Subject: [PATCH 006/117] plugged in more pseudo code for various css class states necessary as well as examples for dropdown case and extra logic required there --- cms/static/sass/views/_unit.scss | 17 +++++++++++++++-- cms/templates/component.html | 25 ++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index ae45c29fb5..b4352f413d 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -502,15 +502,28 @@ body.course.unit { //SettingsLabel li > label { //Text all aligned left + display: inline-block; //this sets height of .settings-row to allow for long help strings. } //SettingsInput - li > input { + li > input, li > select { + @include placeholder($gray-l4); + @include font-size(16); + @include size(100%,100%); width: 100px; + height: auto; //TO-DO - + &:focus { + //TO-DO + } + } + + //SettingsClear + li > button { + border-radius: 20px; //maybe a % calc from input box height + margin-left: 15px; } //SettingsHelp diff --git a/cms/templates/component.html b/cms/templates/component.html index 95e5d6915b..b6c537e036 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -20,17 +20,36 @@
    -
  • + +
  • + + ${helpstring}
  • -
  • +
  • ${helpstring} -
  • ≈ + + +
  • + + + ${helpstring} +
  • +
From 036991dce8ca0018fa2ecdea15bf27f1181ce7e9 Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 3 May 2013 08:10:37 -0700 Subject: [PATCH 007/117] moved bad variable name --- cms/templates/component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/templates/component.html b/cms/templates/component.html index b6c537e036..5a4fe11257 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -22,7 +22,7 @@
  • - +
  • -
    +
    ${editor}
    @@ -23,7 +23,7 @@
  • - + - ${helpstring} + helpstring
  • - ${helpstring} + helpstring
  • From d1595892fd82392e557c98a2ec1472b3bf2eba79 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 4 May 2013 12:23:40 -0700 Subject: [PATCH 011/117] starting settings --- cms/static/sass/views/_unit.scss | 51 +++++++++++++++++++------------- cms/templates/component.html | 20 ++++++------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index fea72f4573..204e9064eb 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -434,6 +434,10 @@ body.course.unit { background: $lightBluishGrey2; } + .component-edit-menu { + background-color: pink; + } + .component-editor { @include edit-box; @include box-shadow(none); @@ -445,8 +449,6 @@ body.course.unit { .component-edit-menu { @include box-sizing(border-box); - position: absolute; - width: 100%; //padding: 15px; top: 0; right: 0; @@ -494,40 +496,39 @@ body.course.unit { .settings-row { // general row sizing stuff - width: 100%; + background-color: $white; padding: 10px; - border-bottom: 1px solid $gray; + border-bottom: 1px solid $gray-l4; - //SettingsLabel - li > label { - //Text all aligned left - display: inline-block; - //this sets height of .settings-row to allow for long help strings. + .setting-label { + font-weight: normal; + display: inline; + position: relative; + left: 0; + width: 200px; } - //SettingsInput - li > input, li > select { + .setting-input { @include placeholder($gray-l4); @include font-size(16); @include size(100%,100%); - width: 100px; + width: 200px; height: auto; //TO-DO - &:focus { + //&:focus { //TO-DO - } } - //SettingsClear - li > button { - border-radius: 20px; //maybe a % calc from input box height + .setting-clear { + border-radius: 50%; margin-left: 15px; } //SettingsHelp - li > span { - //Text all aligned left + .setting-help { + @include font-size(14); + font-color: $gray-l6; } } @@ -561,9 +562,17 @@ body.course.unit { font-weight: 700; } - .save-button { - margin-top: 10px; + // Module Actions + // ==================== + + .module-actions { + padding: 0 0 10px 10px; + box-shadow: 0 2px 1px rgba(182, 182, 182, 0.75) inset; + background-color: $gray-l4; + + .save-button { margin: 15px 8px 0 0; + } } } } diff --git a/cms/templates/component.html b/cms/templates/component.html index 72c7df2845..356766c412 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -22,24 +22,24 @@
  • - - + + - - helpstring + helpstring
  • - - - helpstring + + + helpstring
  • - - @@ -47,7 +47,7 @@ - helpstring + helpstring
  • From ad0909dfbd41f4c5b98e2f7dd4547d258fd54540 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 4 May 2013 23:19:49 -0700 Subject: [PATCH 012/117] style input boxes --- cms/static/sass/views/_unit.scss | 64 ++++++++++++++++++++++++++------ cms/templates/component.html | 18 ++++++--- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 204e9064eb..9e4a102d69 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -453,7 +453,8 @@ body.course.unit { top: 0; right: 0; border-bottom: 1px solid $lightBluishGrey2; - background: $gray-l4; + box-shadow: 0 2px 1px rgba(182, 182, 182, 0.75) inset; + background-color: $white; //Component Name h4 { @@ -492,43 +493,84 @@ body.course.unit { // Settings Wrapper .settings-wrapper{ - //TO-DO + //doverflow-y: scroll; .settings-row { // general row sizing stuff - background-color: $white; + background-color: $lightBluishGrey2; padding: 10px; - border-bottom: 1px solid $gray-l4; + border-bottom: 1px solid $gray-l2; + opacity: .8; + + &:hover { + opacity: 1; + } .setting-label { font-weight: normal; - display: inline; + display: inline-block; + padding-left: 15px; position: relative; left: 0; - width: 200px; + width: 100px; } .setting-input { @include placeholder($gray-l4); - @include font-size(16); - @include size(100%,100%); + border-radius: 2px; width: 200px; height: auto; - //TO-DO + border: 1px solid $gray-l2; //&:focus { //TO-DO } + select { + border: 1px solid $gray-l4; + background: none repeat scroll #F2F2F2; + padding: 5px; + + &:active { + background-color: #FFFCF1; + } + + option { + line-height: 16px; + + } + } + .setting-clear { + @include font-size(11); + color: $gray; + width: 25px; + height: 25px; + vertical-align: middle; + padding: 5px; border-radius: 50%; - margin-left: 15px; + margin-left: 10px; + box-shadow: none; + text-shadow: none; + border: 1px solid $gray-l4; + + &:hover { + background-color: $blue-s3; + color: $white; + } + + &.inactive { + visibility: hidden; + } } //SettingsHelp .setting-help { - @include font-size(14); + display: inline-block; + @include font-size(12); font-color: $gray-l6; + padding-left: 20px; + max-width: 50%; } } diff --git a/cms/templates/component.html b/cms/templates/component.html index 356766c412..6bb3b3eff9 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -4,10 +4,10 @@

    Viewing: Name of Component

    @@ -23,7 +23,7 @@
  • - + + helpstring helpstringhelpstringhelpstringhelpstringhel pstringhelpstringh elpstringhelpstrin sghelp stringhelp stringhelpstringhe lpstring helpstringhelpstringhelpstring
  • - + + helpstring
  • From 6b4ab20d02681d5c2c106e83477588c7abc871df Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 5 May 2013 14:09:59 -0700 Subject: [PATCH 013/117] styled modes header, added inactive and active mode visibility as well as is-set mode styling. no js behavior in yet. adds overscoll fix for webkit --- cms/static/sass/views/_unit.scss | 86 ++++++++++++++++++++------------ cms/templates/component.html | 17 ++++--- 2 files changed, 64 insertions(+), 39 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 9e4a102d69..8ee048df24 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -434,10 +434,6 @@ body.course.unit { background: $lightBluishGrey2; } - .component-edit-menu { - background-color: pink; - } - .component-editor { @include edit-box; @include box-shadow(none); @@ -449,40 +445,50 @@ body.course.unit { .component-edit-menu { @include box-sizing(border-box); - //padding: 15px; + padding: 15px; top: 0; right: 0; - border-bottom: 1px solid $lightBluishGrey2; - box-shadow: 0 2px 1px rgba(182, 182, 182, 0.75) inset; - background-color: $white; + border-bottom: 1px solid $gray-l2; + background-color: $lightBluishGrey2; + box-shadow: 0 1px 2px rgba(182, 182, 182, 0.75) inset; //Component Name - h4 { - //TO-DO - //determine proper h-level + .component-name { + width: 50%; + @include font-size(14); + + em { + font-weight: 700; + } } //Nav-Edit Modes .nav-edit-modes { list-style: none; + right: 0; + top: 0; + position: absolute; + padding: 10px; - li { - //TO-DO - //inherit button styling - float: right; - //no idea what it currently inherits... + .mode { + display: inline-block; - &:hover { - //TO-DO - //opacity change + .inactive-mode { + display: none; } - &.is-active { - //TO-DO - //inherit button styling + .active-mode { + @include white-button; + + &.is-set { + background-color: $lightBluishGrey2; + cursor: default; + linear-gradient: none; + @include box-shadow(0 0 1px 1px rgba(0, 0, 0, .6) inset); + + } } } - } } @@ -493,25 +499,46 @@ body.course.unit { // Settings Wrapper .settings-wrapper{ - //doverflow-y: scroll; + overflow: auto; + max-height: 400px; + //TO-DO browser testing for scrollbar, especially styles below. + + &::-webkit-scrollbar { + -webkit-appearance: none; + width: 11px; + height: 11px; + } + + &::-webkit-scrollbar-thumb { + border-radius: 8px; + border: 2px solid $lightBluishGrey2; + background-color: rgba(0, 0, 0, .5); + } .settings-row { // general row sizing stuff - background-color: $lightBluishGrey2; + background-color: $white; padding: 10px; border-bottom: 1px solid $gray-l2; - opacity: .8; + opacity: .6; &:hover { opacity: 1; } + &.is-set { + opacity: .9; + background-color: $white; + font-weight: 200; + } + .setting-label { font-weight: normal; display: inline-block; padding-left: 15px; position: relative; left: 0; + height: 50%; width: 100px; } @@ -534,11 +561,6 @@ body.course.unit { &:active { background-color: #FFFCF1; } - - option { - line-height: 16px; - - } } .setting-clear { @@ -570,7 +592,7 @@ body.course.unit { @include font-size(12); font-color: $gray-l6; padding-left: 20px; - max-width: 50%; + max-width: 40%; } } diff --git a/cms/templates/component.html b/cms/templates/component.html index 6bb3b3eff9..e4e733aacf 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,21 +1,24 @@
    -
    -

    Viewing: Name of Component

    +
    + Editing: Name of Component
    - ${editor} +
      @@ -37,7 +40,7 @@ - helpstring helpstringhelpstringhelpstringhelpstringhel pstringhelpstringh elpstringhelpstrin sghelp stringhelp stringhelpstringhe lpstring helpstringhelpstringhelpstring + This is a more reasonable helpstring sentence that would alos wrap around. A second sentence in some cases may be necessary.
    • From 38abc0167db13d17d9bfb8b5edbf53d145003384 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 6 May 2013 07:37:14 -0700 Subject: [PATCH 014/117] label on top of input field move --- cms/static/sass/views/_settings.scss | 2 +- cms/static/sass/views/_unit.scss | 22 ++++++++++++---------- cms/templates/component.html | 14 +++++++------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/cms/static/sass/views/_settings.scss b/cms/static/sass/views/_settings.scss index d1ba706d56..def730071e 100644 --- a/cms/static/sass/views/_settings.scss +++ b/cms/static/sass/views/_settings.scss @@ -21,7 +21,7 @@ body.course.settings { font-size: 14px; } - .message-status { + .message-status { display: none; @include border-top-radius(2px); @include box-sizing(border-box); diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 8ee048df24..32b221d9c7 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -481,10 +481,10 @@ body.course.unit { @include white-button; &.is-set { - background-color: $lightBluishGrey2; + background-color: $white; cursor: default; linear-gradient: none; - @include box-shadow(0 0 1px 1px rgba(0, 0, 0, .6) inset); + @include box-shadow(0 0 1px 1px rgba(240, 240, 240, .1) inset); } } @@ -518,24 +518,22 @@ body.course.unit { .settings-row { // general row sizing stuff background-color: $white; - padding: 10px; + padding: 10px 20px; border-bottom: 1px solid $gray-l2; - opacity: .6; + opacity: .8; &:hover { opacity: 1; } &.is-set { - opacity: .9; + opacity: 1; background-color: $white; font-weight: 200; } .setting-label { - font-weight: normal; - display: inline-block; - padding-left: 15px; + font-weight: 500; position: relative; left: 0; height: 50%; @@ -545,6 +543,7 @@ body.course.unit { .setting-input { @include placeholder($gray-l4); border-radius: 2px; + padding: 6px 8px 8px; width: 200px; height: auto; border: 1px solid $gray-l2; @@ -578,7 +577,9 @@ body.course.unit { &:hover { background-color: $blue-s3; + border: 1px solid $blue-s3; color: $white; + @include box-shadow(0 1px 0 rgba(255, 255, 255, .3) inset, 0 1px 1px rgba(0, 0, 0, .15)); } &.inactive { @@ -588,11 +589,12 @@ body.course.unit { //SettingsHelp .setting-help { + @include clearfix; display: inline-block; @include font-size(12); font-color: $gray-l6; padding-left: 20px; - max-width: 40%; + width: 65%; } } @@ -632,7 +634,7 @@ body.course.unit { .module-actions { padding: 0 0 10px 10px; box-shadow: 0 2px 1px rgba(182, 182, 182, 0.75) inset; - background-color: $gray-l4; + background-color: $gray-l6; .save-button { margin: 15px 8px 0 0; diff --git a/cms/templates/component.html b/cms/templates/component.html index e4e733aacf..7cb93bdecc 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -25,8 +25,8 @@
    • - - + +
    • - - + + - This is a more reasonable helpstring sentence that would alos wrap around. A second sentence in some cases may be necessary. +
      This is a more reasonable helpstring sentence that would alos wrap around. A second sentence in some cases may be necessary.
    • - - From d28c0b5f91733eb3252e89826339a25005dcb20d Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 7 May 2013 08:59:28 -0400 Subject: [PATCH 015/117] cleaned up styling, synced up partially to existing standards for forms, fonts, colors, etc; currently open select box issue on chrome --- cms/static/sass/views/_unit.scss | 104 ++++++++++++++++++++++--------- cms/templates/component.html | 90 ++++++++++++++------------ 2 files changed, 123 insertions(+), 71 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 32b221d9c7..cc7042ebca 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -445,20 +445,23 @@ body.course.unit { .component-edit-menu { @include box-sizing(border-box); - padding: 15px; + padding: 15px 0 15px 20px; top: 0; right: 0; border-bottom: 1px solid $gray-l2; - background-color: $lightBluishGrey2; + background-color: $blue; + color: $white; box-shadow: 0 1px 2px rgba(182, 182, 182, 0.75) inset; //Component Name .component-name { + @extend .t-copy-sub1; + color: $white; width: 50%; - @include font-size(14); em { - font-weight: 700; + @extend .t-title-3; + color: $white; } } @@ -478,14 +481,18 @@ body.course.unit { } .active-mode { - @include white-button; + @include blue-button; + } - &.is-set { - background-color: $white; - cursor: default; - linear-gradient: none; - @include box-shadow(0 0 1px 1px rgba(240, 240, 240, .1) inset); + .is-set { + @include linear-gradient($blue, $blue); + box-shadow: inset 0 0 2px $shadow; + background-color: $blue; + cursor: default; + &:hover { + box-shadow: inset 0 0 2px $shadow; + background-color: $blue; } } } @@ -493,16 +500,18 @@ body.course.unit { } // Editor Wrapper - .editor-wrapper{ + .wrapper-component-editor { //TO-DO } + + // Settings Wrapper - .settings-wrapper{ + .wrapper-component-settings ul{ overflow: auto; max-height: 400px; - //TO-DO browser testing for scrollbar, especially styles below. + //chrome scrollbar visibility correction &::-webkit-scrollbar { -webkit-appearance: none; width: 11px; @@ -511,57 +520,92 @@ body.course.unit { &::-webkit-scrollbar-thumb { border-radius: 8px; - border: 2px solid $lightBluishGrey2; + border: 2px solid $gray-l2; background-color: rgba(0, 0, 0, .5); } .settings-row { - // general row sizing stuff + @extend .field-group; // TO-DO ??? background-color: $white; padding: 10px 20px; border-bottom: 1px solid $gray-l2; opacity: .8; &:hover { + @include transition(opacity 0.25s ease-in-out); opacity: 1; } + //Styles for component settings which are set &.is-set { opacity: 1; background-color: $white; - font-weight: 200; + + .setting-label { + color: $blue-l1; + } + + .setting-input { + color: $blue-l1; + } + + .setting-clear { + //... + } } + .wrapper-setting-actions { + @extend .field; + display: inline-block; + width: 360px; + top: 0; + vertical-align: top; + } + + //Setting Label - also basic 'label' .setting-label { - font-weight: 500; + @extend .t-copy-sub2; + display: inline-block; position: relative; left: 0; height: 50%; - width: 100px; + width: 120px; + text-overflow: ellipsis; } + //Setting Input - also basic 'field' .setting-input { + @extend .t-copy-sub3; @include placeholder($gray-l4); border-radius: 2px; padding: 6px 8px 8px; - width: 200px; + width: 180px; height: auto; border: 1px solid $gray-l2; + text-overflow: ellipsis; //&:focus { //TO-DO } + //custom styling of selectbox to look more like input boxes. select { border: 1px solid $gray-l4; background: none repeat scroll #F2F2F2; padding: 5px; + &:focus { + @include box-shadow(0 1px 1px $shadow); + @include transition(opacity 0.25s ease-in-out); + background-color: #FFFCF1; + } + &:active { background-color: #FFFCF1; } } + //Setting Clear Button .setting-clear { @include font-size(11); color: $gray; @@ -570,16 +614,17 @@ body.course.unit { vertical-align: middle; padding: 5px; border-radius: 50%; - margin-left: 10px; + margin: 0 10px; box-shadow: none; text-shadow: none; border: 1px solid $gray-l4; &:hover { + @include box-shadow(0 1px 1px $shadow); + @include transition(opacity 0.25s ease-in-out); background-color: $blue-s3; border: 1px solid $blue-s3; color: $white; - @include box-shadow(0 1px 0 rgba(255, 255, 255, .3) inset, 0 1px 1px rgba(0, 0, 0, .15)); } &.inactive { @@ -587,14 +632,13 @@ body.course.unit { } } - //SettingsHelp + //Setting Tip .setting-help { - @include clearfix; - display: inline-block; @include font-size(12); + display: inline-block; font-color: $gray-l6; - padding-left: 20px; - width: 65%; + max-width: 50%; + vertical-align: top; } } @@ -632,9 +676,9 @@ body.course.unit { // ==================== .module-actions { + @include box-shadow(inset 0 1px 1px $shadow); padding: 0 0 10px 10px; - box-shadow: 0 2px 1px rgba(182, 182, 182, 0.75) inset; - background-color: $gray-l6; + background-color: $gray-l4; .save-button { margin: 15px 8px 0 0; @@ -755,9 +799,9 @@ body.course.unit { .unit-location { .url { + @include box-shadow(none); width: 100%; margin-bottom: 10px; - @include box-shadow(none); } .draft-tag, @@ -771,6 +815,7 @@ body.course.unit { @include tree-view; .section-item { + @include box-sizing(border-box); display: inline-block; width: 100%; font-size: 11px; @@ -778,7 +823,6 @@ body.course.unit { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; - @include box-sizing(border-box); } ol { diff --git a/cms/templates/component.html b/cms/templates/component.html index 7cb93bdecc..ffbd7b7cc8 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -17,49 +17,57 @@
    -
    - +
    +
    -
      - - -
    • - - - - - helpstring -
    • - -
    • - - - -
      This is a more reasonable helpstring sentence that would alos wrap around. A second sentence in some cases may be necessary.
      - - -
    • - - - - helpstring -
    • - -
    +
    +
      + + +
    • +
      + + + + +
      + helpstring +
    • + +
    • +
      + + + +
      + This is a longer sentence, repeated multiple times here just to test out the functionaltiy. +
    • + +
    • +
      + + + +
      + helpstring +
    • + +
    +
    Save From 977d0d76c24075a65d606f44b78ea490a3dc9758 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 7 May 2013 16:40:21 -0400 Subject: [PATCH 016/117] cleaning up styles to use list-input, field, group, label, input, tip, etc standards. also opted to try out initial pass at hierarchy splitting of css classes on items that repeat (li, for example) --- cms/static/sass/elements/_forms.scss | 1 - cms/static/sass/views/_unit.scss | 836 ++++++++++++++------------- cms/templates/component.html | 49 +- 3 files changed, 473 insertions(+), 413 deletions(-) diff --git a/cms/static/sass/elements/_forms.scss b/cms/static/sass/elements/_forms.scss index 1faf4a883e..70d959fdea 100644 --- a/cms/static/sass/elements/_forms.scss +++ b/cms/static/sass/elements/_forms.scss @@ -124,7 +124,6 @@ code { .CodeMirror { font-size: 13px; - border: 1px solid $darkGrey; background: #fff; } diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index cc7042ebca..75b3224f45 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -431,7 +431,7 @@ body.course.unit { .wrapper-component-editor { z-index: 9999; position: relative; - background: $lightBluishGrey2; + background: $white; } .component-editor { @@ -441,225 +441,6 @@ body.course.unit { padding: 0; border-radius: 2px 2px 0 0; - // Edit Menu (Component Name, Mode-Editor, Mode-Settings) - - .component-edit-menu { - @include box-sizing(border-box); - padding: 15px 0 15px 20px; - top: 0; - right: 0; - border-bottom: 1px solid $gray-l2; - background-color: $blue; - color: $white; - box-shadow: 0 1px 2px rgba(182, 182, 182, 0.75) inset; - - //Component Name - .component-name { - @extend .t-copy-sub1; - color: $white; - width: 50%; - - em { - @extend .t-title-3; - color: $white; - } - } - - //Nav-Edit Modes - .nav-edit-modes { - list-style: none; - right: 0; - top: 0; - position: absolute; - padding: 10px; - - .mode { - display: inline-block; - - .inactive-mode { - display: none; - } - - .active-mode { - @include blue-button; - } - - .is-set { - @include linear-gradient($blue, $blue); - box-shadow: inset 0 0 2px $shadow; - background-color: $blue; - cursor: default; - - &:hover { - box-shadow: inset 0 0 2px $shadow; - background-color: $blue; - } - } - } - } - } - - // Editor Wrapper - .wrapper-component-editor { - //TO-DO - } - - - - // Settings Wrapper - .wrapper-component-settings ul{ - overflow: auto; - max-height: 400px; - - //chrome scrollbar visibility correction - &::-webkit-scrollbar { - -webkit-appearance: none; - width: 11px; - height: 11px; - } - - &::-webkit-scrollbar-thumb { - border-radius: 8px; - border: 2px solid $gray-l2; - background-color: rgba(0, 0, 0, .5); - } - - .settings-row { - @extend .field-group; // TO-DO ??? - background-color: $white; - padding: 10px 20px; - border-bottom: 1px solid $gray-l2; - opacity: .8; - - &:hover { - @include transition(opacity 0.25s ease-in-out); - opacity: 1; - } - - //Styles for component settings which are set - &.is-set { - opacity: 1; - background-color: $white; - - .setting-label { - color: $blue-l1; - } - - .setting-input { - color: $blue-l1; - } - - .setting-clear { - //... - } - } - - .wrapper-setting-actions { - @extend .field; - display: inline-block; - width: 360px; - top: 0; - vertical-align: top; - } - - //Setting Label - also basic 'label' - .setting-label { - @extend .t-copy-sub2; - display: inline-block; - position: relative; - left: 0; - height: 50%; - width: 120px; - text-overflow: ellipsis; - } - - //Setting Input - also basic 'field' - .setting-input { - @extend .t-copy-sub3; - @include placeholder($gray-l4); - border-radius: 2px; - padding: 6px 8px 8px; - width: 180px; - height: auto; - border: 1px solid $gray-l2; - text-overflow: ellipsis; - - //&:focus { - //TO-DO - } - - //custom styling of selectbox to look more like input boxes. - select { - border: 1px solid $gray-l4; - background: none repeat scroll #F2F2F2; - padding: 5px; - - &:focus { - @include box-shadow(0 1px 1px $shadow); - @include transition(opacity 0.25s ease-in-out); - background-color: #FFFCF1; - } - - &:active { - background-color: #FFFCF1; - } - } - - //Setting Clear Button - .setting-clear { - @include font-size(11); - color: $gray; - width: 25px; - height: 25px; - vertical-align: middle; - padding: 5px; - border-radius: 50%; - margin: 0 10px; - box-shadow: none; - text-shadow: none; - border: 1px solid $gray-l4; - - &:hover { - @include box-shadow(0 1px 1px $shadow); - @include transition(opacity 0.25s ease-in-out); - background-color: $blue-s3; - border: 1px solid $blue-s3; - color: $white; - } - - &.inactive { - visibility: hidden; - } - } - - //Setting Tip - .setting-help { - @include font-size(12); - display: inline-block; - font-color: $gray-l6; - max-width: 50%; - vertical-align: top; - } - - } - } - - //OLD Meta-data Styling - //TO-DO port over old styling - .metadata_edit { - margin-bottom: 20px; - font-size: 13px; - - li { - margin-bottom: 10px; - } - - label { - display: inline-block; - margin-right: 10px; - } - } - h3 { margin-bottom: 10px; font-size: 18px; @@ -671,222 +452,272 @@ body.course.unit { color: #fff; font-weight: 700; } + } + } +} - // Module Actions - // ==================== +// Edit Header (Component Name, Mode-Editor, Mode-Settings) - .module-actions { - @include box-shadow(inset 0 1px 1px $shadow); - padding: 0 0 10px 10px; - background-color: $gray-l4; +.component-edit-header { + @include box-sizing(border-box); + padding: 15px 0 15px 20px; + top: 0; + right: 0; + border-bottom: 1px solid $gray-l2; + background-color: $blue; + color: $white; + box-shadow: 0 1px 2px rgba(182, 182, 182, 0.75) inset; - .save-button { - margin: 15px 8px 0 0; - } - } + //Component Name + .component-name { + @extend .t-copy-sub1; + color: $white; + width: 50%; + + em { + font-weight: 600; + color: $white; } } - // Unit Page Sidebar - // ==================== + //Nav-Edit Modes + .nav-edit-modes { + list-style: none; + right: 0; + top: 0; + position: absolute; + padding: 10px; - .unit-settings { - .window-contents { - padding: 10px 20px; - } - - .unit-actions { - border-bottom: none; - padding-bottom: 0; - } - - .published-alert { - display: none; - padding: 10px; - border: 1px solid #edbd3c; - border-radius: 3px; - background: #fbf6e1; - font-size: 14px; - line-height: 1.4; - - div { - margin-top: 15px; - } - } - - input[type="radio"] { - margin-right: 7px; - } - - .status { - font-size: 12px; - - strong { - font-weight: 700; - } - } - - .preview-button, .view-button { - @include white-button; - margin-bottom: 10px; - } - - .publish-button { - @include orange-button; - } - - .delete-button { - @include blue-button; - } - - .delete-draft { + .mode { display: inline-block; - } - .delete-button, - .preview-button, - .publish-button, - .view-button { - font-size: 11px; - margin-top: 10px; - padding: 6px 15px 8px; - } - } - - .unit-history { - &.collapsed { - h4 { - border-bottom: none; - border-radius: 3px; - } - - .window-contents { + .inactive-mode { display: none; } - } - ol { - border: 1px solid #ced2db; + .active-mode { + @include blue-button; + } - li { - display: block; - padding: 6px 8px 8px 10px; - background: #edf1f5; - font-size: 12px; + .is-set { + @include linear-gradient($blue, $blue); + box-shadow: inset 0 0 2px $shadow; + background-color: $blue; + cursor: default; &:hover { - background: #fffcf1; - - .item-actions { - display: block; - } - } - - &.checked { - background: #d1dae3; - } - - .item-actions { - display: none; - } - - input[type="radio"] { - margin-right: 7px; + box-shadow: inset 0 0 2px $shadow; + background-color: $blue; } } } } +} - .unit-location { - .url { - @include box-shadow(none); - width: 100%; - margin-bottom: 10px; +// Editor Wrapper +.wrapper-comp-editor { + //TO-DO +} + +// Settings Wrapper +.wrapper-comp-settings { + + //settings-list + .list-input.settings-list { + margin: 0; + padding: 0; + list-style: none; + + overflow: auto; + max-height: 400px; + + + //chrome scrollbar visibility correction + &::-webkit-scrollbar { + -webkit-appearance: none; + width: 11px; + height: 11px; } - .draft-tag, - .hidden-tag, - .private-tag, - .has-new-draft-tag { - font-size: 8px; + &::-webkit-scrollbar-thumb { + border-radius: 8px; + border: 2px solid $gray-l2; + background-color: rgba(0, 0, 0, .5); } - .window-contents > ol { - @include tree-view; + //component-setting-entry + .field.comp-setting-entry { + //margin: 0 0 $baseline 0; - .section-item { - @include box-sizing(border-box); + background-color: $white; + padding: 20px 20px; + border-bottom: 1px solid $gray-l2; + opacity: .6; + + &:last-child { + //margin-bottom: 0; + } + + //no required component settings currently + &.required { + label { + //font-weight: 600; + } + label:after { + //margin-left: ($baseline/4); + //content: "*"; + } + } + + &:hover { + //TO-DO review existing patterns for hover on field + @include transition(opacity 0.25s ease-in-out); + opacity: 1; + } + + &.is-set { + opacity: 1; + background-color: $white; + + //setting-label + .setting-label { + //color: $blue-l1; + } + + //setting-input + .setting-input { + color: $blue-l1; + } + + //setting-clear + .setting-clear { + //... + } + } + + .wrapper-comp-setting{ display: inline-block; - width: 100%; - font-size: 11px; - padding: 2px 8px 4px; + width: 360px; + top: 0; + vertical-align: top; + } + + label.setting-label { + //@extend .t-copy-sub1; + //@include transition(color, 0.15s, ease-in-out); + //margin: 0 0 ($baseline/4) 0; + //font-weight: 400; + + @extend .t-copy-sub2; + display: inline-block; + position: relative; + left: 0; + height: 50%; + width: 120px; text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; + + //&.is-focused { + // color: $blue; + //} } - ol { - .section-item { - padding-left: 20px; + input, select { + //@include placeholder($gray-l4); + //@include font-size(16); + //@include size(100%,100%); + //padding: ($baseline/2); + + //&.long { + //} + + //&.short { + //} + + //&.error { + // border-color: $red; + //} + + //&:focus { + + // + .tip { + // color: $gray; + // } + + @extend .t-copy-sub3; + @include placeholder($gray-l4); + border-radius: 2px; + padding: 6px 8px 8px; + width: 180px; + height: auto; + border: 1px solid $gray-l2; + text-overflow: ellipsis; + } + + select { + border: 1px solid $gray-l4; + background: none repeat scroll #F2F2F2; + padding: 5px; + + &:focus { + @include box-shadow(0 1px 1px $shadow); + @include transition(opacity 0.25s ease-in-out); + background-color: #FFFCF1; } - .new-unit-item { - margin-left: 20px; + &:active { + background-color: #FFFCF1; } } - ol ol { - .section-item { - padding-left: 34px; + //input[type=others] + + .action.setting-clear { + @include font-size(11); + color: $gray; + width: 25px; + height: 25px; + vertical-align: middle; + padding: 5px; + border-radius: 50%; + margin: 0 10px; + box-shadow: none; + text-shadow: none; + border: 1px solid $gray-l4; + + &:hover { + @include box-shadow(0 1px 1px $shadow); + @include transition(opacity 0.25s ease-in-out); + background-color: $blue-s3; + border: 1px solid $blue-s3; + color: $white; } - .new-unit-item { - margin: 0 0 10px 41px; + &.inactive { + visibility: hidden; } } + + tip.setting-help { + @include font-size(12); + display: inline-block; + font-color: $gray-l6; + max-width: 50%; + vertical-align: top; + } } } +} - .edit-state-draft { - .visibility, +// Module Actions +// ==================== - .edit-draft-message, - .view-button { - display: none; - } +.module-actions { + @include box-shadow(inset 0 1px 1px $shadow); + padding: 0 0 10px 10px; + background-color: $gray-l4; - .published-alert { - display: block; - } - } - - .edit-state-public { - .delete-draft, - .component-actions, - .new-component-item, - .editing-draft-alert, - .publish-draft-message, - .preview-button { - display: none; - } - - .published-alert { - display: block; - } - - .drag-handle { - display: none !important; - } - } - - .edit-state-private { - .delete-draft, - .publish-draft, - .editing-draft-alert, - .create-draft, - .view-button { - display: none; - } + .save-button { + margin: 15px 8px 0 0; } } @@ -914,3 +745,222 @@ body.unit { } } } + +// Unit Page Sidebar +// ==================== + +.unit-settings { + .window-contents { + padding: 10px 20px; + } + + .unit-actions { + border-bottom: none; + padding-bottom: 0; + } + + .published-alert { + display: none; + padding: 10px; + border: 1px solid #edbd3c; + border-radius: 3px; + background: #fbf6e1; + font-size: 14px; + line-height: 1.4; + + div { + margin-top: 15px; + } + } + + input[type="radio"] { + margin-right: 7px; + } + + .status { + font-size: 12px; + + strong { + font-weight: 700; + } + } + + .preview-button, .view-button { + @include white-button; + margin-bottom: 10px; + } + + .publish-button { + @include orange-button; + } + + .delete-button { + @include blue-button; + } + + .delete-draft { + display: inline-block; + } + + .delete-button, + .preview-button, + .publish-button, + .view-button { + font-size: 11px; + margin-top: 10px; + padding: 6px 15px 8px; + } +} + +.unit-history { + &.collapsed { + h4 { + border-bottom: none; + border-radius: 3px; + } + + .window-contents { + display: none; + } + } + + ol { + border: 1px solid #ced2db; + + li { + display: block; + padding: 6px 8px 8px 10px; + background: #edf1f5; + font-size: 12px; + + &:hover { + background: #fffcf1; + + .item-actions { + display: block; + } + } + + &.checked { + background: #d1dae3; + } + + .item-actions { + display: none; + } + + input[type="radio"] { + margin-right: 7px; + } + } + } +} + +.unit-location { + .url { + @include box-shadow(none); + width: 100%; + margin-bottom: 10px; + } + + .draft-tag, + .hidden-tag, + .private-tag, + .has-new-draft-tag { + font-size: 8px; + } + + .window-contents > ol { + @include tree-view; + + .section-item { + @include box-sizing(border-box); + display: inline-block; + width: 100%; + font-size: 11px; + padding: 2px 8px 4px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + + ol { + .section-item { + padding-left: 20px; + } + + .new-unit-item { + margin-left: 20px; + } + } + + ol ol { + .section-item { + padding-left: 34px; + } + + .new-unit-item { + margin: 0 0 10px 41px; + } + } + } +} + +.edit-state-draft { + .visibility, + + .edit-draft-message, + .view-button { + display: none; + } + + .published-alert { + display: block; + } +} + +.edit-state-public { + .delete-draft, + .component-actions, + .new-component-item, + .editing-draft-alert, + .publish-draft-message, + .preview-button { + display: none; + } + + .published-alert { + display: block; + } + + .drag-handle { + display: none !important; + } +} + +.edit-state-private { + .delete-draft, + .publish-draft, + .editing-draft-alert, + .create-draft, + .view-button { + display: none; + } +} + + +//OLD Meta-data Styling +//TO-DO port over old styling +.metadata_edit { + margin-bottom: 20px; + font-size: 13px; + + li { + margin-bottom: 10px; + } + + label { + display: inline-block; + margin-right: 10px; + } +} \ No newline at end of file diff --git a/cms/templates/component.html b/cms/templates/component.html index ffbd7b7cc8..496da8cd61 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,6 +1,6 @@
    -
    +
    Editing: Name of Component
    -
    +
    -
    +
      -
    • -
      - - +
    • +
      + + -
      - helpstring + helpstring
    • -
    • +
    • - - -
      - This is a longer sentence, repeated multiple times here just to test out the functionaltiy. + This is a longer sentence, repeated multiple times here just to test out the functionaltiy.
    • -
    • +
    • - - @@ -59,11 +59,22 @@ -
      - helpstring + helpstring +
    • +
    • +
      + + + + +
      + helpstring
    From 328424790501df948635c259a273e05c98880844 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 9 May 2013 09:35:31 -0400 Subject: [PATCH 017/117] restyling of the input fields, partway through adding in examples of all settings --- cms/static/sass/views/_unit.scss | 81 +++++++++++++--------------- cms/templates/component.html | 91 +++++++++++++++++++++++++++----- 2 files changed, 115 insertions(+), 57 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 75b3224f45..c7cdce3cb1 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -452,6 +452,19 @@ body.course.unit { color: #fff; font-weight: 700; } + + // Module Actions + .module-actions { + @include box-shadow(inset 0 1px 1px $shadow); + padding: 0px 0 10px 10px; + background-color: $gray-l4; + + .save-button { + margin: 15px 8px 0 0; + } + } + + } } } @@ -501,12 +514,13 @@ body.course.unit { .is-set { @include linear-gradient($blue, $blue); - box-shadow: inset 0 0 2px $shadow; + box-shadow: inset 0 0 3px $shadow; background-color: $blue; + cursor: default; &:hover { - box-shadow: inset 0 0 2px $shadow; + box-shadow: inset 0 0 3px $shadow; background-color: $blue; } } @@ -531,7 +545,6 @@ body.course.unit { overflow: auto; max-height: 400px; - //chrome scrollbar visibility correction &::-webkit-scrollbar { -webkit-appearance: none; @@ -547,10 +560,9 @@ body.course.unit { //component-setting-entry .field.comp-setting-entry { - //margin: 0 0 $baseline 0; - + //margin: 0 0 $baseline 0; WILL BE REMOVED PRIOR TO PUSH background-color: $white; - padding: 20px 20px; + padding: 20px; border-bottom: 1px solid $gray-l2; opacity: .6; @@ -603,31 +615,32 @@ body.course.unit { } label.setting-label { - //@extend .t-copy-sub1; - //@include transition(color, 0.15s, ease-in-out); - //margin: 0 0 ($baseline/4) 0; - //font-weight: 400; + @extend .t-copy-sub1; + @include transition(color, 0.15s, ease-in-out); + //margin: 0 0 ($baseline/4) 0; WILL BE REMOVED PRIOR TO PUSH + font-weight: 400; - @extend .t-copy-sub2; display: inline-block; position: relative; left: 0; - height: 50%; - width: 120px; - text-overflow: ellipsis; + min-width: 100px; + width: 35%; - //&.is-focused { - // color: $blue; - //} + &.is-focused { + color: $blue; + } } input, select { - //@include placeholder($gray-l4); - //@include font-size(16); - //@include size(100%,100%); - //padding: ($baseline/2); + @include placeholder($gray-l4); + @include font-size(16); + @include size(100%,100%); + padding: ($baseline/2); + min-width: 100px; + width: 45%; //&.long { + // //} //&.short { @@ -638,23 +651,16 @@ body.course.unit { //} //&:focus { - // + .tip { // color: $gray; // } - - @extend .t-copy-sub3; - @include placeholder($gray-l4); - border-radius: 2px; - padding: 6px 8px 8px; - width: 180px; - height: auto; + border-radius: 3px; border: 1px solid $gray-l2; text-overflow: ellipsis; } select { - border: 1px solid $gray-l4; + //border: 1px solid $gray-l2; background: none repeat scroll #F2F2F2; padding: 5px; @@ -701,26 +707,13 @@ body.course.unit { @include font-size(12); display: inline-block; font-color: $gray-l6; - max-width: 50%; + //max-width: 50%; vertical-align: top; } } } } -// Module Actions -// ==================== - -.module-actions { - @include box-shadow(inset 0 1px 1px $shadow); - padding: 0 0 10px 10px; - background-color: $gray-l4; - - .save-button { - margin: 15px 8px 0 0; - } -} - // Editing Units from Courseware // ==================== diff --git a/cms/templates/component.html b/cms/templates/component.html index 496da8cd61..250609d43e 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -24,33 +24,97 @@
      + + +
    • +
      + + + +
      + If disabled, students cannot upload images to be graded with this problem. +
    • + +
    • +
      + + + +
      + If enabled, submissions with poor spelling, short length, or poor grammar won't be peer reviewed. +
    • + +
    • +
      + + + + +
      + This value specifies the discussion are where this . This name appears in the left pane of the discussion forum for your course (question) +
    • + + + + + +
    • +
      + + + + +
      + This value defines the name of this component, and is shown to students as a tooltip. +
    • + + + + +
    • - - + +
      - helpstring + This value defines the name of this component, and is shown to students as a tooltip.
    • - +
    • -
      - - +
      + +
      - This is a longer sentence, repeated multiple times here just to test out the functionaltiy. + When set, this limits the number of times a student can attempt this problem.
    • - +
    • -
      - +
      +
      - This value specifies the discussion are where this . This name appears in the left pane of the discussion forum for your course (question) -
    • - - - - - -
    • -
      - - - - -
      - This value defines the name of this component, and is shown to students as a tooltip. -
    • - - - - - -
    • -
      - - - - -
      - This value defines the name of this component, and is shown to students as a tooltip. + This value specifies the discussion are where this component lives, organized in the left pane of the discussion forum for your course.
    • - - + + + -
      - When set, this limits the number of times a student can attempt this problem. +
    + This value defines the name of this component, and is shown to students as a tooltip.
  • - - - - - - - + +
    - helpstring + If disabled, this problem will not be graded.
  • -
  • +
  • - - + + -
    - helpstring + This value ....needs helpstring....
  • + +
  • +
    + + + +
    + Choose from a few different ways to incorporate randomization into this problem. +
  • + +
  • +
    + + + +
    + Choose from a few different options to define whether students interact with the problem's answer. (info icon here) You can define this for every problem in a course. +
  • + +
  • +
    + + + + +
    + You can specify the order of discussion areas in the discussion dropdown menu. Their order is alphabetical, but uses the sort key value instead of their name. +
  • + +
  • +
    + + + + +
    + Specify a subcategory name for this discussion. This name appears in the left pane of the discussion forum for your course. +
  • + +
    From bfdbcc2f3244c3db41fe45c0225e2e416b3a323e Mon Sep 17 00:00:00 2001 From: cahrens Date: Thu, 9 May 2013 11:16:12 -0400 Subject: [PATCH 019/117] Beginnings of Backbone views/models. --- .../generic_metadata_entry.html | 2 + .../client_templates/metadata_editor.html | 7 +++ .../coffee/src/views/module_edit.coffee | 28 +++-------- cms/static/js/models/metadata_editor.js | 8 +++ cms/static/js/models/metadata_model.js | 13 +++++ .../js/views/generic_metadata_editor.js | 28 +++++++++++ cms/static/js/views/metadata_editor_view.js | 44 ++++++++++++++++ cms/templates/base.html | 7 +++ cms/templates/widgets/metadata-edit.html | 50 +++---------------- common/lib/xmodule/xmodule/mako_module.py | 6 ++- common/lib/xmodule/xmodule/x_module.py | 11 +++- 11 files changed, 138 insertions(+), 66 deletions(-) create mode 100644 cms/static/client_templates/generic_metadata_entry.html create mode 100644 cms/static/client_templates/metadata_editor.html create mode 100644 cms/static/js/models/metadata_editor.js create mode 100644 cms/static/js/models/metadata_model.js create mode 100644 cms/static/js/views/generic_metadata_editor.js create mode 100644 cms/static/js/views/metadata_editor_view.js diff --git a/cms/static/client_templates/generic_metadata_entry.html b/cms/static/client_templates/generic_metadata_entry.html new file mode 100644 index 0000000000..ef65c1bf3f --- /dev/null +++ b/cms/static/client_templates/generic_metadata_entry.html @@ -0,0 +1,2 @@ + + diff --git a/cms/static/client_templates/metadata_editor.html b/cms/static/client_templates/metadata_editor.html new file mode 100644 index 0000000000..9fb8cee67b --- /dev/null +++ b/cms/static/client_templates/metadata_editor.html @@ -0,0 +1,7 @@ +
      + <% _.each(metadata_entries, function(entry) { %> +
    • +
    • + <% }) %> +
    \ No newline at end of file diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index bf56807f66..eeda00638a 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -20,29 +20,15 @@ class CMS.Views.ModuleEdit extends Backbone.View loadEdit: -> if not @module @module = XModule.loadModule(@$el.find('.xmodule_edit')) - @originalMetadata = @metadata() - - metadata: -> - # cdodge: package up metadata which is separated into a number of input fields - # there's probably a better way to do this, but at least this lets me continue to move onwards - _metadata = {} - - $metadata = @$component_editor().find('.metadata_edit') - - if $metadata - # walk through the set of elments which have the 'xmetadata_name' attribute and - # build up a object to pass back to the server on the subsequent POST - _metadata[$(el).data("metadata-name")] = el.value for el in $('[data-metadata-name]', $metadata) - - return _metadata + # At this point, metadata-edit.html will be loaded, and the metadata (as JSON) is available. + metadataEditor = @$el.find('.metadata_edit') + @metadataEditor = new CMS.Views.Metadata.Editor({ + el: metadataEditor, + model: new CMS.Models.MetadataEditor(metadataEditor.data('metadata')) + }); changedMetadata: -> - currentMetadata = @metadata() - changedMetadata = {} - for key of currentMetadata - if currentMetadata[key] != @originalMetadata[key] - changedMetadata[key] = currentMetadata[key] - return changedMetadata + return @metadataEditor.getModifiedMetadataValues() cloneTemplate: (parent, template) -> $.post("/clone_item", { diff --git a/cms/static/js/models/metadata_editor.js b/cms/static/js/models/metadata_editor.js new file mode 100644 index 0000000000..334d8aa718 --- /dev/null +++ b/cms/static/js/models/metadata_editor.js @@ -0,0 +1,8 @@ +CMS.Models.MetadataEditor = Backbone.Model.extend({ + // This model class is not suited for restful operations and is considered just a server side initialized container + url: '', + + defaults: { + } + +}); diff --git a/cms/static/js/models/metadata_model.js b/cms/static/js/models/metadata_model.js new file mode 100644 index 0000000000..4349fa7187 --- /dev/null +++ b/cms/static/js/models/metadata_model.js @@ -0,0 +1,13 @@ +CMS.Models.Metadata = Backbone.Model.extend({ + // This model class is not suited for restful operations and is considered just a server side initialized container + url: '', + + defaults: { + "display_name": null, + "value" : null + }, + + getOriginalValue: function() { + return this.get('value'); + } +}); diff --git a/cms/static/js/views/generic_metadata_editor.js b/cms/static/js/views/generic_metadata_editor.js new file mode 100644 index 0000000000..3dc7f1f7e1 --- /dev/null +++ b/cms/static/js/views/generic_metadata_editor.js @@ -0,0 +1,28 @@ +if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; + +CMS.Views.Metadata.Generic = Backbone.View.extend({ + + // Model class ... + events : { + }, + + initialize : function() { + var self = this; + // instantiates an editor template for each update in the collection + window.templateLoader.loadRemoteTemplate("metadata_entry", + "/static/client_templates/generic_metadata_entry.html", + function (raw_template) { + self.template = _.template(raw_template); + self.$el.append(self.template({model: self.model})); + } + ); + }, + + modified: function () { + return this.getValue() !== this.model.getOriginalValue(); + }, + + getValue: function() { + return this.$el.find('.editor').val(); + } +}); diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js new file mode 100644 index 0000000000..6c1665d294 --- /dev/null +++ b/cms/static/js/views/metadata_editor_view.js @@ -0,0 +1,44 @@ +if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; + +CMS.Views.Metadata.Editor = Backbone.View.extend({ + + // Model class is ... + events : { + }, + + views : {}, // child views + + initialize : function() { + var self = this; + // instantiates an editor template for each update in the collection + window.templateLoader.loadRemoteTemplate("metadata_editor", + "/static/client_templates/metadata_editor.html", + function (raw_template) { + self.template = _.template(raw_template); + self.$el.append(self.template({metadata_entries: self.model.attributes})); + var counter = 0; + _.each(self.model.attributes, + function(item, key) { + self.views[key] = new CMS.Views.Metadata.Generic({ + el: self.$el.find('.metadata_entry')[counter], + model: new CMS.Models.Metadata(item) + } + ); + counter+=1; + }); + } + ); + }, + + getModifiedMetadataValues: function () { + var modified_values = {}; + _.each(this.views, + function (item, key) { + if (item.modified()) { + modified_values[key] = item.getValue(); + } + } + ); + return modified_values; + } +}); diff --git a/cms/templates/base.html b/cms/templates/base.html index f1a87d6424..db62c76015 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -49,6 +49,13 @@ + + + + + + + +
    \ No newline at end of file diff --git a/cms/templates/widgets/raw-edit.html b/cms/templates/widgets/raw-edit.html index 9488552be5..be41fad887 100644 --- a/cms/templates/widgets/raw-edit.html +++ b/cms/templates/widgets/raw-edit.html @@ -1,4 +1,6 @@ <%include file="metadata-edit.html" /> -
    - -
    +
    +
    + +
    +
    From b314b5ce590db3fc295f7840b0da17449a41432b Mon Sep 17 00:00:00 2001 From: cahrens Date: Thu, 9 May 2013 14:51:16 -0400 Subject: [PATCH 024/117] Renaming of some files. --- cms/static/client_templates/metadata_option_entry.html | 0 ...{generic_metadata_entry.html => metadata_string_entry.html} | 2 +- cms/static/js/views/metadata_option_view.js | 0 .../{generic_metadata_editor.js => metadata_string_view.js} | 2 +- cms/templates/base.html | 3 ++- 5 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 cms/static/client_templates/metadata_option_entry.html rename cms/static/client_templates/{generic_metadata_entry.html => metadata_string_entry.html} (88%) create mode 100644 cms/static/js/views/metadata_option_view.js rename cms/static/js/views/{generic_metadata_editor.js => metadata_string_view.js} (91%) diff --git a/cms/static/client_templates/metadata_option_entry.html b/cms/static/client_templates/metadata_option_entry.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cms/static/client_templates/generic_metadata_entry.html b/cms/static/client_templates/metadata_string_entry.html similarity index 88% rename from cms/static/client_templates/generic_metadata_entry.html rename to cms/static/client_templates/metadata_string_entry.html index 42069def5e..494a4ff97a 100644 --- a/cms/static/client_templates/generic_metadata_entry.html +++ b/cms/static/client_templates/metadata_string_entry.html @@ -6,4 +6,4 @@
    -'<%= model.get("help") %>' \ No newline at end of file +<%= model.get('help') %> \ No newline at end of file diff --git a/cms/static/js/views/metadata_option_view.js b/cms/static/js/views/metadata_option_view.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cms/static/js/views/generic_metadata_editor.js b/cms/static/js/views/metadata_string_view.js similarity index 91% rename from cms/static/js/views/generic_metadata_editor.js rename to cms/static/js/views/metadata_string_view.js index 3dc7f1f7e1..53937f3a47 100644 --- a/cms/static/js/views/generic_metadata_editor.js +++ b/cms/static/js/views/metadata_string_view.js @@ -10,7 +10,7 @@ CMS.Views.Metadata.Generic = Backbone.View.extend({ var self = this; // instantiates an editor template for each update in the collection window.templateLoader.loadRemoteTemplate("metadata_entry", - "/static/client_templates/generic_metadata_entry.html", + "/static/client_templates/metadata_string_entry.html", function (raw_template) { self.template = _.template(raw_template); self.$el.append(self.template({model: self.model})); diff --git a/cms/templates/base.html b/cms/templates/base.html index db62c76015..5825cdb1b9 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -52,7 +52,8 @@ - + + From 6dbfa7499b25c823ad99f936ef5a399cfe91f06f Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 9 May 2013 14:58:54 -0400 Subject: [PATCH 025/117] removed metadata-edit styling --- cms/static/sass/views/_unit.scss | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 57ce1e67d0..fd876c083c 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -560,7 +560,6 @@ body.course.unit { //component-setting-entry .field.comp-setting-entry { - //margin: 0 0 $baseline 0; WILL BE REMOVED PRIOR TO PUSH background-color: $white; padding: 20px; border-bottom: 1px solid $gray-l2; @@ -945,12 +944,6 @@ body.unit { //OLD Meta-data Styling //TO-DO port over old styling .metadata_edit { - margin-bottom: 20px; - font-size: 13px; - - li { - margin-bottom: 10px; - } label { display: inline-block; From 04bb7335e752f5d699fdcc73342f233748b2f9f3 Mon Sep 17 00:00:00 2001 From: marco Date: Fri, 10 May 2013 13:18:43 -0400 Subject: [PATCH 026/117] removed extra section heading in settings DOM, placed settings after editor --- cms/static/client_templates/metadata_editor.html | 16 +++++++--------- cms/static/coffee/src/views/module_edit.coffee | 1 + cms/templates/widgets/html-edit.html | 2 +- cms/templates/widgets/metadata-edit.html | 2 +- cms/templates/widgets/problem-edit.html | 4 ++-- cms/templates/widgets/raw-edit.html | 2 +- cms/templates/widgets/sequence-edit.html | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/cms/static/client_templates/metadata_editor.html b/cms/static/client_templates/metadata_editor.html index 92f053ca9f..bf618bd6f1 100644 --- a/cms/static/client_templates/metadata_editor.html +++ b/cms/static/client_templates/metadata_editor.html @@ -1,9 +1,7 @@ -
    -
      - <% _.each(metadata_entries, function(entry) { %> -
    • -
    • - <% }) %> -
    -
    \ No newline at end of file +
      + <% _.each(metadata_entries, function(entry) { %> +
    • +
    • + <% }) %> +
    \ No newline at end of file diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index eeda00638a..8a6db67e3a 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -8,6 +8,7 @@ class CMS.Views.ModuleEdit extends Backbone.View "click .component-actions .edit-button": 'clickEditButton' "click .component-actions .delete-button": 'onDelete' + initialize: -> @onDelete = @options.onDelete @render() diff --git a/cms/templates/widgets/html-edit.html b/cms/templates/widgets/html-edit.html index 7c4a1bde7b..17f86a89dc 100644 --- a/cms/templates/widgets/html-edit.html +++ b/cms/templates/widgets/html-edit.html @@ -1,4 +1,3 @@ -<%include file="metadata-edit.html" />
      @@ -12,3 +11,4 @@
    +<%include file="metadata-edit.html" /> diff --git a/cms/templates/widgets/metadata-edit.html b/cms/templates/widgets/metadata-edit.html index c1e2654724..8367011c42 100644 --- a/cms/templates/widgets/metadata-edit.html +++ b/cms/templates/widgets/metadata-edit.html @@ -8,7 +8,7 @@ % if 'source_code' in json_metadata_data: <% del json_metadata_data['source_code'] %> % endif - - <%include file="metadata-edit.html" />
      @@ -50,5 +49,6 @@
    + <%include file="metadata-edit.html" /> From fd52980a2d19902a532057a251791adddd542705 Mon Sep 17 00:00:00 2001 From: cahrens Date: Fri, 10 May 2013 16:02:22 -0400 Subject: [PATCH 027/117] Option view, changes getting persisted. --- .../metadata_option_entry.html | 12 +++++++ .../metadata_string_entry.html | 5 ++- cms/static/js/views/metadata_editor_view.js | 17 ++++++---- cms/static/js/views/metadata_option_view.js | 32 +++++++++++++++++++ cms/static/js/views/metadata_string_view.js | 9 +++--- common/lib/xmodule/xmodule/capa_module.py | 3 +- common/lib/xmodule/xmodule/x_module.py | 5 +++ 7 files changed, 69 insertions(+), 14 deletions(-) diff --git a/cms/static/client_templates/metadata_option_entry.html b/cms/static/client_templates/metadata_option_entry.html index e69de29bb2..3a1cd30337 100644 --- a/cms/static/client_templates/metadata_option_entry.html +++ b/cms/static/client_templates/metadata_option_entry.html @@ -0,0 +1,12 @@ +
    + + + +
    +<%= model.get('help') %> diff --git a/cms/static/client_templates/metadata_string_entry.html b/cms/static/client_templates/metadata_string_entry.html index 494a4ff97a..af49dc0291 100644 --- a/cms/static/client_templates/metadata_string_entry.html +++ b/cms/static/client_templates/metadata_string_entry.html @@ -1,7 +1,6 @@
    - - - + + diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index 6c1665d294..9665b456dd 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -19,12 +19,17 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({ var counter = 0; _.each(self.model.attributes, function(item, key) { - self.views[key] = new CMS.Views.Metadata.Generic({ - el: self.$el.find('.metadata_entry')[counter], - model: new CMS.Models.Metadata(item) - } - ); - counter+=1; + var data = { + el: self.$el.find('.metadata_entry')[counter++], + model: new CMS.Models.Metadata(item) + }; + if (item.options.length > 0) { + self.views[key] = new CMS.Views.Metadata.Option(data); + } + else { + self.views[key] = new CMS.Views.Metadata.String(data); + } + }); } ); diff --git a/cms/static/js/views/metadata_option_view.js b/cms/static/js/views/metadata_option_view.js index e69de29bb2..b619747282 100644 --- a/cms/static/js/views/metadata_option_view.js +++ b/cms/static/js/views/metadata_option_view.js @@ -0,0 +1,32 @@ +if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; + +CMS.Views.Metadata.Option = Backbone.View.extend({ + + // Model class ... + events : { + }, + + initialize : function() { + var self = this; + this.uniqueId = _.uniqueId('metadata_option_entry_'); + // instantiates an editor template for each update in the collection + window.templateLoader.loadRemoteTemplate("metadata_option_entry", + "/static/client_templates/metadata_option_entry.html", + function (raw_template) { + self.template = _.template(raw_template); + self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId})); + $('#' + self.uniqueId + " option").filter(function() { + return $(this).text() === self.model.get('value'); + }).prop('selected', true); + } + ); + }, + + modified: function () { + return this.getValue() !== this.model.getOriginalValue(); + }, + + getValue: function() { + return this.$el.find('#' + this.uniqueId).find(":selected").text(); + } +}); diff --git a/cms/static/js/views/metadata_string_view.js b/cms/static/js/views/metadata_string_view.js index 53937f3a47..2cb5c04e1b 100644 --- a/cms/static/js/views/metadata_string_view.js +++ b/cms/static/js/views/metadata_string_view.js @@ -1,6 +1,6 @@ if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; -CMS.Views.Metadata.Generic = Backbone.View.extend({ +CMS.Views.Metadata.String = Backbone.View.extend({ // Model class ... events : { @@ -8,12 +8,13 @@ CMS.Views.Metadata.Generic = Backbone.View.extend({ initialize : function() { var self = this; + this.uniqueId = _.uniqueId('metadata_string_entry_'); // instantiates an editor template for each update in the collection - window.templateLoader.loadRemoteTemplate("metadata_entry", + window.templateLoader.loadRemoteTemplate("metadata_string_entry", "/static/client_templates/metadata_string_entry.html", function (raw_template) { self.template = _.template(raw_template); - self.$el.append(self.template({model: self.model})); + self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId})); } ); }, @@ -23,6 +24,6 @@ CMS.Views.Metadata.Generic = Backbone.View.extend({ }, getValue: function() { - return this.$el.find('.editor').val(); + return this.$el.find('#' + this.uniqueId).val(); } }); diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 479cd5a759..004411e509 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -68,7 +68,8 @@ class CapaFields(object): showanswer = String(help="When to show the problem answer to the student", scope=Scope.settings, default="closed", values=["answered", "always", "attempted", "closed", "never"]) force_save_button = Boolean(help="Whether to force the save button to appear on the page", scope=Scope.settings, default=False) - rerandomize = Randomization(help="When to rerandomize the problem", default="always", scope=Scope.settings) + rerandomize = Randomization(help="When to rerandomize the problem", default="always", scope=Scope.settings, + values=["always", "onreset", "never", "per_student"]) data = String(help="XML data for the problem", scope=Scope.content) correct_map = Object(help="Dictionary with the correctness of current student answers", scope=Scope.user_state, default={}) input_state = Object(help="Dictionary for maintaining the state of inputtypes", scope=Scope.user_state) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 8b5ae3e63f..f3b249adff 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -648,8 +648,13 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock): 'inheritable': inheritable, 'explicitly_set': explicitly_set} + values = [] if field.values is None else field.values + for index, choice in enumerate(values): + values[index] = field.to_json(choice) + simple_metadata[field.name] = {'value': field.to_json(value), 'display_name' : field.display_name, + 'options' : values, 'default_value': field.to_json(default_value), 'inheritable': inheritable, 'explicitly_set': explicitly_set, From f4b06b2e966ac2a34a2c28d94ef4959a673caa22 Mon Sep 17 00:00:00 2001 From: cahrens Date: Fri, 10 May 2013 16:41:07 -0400 Subject: [PATCH 028/117] Beginnings of is-set work. --- cms/static/client_templates/metadata_editor.html | 3 +-- .../client_templates/metadata_string_entry.html | 2 +- cms/static/js/views/metadata_editor_view.js | 2 ++ cms/static/js/views/metadata_number_view.js | 14 ++++++++++++++ cms/static/js/views/metadata_option_view.js | 5 +++++ cms/static/js/views/metadata_string_view.js | 4 ++++ cms/templates/base.html | 1 + 7 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 cms/static/js/views/metadata_number_view.js diff --git a/cms/static/client_templates/metadata_editor.html b/cms/static/client_templates/metadata_editor.html index bf618bd6f1..6780c4f1da 100644 --- a/cms/static/client_templates/metadata_editor.html +++ b/cms/static/client_templates/metadata_editor.html @@ -1,7 +1,6 @@
      <% _.each(metadata_entries, function(entry) { %> -
    • -
    • <% }) %>
    \ No newline at end of file diff --git a/cms/static/client_templates/metadata_string_entry.html b/cms/static/client_templates/metadata_string_entry.html index af49dc0291..647e48400a 100644 --- a/cms/static/client_templates/metadata_string_entry.html +++ b/cms/static/client_templates/metadata_string_entry.html @@ -5,4 +5,4 @@
    -<%= model.get('help') %> \ No newline at end of file +<%= model.get('help') %> diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index 9665b456dd..4e35deba9f 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -24,6 +24,8 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({ model: new CMS.Models.Metadata(item) }; if (item.options.length > 0) { + // Right now, all our option types only hold strings. Should really support + // any type though. self.views[key] = new CMS.Views.Metadata.Option(data); } else { diff --git a/cms/static/js/views/metadata_number_view.js b/cms/static/js/views/metadata_number_view.js new file mode 100644 index 0000000000..a1be53eafa --- /dev/null +++ b/cms/static/js/views/metadata_number_view.js @@ -0,0 +1,14 @@ +if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; + +CMS.Views.Metadata.Number = CMS.Views.Metadata.String.extend({ + + getValue: function() { + var stringVal = this.$el.find('#' + this.uniqueId).val(); + if (this.isInteger) { + return parseInt(stringVal) + } + else { + return parseFloat(stringVal) + } + } +}); \ No newline at end of file diff --git a/cms/static/js/views/metadata_option_view.js b/cms/static/js/views/metadata_option_view.js index b619747282..28c49fb3d4 100644 --- a/cms/static/js/views/metadata_option_view.js +++ b/cms/static/js/views/metadata_option_view.js @@ -18,6 +18,11 @@ CMS.Views.Metadata.Option = Backbone.View.extend({ $('#' + self.uniqueId + " option").filter(function() { return $(this).text() === self.model.get('value'); }).prop('selected', true); + if (self.model.get('explicitly_set')) { + self.$el.addClass('is-set'); + self.$el.find('#'+self.uniqueId + " .setting-clear").addClass('active'); + } + } ); }, diff --git a/cms/static/js/views/metadata_string_view.js b/cms/static/js/views/metadata_string_view.js index 2cb5c04e1b..465b75ba8b 100644 --- a/cms/static/js/views/metadata_string_view.js +++ b/cms/static/js/views/metadata_string_view.js @@ -15,6 +15,10 @@ CMS.Views.Metadata.String = Backbone.View.extend({ function (raw_template) { self.template = _.template(raw_template); self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId})); + if (self.model.get('explicitly_set')) { + self.$el.addClass('is-set'); + self.$el.find('#'+self.uniqueId + " .setting-clear").addClass('active'); + } } ); }, diff --git a/cms/templates/base.html b/cms/templates/base.html index 5825cdb1b9..6649affefb 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -53,6 +53,7 @@ + From 2360a111c83d416319c09f22f9ac057dc50417d7 Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 12 May 2013 12:08:04 -0400 Subject: [PATCH 029/117] attempt to trigger js event for mode button press, not breaking yet but nonfunctional --- cms/static/coffee/src/views/module_edit.coffee | 7 ++++++- cms/templates/component.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 8a6db67e3a..83298a215b 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -7,7 +7,7 @@ class CMS.Views.ModuleEdit extends Backbone.View "click .component-editor .save-button": 'clickSaveButton' "click .component-actions .edit-button": 'clickEditButton' "click .component-actions .delete-button": 'onDelete' - + "click .mode .not-set": 'clickModeButton' initialize: -> @onDelete = @options.onDelete @@ -83,3 +83,8 @@ class CMS.Views.ModuleEdit extends Backbone.View $modalCover.show().addClass('is-fixed') @$component_editor().slideDown(150) @loadEdit() + + clickModeButton: (event) -> + event.preventDefault() + @$el.removeClass('not-set') + @$el.addClass('is-set') diff --git a/cms/templates/component.html b/cms/templates/component.html index a461f4ce06..5883bd55d5 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -11,7 +11,7 @@ Compiler
    From 125c9c13c1343334e769836a0cc4cd05aaab2c26 Mon Sep 17 00:00:00 2001 From: cahrens Date: Sun, 12 May 2013 15:45:31 -0400 Subject: [PATCH 030/117] Got clearing of fields working. --- cms/static/js/models/metadata_model.js | 41 ++++++- cms/static/js/views/metadata_editor_view.js | 115 ++++++++++++++++++++ cms/static/js/views/metadata_number_view.js | 14 --- cms/static/js/views/metadata_option_view.js | 37 ------- cms/static/js/views/metadata_string_view.js | 33 ------ cms/templates/base.html | 3 - 6 files changed, 155 insertions(+), 88 deletions(-) delete mode 100644 cms/static/js/views/metadata_number_view.js delete mode 100644 cms/static/js/views/metadata_option_view.js delete mode 100644 cms/static/js/views/metadata_string_view.js diff --git a/cms/static/js/models/metadata_model.js b/cms/static/js/models/metadata_model.js index 4349fa7187..4aa10f57d1 100644 --- a/cms/static/js/models/metadata_model.js +++ b/cms/static/js/models/metadata_model.js @@ -4,10 +4,49 @@ CMS.Models.Metadata = Backbone.Model.extend({ defaults: { "display_name": null, - "value" : null + "value" : null, + "explicitly_set": null, + "default_value" : null + }, + + initialize: function() { + this.original_value = this.get('value'); + this.original_explicitly_set = this.get('explicitly_set'); }, getOriginalValue: function() { + return this.originalValue; + }, + + isModified : function() { + if (!this.get('explicitly_set') && !this.original_explicitly_set) { + return false; + } + if (this.get('explicitly_set') && this.original_explicitly_set) { + return this.get('value') !== this.original_value; + } + return true; + }, + + isExplicitlySet: function() { + return this.get('explicitly_set'); + }, + + getDisplayValue : function () { return this.get('value'); + }, + + getValue: function() { + return this.get('explicitly_set') ? this.get('value') : null; + }, + + setValue: function (value) { + this.set('explicitly_set', true); + this.set('value', value); + }, + + clear: function() { + this.set('explicitly_set', false); + this.set('value', this.get('default_value')); } }); diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index 4e35deba9f..6c2081977c 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -49,3 +49,118 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({ return modified_values; } }); + +CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({ + + initialize : function() { + var self = this; + var templateName = this.getTemplateName(); + this.uniqueId = _.uniqueId(templateName + "_"); + window.templateLoader.loadRemoteTemplate(templateName, + "/static/client_templates/" + templateName + ".html", + function (raw_template) { + self.template = _.template(raw_template); + self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId})); + self.render(); + } + ); + }, + + getTemplateName : function () {}, + + getValueFromEditor : function () {}, + + setValueInEditor : function (value) {}, + + updateModel: function () { + this.model.setValue(this.getValueFromEditor()); + this.render(); + }, + + clear: function () { + this.model.clear(); + this.render(); + }, + + showClearButton: function() { + if (!this.$el.hasClass('is-set')) { + this.$el.addClass('is-set'); + // TODO: can we use toggleclass? + this.$el.find('.setting-clear').removeClass('inactive'); + this.$el.find('.setting-clear').addClass('active'); + } + }, + + render: function () { + if (!this.template) return; + + this.setValueInEditor(this.model.getDisplayValue()); + + if (this.model.isExplicitlySet()) { + this.showClearButton(); + } + else { + this.$el.removeClass('is-set'); + // TODO: can we use toggleclass? + this.$el.find('.setting-clear').addClass('inactive'); + this.$el.find('.setting-clear').removeClass('active'); + } + }, + + + modified: function () { + return this.model.isModified(); + }, + + getValue: function() { + return this.model.getValue(); + } +}); + +CMS.Views.Metadata.String = CMS.Views.Metadata.AbstractEditor.extend({ + + events : { + "change input" : "updateModel", + "keypress .setting-input" : "showClearButton" , + "click .setting-clear" : "clear" + }, + + getTemplateName : function () { + return "metadata_string_entry"; + }, + + getValueFromEditor : function () { + var val = this.$el.find('#' + this.uniqueId).val(); +// TODO: not sure this is necessary. Trying to support empty value (""). + return val ? val : ""; + }, + + setValueInEditor : function (value) { + this.$el.find('input').val(value); + } +}); + +CMS.Views.Metadata.Option = CMS.Views.Metadata.AbstractEditor.extend({ + + events : { + "change select" : "updateModel", + "click .setting-clear" : "clear" + }, + + getTemplateName : function () { + return "metadata_option_entry"; + }, + + getValueFromEditor : function () { + return this.$el.find('#' + this.uniqueId).find(":selected").text(); + }, + + setValueInEditor : function (value) { + $('#' + this.uniqueId + " option").filter(function() { + return $(this).text() === value; + }).prop('selected', true); + } +}); + + + diff --git a/cms/static/js/views/metadata_number_view.js b/cms/static/js/views/metadata_number_view.js deleted file mode 100644 index a1be53eafa..0000000000 --- a/cms/static/js/views/metadata_number_view.js +++ /dev/null @@ -1,14 +0,0 @@ -if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; - -CMS.Views.Metadata.Number = CMS.Views.Metadata.String.extend({ - - getValue: function() { - var stringVal = this.$el.find('#' + this.uniqueId).val(); - if (this.isInteger) { - return parseInt(stringVal) - } - else { - return parseFloat(stringVal) - } - } -}); \ No newline at end of file diff --git a/cms/static/js/views/metadata_option_view.js b/cms/static/js/views/metadata_option_view.js deleted file mode 100644 index 28c49fb3d4..0000000000 --- a/cms/static/js/views/metadata_option_view.js +++ /dev/null @@ -1,37 +0,0 @@ -if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; - -CMS.Views.Metadata.Option = Backbone.View.extend({ - - // Model class ... - events : { - }, - - initialize : function() { - var self = this; - this.uniqueId = _.uniqueId('metadata_option_entry_'); - // instantiates an editor template for each update in the collection - window.templateLoader.loadRemoteTemplate("metadata_option_entry", - "/static/client_templates/metadata_option_entry.html", - function (raw_template) { - self.template = _.template(raw_template); - self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId})); - $('#' + self.uniqueId + " option").filter(function() { - return $(this).text() === self.model.get('value'); - }).prop('selected', true); - if (self.model.get('explicitly_set')) { - self.$el.addClass('is-set'); - self.$el.find('#'+self.uniqueId + " .setting-clear").addClass('active'); - } - - } - ); - }, - - modified: function () { - return this.getValue() !== this.model.getOriginalValue(); - }, - - getValue: function() { - return this.$el.find('#' + this.uniqueId).find(":selected").text(); - } -}); diff --git a/cms/static/js/views/metadata_string_view.js b/cms/static/js/views/metadata_string_view.js deleted file mode 100644 index 465b75ba8b..0000000000 --- a/cms/static/js/views/metadata_string_view.js +++ /dev/null @@ -1,33 +0,0 @@ -if (!CMS.Views['Metadata']) CMS.Views.Metadata = {}; - -CMS.Views.Metadata.String = Backbone.View.extend({ - - // Model class ... - events : { - }, - - initialize : function() { - var self = this; - this.uniqueId = _.uniqueId('metadata_string_entry_'); - // instantiates an editor template for each update in the collection - window.templateLoader.loadRemoteTemplate("metadata_string_entry", - "/static/client_templates/metadata_string_entry.html", - function (raw_template) { - self.template = _.template(raw_template); - self.$el.append(self.template({model: self.model, uniqueId: self.uniqueId})); - if (self.model.get('explicitly_set')) { - self.$el.addClass('is-set'); - self.$el.find('#'+self.uniqueId + " .setting-clear").addClass('active'); - } - } - ); - }, - - modified: function () { - return this.getValue() !== this.model.getOriginalValue(); - }, - - getValue: function() { - return this.$el.find('#' + this.uniqueId).val(); - } -}); diff --git a/cms/templates/base.html b/cms/templates/base.html index 6649affefb..88bbc56677 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -52,9 +52,6 @@ - - - From 97de97cc18a703503a29bddb85a25d238a08e80b Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 13 May 2013 09:27:13 -0400 Subject: [PATCH 031/117] minimal mce editor style changes to borders --- cms/static/sass/views/_unit.scss | 4 ++++ .../js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index fd876c083c..b2d89c095b 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -453,6 +453,10 @@ body.course.unit { font-weight: 700; } + .row { + margin-bottom: 0px; + } + // Module Actions .module-actions { @include box-shadow(inset 0 1px 1px $shadow); diff --git a/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css b/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css index b2d3e494aa..c973248384 100644 --- a/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css +++ b/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css @@ -25,8 +25,8 @@ /* Layout */ .studioSkin table.mceLayout {border:0;} -.studioSkin table.mceLayout tr.mceFirst td {border-top:1px solid #3c3c3c;} -.studioSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #3c3c3c;} +.studioSkin table.mceLayout tr.mceFirst td {border-top: 1px solid #D1DCE6;} +.studioSkin table.mceLayout tr.mceLast td {border-bottom:none;} .studioSkin table.mceToolbar, .studioSkin tr.mceFirst .mceToolbar tr td, .studioSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;} .studioSkin td.mceToolbar { background: -webkit-linear-gradient(top, #d4dee8, #c9d5e2); @@ -36,7 +36,7 @@ background: linear-gradient(top, #d4dee8, #c9d5e2); border: 1px solid #3c3c3c; border-bottom-color: #a5aaaf; - border-radius: 3px 3px 0 0; + border-radius: 0; padding: 10px 10px 9px; vertical-align: top; } From e29c940e7c7c28a90999389c966e53ccea1838db Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 13 May 2013 13:15:07 -0400 Subject: [PATCH 032/117] Add display_names, update help, remove unnecessary things from templates. --- common/lib/xmodule/xmodule/capa_module.py | 19 ++++++++++++------- .../lib/xmodule/xmodule/discussion_module.py | 8 ++++++-- .../xmodule/xmodule/templates/html/empty.yaml | 1 - .../templates/problem/circuitschematic.yaml | 2 -- .../templates/problem/customgrader.yaml | 2 -- .../xmodule/templates/problem/empty.yaml | 3 --- .../templates/problem/emptyadvanced.yaml | 3 --- .../templates/problem/forumularesponse.yaml | 2 -- .../templates/problem/imageresponse.yaml | 2 -- .../templates/problem/numericalresponse.yaml | 2 -- .../templates/problem/optionresponse.yaml | 2 -- .../templates/problem/string_response.yaml | 2 -- common/lib/xmodule/xmodule/x_module.py | 3 ++- 13 files changed, 20 insertions(+), 31 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 004411e509..f7ffaec320 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -62,23 +62,28 @@ class ComplexEncoder(json.JSONEncoder): class CapaFields(object): attempts = StringyInteger(help="Number of attempts taken by the student on this problem", default=0, scope=Scope.user_state) - max_attempts = StringyInteger(help="Maximum number of attempts that a student is allowed", scope=Scope.settings) + max_attempts = StringyInteger(display_name="Maximum Attempts", + help="When set, this specifies the number of times the student can try to answer this problem.", scope=Scope.settings) due = Date(help="Date that this problem is due by", scope=Scope.settings) graceperiod = Timedelta(help="Amount of time after the due date that submissions will be accepted", scope=Scope.settings) - showanswer = String(help="When to show the problem answer to the student", scope=Scope.settings, default="closed", - values=["answered", "always", "attempted", "closed", "never"]) + showanswer = String(display_name="Show Answer", + help="Specifies when to show the answer to this problem. A default value can be set course-wide in Advanced Settings.", + scope=Scope.settings, default="closed", values=["answered", "always", "attempted", "closed", "never"]) force_save_button = Boolean(help="Whether to force the save button to appear on the page", scope=Scope.settings, default=False) - rerandomize = Randomization(help="When to rerandomize the problem", default="always", scope=Scope.settings, - values=["always", "onreset", "never", "per_student"]) + rerandomize = Randomization(display_name="Randomization", help="Specifies whether variable inputs for this problem are randomized each time a student loads the problem. This only applies to problems that have randomly generated numeric variables. A default value can be set course-wide in Advanced Settings.", + default="always", scope=Scope.settings, values=["always", "onreset", "never", "per_student"]) data = String(help="XML data for the problem", scope=Scope.content) correct_map = Object(help="Dictionary with the correctness of current student answers", scope=Scope.user_state, default={}) input_state = Object(help="Dictionary for maintaining the state of inputtypes", scope=Scope.user_state) student_answers = Object(help="Dictionary with the current student responses", scope=Scope.user_state) done = Boolean(help="Whether the student has answered the problem", scope=Scope.user_state) seed = StringyInteger(help="Random seed for this student", scope=Scope.user_state) - weight = StringyFloat(help="How much to weight this problem by", scope=Scope.settings) + weight = StringyFloat(display_name="Problem Weight", + help="Specifies the number of points the problem is worth. By default, each response field in the problem is worth one point.", + scope=Scope.settings) markdown = String(help="Markdown source of this module", scope=Scope.settings) - source_code = String(help="Source code for LaTeX and Word problems. This feature is not well-supported.", scope=Scope.settings) + source_code = String(help="Source code for LaTeX and Word problems. This feature is not well-supported.", + scope=Scope.settings) class CapaModule(CapaFields, XModule): diff --git a/common/lib/xmodule/xmodule/discussion_module.py b/common/lib/xmodule/xmodule/discussion_module.py index 98082ddea2..62d14e0600 100644 --- a/common/lib/xmodule/xmodule/discussion_module.py +++ b/common/lib/xmodule/xmodule/discussion_module.py @@ -8,8 +8,12 @@ from xblock.core import String, Scope class DiscussionFields(object): discussion_id = String(scope=Scope.settings) - discussion_category = String(scope=Scope.settings) - discussion_target = String(scope=Scope.settings) + discussion_category = String(display_name="Category", + help="Specifies a category name for this discussion. This name appears in the left pane of the discussion forum for your course.", + scope=Scope.settings) + discussion_target = String(display_name="Subcategory", + help="Specifies a subcategory name for this discussion. This name appears in the left pane of the discussion forum for your course.", + scope=Scope.settings) sort_key = String(scope=Scope.settings) diff --git a/common/lib/xmodule/xmodule/templates/html/empty.yaml b/common/lib/xmodule/xmodule/templates/html/empty.yaml index b6d867d7d6..40b005af28 100644 --- a/common/lib/xmodule/xmodule/templates/html/empty.yaml +++ b/common/lib/xmodule/xmodule/templates/html/empty.yaml @@ -1,7 +1,6 @@ --- metadata: display_name: Blank HTML Page - empty: True data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml index a94b824cfb..841bd5afcd 100644 --- a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml @@ -4,8 +4,6 @@ metadata: display_name: Circuit Schematic Builder rerandomize: never showanswer: always - weight: "" - attempts: "" data: | Please make a voltage divider that splits the provided voltage evenly. diff --git a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml index aadbe4075a..6fa1779918 100644 --- a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml @@ -3,8 +3,6 @@ metadata: display_name: Custom Python-Evaluated Input rerandomize: never showanswer: always - weight: "" - attempts: "" data: |

    diff --git a/common/lib/xmodule/xmodule/templates/problem/empty.yaml b/common/lib/xmodule/xmodule/templates/problem/empty.yaml index 39c9e7671c..d372048ee5 100644 --- a/common/lib/xmodule/xmodule/templates/problem/empty.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/empty.yaml @@ -4,9 +4,6 @@ metadata: rerandomize: never showanswer: always markdown: "" - weight: "" - empty: True - attempts: "" data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml b/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml index bba7b3a8ac..902b08e252 100644 --- a/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml @@ -3,9 +3,6 @@ metadata: display_name: Blank Advanced Problem rerandomize: never showanswer: always - weight: "" - attempts: "" - empty: True data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml index b4c53a107b..890260d381 100644 --- a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml @@ -3,8 +3,6 @@ metadata: display_name: Math Expression Input rerandomize: never showanswer: always - weight: "" - attempts: "" data: |

    diff --git a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml index 3ef619d54b..9086dd7426 100644 --- a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml @@ -3,8 +3,6 @@ metadata: display_name: Image Mapped Input rerandomize: never showanswer: always - weight: "" - attempts: "" data: |

    diff --git a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml index 1dc46f5f51..4623e53e00 100644 --- a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml @@ -3,8 +3,6 @@ metadata: display_name: Numerical Input rerandomize: never showanswer: always - weight: "" - attempts: "" markdown: "A numerical input problem accepts a line of text input from the student, and evaluates the input for correctness based on its diff --git a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml index f523c7fdc5..a87885594a 100644 --- a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml @@ -3,8 +3,6 @@ metadata: display_name: Dropdown rerandomize: never showanswer: always - weight: "" - attempts: "" markdown: "Dropdown problems give a limited set of options for students to respond with, and present those options in a format that encourages them to search for a specific answer rather than being immediately presented diff --git a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml index c018d3f6cf..9519c192ac 100644 --- a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml @@ -3,8 +3,6 @@ metadata: display_name: Text Input rerandomize: never showanswer: always - weight: "" - attempts: "" # Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding markdown: "A text input problem accepts a line of text from the diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index f3b249adff..7e2944e1fd 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -80,7 +80,8 @@ class HTMLSnippet(object): class XModuleFields(object): display_name = String( - help="Display name for this module", + display_name="Display Name", + help="Specifies the name for this component. The name appears as a tooltip in the course ribbon at the top of the page.", scope=Scope.settings, default=None ) From 8c36918abfe6f9a4d077af8c4f0c806034555efe Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 13 May 2013 15:35:55 -0400 Subject: [PATCH 033/117] Support display names for choices. --- .../metadata_option_entry.html | 6 ++- cms/static/js/models/metadata_model.js | 12 ++++- cms/static/js/views/metadata_editor_view.js | 46 +++++++++++++++---- common/lib/xmodule/xmodule/capa_module.py | 12 ++++- common/lib/xmodule/xmodule/x_module.py | 11 ++++- 5 files changed, 72 insertions(+), 15 deletions(-) diff --git a/cms/static/client_templates/metadata_option_entry.html b/cms/static/client_templates/metadata_option_entry.html index 3a1cd30337..b0c8d83ba9 100644 --- a/cms/static/client_templates/metadata_option_entry.html +++ b/cms/static/client_templates/metadata_option_entry.html @@ -2,7 +2,11 @@ +

    +<%= model.get('help') %> diff --git a/cms/static/client_templates/metadata_option_entry.html b/cms/static/client_templates/metadata_option_entry.html index b0c8d83ba9..d2053e497a 100644 --- a/cms/static/client_templates/metadata_option_entry.html +++ b/cms/static/client_templates/metadata_option_entry.html @@ -10,7 +10,7 @@ <% }) %>
    <%= model.get('help') %> diff --git a/cms/static/client_templates/metadata_string_entry.html b/cms/static/client_templates/metadata_string_entry.html index 647e48400a..74d64d58af 100644 --- a/cms/static/client_templates/metadata_string_entry.html +++ b/cms/static/client_templates/metadata_string_entry.html @@ -2,7 +2,7 @@
    <%= model.get('help') %> diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index b2d89c095b..d5fb7cbfbd 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -461,7 +461,7 @@ body.course.unit { .module-actions { @include box-shadow(inset 0 1px 1px $shadow); padding: 0px 0 10px 10px; - background-color: $gray-l4; + background-color: $gray-l6; .save-button { margin: 15px 8px 0 0; @@ -533,9 +533,7 @@ body.course.unit { } // Editor Wrapper -.wrapper-comp-editor { - //TO-DO -} +.wrapper-comp-editor { } // Settings Wrapper .wrapper-comp-settings { @@ -585,7 +583,6 @@ body.course.unit { } &:hover { - //TO-DO review existing patterns for hover on field @include transition(opacity 0.25s ease-in-out); opacity: 1; } @@ -595,9 +592,7 @@ body.course.unit { background-color: $white; //setting-label - .setting-label { - //color: $blue-l1; - } + .setting-label { } //setting-input .setting-input { @@ -605,9 +600,7 @@ body.course.unit { } //setting-clear - .setting-clear { - //... - } + .setting-clear { } } .wrapper-comp-setting{ @@ -620,9 +613,7 @@ body.course.unit { label.setting-label { @extend .t-copy-sub1; @include transition(color, 0.15s, ease-in-out); - //margin: 0 0 ($baseline/4) 0; WILL BE REMOVED PRIOR TO PUSH font-weight: 400; - display: inline-block; position: relative; left: 0; @@ -663,9 +654,8 @@ body.course.unit { } select { - //border: 1px solid $gray-l2; - background: none repeat scroll #F2F2F2; @include box-shadow(0 1px 2px rgba(0, 0, 0, .1) inset); + background: none repeat scroll #F2F2F2; &:focus { @include box-shadow(0 0 1px $shadow); @@ -682,6 +672,7 @@ body.course.unit { .action.setting-clear { @include font-size(11); + background-color: $gray-l4; color: $gray; width: 25px; height: 25px; @@ -695,7 +686,7 @@ body.course.unit { &:hover { @include box-shadow(0 1px 1px $shadow); - @include transition(opacity 0.25s ease-in-out); + @include transition(opacity 0.15s ease-in-out); background-color: $blue-s3; border: 1px solid $blue-s3; color: $white; @@ -706,11 +697,13 @@ body.course.unit { } } - tip.setting-help { + .tip.setting-help { @include font-size(12); + margin-top: 5px; display: inline-block; font-color: $gray-l6; - //max-width: 50%; + min-width: 280px; + width: 50%; vertical-align: top; } } @@ -942,15 +935,4 @@ body.unit { .view-button { display: none; } -} - - -//OLD Meta-data Styling -//TO-DO port over old styling -.metadata_edit { - - label { - display: inline-block; - margin-right: 10px; - } } \ No newline at end of file diff --git a/cms/templates/component.html b/cms/templates/component.html index 5883bd55d5..012618ec8c 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -2,16 +2,15 @@
    Editing: Name of Component -
    diff --git a/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css b/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css index c973248384..77afc23874 100644 --- a/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css +++ b/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css @@ -25,7 +25,7 @@ /* Layout */ .studioSkin table.mceLayout {border:0;} -.studioSkin table.mceLayout tr.mceFirst td {border-top: 1px solid #D1DCE6;} +.studioSkin table.mceLayout tr.mceFirst td {border-top: 1px solid #D1DCE6; border-left: none; border-right:none;} .studioSkin table.mceLayout tr.mceLast td {border-bottom:none;} .studioSkin table.mceToolbar, .studioSkin tr.mceFirst .mceToolbar tr td, .studioSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;} .studioSkin td.mceToolbar { From 8d8c8d83df59412b59744382eebdbb2703bc9f01 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 14 May 2013 12:38:52 -0400 Subject: [PATCH 037/117] updated unit styling, added polyfill js library, updated javascript handling for modes swap --- .../coffee/src/views/module_edit.coffee | 12 +- cms/static/sass/views/_unit.scss | 24 +- cms/templates/base.html | 1 + cms/templates/component.html | 14 +- .../html5-input-polyfills/number-polyfill.js | 299 ++++++++++++++++++ 5 files changed, 328 insertions(+), 22 deletions(-) create mode 100644 common/static/js/vendor/html5-input-polyfills/number-polyfill.js diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index a6f93197f3..10e07081cb 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -7,7 +7,7 @@ class CMS.Views.ModuleEdit extends Backbone.View "click .component-editor .save-button": 'clickSaveButton' "click .component-actions .edit-button": 'clickEditButton' "click .component-actions .delete-button": 'onDelete' - "click .mode .not-set": 'clickModeButton' + "click .not-set ": 'clickModeButton' initialize: -> @onDelete = @options.onDelete @@ -86,5 +86,11 @@ class CMS.Views.ModuleEdit extends Backbone.View clickModeButton: (event) -> event.preventDefault() - @$el.find("a").removeClass('not-set') - @$el.find("a").addClass('is-set') + @$el.find("a").removeClass('not-set').addClass('is-set') + + previouslySetMode = @$el.siblings('li.active-mode').find('.is-set') + previouslySetMode.find("a").removeClass('is-set').addClass('not-set') + + activeTab = $component_editor.find('.xmodule_edit').find(".is-set") + activeTab.removeClass('is-set') + activeTab.siblings('.not-set').addClass('is-set') diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index d5fb7cbfbd..37db76568a 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -508,24 +508,24 @@ body.course.unit { .mode { display: inline-block; - .inactive-mode { + &.inactive-mode{ display: none; } - .active-mode { + &.active-mode a { + @include blue-button; - } - .is-set { - @include linear-gradient($blue, $blue); - box-shadow: inset 0 0 3px $shadow; - background-color: $blue; - - cursor: default; - - &:hover { + &.is-set { + @include linear-gradient($blue, $blue); box-shadow: inset 0 0 3px $shadow; background-color: $blue; + cursor: default; + + &:hover { + box-shadow: inset 0 0 3px $shadow; + background-color: $blue; + } } } } @@ -654,7 +654,7 @@ body.course.unit { } select { - @include box-shadow(0 1px 2px rgba(0, 0, 0, .1) inset); + @include box-shadow(0 1px 2px $shadow-l1 inset); background: none repeat scroll #F2F2F2; &:focus { diff --git a/cms/templates/base.html b/cms/templates/base.html index 88bbc56677..521bb8b1ff 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -49,6 +49,7 @@ + diff --git a/cms/templates/component.html b/cms/templates/component.html index 012618ec8c..ef0b62f4a4 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,16 +1,16 @@
    - Editing: Name of Component + Editing: Component
    diff --git a/common/static/js/vendor/html5-input-polyfills/number-polyfill.js b/common/static/js/vendor/html5-input-polyfills/number-polyfill.js new file mode 100644 index 0000000000..080ae27be6 --- /dev/null +++ b/common/static/js/vendor/html5-input-polyfills/number-polyfill.js @@ -0,0 +1,299 @@ +// Generated by CoffeeScript 1.4.0 + +/* +HTML5 Number polyfill | Jonathan Stipe | https://github.com/jonstipe/number-polyfill +*/ + + +(function() { + + (function($) { + var i; + i = document.createElement("input"); + i.setAttribute("type", "number"); + if (i.type === "text") { + $.fn.inputNumber = function() { + var clipValues, decrement, domMouseScrollHandler, extractNumDecimalDigits, getParams, increment, matchStep, mouseWheelHandler; + getParams = function(elem) { + var $elem, max, min, step, val; + $elem = $(elem); + step = $elem.attr('step'); + min = $elem.attr('min'); + max = $elem.attr('max'); + val = parseFloat($elem.val()); + step = /^-?\d+(?:\.\d+)?$/.test(step) ? parseFloat(step) : null; + min = /^-?\d+(?:\.\d+)?$/.test(min) ? parseFloat(min) : null; + max = /^-?\d+(?:\.\d+)?$/.test(max) ? parseFloat(max) : null; + if (isNaN(val)) { + val = min || 0; + } + return { + min: min, + max: max, + step: step, + val: val + }; + }; + clipValues = function(value, min, max) { + if ((max != null) && value > max) { + return max; + } else if ((min != null) && value < min) { + return min; + } else { + return value; + } + }; + extractNumDecimalDigits = function(input) { + var num, raisedNum; + if (input != null) { + num = 0; + raisedNum = input; + while (raisedNum !== Math.round(raisedNum)) { + num += 1; + raisedNum = input * Math.pow(10, num); + } + return num; + } else { + return 0; + } + }; + matchStep = function(value, min, max, step) { + var mod, raiseTo, raisedMod, raisedStep, raisedStepDown, raisedStepUp, raisedValue, stepDecimalDigits, stepDown, stepUp; + stepDecimalDigits = extractNumDecimalDigits(step); + if (step == null) { + return value; + } else if (stepDecimalDigits === 0) { + mod = (value - (min || 0)) % step; + if (mod === 0) { + return value; + } else { + stepDown = value - mod; + stepUp = stepDown + step; + if ((stepUp > max) || ((value - stepDown) < (stepUp - value))) { + return stepDown; + } else { + return stepUp; + } + } + } else { + raiseTo = Math.pow(10, stepDecimalDigits); + raisedStep = step * raiseTo; + raisedMod = (value - (min || 0)) * raiseTo % raisedStep; + if (raisedMod === 0) { + return value; + } else { + raisedValue = value * raiseTo; + raisedStepDown = raisedValue - raisedMod; + raisedStepUp = raisedStepDown + raisedStep; + if (((raisedStepUp / raiseTo) > max) || ((raisedValue - raisedStepDown) < (raisedStepUp - raisedValue))) { + return raisedStepDown / raiseTo; + } else { + return raisedStepUp / raiseTo; + } + } + } + }; + increment = function(elem) { + var newVal, params, raiseTo; + if (!$(elem).is(":disabled")) { + params = getParams(elem); + raiseTo = Math.pow(10, Math.max(extractNumDecimalDigits(params['val']), extractNumDecimalDigits(params['step']))); + newVal = (Math.round(params['val'] * raiseTo) + Math.round((params['step'] || 1) * raiseTo)) / raiseTo; + if ((params['max'] != null) && newVal > params['max']) { + newVal = params['max']; + } + newVal = matchStep(newVal, params['min'], params['max'], params['step']); + $(elem).val(newVal).change(); + } + return null; + }; + decrement = function(elem) { + var newVal, params, raiseTo; + if (!$(elem).is(":disabled")) { + params = getParams(elem); + raiseTo = Math.pow(10, Math.max(extractNumDecimalDigits(params['val']), extractNumDecimalDigits(params['step']))); + newVal = (Math.round(params['val'] * raiseTo) - Math.round((params['step'] || 1) * raiseTo)) / raiseTo; + if ((params['min'] != null) && newVal < params['min']) { + newVal = params['min']; + } + newVal = matchStep(newVal, params['min'], params['max'], params['step']); + $(elem).val(newVal).change(); + } + return null; + }; + domMouseScrollHandler = function(e) { + e.preventDefault(); + if (e.originalEvent.detail < 0) { + increment(this); + } else { + decrement(this); + } + return null; + }; + mouseWheelHandler = function(e) { + e.preventDefault(); + if (e.originalEvent.wheelDelta > 0) { + increment(this); + } else { + decrement(this); + } + return null; + }; + $(this).filter('input[type="number"]').each(function() { + var $downBtn, $elem, $upBtn, attrMutationCallback, attrObserver, btnContainer, downBtn, elem, halfHeight, upBtn; + elem = this; + $elem = $(elem); + halfHeight = ($elem.outerHeight() / 2) + 'px'; + upBtn = document.createElement('div'); + downBtn = document.createElement('div'); + $upBtn = $(upBtn); + $downBtn = $(downBtn); + btnContainer = document.createElement('div'); + $upBtn.addClass('number-spin-btn number-spin-btn-up').css('height', halfHeight); + $downBtn.addClass('number-spin-btn number-spin-btn-down').css('height', halfHeight); + btnContainer.appendChild(upBtn); + btnContainer.appendChild(downBtn); + $(btnContainer).addClass('number-spin-btn-container').insertAfter(elem); + $elem.on({ + focus: function(e) { + $elem.on({ + DOMMouseScroll: domMouseScrollHandler, + mousewheel: mouseWheelHandler + }); + return null; + }, + blur: function(e) { + $elem.off({ + DOMMouseScroll: domMouseScrollHandler, + mousewheel: mouseWheelHandler + }); + return null; + }, + keypress: function(e) { + var _ref, _ref1; + if (e.keyCode === 38) { + increment(this); + } else if (e.keyCode === 40) { + decrement(this); + } else if (((_ref = e.keyCode) !== 8 && _ref !== 9 && _ref !== 35 && _ref !== 36 && _ref !== 37 && _ref !== 39) && ((_ref1 = e.which) !== 45 && _ref1 !== 46 && _ref1 !== 48 && _ref1 !== 49 && _ref1 !== 50 && _ref1 !== 51 && _ref1 !== 52 && _ref1 !== 53 && _ref1 !== 54 && _ref1 !== 55 && _ref1 !== 56 && _ref1 !== 57)) { + e.preventDefault(); + } + return null; + }, + change: function(e) { + var newVal, params; + if (e.originalEvent != null) { + params = getParams(this); + newVal = clipValues(params['val'], params['min'], params['max']); + newVal = matchStep(newVal, params['min'], params['max'], params['step'], params['stepDecimal']); + $(this).val(newVal); + } + return null; + } + }); + $upBtn.on("mousedown", function(e) { + var releaseFunc, timeoutFunc; + increment(elem); + timeoutFunc = function(elem, incFunc) { + incFunc(elem); + $elem.data("timeoutID", window.setTimeout(timeoutFunc, 10, elem, incFunc)); + return null; + }; + releaseFunc = function(e) { + window.clearTimeout($elem.data("timeoutID")); + $(document).off('mouseup', releaseFunc); + $upBtn.off('mouseleave', releaseFunc); + return null; + }; + $(document).on('mouseup', releaseFunc); + $upBtn.on('mouseleave', releaseFunc); + $elem.data("timeoutID", window.setTimeout(timeoutFunc, 700, elem, increment)); + return null; + }); + $downBtn.on("mousedown", function(e) { + var releaseFunc, timeoutFunc; + decrement(elem); + timeoutFunc = function(elem, decFunc) { + decFunc(elem); + $elem.data("timeoutID", window.setTimeout(timeoutFunc, 10, elem, decFunc)); + return null; + }; + releaseFunc = function(e) { + window.clearTimeout($elem.data("timeoutID")); + $(document).off('mouseup', releaseFunc); + $downBtn.off('mouseleave', releaseFunc); + return null; + }; + $(document).on('mouseup', releaseFunc); + $downBtn.on('mouseleave', releaseFunc); + $elem.data("timeoutID", window.setTimeout(timeoutFunc, 700, elem, decrement)); + return null; + }); + $elem.css("textAlign", 'right'); + if ($elem.css("opacity") !== "1") { + $(btnContainer).css("opacity", $elem.css("opacity")); + } + if ($elem.css("visibility") !== "visible") { + $(btnContainer).css("visibility", $elem.css("visibility")); + } + if (elem.style.display !== "") { + $(btnContainer).css("display", $elem.css("display")); + } + if ((typeof WebKitMutationObserver !== "undefined" && WebKitMutationObserver !== null) || (typeof MutationObserver !== "undefined" && MutationObserver !== null)) { + attrMutationCallback = function(mutations, observer) { + var mutation, _i, _len; + for (_i = 0, _len = mutations.length; _i < _len; _i++) { + mutation = mutations[_i]; + if (mutation.type === "attributes") { + if (mutation.attributeName === "class") { + $(btnContainer).removeClass(mutation.oldValue).addClass(elem.className); + } else if (mutation.attributeName === "style") { + $(btnContainer).css({ + "opacity": elem.style.opacity, + "visibility": elem.style.visibility, + "display": elem.style.display + }); + } + } + } + return null; + }; + attrObserver = (typeof WebKitMutationObserver !== "undefined" && WebKitMutationObserver !== null) ? new WebKitMutationObserver(attrMutationCallback) : ((typeof MutationObserver !== "undefined" && MutationObserver !== null) ? new MutationObserver(attrMutationCallback) : null); + attrObserver.observe(elem, { + attributes: true, + attributeOldValue: true, + attributeFilter: ["class", "style"] + }); + } else if (typeof MutationEvent !== "undefined" && MutationEvent !== null) { + $elem.on("DOMAttrModified", function(evt) { + if (evt.originalEvent.attrName === "class") { + $(btnContainer).removeClass(evt.originalEvent.prevValue).addClass(evt.originalEvent.newValue); + } else if (evt.originalEvent.attrName === "style") { + $(btnContainer).css({ + "display": elem.style.display, + "visibility": elem.style.visibility, + "opacity": elem.style.opacity + }); + } + return null; + }); + } + return null; + }); + return $(this); + }; + $(function() { + $('input[type="number"]').inputNumber(); + return null; + }); + null; + } else { + $.fn.inputNumber = function() { + return $(this); + }; + null; + } + return null; + })(jQuery); + +}).call(this); From 82899d6d2eb5f48d81fccd464ebd3b8433f8f010 Mon Sep 17 00:00:00 2001 From: cahrens Date: Tue, 14 May 2013 12:40:17 -0400 Subject: [PATCH 038/117] Number view. --- .../metadata_number_entry.html | 2 +- cms/static/js/views/metadata_editor_view.js | 30 ++++++++++++++--- common/lib/xmodule/xmodule/capa_module.py | 6 ++-- .../xmodule/combined_open_ended_module.py | 3 +- common/lib/xmodule/xmodule/x_module.py | 32 +++++++++++++------ 5 files changed, 55 insertions(+), 18 deletions(-) diff --git a/cms/static/client_templates/metadata_number_entry.html b/cms/static/client_templates/metadata_number_entry.html index 5ccea65d5d..040488cb39 100644 --- a/cms/static/client_templates/metadata_number_entry.html +++ b/cms/static/client_templates/metadata_number_entry.html @@ -1,6 +1,6 @@
    - + diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index a051255dd2..9a1c324732 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -30,15 +30,15 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({ el: self.$el.find('.metadata_entry')[counter++], model: new CMS.Models.Metadata(item) }; - if (item.options.length > 0) { - // Right now, all our option types only hold strings. Should really support - // any type though. + if (item.type === 'Select') { self.views.push(new CMS.Views.Metadata.Option(data)); } + else if (item.type === 'Integer' || item.type === 'Float') { + self.views.push(new CMS.Views.Metadata.Number(data)); + } else { self.views.push(new CMS.Views.Metadata.String(data)); } - }); } ); @@ -151,6 +151,28 @@ CMS.Views.Metadata.String = CMS.Views.Metadata.AbstractEditor.extend({ } }); +CMS.Views.Metadata.Number = CMS.Views.Metadata.AbstractEditor.extend({ + + events : { + "change input" : "updateModel", + "keypress .setting-input" : "showClearButton" , + "click .setting-clear" : "clear" + }, + + getTemplateName : function () { + return "metadata_number_entry"; + }, + + getValueFromEditor : function () { + return this.$el.find('#' + this.uniqueId).val(); + }, + + setValueInEditor : function (value) { + this.$el.find('input').val(value); + } +}); + + CMS.Views.Metadata.Option = CMS.Views.Metadata.AbstractEditor.extend({ events : { diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 91deb45a46..b33cf5fb8c 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -63,7 +63,8 @@ class ComplexEncoder(json.JSONEncoder): class CapaFields(object): attempts = StringyInteger(help="Number of attempts taken by the student on this problem", default=0, scope=Scope.user_state) max_attempts = StringyInteger(display_name="Maximum Attempts", - help="When set, this specifies the number of times the student can try to answer this problem.", scope=Scope.settings) + help="This specifies the number of times the student can try to answer this problem. If unset, infinite attempts are allowed.", + values = {"min" : 1 }, scope=Scope.settings) due = Date(help="Date that this problem is due by", scope=Scope.settings) graceperiod = Timedelta(help="Amount of time after the due date that submissions will be accepted", scope=Scope.settings) showanswer = String(display_name="Show Answer", @@ -87,7 +88,8 @@ class CapaFields(object): done = Boolean(help="Whether the student has answered the problem", scope=Scope.user_state) seed = StringyInteger(help="Random seed for this student", scope=Scope.user_state) weight = StringyFloat(display_name="Problem Weight", - help="Specifies the number of points the problem is worth. By default, each response field in the problem is worth one point.", + help="Specifies the number of points the problem is worth. If unset, each response field in the problem is worth one point.", + values = {"min" : 0 }, scope=Scope.settings) markdown = String(help="Markdown source of this module", scope=Scope.settings) source_code = String(help="Source code for LaTeX and Word problems. This feature is not well-supported.", diff --git a/common/lib/xmodule/xmodule/combined_open_ended_module.py b/common/lib/xmodule/xmodule/combined_open_ended_module.py index 1e965e6c6b..b170fa9a7d 100644 --- a/common/lib/xmodule/xmodule/combined_open_ended_module.py +++ b/common/lib/xmodule/xmodule/combined_open_ended_module.py @@ -57,7 +57,8 @@ class CombinedOpenEndedFields(object): ready_to_reset = Boolean(help="If the problem is ready to be reset or not.", default=False, scope=Scope.user_state) attempts = Integer(display_name="Maximum Attempts", - help="Specifies the number of times the student can try to answer this problem.", default=1, scope=Scope.settings) + help="Specifies the number of times the student can try to answer this problem.", default=1, + scope=Scope.settings) # TODO: move values to Boolean in xblock. is_graded = Boolean(display_name="Graded", help="Whether or not the problem is graded.", default=False, scope=Scope.settings, values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}]) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 3b094e04a5..5c22106f75 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -9,7 +9,7 @@ from pkg_resources import resource_listdir, resource_string, resource_isdir from xmodule.modulestore import Location from xmodule.modulestore.exceptions import ItemNotFoundError -from xblock.core import XBlock, Scope, String +from xblock.core import XBlock, Scope, String, Integer, Float log = logging.getLogger(__name__) @@ -649,17 +649,29 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock): 'inheritable': inheritable, 'explicitly_set': explicitly_set} + # We support the following editors: + # 1. A select editor for fields with a list of possible values (includes Booleans). + # 2. Number editor for integers and floats. + # 3. A generic string editor for anything else (editing JSON representation of the value). + type = "Generic" + # TODO: test all this logic values = [] if field.values is None else field.values - for index, choice in enumerate(values): - json_choice = choice - # TODO: test this logic. - if hasattr(json_choice, 'value'): - json_choice['value'] = field.to_json(json_choice['value']) - else: - json_choice = field.to_json(json_choice) - values[index] = json_choice - + if isinstance(values, list): + if len(values) > 0: + type = "Select" + for index, choice in enumerate(values): + json_choice = choice + if hasattr(json_choice, 'value'): + json_choice['value'] = field.to_json(json_choice['value']) + else: + json_choice = field.to_json(json_choice) + values[index] = json_choice + elif isinstance(field, Integer): + type = "Integer" + elif isinstance(field, Float): + type = "Float" simple_metadata[field.name] = {'field_name' : field.name, + 'type' : type, 'display_name' : field.display_name, 'value': field.to_json(value), 'options' : values, From 17750a7d6d60d59d8600cf83ffc4b747e810e2f2 Mon Sep 17 00:00:00 2001 From: cahrens Date: Tue, 14 May 2013 14:20:10 -0400 Subject: [PATCH 039/117] Use min, max, and step values from server. --- .../metadata_number_entry.html | 2 +- cms/static/js/models/metadata_model.js | 7 ++++- cms/static/js/views/metadata_editor_view.js | 27 +++++++++++++++++++ common/lib/xmodule/xmodule/capa_module.py | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/cms/static/client_templates/metadata_number_entry.html b/cms/static/client_templates/metadata_number_entry.html index 040488cb39..981db06bd4 100644 --- a/cms/static/client_templates/metadata_number_entry.html +++ b/cms/static/client_templates/metadata_number_entry.html @@ -1,6 +1,6 @@
    - + diff --git a/cms/static/js/models/metadata_model.js b/cms/static/js/models/metadata_model.js index d2e3e52f66..90476431d4 100644 --- a/cms/static/js/models/metadata_model.js +++ b/cms/static/js/models/metadata_model.js @@ -8,7 +8,8 @@ CMS.Models.Metadata = Backbone.Model.extend({ "value" : null, "explicitly_set": null, "default_value" : null, - "options" : null + "options" : null, + "type" : null }, initialize: function() { @@ -55,6 +56,10 @@ CMS.Models.Metadata = Backbone.Model.extend({ return this.get('options'); }, + getType: function() { + return this.get('type'); + }, + clear: function() { this.set('explicitly_set', false); this.set('value', this.get('default_value')); diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index 9a1c324732..b4378bbbc7 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -159,6 +159,33 @@ CMS.Views.Metadata.Number = CMS.Views.Metadata.AbstractEditor.extend({ "click .setting-clear" : "clear" }, + render: function () { + CMS.Views.Metadata.AbstractEditor.prototype.render.apply(this); + if (!this.inputAttributesSet) { + var min = "min"; + var max = "max"; + var step = "step"; + var options = this.model.getOptions(); + if (options.hasOwnProperty(min)) { + this.$el.find('input').attr(min, options[min].toString()); + } + if (options.hasOwnProperty(max)) { + this.$el.find('input').attr(max, options[max].toString()); + } + var stepValue = undefined; + if (options.hasOwnProperty(step)) { + stepValue = options[step].toString(); + } + else if (this.model.getType() === 'Integer') { + stepValue = "1"; + } + if (stepValue !== undefined) { + this.$el.find('input').attr(step, stepValue); + } + this.inputAttributesSet = true; + } + }, + getTemplateName : function () { return "metadata_number_entry"; }, diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index b33cf5fb8c..3433e6c88b 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -89,7 +89,7 @@ class CapaFields(object): seed = StringyInteger(help="Random seed for this student", scope=Scope.user_state) weight = StringyFloat(display_name="Problem Weight", help="Specifies the number of points the problem is worth. If unset, each response field in the problem is worth one point.", - values = {"min" : 0 }, + values = {"min" : 0 , "step": ".1"}, scope=Scope.settings) markdown = String(help="Markdown source of this module", scope=Scope.settings) source_code = String(help="Source code for LaTeX and Word problems. This feature is not well-supported.", From 064d21c4e28e8832fa56131d91f4a5330b6ced86 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 14 May 2013 15:05:22 -0400 Subject: [PATCH 040/117] clean up of editor header styling --- cms/static/sass/views/_unit.scss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 37db76568a..655be20efc 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -480,10 +480,8 @@ body.course.unit { padding: 15px 0 15px 20px; top: 0; right: 0; - border-bottom: 1px solid $gray-l2; background-color: $blue; color: $white; - box-shadow: 0 1px 2px rgba(182, 182, 182, 0.75) inset; //Component Name .component-name { @@ -518,12 +516,13 @@ body.course.unit { &.is-set { @include linear-gradient($blue, $blue); - box-shadow: inset 0 0 3px $shadow; + color: $blue-d1; + box-shadow: inset 0 3px 3px $shadow-d1; background-color: $blue; cursor: default; &:hover { - box-shadow: inset 0 0 3px $shadow; + box-shadow: inset 0 3px 3px $shadow-d1; background-color: $blue; } } @@ -614,6 +613,7 @@ body.course.unit { @extend .t-copy-sub1; @include transition(color, 0.15s, ease-in-out); font-weight: 400; + vertical-align: middle; display: inline-block; position: relative; left: 0; @@ -702,7 +702,7 @@ body.course.unit { margin-top: 5px; display: inline-block; font-color: $gray-l6; - min-width: 280px; + min-width: 260px; width: 50%; vertical-align: top; } From 81e95f27db01bb6677365d49f9f18b59dd26258d Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 14 May 2013 22:31:11 -0400 Subject: [PATCH 041/117] basic tab switching added --- .../coffee/src/views/module_edit.coffee | 26 +++++++++++++------ cms/static/sass/views/_unit.scss | 15 +++++++++-- cms/templates/component.html | 9 +++---- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 10e07081cb..5f935519d5 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -7,7 +7,7 @@ class CMS.Views.ModuleEdit extends Backbone.View "click .component-editor .save-button": 'clickSaveButton' "click .component-actions .edit-button": 'clickEditButton' "click .component-actions .delete-button": 'onDelete' - "click .not-set ": 'clickModeButton' + "click .mode a": 'clickModeButton' initialize: -> @onDelete = @options.onDelete @@ -28,6 +28,8 @@ class CMS.Views.ModuleEdit extends Backbone.View model: new CMS.Models.MetadataEditor(metadataEditor.data('metadata')) }); + ----> find id of the li that wraps the is-set A thinger, that thing's name, get the first word set to VAR, and then add is-active to the div whose class equals wrapper-comp-VAR + changedMetadata: -> return @metadataEditor.getModifiedMetadataValues() @@ -86,11 +88,19 @@ class CMS.Views.ModuleEdit extends Backbone.View clickModeButton: (event) -> event.preventDefault() - @$el.find("a").removeClass('not-set').addClass('is-set') + if $(this).hasClass(".is-set") + alert("Hey Sucka") + else + previousTab = @$el.find('li.active-mode .is-set') + previousTab.parent().siblings().find("a").addClass('is-set').attr({ + aria-selected: 'true', + tab-index: '1' + }) + previousTab.removeClass('is-set').attr({ + aria-selected: 'false', + tab-index: '0' + }) - previouslySetMode = @$el.siblings('li.active-mode').find('.is-set') - previouslySetMode.find("a").removeClass('is-set').addClass('not-set') - - activeTab = $component_editor.find('.xmodule_edit').find(".is-set") - activeTab.removeClass('is-set') - activeTab.siblings('.not-set').addClass('is-set') + previousTabContent = @$el.find('div.is-active') + previousTabContent.siblings().addClass('is-active') + previousTabContent.removeClass('is-active') diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 655be20efc..86758c5c68 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -532,10 +532,21 @@ body.course.unit { } // Editor Wrapper -.wrapper-comp-editor { } +.wrapper-comp-editor { + display: none; + + &.is-active { + display: block; + } + } // Settings Wrapper .wrapper-comp-settings { + display: none; + + &.is-active { + display: block; + } //settings-list .list-input.settings-list { @@ -625,7 +636,7 @@ body.course.unit { } } - input, select { + input, select, input[type="number"] { @include placeholder($gray-l4); @include font-size(16); @include size(100%,100%); diff --git a/cms/templates/component.html b/cms/templates/component.html index ef0b62f4a4..3aa8c322df 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -3,13 +3,10 @@
    Editing: Component From 98e692d15e31438ba3387ecc32052cb2c1b8a321 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 14 May 2013 23:03:33 -0400 Subject: [PATCH 042/117] fixed broken coffee script caused by errant pseudo code I checked in --- cms/static/coffee/src/views/module_edit.coffee | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 5f935519d5..d5b6ef1b52 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -28,8 +28,6 @@ class CMS.Views.ModuleEdit extends Backbone.View model: new CMS.Models.MetadataEditor(metadataEditor.data('metadata')) }); - ----> find id of the li that wraps the is-set A thinger, that thing's name, get the first word set to VAR, and then add is-active to the div whose class equals wrapper-comp-VAR - changedMetadata: -> return @metadataEditor.getModifiedMetadataValues() @@ -89,17 +87,11 @@ class CMS.Views.ModuleEdit extends Backbone.View clickModeButton: (event) -> event.preventDefault() if $(this).hasClass(".is-set") - alert("Hey Sucka") + alert("Hi There") else previousTab = @$el.find('li.active-mode .is-set') - previousTab.parent().siblings().find("a").addClass('is-set').attr({ - aria-selected: 'true', - tab-index: '1' - }) - previousTab.removeClass('is-set').attr({ - aria-selected: 'false', - tab-index: '0' - }) + previousTab.parent().siblings().find("a").addClass('is-set') + previousTab.removeClass('is-set') previousTabContent = @$el.find('div.is-active') previousTabContent.siblings().addClass('is-active') From 47a4d6b6a1e4bc4b837552db9657e201f6cd626e Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 14 May 2013 23:55:34 -0400 Subject: [PATCH 043/117] initial polyfill implementation and metadata number entry javascript validation --- .../metadata_number_entry.html | 2 +- cms/static/js/base.js | 14 ++++ cms/static/sass/views/_unit.scss | 8 +- cms/templates/base.html | 4 +- .../html5-input-polyfills/number-polyfill.css | 80 +++++++++++++++++++ 5 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 common/static/css/vendor/html5-input-polyfills/number-polyfill.css diff --git a/cms/static/client_templates/metadata_number_entry.html b/cms/static/client_templates/metadata_number_entry.html index 981db06bd4..f60e47160f 100644 --- a/cms/static/client_templates/metadata_number_entry.html +++ b/cms/static/client_templates/metadata_number_entry.html @@ -1,6 +1,6 @@
    - + diff --git a/cms/static/js/base.js b/cms/static/js/base.js index c8371fcf64..a986f2ac00 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -896,3 +896,17 @@ function saveSetSectionScheduleDate(e) { hideModal(); }); } + +function checkNumberSettingValidity(e) { + e.preventDefault(); + + if (!e.checkNumberSettingValidity()) + { + alert("You have invalid input. Correct it!"); + obj.focus(); + + $('this').val(''); + } +} + + diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 86758c5c68..09a4a37abe 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -517,12 +517,12 @@ body.course.unit { &.is-set { @include linear-gradient($blue, $blue); color: $blue-d1; - box-shadow: inset 0 3px 3px $shadow-d1; + box-shadow: inset 0 2px 2px $shadow-d1; background-color: $blue; cursor: default; &:hover { - box-shadow: inset 0 3px 3px $shadow-d1; + box-shadow: inset 0 2px 2px $shadow-d1; background-color: $blue; } } @@ -664,6 +664,10 @@ body.course.unit { text-overflow: ellipsis; } + input[type="number"] { + width: 39%; + } + select { @include box-shadow(0 1px 2px $shadow-l1 inset); background: none repeat scroll #F2F2F2; diff --git a/cms/templates/base.html b/cms/templates/base.html index 521bb8b1ff..83627ba3e6 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -22,6 +22,7 @@ + <%include file="widgets/segment-io.html" /> @@ -38,6 +39,8 @@ + + <%static:js group='main'/> <%static:js group='module-js'/> @@ -49,7 +52,6 @@ - diff --git a/common/static/css/vendor/html5-input-polyfills/number-polyfill.css b/common/static/css/vendor/html5-input-polyfills/number-polyfill.css new file mode 100644 index 0000000000..ceaa34a8e9 --- /dev/null +++ b/common/static/css/vendor/html5-input-polyfills/number-polyfill.css @@ -0,0 +1,80 @@ +/* HTML5 Number polyfill | Jonathan Stipe | https://github.com/jonstipe/number-polyfill*/ +div.number-spin-btn-container { + display: inline-block; + position: relative; + vertical-align: bottom; + margin: 0; + padding: 0; } + +div.number-spin-btn { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + border-width: 2px; + border-color: #ededed #777777 #777777 #ededed; + border-style: solid; + background-color: #cccccc; + width: 1.2em; } + div.number-spin-btn:hover { + cursor: pointer; } + div.number-spin-btn:active { + border-width: 2px; + border-color: #5e5e5e #d8d8d8 #d8d8d8 #5e5e5e; + border-style: solid; + background-color: #999999; } + +div.number-spin-btn-up { + border-bottom-width: 1px; + -moz-border-radius: 3px 3px 0px 0px; + -webkit-border-radius: 3px 3px 0px 0px; + border-radius: 3px 3px 0px 0px; } + div.number-spin-btn-up:before { + border-width: 0 0.3em 0.3em 0.3em; + border-color: transparent transparent black transparent; + top: 25%; } + div.number-spin-btn-up:active { + border-bottom-width: 1px; } + div.number-spin-btn-up:active:before { + border-bottom-color: white; + top: 26%; + left: 51%; } + +div.number-spin-btn-down { + border-top-width: 1px; + -moz-border-radius: 0px 0px 3px 3px; + -webkit-border-radius: 0px 0px 3px 3px; + border-radius: 0px 0px 3px 3px; } + div.number-spin-btn-down:before { + border-width: 0.3em 0.3em 0 0.3em; + border-color: black transparent transparent transparent; + top: 75%; } + div.number-spin-btn-down:active { + border-top-width: 1px; } + div.number-spin-btn-down:active:before { + border-top-color: white; + top: 76%; + left: 51%; } + +div.number-spin-btn-up:before, +div.number-spin-btn-down:before { + content: ""; + width: 0; + height: 0; + border-style: solid; + position: absolute; + left: 50%; + margin: -0.15em 0 0 -0.3em; + padding: 0; } + +input:disabled + div.number-spin-btn-container > div.number-spin-btn-up:active, input:disabled + div.number-spin-btn-container > div.number-spin-btn-down:active { + border-color: #ededed #777777 #777777 #ededed; + border-style: solid; + background-color: #cccccc; } +input:disabled + div.number-spin-btn-container > div.number-spin-btn-up:before, input:disabled + div.number-spin-btn-container > div.number-spin-btn-up:active:before { + border-bottom-color: #999999; + top: 25%; + left: 50%; } +input:disabled + div.number-spin-btn-container > div.number-spin-btn-down:before, input:disabled + div.number-spin-btn-container > div.number-spin-btn-down:active:before { + border-top-color: #999999; + top: 75%; + left: 50%; } From b9fc3f9e073c13c4bd46e17e88cbd696ce1319ba Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 15 May 2013 00:04:41 -0400 Subject: [PATCH 044/117] updated styles for input type numbers --- cms/static/sass/views/_unit.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 09a4a37abe..e9049e9da5 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -666,6 +666,11 @@ body.course.unit { input[type="number"] { width: 39%; + @include box-shadow(0 1px 2px $shadow-l1 inset); + + &:active { + background-color: #FFFCF1; + } } select { From d4d38827b4344110e9f0c25076db1ec310e9dcef Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 15 May 2013 10:35:40 -0400 Subject: [PATCH 045/117] Updates for showanswer. --- common/lib/xmodule/xmodule/capa_module.py | 13 ++++++++----- .../xmodule/templates/problem/circuitschematic.yaml | 2 +- .../xmodule/templates/problem/customgrader.yaml | 2 +- .../xmodule/xmodule/templates/problem/empty.yaml | 2 +- .../xmodule/templates/problem/emptyadvanced.yaml | 2 +- .../xmodule/templates/problem/forumularesponse.yaml | 2 +- .../xmodule/templates/problem/imageresponse.yaml | 2 +- .../xmodule/templates/problem/multiplechoice.yaml | 2 +- .../templates/problem/numericalresponse.yaml | 2 +- .../xmodule/templates/problem/optionresponse.yaml | 2 +- .../xmodule/templates/problem/string_response.yaml | 2 +- 11 files changed, 18 insertions(+), 15 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 3433e6c88b..5d2fffe895 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -70,11 +70,14 @@ class CapaFields(object): showanswer = String(display_name="Show Answer", help="Specifies when to show the answer to this problem. A default value can be set course-wide in Advanced Settings.", scope=Scope.settings, default="closed", - values=[{"display_name": "Always", "value": "always"}, - {"display_name": "Answered", "value": "answered"}, - {"display_name": "Attempted", "value": "attempted"}, - {"display_name": "Closed", "value": "closed"}, - {"display_name": "Never", "value": "never"}]) + values=[ + {"display_name": "Always", "value": "always"}, + {"display_name": "Answered", "value": "answered"}, + {"display_name": "Attempted", "value": "attempted"}, + {"display_name": "Closed", "value": "closed"}, + {"display_name": "Finished", "value": "finished"}, + {"display_name": "Past Due", "value": "past_due"}, + {"display_name": "Never", "value": "never"}]) force_save_button = Boolean(help="Whether to force the save button to appear on the page", scope=Scope.settings, default=False) rerandomize = Randomization(display_name="Randomization", help="Specifies whether variable inputs for this problem are randomized each time a student loads the problem. This only applies to problems that have randomly generated numeric variables. A default value can be set course-wide in Advanced Settings.", default="always", scope=Scope.settings, values=[{"display_name": "Always", "value": "always"}, diff --git a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml index 841bd5afcd..56f802a6a3 100644 --- a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml @@ -3,7 +3,7 @@ metadata: display_name: Circuit Schematic Builder rerandomize: never - showanswer: always + showanswer: finished data: | Please make a voltage divider that splits the provided voltage evenly. diff --git a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml index 6fa1779918..b5b0d71f4d 100644 --- a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml @@ -2,7 +2,7 @@ metadata: display_name: Custom Python-Evaluated Input rerandomize: never - showanswer: always + showanswer: finished data: |

    diff --git a/common/lib/xmodule/xmodule/templates/problem/empty.yaml b/common/lib/xmodule/xmodule/templates/problem/empty.yaml index d372048ee5..97a2aef423 100644 --- a/common/lib/xmodule/xmodule/templates/problem/empty.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/empty.yaml @@ -2,7 +2,7 @@ metadata: display_name: Blank Common Problem rerandomize: never - showanswer: always + showanswer: finished markdown: "" data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml b/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml index 902b08e252..3d696ec2fd 100644 --- a/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/emptyadvanced.yaml @@ -2,7 +2,7 @@ metadata: display_name: Blank Advanced Problem rerandomize: never - showanswer: always + showanswer: finished data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml index 890260d381..0401a01c31 100644 --- a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml @@ -2,7 +2,7 @@ metadata: display_name: Math Expression Input rerandomize: never - showanswer: always + showanswer: finished data: |

    diff --git a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml index 9086dd7426..ab1f22e3b2 100644 --- a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml @@ -2,7 +2,7 @@ metadata: display_name: Image Mapped Input rerandomize: never - showanswer: always + showanswer: finished data: |

    diff --git a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml index 3a35a35199..df3eafc4a5 100644 --- a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml @@ -2,7 +2,7 @@ metadata: display_name: Multiple Choice rerandomize: never - showanswer: always + showanswer: finished weight: "" attempts: "" markdown: diff --git a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml index 4623e53e00..548fd94fab 100644 --- a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml @@ -2,7 +2,7 @@ metadata: display_name: Numerical Input rerandomize: never - showanswer: always + showanswer: finished markdown: "A numerical input problem accepts a line of text input from the student, and evaluates the input for correctness based on its diff --git a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml index a87885594a..c2edfb1cbc 100644 --- a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml @@ -2,7 +2,7 @@ metadata: display_name: Dropdown rerandomize: never - showanswer: always + showanswer: finished markdown: "Dropdown problems give a limited set of options for students to respond with, and present those options in a format that encourages them to search for a specific answer rather than being immediately presented diff --git a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml index 9519c192ac..64e3dc062f 100644 --- a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml @@ -2,7 +2,7 @@ metadata: display_name: Text Input rerandomize: never - showanswer: always + showanswer: finished # Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding markdown: "A text input problem accepts a line of text from the From e157173c1119d0a10f3d85343586f1cfea8a57ca Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 15 May 2013 10:53:54 -0400 Subject: [PATCH 046/117] styling adjustments to codemirror and wrapped polyfill into a function --- cms/static/coffee/src/views/module_edit.coffee | 2 ++ cms/static/sass/views/_unit.scss | 11 +++++------ .../xmodule/xmodule/css/codemirror/codemirror.scss | 1 + common/lib/xmodule/xmodule/css/editor/edit.scss | 2 -- .../vendor/html5-input-polyfills/number-polyfill.js | 5 ++++- .../tiny_mce/themes/advanced/skins/studio/ui.css | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index d5b6ef1b52..22fb90c1b9 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -27,6 +27,8 @@ class CMS.Views.ModuleEdit extends Backbone.View el: metadataEditor, model: new CMS.Models.MetadataEditor(metadataEditor.data('metadata')) }); + # Checks for number input fields and adds polyfill + #triggerNumberPolyfill() changedMetadata: -> return @metadataEditor.getModifiedMetadataValues() diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index e9049e9da5..74a354d09d 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -234,7 +234,7 @@ body.course.unit { opacity:.8; &:hover { - opacity:1; + opacity:.9; background-color: tint($lightBluishGrey, 20%); } @@ -481,6 +481,7 @@ body.course.unit { top: 0; right: 0; background-color: $blue; + border-bottom: 1px solid $blue-d2; color: $white; //Component Name @@ -517,12 +518,12 @@ body.course.unit { &.is-set { @include linear-gradient($blue, $blue); color: $blue-d1; - box-shadow: inset 0 2px 2px $shadow-d1; + box-shadow: inset 1px 1px 1px $shadow-d1; background-color: $blue; cursor: default; &:hover { - box-shadow: inset 0 2px 2px $shadow-d1; + box-shadow: inset 1px 1px 1px $shadow-d1; background-color: $blue; } } @@ -575,7 +576,7 @@ body.course.unit { background-color: $white; padding: 20px; border-bottom: 1px solid $gray-l2; - opacity: .6; + opacity: .8; &:last-child { //margin-bottom: 0; @@ -688,8 +689,6 @@ body.course.unit { } } - //input[type=others] - .action.setting-clear { @include font-size(11); background-color: $gray-l4; diff --git a/common/lib/xmodule/xmodule/css/codemirror/codemirror.scss b/common/lib/xmodule/xmodule/css/codemirror/codemirror.scss index 0dc07919ae..91c79d970f 100644 --- a/common/lib/xmodule/xmodule/css/codemirror/codemirror.scss +++ b/common/lib/xmodule/xmodule/css/codemirror/codemirror.scss @@ -2,4 +2,5 @@ background: #fff; font-size: 13px; color: #3c3c3c; + padding: 15px; } \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/css/editor/edit.scss b/common/lib/xmodule/xmodule/css/editor/edit.scss index ac53bb5a70..d30f69bcd2 100644 --- a/common/lib/xmodule/xmodule/css/editor/edit.scss +++ b/common/lib/xmodule/xmodule/css/editor/edit.scss @@ -10,8 +10,6 @@ position: relative; @include linear-gradient(top, #d4dee8, #c9d5e2); padding: 5px; - border: 1px solid #3c3c3c; - border-radius: 3px 3px 0 0; border-bottom-color: #a5aaaf; @include clearfix; diff --git a/common/static/js/vendor/html5-input-polyfills/number-polyfill.js b/common/static/js/vendor/html5-input-polyfills/number-polyfill.js index 080ae27be6..ab47dcdd94 100644 --- a/common/static/js/vendor/html5-input-polyfills/number-polyfill.js +++ b/common/static/js/vendor/html5-input-polyfills/number-polyfill.js @@ -4,7 +4,8 @@ HTML5 Number polyfill | Jonathan Stipe | https://github.com/jonstipe/number-polyfill */ - +function triggerNumberPolyfill() { + (function() { (function($) { @@ -297,3 +298,5 @@ HTML5 Number polyfill | Jonathan Stipe | https://github.com/jonstipe/number-poly })(jQuery); }).call(this); + +} \ No newline at end of file diff --git a/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css b/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css index 77afc23874..fc97eb6450 100644 --- a/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css +++ b/common/static/js/vendor/tiny_mce/themes/advanced/skins/studio/ui.css @@ -40,7 +40,7 @@ padding: 10px 10px 9px; vertical-align: top; } -.studioSkin .mceIframeContainer {border: 1px solid #3c3c3c; border-top: none;} +.studioSkin .mceIframeContainer {border: 1px solid white; border-top: none;} .studioSkin .mceStatusbar {background:#F0F0EE; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px} .studioSkin .mceStatusbar div {float:left; margin:2px} .studioSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/studio-icons.png) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0} From 63960ee4a276941e1a70b91c1baa3b2c55f19234 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 15 May 2013 11:26:34 -0400 Subject: [PATCH 047/117] style change for is-set --- cms/static/sass/views/_unit.scss | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 74a354d09d..c320996095 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -506,6 +506,7 @@ body.course.unit { .mode { display: inline-block; + margin-left: 8px; &.inactive-mode{ display: none; @@ -518,13 +519,13 @@ body.course.unit { &.is-set { @include linear-gradient($blue, $blue); color: $blue-d1; - box-shadow: inset 1px 1px 1px $shadow-d1; - background-color: $blue; + box-shadow: inset 0 1px 2px 2px $shadow; + background-color: $blue-d4; cursor: default; &:hover { - box-shadow: inset 1px 1px 1px $shadow-d1; - background-color: $blue; + box-shadow: inset 0 1px 2px 2px $shadow; + background-color: $blue-d4; } } } From faf31d972868311602616b0a04a2923d536e1824 Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 15 May 2013 11:34:49 -0400 Subject: [PATCH 048/117] Get toggling between Editor and Settings working. --- .../coffee/src/views/module_edit.coffee | 45 +++++++++++++++---- cms/templates/component.html | 6 +-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index d5b6ef1b52..c5869fa9b9 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -1,6 +1,7 @@ class CMS.Views.ModuleEdit extends Backbone.View tagName: 'li' className: 'component' + editorMode: 'editor-mode' events: "click .component-editor .cancel-button": 'clickCancelButton' @@ -27,6 +28,12 @@ class CMS.Views.ModuleEdit extends Backbone.View el: metadataEditor, model: new CMS.Models.MetadataEditor(metadataEditor.data('metadata')) }); + # Need to update set "active" class on data editor if there is one. + # If we are only showing settings, hide the data editor controls and update settings accordingly. + if @hasDataEditor() + @selectMode(@editorMode) + else + @hideDataEditor() changedMetadata: -> return @metadataEditor.getModifiedMetadataValues() @@ -86,13 +93,33 @@ class CMS.Views.ModuleEdit extends Backbone.View clickModeButton: (event) -> event.preventDefault() - if $(this).hasClass(".is-set") - alert("Hi There") - else - previousTab = @$el.find('li.active-mode .is-set') - previousTab.parent().siblings().find("a").addClass('is-set') - previousTab.removeClass('is-set') + if not @hasDataEditor() + return + @selectMode(event.currentTarget.parentElement.id) - previousTabContent = @$el.find('div.is-active') - previousTabContent.siblings().addClass('is-active') - previousTabContent.removeClass('is-active') + hasDataEditor: => + return @$el.find('.wrapper-comp-editor').length > 0 + + selectMode: (mode) => + dataEditor = @$el.find('.wrapper-comp-editor') + settingsEditor = @$el.find('.wrapper-comp-settings') + editorModeButton = @$el.find('#editor-mode').find("a") + settingsModeButton = @$el.find('#settings-mode').find("a") + + if mode == @editorMode + dataEditor.addClass('is-active') + settingsEditor.removeClass('is-active') + editorModeButton.addClass('is-set') + settingsModeButton.removeClass('is-set') + else + dataEditor.removeClass('is-active') + settingsEditor.addClass('is-active') + editorModeButton.removeClass('is-set') + settingsModeButton.addClass('is-set') + + hideDataEditor: => + editorModeButtonParent = @$el.find('#editor-mode') + # Can it be enough to just remove active-mode? + editorModeButtonParent.addClass('inactive-mode') + editorModeButtonParent.removeClass('active-mode') + @$el.find('.wrapper-comp-settings').addClass('is-active') \ No newline at end of file diff --git a/cms/templates/component.html b/cms/templates/component.html index 3aa8c322df..cfdd40403d 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -3,11 +3,11 @@

    Editing: Component
    From a16740691f37f0f545124890c82ea14b4c9c640e Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 15 May 2013 11:39:07 -0400 Subject: [PATCH 049/117] Minor update. --- cms/static/coffee/src/views/module_edit.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index c5869fa9b9..04d99299d2 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -122,4 +122,5 @@ class CMS.Views.ModuleEdit extends Backbone.View # Can it be enough to just remove active-mode? editorModeButtonParent.addClass('inactive-mode') editorModeButtonParent.removeClass('active-mode') - @$el.find('.wrapper-comp-settings').addClass('is-active') \ No newline at end of file + @$el.find('.wrapper-comp-settings').addClass('is-active') + @$el.find('#settings-mode').find("a").addClass('is-set') \ No newline at end of file From 56df114edbc5ebed03edfc96e5bfd85616af015f Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 15 May 2013 11:41:19 -0400 Subject: [PATCH 050/117] style changes to component header --- cms/static/sass/views/_unit.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index c320996095..590ce59cd4 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -477,7 +477,7 @@ body.course.unit { .component-edit-header { @include box-sizing(border-box); - padding: 15px 0 15px 20px; + padding: 18px 0 18px 20px; top: 0; right: 0; background-color: $blue; @@ -502,7 +502,7 @@ body.course.unit { right: 0; top: 0; position: absolute; - padding: 10px; + padding: 15px; .mode { display: inline-block; From 06d315484f1773df05de86673db49283f6092e14 Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 15 May 2013 11:52:38 -0400 Subject: [PATCH 051/117] Set "editing" name. --- cms/static/coffee/src/views/module_edit.coffee | 1 + cms/static/js/views/metadata_editor_view.js | 6 ++++++ cms/templates/component.html | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 04d99299d2..1d1ff936be 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -34,6 +34,7 @@ class CMS.Views.ModuleEdit extends Backbone.View @selectMode(@editorMode) else @hideDataEditor() + @$el.find('.component-name').html('Editing: ' + @metadataEditor.getDisplayName()) changedMetadata: -> return @metadataEditor.getModifiedMetadataValues() diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js index b4378bbbc7..633c766923 100644 --- a/cms/static/js/views/metadata_editor_view.js +++ b/cms/static/js/views/metadata_editor_view.js @@ -54,6 +54,12 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({ } ); return modified_values; + }, + + getDisplayName: function () { + // It is possible that there is no display name set. In that case, return empty string. + var displayNameValue = this.model.get('display_name').value; + return displayNameValue ? displayNameValue : ''; } }); diff --git a/cms/templates/component.html b/cms/templates/component.html index cfdd40403d..54c62dcba9 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -1,7 +1,7 @@
    - Editing: Component + \ No newline at end of file + +% if showHighLevelSource: + Edit High Level Source + <%include file="source-edit.html" /> +% endif \ No newline at end of file diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 04d99299d2..6e5676ca82 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -28,6 +28,11 @@ class CMS.Views.ModuleEdit extends Backbone.View el: metadataEditor, model: new CMS.Models.MetadataEditor(metadataEditor.data('metadata')) }); + + #Manually runs polyfill for input number types to correct for Firefox non-support + #wrapperSettings = @$el.find(".wrapper-comp-settings") + #wrapperSettings.inputNumber() + # Need to update set "active" class on data editor if there is one. # If we are only showing settings, hide the data editor controls and update settings accordingly. if @hasDataEditor() diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index e19a49a0da..56c838f799 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -954,4 +954,19 @@ body.unit { .view-button { display: none; } +} + +// Latex Compiler +// ==================== +.launch-latex-compiler { + background-color: $white; + padding: 10px 0 10px 20px; + border-bottom: 1px solid $gray-l2; + opacity: .8; + + + &:hover { + @include transition(opacity 0.25s ease-in-out); + opacity: 1; + } } \ No newline at end of file diff --git a/cms/templates/widgets/metadata-edit.html b/cms/templates/widgets/metadata-edit.html index 8367011c42..0f906ebed2 100644 --- a/cms/templates/widgets/metadata-edit.html +++ b/cms/templates/widgets/metadata-edit.html @@ -8,10 +8,12 @@ % if 'source_code' in json_metadata_data: <% del json_metadata_data['source_code'] %> % endif - ${preview} diff --git a/cms/templates/unit.html b/cms/templates/unit.html index cb34f42a09..02a204b9ba 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -1,5 +1,6 @@ <%inherit file="base.html" /> <%! from django.core.urlresolvers import reverse %> +<%! from django.utils.translation import ugettext as _ %> <%namespace name="units" file="widgets/units.html" /> <%block name="title">Individual Unit <%block name="bodyclass">is-signedin course unit @@ -35,23 +36,23 @@
    -

    You are editing a draft. +

    ${_("You are editing a draft.")} % if published_date: This unit was originally published on ${published_date}. % endif

    - View the Live Version + ${_("View the Live Version")}
    % endfor @@ -135,13 +136,13 @@
    Setting LabelSetting InputSetting Help
    Example DropdownInput/Form stuff to be children here. Example Numerical Input