Skip to content

Commit

Permalink
Cleanup code #468
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Sep 18, 2018
1 parent 4d742ed commit 2bf70c9
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 151 deletions.
14 changes: 6 additions & 8 deletions app/javascript/vue/tasks/nomenclature/by_source/app.vue
Expand Up @@ -3,10 +3,10 @@
<div class="flexbox">
<h1 class="task_header"> Nomenclature by source </h1>
<spinner
v-if="isLoading"
:full-screen="true"
legend="Loading..."
:logo-size="{ width: '100px', height: '100px'}"/>
v-if="isLoading"
:full-screen="true"
legend="Loading..."
:logo-size="{ width: '100px', height: '100px'}"/>
<nomen-source @sourceID="sourceID = $event"/>
</div>
<div class="flexbox">
Expand Down Expand Up @@ -58,7 +58,7 @@
</div>
</template>
<script>
import SmartSelector from './components/smartSelector'
import NomenSource from './components/nomen_source'
import CiteTaxonName from './components/cite_taxon_name'
import OtusByMatch from './components/otus_by_match'
Expand All @@ -69,11 +69,9 @@
import AssertedDistributions from './components/asserted_distributions'
import OtusMatchProxy from './components/otus_match_proxy'
import Spinner from '../../../components/spinner.vue'
// import from './components/asserted_distributions'
// import AssertedDistributions from './components/asserted_distributions'
export default {
components: {
SmartSelector,
NomenSource,
OtusByMatch,
CiteTaxonName,
Expand Down
Expand Up @@ -16,9 +16,6 @@
OtuRadial
},
props: {
value: {
},
sourceID: {
type: String,
default: "0"
Expand All @@ -37,7 +34,6 @@
methods: {
getCites() {
this.$http.get('/citations.json?citation_object_type=AssertedDistribution&source_id=' + this.sourceID).then(response => {
// build the tabular list, extracting the
this.asserted_distributions_cites_list = response.body;
this.$emit("distribution_cites", this.asserted_distributions_cites_list)
})
Expand Down
Expand Up @@ -16,9 +16,6 @@
OtuRadial
},
props: {
value: {
type: String
},
sourceID: {
type: String,
default: "0"
Expand All @@ -34,7 +31,6 @@
this.getCites();
}
},
methods: {
getCites() {
this.$http.get('/citations.json?citation_object_type=BiologicalAssociation&source_id=' + this.sourceID).then(response => {
Expand Down
Expand Up @@ -6,24 +6,25 @@
name="citation"
:add-option="moreOptions"
v-model="view"/>
<autocomplete
v-if="view === 'Search'"
url="/taxon_names/autocomplete"
min="2"
param="term"
placeholder="Search for a taxon"
event-send="setTaxonforCite(item)"
label="label"
@getItem="foundTaxon = $event"
:autofocus="true" />
<button v-else
v-for="item in showList[view]"
:key="item.id"
type="button"
:class="{ 'button-default': !(selectedList.hasOwnProperty(item.id))}"
class="button normal-input biocuration-toggle-button"
@click="addTaxonCite(item)"
v-html="item.name"/>
<autocomplete
v-if="view === 'Search'"
url="/taxon_names/autocomplete"
min="2"
param="term"
placeholder="Search for a taxon"
event-send="setTaxonforCite(item)"
label="label"
@getItem="foundTaxon = $event"
:autofocus="true" />
<button
v-else
v-for="item in showList[view]"
:key="item.id"
type="button"
:class="{ 'button-default': !(selectedList.hasOwnProperty(item.id))}"
class="button normal-input biocuration-toggle-button"
@click="addTaxonCite(item)"
v-html="item.name"/>
<button
class="button normal-input button-default"
@click="createTaxonCite()"
Expand All @@ -33,23 +34,16 @@
</div>
</template>
<script>
import SmartSelector from './smartSelector.vue'
import SmartSelector from '../../../../components/switch.vue'
import Autocomplete from '../../../../components/autocomplete.vue'
export default {
components: {
SmartSelector,
Autocomplete
},
props: {
// selectOptionsUrl: {
// type: String
// },
// allSelectOptionUrl: {
// type: String
// },
value: {
type: Object,
},
sourceID: {
type: String,
default: "0"
Expand All @@ -71,10 +65,6 @@
setTaxonforCite() {
this.foundTaxon = item;
},
addTaxonCite(taxon) {
// first GET the citation for this taxon
},
createTaxonCite() {
let params = {
citation: {
Expand Down
Expand Up @@ -16,14 +16,10 @@
<script>
import Autocomplete from "../../../../components/autocomplete";
export default {
components: {Autocomplete},
props: {
value: {
type: String,
default: window.location.href.split('by_source/')[1]
},
components: {
Autocomplete
},
data: function() {
data() {
return {
sourceText: 'Invalid source or no source supplied'
,
Expand Down Expand Up @@ -59,12 +55,11 @@
})
})
}
}
,
mounted: function () {
},
mounted() {
let pieces = window.location.href.split('/');
this.sourceID = pieces[pieces.length - 1];
this.getSource();
}
if (this.sourceID.length && Number.isInteger(Number(this.sourceID))) this.getSource();
}
}
</script>
Expand Up @@ -16,16 +16,13 @@
OtuRadial
},
props: {
value: {
type: String
},
sourceID: {
type: String,
default: "0"
},
newTaxon: {
type: Object,
default: {}
default: () => { return {} }
}
},
data() {
Expand Down
Expand Up @@ -18,36 +18,33 @@
OtuRadial
},
props: {
value: {
type: String
},
sourceID: {
type: String,
default: "0",
},
otu_names_cites: {
type: Array,
default: [],
default: () => { return [] }
},
taxon_names_cites: {
type: Array,
default: [],
default: () => { return [] }
},
taxon_relationship_cites: {
type: Array,
default: [],
default: () => { return [] }
},
taxon_classification_cites: {
type: Array,
default: [],
default: () => { return [] }
},
biological_association_cites: {
type: Array,
default: [],
default: () => { return [] }
},
distribution_cites: {
type: Array,
default: [],
default: () => { return [] }
},
updateOtus: {
type: Boolean,
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -6,8 +6,8 @@
</td>
<td>
<otu-radial
:taxon-id="otu.taxon_name_id"
:redirect="false"/>
:taxon-id="otu.taxon_name_id"
:redirect="false"/>
</td>
</tr>
</template>
Expand Down
Expand Up @@ -52,9 +52,6 @@ export default {
that.$http.patch('/citations/' + this.citation.id + '.json', { citation: this.citation }).then(response => {
TW.workbench.alert.create('Citation was successfully updated.', 'notice')
})
// that.$http.post('/citations/.json', { citation: this.citation }).then(response => {
// TW.workbench.alert.create('Citation was successfully created.', 'notice')
// }) // above block for CREATE-ing new citations on page edit
}, this.time)
},
removeMe() {
Expand Down
Expand Up @@ -17,9 +17,6 @@
OtuRadial
},
props: {
value: {
type: String
},
sourceID: {
type: String,
default: "0"
Expand Down
Expand Up @@ -2,23 +2,22 @@
<div>
<h2>Taxon Name Relationships</h2>
<table-component
:list="taxon_relationship_cites_list"/>
:list="taxon_relationship_cites_list"/>
</div>
</template>
<script>
import TableComponent from './tables/table.vue'
import RadialAnnotator from '../../../../components/annotator/annotator.vue'
import OtuRadial from '../../../../components/otu/otu.vue'
export default {
components: {
TableComponent,
RadialAnnotator,
OtuRadial
},
props: {
value: {
type: String
},
sourceID: {
type: String,
default: '0'
Expand All @@ -34,11 +33,9 @@
this.getCites();
}
},
methods: {
getCites() {
this.$http.get('/citations.json?citation_object_type=TaxonNameRelationship&source_id=' + this.sourceID).then(response => {
// build the tabular list, extracting the
this.taxon_relationship_cites_list = response.body;
this.$emit("taxon_relationship_cites", this.taxon_relationship_cites_list)
})
Expand Down

0 comments on commit 2bf70c9

Please sign in to comment.