Merge pull request #402 from nextcloud/enh/sort_forms

Sort Navigation newest forms first
This commit is contained in:
Jan C. Borchardt 2020-05-22 17:16:38 +02:00 committed by GitHub
commit c08afe9fa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -84,7 +84,9 @@ class FormMapper extends QBMapper {
$qb = $this->db->getQueryBuilder(); $qb = $this->db->getQueryBuilder();
$qb->select('*') $qb->select('*')
->from($this->getTableName()); ->from($this->getTableName())
//Newest forms first
->orderBy('created', 'DESC');
return $this->findEntities($qb); return $this->findEntities($qb);
} }
@ -99,7 +101,9 @@ class FormMapper extends QBMapper {
->from($this->getTableName()) ->from($this->getTableName())
->where( ->where(
$qb->expr()->eq('owner_id', $qb->createNamedParameter($ownerId)) $qb->expr()->eq('owner_id', $qb->createNamedParameter($ownerId))
); )
//Newest forms first
->orderBy('created', 'DESC');
return $this->findEntities($qb); return $this->findEntities($qb);
} }

View file

@ -148,7 +148,7 @@ export default {
// Request a new empty form // Request a new empty form
const response = await axios.post(generateUrl('/apps/forms/api/v1/form')) const response = await axios.post(generateUrl('/apps/forms/api/v1/form'))
const newForm = response.data const newForm = response.data
this.forms.push(newForm) this.forms.unshift(newForm)
this.$router.push({ name: 'edit', params: { hash: newForm.hash } }) this.$router.push({ name: 'edit', params: { hash: newForm.hash } })
} catch (error) { } catch (error) {
showError(t('forms', 'Unable to create a new form')) showError(t('forms', 'Unable to create a new form'))