Skip to content

Commit

Permalink
fix doi form. #280
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 4, 2020
1 parent 2bcc6dc commit fadcb83
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 137 deletions.
2 changes: 1 addition & 1 deletion app/components/doi-creators.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default Component.extend({
this.model.get('creators').createFragment();
}

this.setValidationClass(false);
// this.setValidationClass(false);
},

// setValidationClass(success) {
Expand Down
3 changes: 1 addition & 2 deletions app/components/doi-doi.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ export default Component.extend({
setDefaultPrefix() {
let self = this;
this.store.query('prefix', { 'client-id': this.repository.get('id'), sort: 'name', 'page[size]': 25 }).then(function(prefixes) {

if ((typeof self.get('model').get('doi')) == 'undefined') {
self.set('prefixes', prefixes);
}

let prefix = prefixes.length > 0 ? prefixes.get('firstObject') : null;

self.get('model').set('prefix', prefix);
self.get('model').set('prefix', prefix.id);

if (typeof self.get('model').get('doi') == 'undefined') {
self.generate();
Expand Down
53 changes: 0 additions & 53 deletions app/components/doi-url.js

This file was deleted.

11 changes: 10 additions & 1 deletion app/templates/components/doi-doi.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
{{/el.control}}
{{/form.element}}
</span>
<form.element @controlType="text" @class="suffix" @id="suffix-field" @formLayout="vertical" @property="suffix" @onChange={{action "selectSuffix"}} @helpText="A globally unique string that identifies the resource and can't be changed." @required={{false}} />
{{form.element
controlType="text"
class="suffix"
id="suffix-field"
formLayout="vertical"
property="suffix"
onChange=(action "selectSuffix")
helpText="A globally unique string that identifies the resource and can't be changed."
required=false
}}
<span class="input-group-addon refresh" title="Refresh" aria-label="Refresh" {{action 'refresh'}}>{{fa-icon "refresh"}}</span>
<span class="input-group-addon clear" title="Clear" aria-label="Clear" {{action 'clear'}}>{{fa-icon "times-circle"}}</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/components/doi-media.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
{{#each model.media as |media|}}
<div class="row">
<div class="col-md-2">
<strong><media.media-type /></strong>
<strong>{{media.media-type}}</strong>
</div>
<div class="col-md-7">
<UrlCheck @url={{media.url}} @contentType={{media.media-type}} @urlToCheck={{url-transform model.doi contentType=media.media-type}} />
<a href="{{media.url}}">{{media.url}}</a>
</div>
</div>
{{/each}}
Expand Down
9 changes: 8 additions & 1 deletion app/templates/components/doi-types.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@
}}
{{/form.element}}

<form.element @controlType="text" @label="Resource Type (optional)" @property="types.resourceType" @helpText="A description of the resource, the preferred format is a single term of some detail." @required={{false}} @disabled={{disabled}} />
{{form.element
controlType="text"
label="Resource Type (optional)"
property="types.resourceType"
helpText="A description of the resource, the preferred format is a single term of some detail."
required=false
disabled=disabled
}}
8 changes: 4 additions & 4 deletions app/templates/components/doi-upload.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</span>
</FileUpload>
</div>
</div>

<Textarea @property="xml" @rows={{15}} @showValidationOn="focusOut" @helpText="Metadata that describe the resource. Upload a file with metadata in DataCite XML format, or one of the other supported formats. The DOI in the metadata will be replaced with the DOI in the DOI field if different." @required={{false}} as |el|>
<el.control @class="form-control metadata" />
</Textarea>
<Textarea @property="xml" @rows={{15}} @showValidationOn="focusOut" @helpText="Metadata that describe the resource. Upload a file with metadata in DataCite XML format, or one of the other supported formats. The DOI in the metadata will be replaced with the DOI in the DOI field if different." @required={{false}} as |el|>
<el.control @class="form-control metadata" />
</Textarea>
</div>
10 changes: 0 additions & 10 deletions app/templates/components/doi-url.hbs

This file was deleted.

6 changes: 4 additions & 2 deletions app/templates/dois/show/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
the resource and can't be changed." @disabled={{true}} />

<DoiState @model={{model}} @form={{form}} />
<DoiUrl @model={{model}} @form={{form}} />

<form.element @id="url" @controlType="text" @label="URL" @property="url" @helpText="The location of the landing page with more information about the resource." @required={{false}} />

<DoiCreators @model={{model}} @form={{form}} />
<DoiTitles @model={{model}} @form={{form}} />

Expand All @@ -31,7 +33,7 @@ the resource and can't be changed." @disabled={{true}} />
<ModelValidationErrors @model={{model}} @form={{form}} />

<div class="col-md-9 col-md-offset-3">
<button type="submit" id="update-doi" class="btn btn-sm btn-fill" disabled={{model-disabled (v-get model 'isValid') model.state model.creators}}>Update DOI</button>
<button type="submit" id="update-doi" class="btn btn-sm btn-fill" disabled={{v-get model 'isInvalid'}}>Update DOI</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
</BsForm>
Expand Down
14 changes: 11 additions & 3 deletions app/templates/dois/show/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,23 @@
<RepositorySidebar @model={{model}} />
</div>
<div class='col-md-9'>
<DoiUrl @model={{model}} />
{{#if model.url}}
<h3 class="member-results">URL</h3>
<div class="panel panel-transparent url">
<div class="panel-body">
<a href="{{model.url}}">{{model.url}}</a>
</div>
</div>
{{/if}}

<DoiMetadata @model={{model}} />

{{#if model.showCitation}}
<DoiCitation @model={{model}} />
<DoiCitation @model={{model}} />
{{/if}}

{{#if (and model.landingPage.checked (can "viewHealth doi" model))}}
<DoiHealth @model={{model}} />
<DoiHealth @model={{model}} />
{{/if}}
</div>
</div>
19 changes: 9 additions & 10 deletions app/templates/dois/show/modify.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@
</div>

<BsForm @formLayout="horizontal" @horizontalLabelGridClass="col-md-3" @model={{model}} @onSubmit={{action "submit" model}} as |form|>
<form.element @controlType="text" @label="DOI" @property="doi" @helpText="The globally unique string that identifies
the resource and can't be changed." @disabled={{true}} />
<form.element @controlType="text" @label="DOI" @property="doi" @helpText="The globally unique string that identifies the resource and can't be changed." @disabled={{true}} />

<DoiState @model={{model}} @form={{form}} />
<DoiUrl @model={{model}} @form={{form}} />
<DoiUpload @model={{model}} @form={{form}} />
<DoiState @model={{model}} @form={{form}} />
<form.element @id="url" @controlType="text" @label="URL" @property="url" @helpText="The location of the landing page with more information about the resource." @required={{false}} />
<DoiUpload @model={{model}} @form={{form}} />

<ModelValidationErrors @model={{model}} @form={{form}} />
<ModelValidationErrors @model={{model}} @form={{form}} />

<div class="col-md-9 col-md-offset-3">
<button type="submit" class="btn btn-sm btn-fill">Update DOI</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
<div class="col-md-9 col-md-offset-3">
<button type="submit" class="btn btn-sm btn-fill" disabled={{v-get model 'isInvalid'}}>Update DOI</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
</BsForm>
</div>
</div>
2 changes: 1 addition & 1 deletion app/templates/repositories/show/dois/new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ModelValidationErrors @model={{model.doi}} @form={{form}} />

<div class="col-md-9 col-md-offset-3">
<button type="submit" id="create" class="btn btn-sm btn-fill" disabled={{model-disabled (v-get model.doi 'isValid') model.doi.state model.doi.creators}}>Create DOI</button>
<button type="submit" id="create" class="btn btn-sm btn-fill" disabled={{v-get model 'isInvalid'}}>Create DOI</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
</BsForm>
Expand Down
17 changes: 8 additions & 9 deletions app/templates/repositories/show/dois/upload.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
</div>

<BsForm @formLayout="horizontal" @horizontalLabelGridClass="col-md-3" @model={{model.doi}} @onSubmit={{action "submit" model.doi}} as |form|>
<DoiDoi @model={{model.doi}} @repository={{model.repository}} @form={{form}} />
<DoiDoi @model={{model.doi}} @repository={{model.repository}} @form={{form}} />

<form.element @controlType="text" @label="URL" @property="url" @helpText="The location of the landing page with more
information about the resource." @required={{false}} />
<form.element @controlType="text" @label="URL" @property="url" @helpText="The location of the landing page with more information about the resource." @required={{false}} />

<DoiUpload @model={{model.doi}} @form={{form}} />
<DoiUpload @model={{model.doi}} @form={{form}} />

<ModelValidationErrors @model={{model.doi}} @form={{form}} />
<ModelValidationErrors @model={{model.doi}} @form={{form}} />

<div class="col-md-9 col-md-offset-3">
<button type="submit" class="btn btn-sm btn-fill">Create DOI</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
<div class="col-md-9 col-md-offset-3">
<button type="submit" class="btn btn-sm btn-fill" disabled={{v-get model 'isInvalid'}}>Create DOI</button>
<button {{action "cancel"}} class="btn btn-sm">Cancel</button>
</div>
</BsForm>
</div>
</div>
17 changes: 0 additions & 17 deletions tests/integration/components/doi-url-test.js

This file was deleted.

21 changes: 0 additions & 21 deletions tests/integration/components/url-check-test.js

This file was deleted.

0 comments on commit fadcb83

Please sign in to comment.