Skip to content

Commit

Permalink
[#1788]: Avoid overlapping input names in subform.
Browse files Browse the repository at this point in the history
  • Loading branch information
teajaymars committed Mar 30, 2012
1 parent 2ee1b48 commit 60e1fff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions ckan/public/scripts/application.js
Expand Up @@ -763,7 +763,7 @@ CKAN.View.ResourceAddUpload = Backbone.View.extend({
error: function(jqXHR, textStatus, errorThrown) {
// TODO: more graceful error handling (e.g. of 409)
self.setMessage('Failed to get credentials for storage upload. Upload cannot proceed', 'error');
self.el.find('input[name="upload"]').hide();
self.el.find('input[name="add-resource-upload"]').hide();
}
});
},
Expand Down Expand Up @@ -844,8 +844,8 @@ CKAN.View.ResourceAddUrl = Backbone.View.extend({
var self = this;
var newResource = new CKAN.Model.Resource({});

this.el.find('input[name=save]').addClass("disabled");
var urlVal = this.el.find('input[name=url]').val();
this.el.find('input[name="add-resource-save"]').addClass("disabled");
var urlVal = this.el.find('input[name="add-resource-url"]').val();
var qaEnabled = $.inArray('qa',CKAN.plugins)>=0;

if(qaEnabled && this.options.mode=='file') {
Expand Down Expand Up @@ -883,8 +883,8 @@ CKAN.View.ResourceAddUrl = Backbone.View.extend({
},

resetForm: function() {
this.el.find('input[name=save]').removeClass("disabled");
this.el.find('input[name=url]').val('');
this.el.find('input[name="add-resource-save"]').removeClass("disabled");
this.el.find('input[name="add-resource-url"]').val('');
},

events: {
Expand Down
2 changes: 1 addition & 1 deletion ckan/public/scripts/templates.js
Expand Up @@ -11,7 +11,7 @@ CKAN.Templates.resourceUpload = ' \
<input type="file" name="file" /> \
<br /> \
<div class="fileinfo"></div> \
<input id="upload" name="upload" type="submit" class="btn btn-primary" value="'+CKAN.Strings.upload+'" /> \
<input id="upload" name="add-resource-upload" type="submit" class="btn btn-primary" value="'+CKAN.Strings.upload+'" /> \
</form> \
<div class="alert alert-block" style="display: none;"></div> \
</div>';
Expand Down
8 changes: 4 additions & 4 deletions ckan/templates/package/new_package_form.html
Expand Up @@ -160,15 +160,15 @@ <h2>Errors in form</h2>
<div class="tab-pane" id="link-file">
<div class="form-inline js-add-url-form">
<label class="field_opt" for="url">File URL</label>
<input name="url" type="text" class="input-small" placeholder="http://mydataset.com/file.csv"/>
<input name="save" type="submit" class="btn btn-primary" value="Add" />
<input name="add-resource-url" type="text" class="input-small" placeholder="http://mydataset.com/file.csv"/>
<input name="add-resource-save" type="submit" class="btn btn-primary" value="Add" />
</div>
</div>
<div class="tab-pane" id="link-api">
<div class="form-inline js-add-api-form">
<label class="field_opt" for="url">API URL</label>
<input name="url" type="text" class="input-small" placeholder="http://mydataset.com/api/"/>
<input name="save" type="submit" class="btn btn-primary" value="Add" />
<input name="add-resource-url" type="text" class="input-small" placeholder="http://mydataset.com/api/"/>
<input name="add-resource-save" type="submit" class="btn btn-primary" value="Add" />
</div>
</div>
<div class="tab-pane" id="upload-file">
Expand Down

0 comments on commit 60e1fff

Please sign in to comment.