Commit 01ede40b by cahrens

Switching branches

parent 6ee2ab86
...@@ -682,6 +682,7 @@ def save_item(request): ...@@ -682,6 +682,7 @@ def save_item(request):
del existing_item._model_data[metadata_key] del existing_item._model_data[metadata_key]
del posted_metadata[metadata_key] del posted_metadata[metadata_key]
else: else:
# TODO, in here check if value is the same before setting.
existing_item._model_data[metadata_key] = value existing_item._model_data[metadata_key] = value
# commit to datastore # commit to datastore
......
...@@ -35,6 +35,8 @@ class CMS.Views.ModuleEdit extends Backbone.View ...@@ -35,6 +35,8 @@ class CMS.Views.ModuleEdit extends Backbone.View
return _metadata return _metadata
getMetadata: ->
cloneTemplate: (parent, template) -> cloneTemplate: (parent, template) ->
$.post("/clone_item", { $.post("/clone_item", {
parent_location: parent parent_location: parent
......
...@@ -845,15 +845,15 @@ function saveSetSectionScheduleDate(e) { ...@@ -845,15 +845,15 @@ function saveSetSectionScheduleDate(e) {
data: JSON.stringify({ 'id': id, 'metadata': {'start': start}}) data: JSON.stringify({ 'id': id, 'metadata': {'start': start}})
}).success(function () { }).success(function () {
var $thisSection = $('.courseware-section[data-id="' + id + '"]'); var $thisSection = $('.courseware-section[data-id="' + id + '"]');
var format = gettext('<strong>Will Release:</strong> %(date)s at $(time)s UTC'); var format = gettext('<strong>Will Release:</strong> %(date)s at $(time)s UTC');
var willReleaseAt = interpolate(format, [input_date, input_time], true); var willReleaseAt = interpolate(format, [input_date, input_time], true);
$thisSection.find('.section-published-date').html( $thisSection.find('.section-published-date').html(
'<span class="published-status">' + willReleaseAt + '</span>' + '<span class="published-status">' + willReleaseAt + '</span>' +
'<a href="#" class="edit-button" ' + '<a href="#" class="edit-button" ' +
'" data-date="' + input_date + '" data-date="' + input_date +
'" data-time="' + input_time + '" data-time="' + input_time +
'" data-id="' + id + '">' + '" data-id="' + id + '">' +
gettext('Edit') + '</a>'); gettext('Edit') + '</a>');
$thisSection.find('.section-published-date').animate({ $thisSection.find('.section-published-date').animate({
'background-color': 'rgb(182,37,104)' 'background-color': 'rgb(182,37,104)'
}, 300).animate({ }, 300).animate({
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<body class="<%block name='bodyclass'></%block> hide-wip"> <body class="<%block name='bodyclass'></%block> hide-wip">
<%include file="courseware_vendor_js.html"/> <%include file="courseware_vendor_js.html"/>
<script type="text/javascript" src="jsi18n/"></script> <script type="text/javascript" src="/jsi18n/"></script>
<script type="text/javascript" src="${static.url('js/vendor/json2.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/json2.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/underscore-min.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/underscore-min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/backbone-min.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/backbone-min.js')}"></script>
......
<% <%
import hashlib import hashlib
from xmodule.fields import StringyInteger, StringyFloat
hlskey = hashlib.md5(module.location.url()).hexdigest() hlskey = hashlib.md5(module.location.url()).hexdigest()
%> %>
<section class="metadata_edit"> <section class="metadata_edit">
...@@ -12,8 +13,17 @@ ...@@ -12,8 +13,17 @@
% endif % endif
% else: % else:
<label>${field_value['field'].display_name}:</label> <label>${field_value['field'].display_name}:</label>
<input type='text' data-metadata-name='${field_value["field"].display_name}' value='${field_value["field"].to_json(field_value["value"])}' size='60' /> <input type='text' data-metadata-name='${field_value["field"].display_name}'
% if False: ## This is a hack to keep current behavior for weight and attempts (empty will parse OK as unset).
## This hack will go away with our custom editors.
% if field_value["value"] == None and (isinstance(field_value["field"], StringyFloat) or isinstance(field_value["field"], StringyInteger)):
value = ''
% else:
value='${field_value["field"].to_json(field_value["value"])}'
% endif
size='60' />
## Change to True to see all the information being passed through.
% if True:
<label>Help: ${field_value['field'].help}</label> <label>Help: ${field_value['field'].help}</label>
<label>Type: ${type(field_value['field']).__name__}</label> <label>Type: ${type(field_value['field']).__name__}</label>
<label>Inherited: ${field_value['is_inherited']}</label> <label>Inherited: ${field_value['is_inherited']}</label>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<form id="hls-form" enctype="multipart/form-data"> <form id="hls-form" enctype="multipart/form-data">
<section class="source-edit"> <section class="source-edit">
<textarea name="" data-metadata-name="source_code" class="source-edit-box hls-data" rows="8" cols="40">${editable_metadata_fields['source_code']|h}</textarea> <textarea name="" data-metadata-name="source_code" class="source-edit-box hls-data" rows="8" cols="40">${editable_metadata_fields['source_code']['value']|h}</textarea>
</section> </section>
<div class="submit"> <div class="submit">
<button type="reset" class="hls-compile">Save &amp; Compile to edX XML</button> <button type="reset" class="hls-compile">Save &amp; Compile to edX XML</button>
......
--- ---
metadata: metadata:
display_name: Blank Common Problem display_name: Blank Common Problem
rerandomize: never
showanswer: always showanswer: always
markdown: "" markdown: ""
weight: ""
empty: True empty: True
attempts: "" attempts: ""
data: | data: |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment