Correct fix window title
Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
This commit is contained in:
parent
a3079b5008
commit
3c973b101d
|
@ -19,14 +19,17 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {
|
/**
|
||||||
methods: {
|
* Set the Window-Title to current FormTitle including suffix.
|
||||||
setWindowTitle(formTitle) {
|
*
|
||||||
if (formTitle === '') {
|
* @param {String} formTitle Title of current form to set on window.
|
||||||
window.document.title = t('forms', 'Forms') + ' - ' + OC.theme.title
|
*/
|
||||||
} else {
|
const SetWindowTitle = function(formTitle) {
|
||||||
window.document.title = formTitle + ' - ' + t('forms', 'Forms') + ' - ' + OC.theme.title
|
if (formTitle === '') {
|
||||||
}
|
window.document.title = t('forms', 'Forms') + ' - ' + OC.theme.title
|
||||||
},
|
} else {
|
||||||
},
|
window.document.title = formTitle + ' - ' + t('forms', 'Forms') + ' - ' + OC.theme.title
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default SetWindowTitle
|
|
@ -137,7 +137,7 @@ import QuestionMultiple from '../components/Questions/QuestionMultiple'
|
||||||
import QuestionShort from '../components/Questions/QuestionShort'
|
import QuestionShort from '../components/Questions/QuestionShort'
|
||||||
import TopBar from '../components/TopBar'
|
import TopBar from '../components/TopBar'
|
||||||
import ViewsMixin from '../mixins/ViewsMixin'
|
import ViewsMixin from '../mixins/ViewsMixin'
|
||||||
import WindowTitleMixin from '../mixins/WindowTitleMixin'
|
import SetWindowTitle from '../utils/SetWindowTitle'
|
||||||
|
|
||||||
window.axios = axios
|
window.axios = axios
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ export default {
|
||||||
TopBar,
|
TopBar,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [ViewsMixin, WindowTitleMixin],
|
mixins: [ViewsMixin],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -175,13 +175,17 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
title() {
|
/**
|
||||||
if (this.form.title === '') {
|
* Return form title, or placeholder if not set
|
||||||
return t('forms', 'Create new form')
|
* @returns {string}
|
||||||
} else {
|
*/
|
||||||
|
formTitle() {
|
||||||
|
if (this.form.title) {
|
||||||
return this.form.title
|
return this.form.title
|
||||||
}
|
}
|
||||||
|
return t('forms', 'New form')
|
||||||
},
|
},
|
||||||
|
|
||||||
hasQuestions() {
|
hasQuestions() {
|
||||||
return this.form.questions && this.form.questions.length === 0
|
return this.form.questions && this.form.questions.length === 0
|
||||||
},
|
},
|
||||||
|
@ -206,13 +210,13 @@ export default {
|
||||||
|
|
||||||
// Update Window-Title on title change
|
// Update Window-Title on title change
|
||||||
'form.title': function() {
|
'form.title': function() {
|
||||||
this.setWindowTitle(this.form.title)
|
SetWindowTitle(this.formTitle)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.fetchFullForm(this.form.id)
|
this.fetchFullForm(this.form.id)
|
||||||
this.setWindowTitle(this.form.title)
|
SetWindowTitle(this.formTitle)
|
||||||
},
|
},
|
||||||
|
|
||||||
updated() {
|
updated() {
|
||||||
|
|
|
@ -96,7 +96,7 @@ import EmptyContent from '../components/EmptyContent'
|
||||||
import Submission from '../components/Results/Submission'
|
import Submission from '../components/Results/Submission'
|
||||||
import TopBar from '../components/TopBar'
|
import TopBar from '../components/TopBar'
|
||||||
import ViewsMixin from '../mixins/ViewsMixin'
|
import ViewsMixin from '../mixins/ViewsMixin'
|
||||||
import WindowTitleMixin from '../mixins/WindowTitleMixin'
|
import SetWindowTitle from '../utils/SetWindowTitle'
|
||||||
|
|
||||||
Vue.use(Clipboard)
|
Vue.use(Clipboard)
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ export default {
|
||||||
TopBar,
|
TopBar,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [ViewsMixin, WindowTitleMixin],
|
mixins: [ViewsMixin],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -141,7 +141,7 @@ export default {
|
||||||
|
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.loadFormResults()
|
this.loadFormResults()
|
||||||
this.setWindowTitle(this.form.title)
|
SetWindowTitle(this.formTitle)
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -85,7 +85,7 @@ import Question from '../components/Questions/Question'
|
||||||
import QuestionLong from '../components/Questions/QuestionLong'
|
import QuestionLong from '../components/Questions/QuestionLong'
|
||||||
import QuestionShort from '../components/Questions/QuestionShort'
|
import QuestionShort from '../components/Questions/QuestionShort'
|
||||||
import QuestionMultiple from '../components/Questions/QuestionMultiple'
|
import QuestionMultiple from '../components/Questions/QuestionMultiple'
|
||||||
import WindowTitleMixin from '../mixins/WindowTitleMixin'
|
import SetWindowTitle from '../utils/SetWindowTitle'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Submit',
|
name: 'Submit',
|
||||||
|
@ -100,8 +100,6 @@ export default {
|
||||||
QuestionMultiple,
|
QuestionMultiple,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [WindowTitleMixin],
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: loadState('forms', 'form'),
|
form: loadState('forms', 'form'),
|
||||||
|
@ -152,7 +150,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.setWindowTitle(this.form.title)
|
SetWindowTitle(this.formTitle)
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in a new issue