Skip to content

Commit

Permalink
Merge branch 'feature-1716-ux-tweak'
Browse files Browse the repository at this point in the history
  • Loading branch information
teajaymars committed Jan 26, 2012
2 parents 6c9705d + 95606b5 commit 2bd50d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ckan/public/scripts/application.js
Expand Up @@ -492,7 +492,13 @@ CKAN.View.DatasetEditForm = Backbone.View.extend({
var boundToUnload = false;
return function() {
if (!boundToUnload) {
CKAN.Utils.flashMessage(CKAN.Strings.youHaveUnsavedChanges,'notice');
var parentDiv = $('<div />').addClass('flash-messages');
var messageDiv = $('<div />').html(CKAN.Strings.youHaveUnsavedChanges).addClass('notice').hide();
parentDiv.append(messageDiv);
$('#unsaved-warning').append(parentDiv);
console.log($('#unsaved-warning'));
messageDiv.show(1200);

boundToUnload = true;
window.onbeforeunload = function () {
return CKAN.Strings.youHaveUnsavedChanges;
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/js_strings.html
Expand Up @@ -22,7 +22,7 @@
CKAN.Strings.failedToSave = "${_('Failed to save, possibly due to invalid data ')}";
CKAN.Strings.addDataset = "${_('Add Dataset')}";
CKAN.Strings.addGroup = "${_('Add Group')}";
CKAN.Strings.youHaveUnsavedChanges = "${_('You have unsaved changes. Hit Save Changes at the bottom of the page to submit them.')}";
CKAN.Strings.youHaveUnsavedChanges = "${_('You have unsaved changes. Hit Save Changes below submit them.')}";
CKAN.Strings.loading = "${_('Loading...')}";
CKAN.Strings.noNameBrackets = "${_('(no name)')}";
CKAN.Strings.deleteThisResourceQuestion = "${_('Delete the resource \'%name%\'?')}"
Expand Down
2 changes: 2 additions & 0 deletions ckan/templates/package/new_package_form.html
Expand Up @@ -200,6 +200,8 @@ <h3>Tags</h3>
</dl>
</fieldset>

<div id="unsaved-warning"></div>

<label for="log_message" class="edit-summary">Edit summary (briefly describe the changes you have made)</label>
<textarea id="log_message" name="log_message" class="edit-summary short wide">${data.get('log_message', '')}</textarea>

Expand Down

0 comments on commit 2bd50d9

Please sign in to comment.