Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
d11c92d7
Commit
d11c92d7
authored
Sep 19, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the URL on the collection instead of the model.
parent
9ceee362
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
16 deletions
+3
-16
cms/static/coffee/spec/models/asset_spec.coffee
+0
-11
cms/static/coffee/spec/views/assets_spec.coffee
+2
-0
cms/static/js/models/asset.js
+0
-4
cms/templates/asset_index.html
+1
-1
No files found.
cms/static/coffee/spec/models/asset_spec.coffee
deleted
100644 → 0
View file @
9ceee362
describe
"CMS.Models.Asset"
,
->
beforeEach
->
CMS
.
URL
.
UPDATE_ASSET
=
"/update_asset/"
@
model
=
new
CMS
.
Models
.
Asset
({
id
:
"/c4x/id"
})
afterEach
->
delete
CMS
.
URL
.
UPDATE_ASSET
it
"should have a url set"
,
->
expect
(
@
model
.
url
()).
toEqual
(
"/update_asset//c4x/id"
)
cms/static/coffee/spec/views/assets_spec.coffee
View file @
d11c92d7
...
...
@@ -9,6 +9,7 @@ describe "CMS.Views.Asset", ->
@
model
=
new
CMS
.
Models
.
Asset
({
display_name
:
"test asset"
,
url
:
'actual_asset_url'
,
portable_url
:
'portable_url'
,
date_added
:
'date'
,
thumbnail
:
null
,
id
:
'id'
})
spyOn
(
@
model
,
"destroy"
).
andCallThrough
()
@
collection
=
new
CMS
.
Models
.
AssetCollection
([
@
model
])
@
collection
.
url
=
"update-asset-url"
@
view
=
new
CMS
.
Views
.
Asset
({
model
:
@
model
})
@
promptSpies
=
spyOnConstructor
(
CMS
.
Views
.
Prompt
,
"Warning"
,
[
"show"
,
"hide"
])
...
...
@@ -82,6 +83,7 @@ describe "CMS.Views.Assets", ->
{
display_name
:
"test asset 1"
,
url
:
'actual_asset_url_1'
,
portable_url
:
'portable_url_1'
,
date_added
:
'date_1'
,
thumbnail
:
null
,
id
:
'id_1'
},
{
display_name
:
"test asset 2"
,
url
:
'actual_asset_url_2'
,
portable_url
:
'portable_url_2'
,
date_added
:
'date_2'
,
thumbnail
:
null
,
id
:
'id_2'
}
])
@
collection
.
url
=
"update-asset-url"
@
view
=
new
CMS
.
Views
.
Assets
({
collection
:
@
collection
,
el
:
$
(
'#asset_table_body'
)})
@
promptSpies
=
spyOnConstructor
(
CMS
.
Views
.
Prompt
,
"Warning"
,
[
"show"
,
"hide"
])
...
...
cms/static/js/models/asset.js
View file @
d11c92d7
...
...
@@ -9,9 +9,5 @@ CMS.Models.Asset = Backbone.Model.extend({
url
:
""
,
portable_url
:
""
,
is_locked
:
false
},
url
:
function
()
{
return
CMS
.
URL
.
UPDATE_ASSET
+
this
.
id
;
}
});
cms/templates/asset_index.html
View file @
d11c92d7
...
...
@@ -18,8 +18,8 @@
<script
src=
"${static.url('js/vendor/jQuery-File-Upload/js/jquery.fileupload.js')}"
>
</script>
<script
type=
"text/javascript"
>
CMS
.
URL
.
UPDATE_ASSET
=
"${update_asset_callback_url}"
;
var
assets
=
new
CMS
.
Models
.
AssetCollection
(
$
{
asset_list
});
assets
.
url
=
"${update_asset_callback_url}"
;
var
assetsView
=
new
CMS
.
Views
.
Assets
({
collection
:
assets
,
el
:
$
(
'#asset_table_body'
)});
$
(
document
).
ready
(
function
()
{
...
...
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