Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: an example to demonstrate editing a single item #27

Open
BananaAcid opened this issue Jun 21, 2019 · 3 comments
Open

request: an example to demonstrate editing a single item #27

BananaAcid opened this issue Jun 21, 2019 · 3 comments
Labels

Comments

@BananaAcid
Copy link

BananaAcid commented Jun 21, 2019

The current examples are fine, but talking to two other friends of mine, they seem to have the same problem: how to build a todo app, where the editing is using another view (passing the doc._id).

Another thing: The auth examples shows two code blocks - but no explanation where/how to use them. I know, it is probably super clear for a pro using this plugin for a while, but not for beginners with this plugin.

Would be great if you could see to this, as I believe it would make it easier to get going with it.

btw, using framework7.io/vue - building a PWA

@assemblethis
Copy link
Collaborator

That's a great idea. If I have time or someone else does maybe we can get some fully worked out examples put up here.

As for immediately, the Boatnet project might interest you: https://github.com/nwfsc-fram/boatnet

They're using pouch-vue in their PWA.

@BananaAcid
Copy link
Author

BananaAcid commented Jun 23, 2019

went with (maybe as a starting point)

       {
		pouch: {

			item() {
				const self = this;
				return {
					database: 'items',
					selector: {_id: self.$f7route.params.id}, // the view used the Framework7 router to receive the item._id
					first: true // returns a single item (not the usual array of items)
				}
			}

		},
         }

need to wait for the item to be populated, v-if will only show if it is there

		<div v-if="!item">
                 loading, please wait ...
                </div>

		<div v-if="item">
                 Item JSON: {{item}}
                </div>

@MDSLKTR
Copy link
Owner

MDSLKTR commented Jun 24, 2019

Hey, thanks for the feedback! Those code snippets were initially just for reference on an internal project. I agree that there is a need for more context on the topic. The login example will generally help you sign in to your pwa leading the user to another page, something like a dashboard. The session example will be called on all "protected" routes making sure the user is signed in otherwise redirecting to the login view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants