+<link rel="import"href="../../bower_components/polymer/polymer.html"><link rel="import"href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html"><link rel="import"href="../../bower_components/lite-signal/lite-signal.html"><link rel="import"href="../yp-behaviors/yp-language-behavior.html"><link rel="import"href="../yp-behaviors/access-helpers.html"><link rel="import"href="../yp-ajax/yp-ajax.html"><link rel="import"href="../yp-edit-dialog/yp-edit-dialog.html"><link rel="import"href="../yp-edit-dialog/yp-edit-dialog-behavior.html"><body><dom-module id="yp-duplicate-collection"><template><style include="iron-flex iron-flex-alignment">.additionalSettings{padding-top:16px;}paper-textarea{padding-top:16px;}.groupName{cursor:pointer;}</style><lite-signal on-lite-signal-yp-language="_languageEvent"></lite-signal><yp-edit-dialog id="editDialog"title="[[editHeaderText]]"icon="language"confirmation-text="[[t('close')]]"action="[[action]]"method="[[method]]"params="[[params]]"save-text="[[saveText]]"toast-text="[[toastText]]"><div class="layout horizontal center-center"><yp-ajax method="GET"id="getAvailableGroupsAjax"url="/api/users/available/groups"on-response="_getGroupsResponse"></yp-ajax><yp-ajax method="PUT"id="duplicatCollectionAjax"on-response="_duplicatCollectionResponse"></yp-ajax><yp-ajax method="PUT"id="duplicatCollectionProgressAjax"on-response="_duplicatCollectionProgressResponse"></yp-ajax></div></yp-edit-dialog></template></dom-module><script>Polymer({is:"yp-duplicate-collection",behaviors:[Polymer.ypLanguageBehavior,Polymer.ypEditDialogBehavior,Polymer.AccessHelpers,Polymer.ypPostMoveBehavior],properties:{action:{type:String,value:"/api/posts"},post:{type:Object},selectedGroupId:Number},_selectGroup:function(t){this.set("selectedGroupId",t.target.getAttribute("data-args"));var e=t.target.getAttribute("data-args-name");Polymer.dom(document).querySelector("yp-app").getDialogAsync("confirmationDialog",function(t){t.open(this.t("post.confirmMove")+' "'+this.post.name+'" '+this.t("to")+' "'+e+'"',this._reallyMove.bind(this))}.bind(this))},_reallyMove:function(){this.$.movePostAjax.url="/api/posts/"+this.post.id+"/"+this.selectedGroupId+"/move",this.$.movePostAjax.body={},this.$.movePostAjax.generateRequest()},_movePostResponse:function(){location.reload()},_clear:function(){this.set("selectedGroupId",null),this.set("post",null)},setupAndOpen:function(t,e){this.set("post",t),this.set("refreshFunction",e),this._setupTranslation(),this.$.getAvailableGroupsAjax.generateRequest(),this.open()},_setupTranslation:function(){this.set("editHeaderText",this.t("post.move")),this.set("toastText",this.t("post.haveMovedPost")),this.set("saveText",this.t("post.move"))}})</script>
0 commit comments