Commit 1cab3a66 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

simplication du process + sélection émise au format JSON

parent f64bd419
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -36,14 +36,11 @@ Another example with custom options :
    default-id="475425" 
    :options="{
        pageLength: 10,
        editableConfig: false,
        format: 'json'
        editableConfig: false
      }"
    @entry-selected="selectedEntryCallback"/>
```

available formats : https://www.zotero.org/support/dev/web_api/v3/basics#export_formats. *zotero-vue-client* uses 'tei'
as default one.
`selectedEntryCallback` will received the selected entry as argument (in JSON format)

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
+1 −1
Original line number Diff line number Diff line
{
  "name": "zotero-vue-client",
  "version": "0.1.2",
  "version": "0.1.3",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
+1 −2
Original line number Diff line number Diff line
@@ -19,8 +19,7 @@

        methods : {
            selectedEntry(entry){
                console.log("entry key = ", entry.key)
                alert(entry.serialized)
                alert(JSON.stringify(entry))
            }
        }
    }
+4 −17
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
                <ul>
                    <li class="zotero-entry"
                        v-for="entry in entries"
                        @click="entrySelected(entry.key)"
                        @click="entrySelected(entry)"
                        :key="'entry-' + entry.key">
                        <ul>
                            <li class="zotero-title">{{entry.data.title}}</li>
@@ -77,8 +77,7 @@
                default: function() {
                    return {
                        editableConfig: true,
                        pageLength: 5,
                        format: 'tei'
                        pageLength: 5
                    }
                }
            }
@@ -135,20 +134,8 @@
                this.doQuery(false);
            },

            entrySelected(entryKey){
                let suffix = this.type + 's' +'/' + this.groupOrUserId + '/items/' + entryKey
                fetch('https://api.zotero.org/'
                    + suffix + '?format=' + this.format)
                    .then(response => response.text()).then(entry => {
                        console.log()
                        this.$emit(
                            'entry-selected',
                            {
                                key: entryKey,
                                url : 'http://zotero.org/' + suffix,
                                serialized :entry
                            })
                })
            entrySelected(entry){
                this.$emit('entry-selected',entry)
            }
        }