All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertigo.ui.static.js.v-components.v-comments.js Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
Vue.component('v-comments', {
	template : 
''
+'	'
+'		{{count}}'
+'	'
+'	'
+'		'
+'			{{$q.lang.vui.comments.title}}'
+'			'
+'      		'
+'				'
+'      	'
+'			'
+'          '
+'    			 '
+'    			'
+'					{{comment.authorDisplayName}}'
+'					
' +' {{comment.msg}}' +'
' +'
' +' ' +' {{toDelay(new Date(comment.creationDate))}}' +' ' +' ' +' ' +' ' +' ' +'
' +'
' +'
' +'
' , props : { concept : { type: String }, id : { type: String }, icon : { type: String, 'default': 'comment' }, iconNone : { type: String, 'default': 'add_comment' }, baseUrl : { type: String, 'default': '/api/', required:true }, connectedAccount : { type: String } }, data: function() { return { list: [], count: 0, commentDrawer: false, commentTextArea :"" } }, created: function() { this.fetchCommentsList(); }, methods: { fetchCommentsList: function() { this.$http.get(this.baseUrl+'x/comment/api/comments?concept='+this.concept+'&id='+this.id) .then( function (response) { //Ok this.list = response.body; this.count = this.list.length; }); }, publishComment: function() { var newComment = { msg : this.commentTextArea }; if (newComment.msg){ newComment.concept = this.concept; newComment.id = this.id; this.$http.post(this.baseUrl+'x/comment/api/comments?concept='+this.concept+'&id='+this.id, newComment) .then( function (response) { //Ok this.commentTextArea = ''; this.fetchCommentsList(); }); } }, updateComment: function(newComment) { this.$http.put(this.baseUrl+'x/comment/api/comments/'+newComment.uuid, newComment) .then( function (response) { //Ok this.commentTextArea = ''; this.fetchCommentsList(); }); }, toDelay : function(creationDate) { let diff = Quasar.utils.date.getDateDiff(Date.now(),creationDate, 'days'); if(diff>0) return diff+' days'; diff = Quasar.utils.date.getDateDiff(Date.now(),creationDate, 'hours'); if(diff>0) return diff+' hours'; diff = Quasar.utils.date.getDateDiff(Date.now(),creationDate, 'minutes'); if(diff>0) return diff+' min'; return 'Now'; } }, })




© 2015 - 2025 Weber Informatics LLC | Privacy Policy