Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
ed3edb8f
Commit
ed3edb8f
authored
Nov 03, 2016
by
Vedran Karačić
Committed by
GitHub
Nov 03, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #979 from edx/vkaracic/SOL-2101
[SOL-2101, SOL-2102] Increase text length for dynamic coupons
parents
df4ad118
50ac879f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
2 deletions
+60
-2
ecommerce/extensions/offer/migrations/0007_auto_20161026_0856.py
+19
-0
ecommerce/extensions/offer/models.py
+1
-1
ecommerce/extensions/offer/tests/test_models.py
+14
-0
ecommerce/static/js/test/specs/views/coupon_form_view_spec.js
+11
-0
ecommerce/static/js/views/coupon_form_view.js
+6
-0
ecommerce/static/sass/partials/utilities/_variables.scss
+2
-0
ecommerce/static/sass/partials/views/_coupon_admin.scss
+6
-1
ecommerce/static/templates/coupon_form.html
+1
-0
No files found.
ecommerce/extensions/offer/migrations/0007_auto_20161026_0856.py
0 → 100644
View file @
ed3edb8f
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'offer'
,
'0006_auto_20161025_1446'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'range'
,
name
=
'catalog_query'
,
field
=
models
.
TextField
(
null
=
True
,
blank
=
True
),
),
]
ecommerce/extensions/offer/models.py
View file @
ed3edb8f
...
@@ -75,7 +75,7 @@ class Range(AbstractRange):
...
@@ -75,7 +75,7 @@ class Range(AbstractRange):
'course_seat_types'
,
'course_seat_types'
,
]
]
catalog
=
models
.
ForeignKey
(
'catalogue.Catalog'
,
blank
=
True
,
null
=
True
,
related_name
=
'ranges'
)
catalog
=
models
.
ForeignKey
(
'catalogue.Catalog'
,
blank
=
True
,
null
=
True
,
related_name
=
'ranges'
)
catalog_query
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
catalog_query
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
course_seat_types
=
models
.
CharField
(
course_seat_types
=
models
.
CharField
(
max_length
=
255
,
max_length
=
255
,
validators
=
[
validate_credit_seat_type
],
validators
=
[
validate_credit_seat_type
],
...
...
ecommerce/extensions/offer/tests/test_models.py
View file @
ed3edb8f
...
@@ -61,6 +61,20 @@ class RangeTests(CouponMixin, CourseCatalogTestMixin, CourseCatalogMockMixin, Te
...
@@ -61,6 +61,20 @@ class RangeTests(CouponMixin, CourseCatalogTestMixin, CourseCatalogMockMixin, Te
self
.
assertIn
(
self
.
product
,
self
.
range_with_catalog
.
all_products
())
self
.
assertIn
(
self
.
product
,
self
.
range_with_catalog
.
all_products
())
self
.
assertEqual
(
len
(
self
.
range_with_catalog
.
all_products
()),
1
)
self
.
assertEqual
(
len
(
self
.
range_with_catalog
.
all_products
()),
1
)
def
test_large_query
(
self
):
"""Verify the range can store large queries."""
large_query
=
"""
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
"""
self
.
range
.
catalog_query
=
large_query
self
.
range
.
save
()
self
.
assertEqual
(
self
.
range
.
catalog_query
,
large_query
)
@mock.patch
(
'ecommerce.core.url_utils.get_current_request'
,
mock
.
Mock
(
return_value
=
None
))
@mock.patch
(
'ecommerce.core.url_utils.get_current_request'
,
mock
.
Mock
(
return_value
=
None
))
def
test_run_catalog_query_no_request
(
self
):
def
test_run_catalog_query_no_request
(
self
):
"""
"""
...
...
ecommerce/static/js/test/specs/views/coupon_form_view_spec.js
View file @
ed3edb8f
...
@@ -289,6 +289,17 @@ define([
...
@@ -289,6 +289,17 @@ define([
expect
(
view
.
dynamic_catalog_view
.
query
).
toEqual
(
undefined
);
expect
(
view
.
dynamic_catalog_view
.
query
).
toEqual
(
undefined
);
expect
(
view
.
dynamic_catalog_view
.
seat_types
).
toEqual
([
]);
expect
(
view
.
dynamic_catalog_view
.
seat_types
).
toEqual
([
]);
});
});
it
(
'should update the query length indicator'
,
function
()
{
var
query_1
=
'example query'
,
query_2
=
'a larger example query'
;
view
.
$
(
'textarea[name=catalog_query]'
).
val
(
query_1
).
trigger
(
'input'
);
expect
(
view
.
$
(
'span.query_length'
).
text
()).
toEqual
(
String
(
query_1
.
length
));
view
.
$
(
'textarea[name=catalog_query]'
).
val
(
query_2
).
trigger
(
'input'
);
expect
(
view
.
$
(
'span.query_length'
).
text
()).
toEqual
(
String
(
query_2
.
length
));
});
});
});
});
});
}
}
...
...
ecommerce/static/js/views/coupon_form_view.js
View file @
ed3edb8f
...
@@ -224,6 +224,7 @@ define([
...
@@ -224,6 +224,7 @@ define([
events
:
{
events
:
{
'input [name=course_id]'
:
'fillFromCourse'
,
'input [name=course_id]'
:
'fillFromCourse'
,
'input [name=quantity]'
:
'changeTotalValue'
,
'input [name=quantity]'
:
'changeTotalValue'
,
'input [name=catalog_query]'
:
'updateCatalogQueryLength'
,
// catch value after autocomplete
// catch value after autocomplete
'blur [name=course_id]'
:
'fillFromCourse'
,
'blur [name=course_id]'
:
'fillFromCourse'
,
...
@@ -279,6 +280,11 @@ define([
...
@@ -279,6 +280,11 @@ define([
this
.
_super
();
this
.
_super
();
},
},
updateCatalogQueryLength
:
function
()
{
var
query_length
=
this
.
$
(
'textarea[name=catalog_query]'
).
val
().
length
;
this
.
$
(
'.query_length'
).
text
(
query_length
);
},
toggleCreditSeats
:
function
()
{
toggleCreditSeats
:
function
()
{
var
nonCreditSeatsField
=
this
.
$
(
'.non-credit-seats'
);
var
nonCreditSeatsField
=
this
.
$
(
'.non-credit-seats'
);
if
(
this
.
$
(
'#credit'
).
is
(
':checked'
))
{
if
(
this
.
$
(
'#credit'
).
is
(
':checked'
))
{
...
...
ecommerce/static/sass/partials/utilities/_variables.scss
View file @
ed3edb8f
...
@@ -52,3 +52,5 @@ $pagination-darker-silver: #ddd;
...
@@ -52,3 +52,5 @@ $pagination-darker-silver: #ddd;
$small-input-width
:
174px
;
$small-input-width
:
174px
;
$input-addon-width
:
40px
;
$input-addon-width
:
40px
;
$coupon-grid-item-height
:
75px
;
ecommerce/static/sass/partials/views/_coupon_admin.scss
View file @
ed3edb8f
...
@@ -124,7 +124,7 @@
...
@@ -124,7 +124,7 @@
@include
margin-right
(
2%
);
@include
margin-right
(
2%
);
margin-bottom
:
50px
;
margin-bottom
:
50px
;
width
:
48%
;
width
:
48%
;
height
:
75px
;
height
:
$coupon-grid-item-height
;
}
}
.total-paid
{
.total-paid
{
...
@@ -151,6 +151,11 @@
...
@@ -151,6 +151,11 @@
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
}
}
.catalog-query
{
height
:
auto
;
min-height
:
$coupon-grid-item-height
;
}
}
}
}
}
...
...
ecommerce/static/templates/coupon_form.html
View file @
ed3edb8f
...
@@ -180,6 +180,7 @@
...
@@ -180,6 +180,7 @@
<div
class=
"form-group catalog-query"
>
<div
class=
"form-group catalog-query"
>
<label
for=
"catalog-query"
><
%=
gettext
('
Query
string:
')
%
>
*
<a
href=
"https://stage-edx-discovery.edx.org/"
class=
"external-link normal-font-weight"
>
(query guidelines)
</a></label>
<label
for=
"catalog-query"
><
%=
gettext
('
Query
string:
')
%
>
*
<a
href=
"https://stage-edx-discovery.edx.org/"
class=
"external-link normal-font-weight"
>
(query guidelines)
</a></label>
<textarea
id=
"catalog-query"
class=
"form-control"
name=
"catalog_query"
rows=
"10"
></textarea>
<textarea
id=
"catalog-query"
class=
"form-control"
name=
"catalog_query"
rows=
"10"
></textarea>
<span>
Query length:
<span
class=
"query_length"
>
0
</span></span>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group course-seat-types"
>
<div
class=
"form-group course-seat-types"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment