diff --git a/dist/index.html b/dist/index.html index 2bcf465..a5bc5bc 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,3 +1,3 @@ -Dialoga Brasil
Dialoga Brasil
\ No newline at end of file +
\ No newline at end of file diff --git a/dist/scripts/app-2f7926a81e.js b/dist/scripts/app-2f7926a81e.js new file mode 100644 index 0000000..ed02ddd --- /dev/null +++ b/dist/scripts/app-2f7926a81e.js @@ -0,0 +1,5 @@ +!function(){"use strict";angular.module("dialoga",["ngAnimate","ngCookies","ngTouch","ngSanitize","ui.router","ngStorage","720kb.socialshare","slugifier","ncy-angular-breadcrumb","ngMessages"])}(),function(){"use strict";function a(a,e,o,s,r){var t=this;t.DialogaService=a,t.$scope=e,t.$location=o,t.$filter=s,t.$log=r,t.init(),t.loadData(),r.debug("RankingPageController")}angular.module("dialoga").controller("RankingPageController",a),a.$inject=["DialogaService","$scope","$location","$filter","$log"],a.prototype.init=function(){var a=this;a.page=1,a.per_page=20,a.themes=null,a.selectedTheme=null,a.filtredPrograms=null,a.selectedProgram=null,a.proposals=null,a.filtredProposals=null,a.query=null,a.search=a.$location.search(),a.loading=null,a.error=null},a.prototype.loadData=function(){var a=this;a.loading=!0,a.loadingThemes=!0,a.DialogaService.getThemes(function(e){a.themes=e,a.loadingThemes=!1;var o=null;if(a.search.tema){var s=a.themes.filter(function(e){return e.slug===a.search.tema});s&&s.length>0&&(o=s[0],a.selectedTheme=o)}o||(a.selectedTheme=a.themes[Math.floor(Math.random()*a.themes.length)]);var r=a.selectedTheme.id;a.loadPrograms(r,function(){a.loadProposals(),a.loading=!1})},function(e){a.error=e,a.$log.error(e),a.loadingThemes=!1,a.loading=!1})},a.prototype.loadPrograms=function(a,e){var o=this;o.DialogaService.getProgramsByThemeId(a,function(a){o.filtredPrograms=a;var s=null;if(o.search.programa){var r=o.filtredPrograms.filter(function(a){return a.slug===o.search.programa});r&&r.length>0&&(s=r[0],o.selectedProgram=s)}s||(o.selectedProgram=o.filtredPrograms[Math.floor(Math.random()*o.filtredPrograms.length)]),e&&e()},function(a){o.$log.error(a),e&&e()})},a.prototype.loadProposals=function(){var a=this;a.loadingProposals=!0,a.DialogaService.getProposals({page:a.page,per_page:a.per_page},function(e){a.proposals=e.articles,a.filtredProposals=a.proposals,a.loadingProposals=!1,a.attachListeners()},function(e){a.error=e,a.$log.error(e),a.loadingProposals=!1})},a.prototype.attachListeners=function(){var a=this;a.$scope.$on("change-selectedCategory",function(e,o){a.selectedTheme=o}),a.$scope.$watch("pageRanking.selectedTheme",function(e){a.search.tema=e?e.slug:null,a.$location.search("tema",a.search.tema),a.selectedTheme&&a.selectedTheme.id&&a.loadPrograms(a.selectedTheme.id,function(){a.filterProposals()})}),a.$scope.$on("change-selectedTopic",function(e,o){a.selectedProgram=o}),a.$scope.$watch("pageRanking.selectedProgram",function(e){a.search.programa=e?e.slug:null,a.$location.search("programa",a.search.programa),a.filterProposals()}),a.$scope.$watch("pageRanking.query",function(e){a.search.filtro=e?e:null,a.$location.search("filtro",a.search.filtro),a.filterProposals()})},a.prototype.resetFilterValues=function(){var a=this;a.query=null,a.selectedTheme=null},a.prototype.changePage=function(a){var e=this;e.page=a,e.filterProposals(a)},a.prototype.filterProposals=function(a,e){var o=this;if(o.loadingProposals)return void o.$log.debug("Content is not loaded yet.");var s=a||o.page,r=e||o.per_page,t=o.query,i=o.selectedProgram;if(i){var l={page:s,per_page:r,parent_id:i.id};t&&(l.query=t),o.loadingProposals=!0,o.DialogaService.searchProposals(l,function(a){o.total_proposals=parseInt(a._obj.headers("total")),o.filtredProposals=a.articles,o.loadingProposals=!1},function(a){o.error=a,o.$log.error(a),o.loadingProposals=!1})}else o.filtredProposals=[]}}(),function(){"use strict";function a(a,e,o,s,r){var t=this;t.DialogaService=a,t.$scope=e,t.$location=o,t.$filter=s,t.$log=r,t.init(),t.loadData(),r.debug("PropostasPageController")}angular.module("dialoga").controller("PropostasPageController",a),a.$inject=["DialogaService","$scope","$location","$filter","$log"],a.prototype.init=function(){var a=this;a.themes=null,a.selectedTheme=null,a.filtredPrograms=null,a.selectedProgram=null,a.proposals=null,a.filtredProposals=null,a.query=null,a.search=a.$location.search(),a.loading=null,a.error=null},a.prototype.loadData=function(){var a=this;a.loading=!0,a.loadingThemes=!0,a.DialogaService.getThemes(function(e){a.themes=e,a.loadingThemes=!1,a.loading=!1,a.loadProposals(function(){a.attachListeners()})},function(e){a.error=e,a.$log.error(e),a.loadingThemes=!1,a.loading=!1})},a.prototype.loadProposals=function(a){var e=this;e.loadingProposals=!0,e.DialogaService.getProposals({},function(o){e.proposals=o.articles,e.filtredProposals=e.proposals,e.loadingProposals=!1,e.loading=!1,a&&a()},function(a){e.error=a,e.$log.error(a),e.loadingProposals=!1,e.loading=!1})},a.prototype.attachListeners=function(){var a=this;a.$scope.$on("change-selectedCategory",function(e,o){a.selectedTheme=o}),a.$scope.$watch("pagePropostas.selectedTheme",function(e){a.search.tema=e?e.slug:null,a.$location.search("tema",a.search.tema),a.filtredProposals=a.getFiltredProposals()}),a.$scope.$on("change-selectedTopic",function(e,o){a.selectedProgram=o}),a.$scope.$watch("pagePropostas.selectedProgram",function(e){a.search.programa=e?e.slug:null,a.$location.search("programa",a.search.programa),a.filtredProposals=a.getFiltredProposals()}),a.$scope.$watch("pagePropostas.query",function(e){a.search.filtro=e?e:null,a.$location.search("filtro",a.search.filtro),a.filtredProposals=a.getFiltredProposals()})},a.prototype.resetFilterValues=function(){var a=this;a.query=null,a.selectedTheme=null},a.prototype.getFiltredProposals=function(){var a=this;if(!a.proposals)return a.$log.info("No proposals loaded yet. Abort."),null;var e=a.proposals,o=e,s=a.query,r=a.selectedTheme,t=a.selectedProgram,i=a.$filter("filter");return r&&(o=a.DialogaService.filterProposalsByCategorySlug(o,r.slug)),t&&(o=a.DialogaService.filterProposalsByProgramId(o,t.id)),s&&(o=i(o,s,!1)),o}}(),function(){"use strict";function a(a,e,o,s,r,t){var i=this;i.DialogaService=a,i.$scope=e,i.$rootScope=o,i.$location=s,i.$filter=r,i.$log=t,i.init(),i.loadData(),i.attachListeners(),i.$rootScope.focusMainContent(),i.$log.debug("ProgramasPageController")}angular.module("dialoga").controller("ProgramasPageController",a),a.$inject=["DialogaService","$scope","$rootScope","$location","$filter","$log"],a.prototype.init=function(){var a=this;a.themes=null,a.selectedTheme=null,a.programs=null,a.filtredPrograms=null,a.query=null,a.search=a.$location.search(),a.search.tema&&(a._filtredByThemeSlug=a.search.tema),a.search.filtro&&(a._filtredByQuery=a.search.filtro),(a.search.tema||a.search.filtro)&&(a.loadingFilter=!0),a.loading=null,a.error=null},a.prototype.loadData=function(){var a=this;a.loading=!0,a.loadingPrograms=!0,a.DialogaService.getPrograms(function(e){a.programs=e,a.filtredPrograms=a.programs,a.loadingPrograms=!1,a.filter()},function(e){a.error=e,a.$log.error(e),a.loadingPrograms=!1}),a.loadingThemes=!0,a.DialogaService.getThemes(function(e){a.themes=e,a.loadingThemes=!1,a.filter()},function(e){a.error=e,a.$log.error(e),a.loadingThemes=!1})},a.prototype.attachListeners=function(){var a=this;a.$scope.$on("change-selectedCategory",function(e,o){a.selectedTheme=o,a.$log.debug("vm.selectedTheme",a.selectedTheme)}),a.$scope.$watch("pageProgramas.selectedTheme",function(e){a.search.tema=e?e.slug:null,a.$location.search("tema",a.search.tema),a.loadingFilter||(a.filtredPrograms=a.getFiltredPrograms())}),a.$scope.$watch("pageProgramas.query",function(e){a.search.filtro=e?e:null,a.$location.search("filtro",a.search.filtro),a.loadingFilter||(a.filtredPrograms=a.getFiltredPrograms())})},a.prototype.filter=function(){var a=this;if(a.loadingThemes||a.loadingPrograms)return void a.$log.info("No programs or themes loaded yet. Abort.");if(a._filtredByThemeSlug){var e=a._filtredByThemeSlug;a.DialogaService.getThemeBySlug(e,function(e){a.selectedTheme=e},function(e){a.$log.error('Error when try to "getThemeBySlug"',e)})}a._filtredByQuery&&(a.query=a._filtredByQuery),(a._filtredByThemeSlug||a._filtredByQuery)&&(a.filtredPrograms=a.getFiltredPrograms(),a.loadingFilter=!1)},a.prototype.showAllPrograms=function(a){var e=this;a.stopPropagation(),e.resetFilterValues(),e._showAllFlag=!0,e.filtredPrograms=e.getFiltredPrograms()},a.prototype.resetFilterValues=function(){var a=this;a.query=null,a.selectedTheme=null},a.prototype.getFiltredPrograms=function(){var a=this;if(!a.programs)return a.$log.info("No programs loaded yet. Abort."),null;var e=a.programs,o=e,s=a.query,r=a.selectedTheme,t=a.$filter("filter");return r&&(o=a._filterByCategory(o,r)),s&&(o=t(o,s,!1)),s||r||!a._showAllFlag||(o=a._balanceByCategory(o)),o},a.prototype._filterByCategory=function(a,e){var o=this;if(a=a||[],!e)return a;for(var s=[],r=0;r0)){var d=n.pop();o.push(d),p=!0}p||(c=!1)}return o}}(),function(){"use strict";function a(a,e,o,s,r,t,i,l,n,c,p,d){var g=this;g.DialogaService=a,g.PATH=e,g.VOTE_OPTIONS=o,g.PROPOSAL_STATUS=s,g.$state=r,g.$location=t,g.$scope=i,g.$rootScope=l,g.$element=n,g.$timeout=c,g.$sce=p,g.$log=d,g.init(),g.loadData(),g.attachListeners(),g.$rootScope.focusMainContent(),g.$log.debug("ProgramaPageController")}angular.module("dialoga").controller("ProgramaPageController",a),a.$inject=["DialogaService","PATH","VOTE_OPTIONS","PROPOSAL_STATUS","$state","$location","$scope","$rootScope","$element","$timeout","$sce","$log"],a.prototype.init=function(){var a=this;a.article=null,a.category=null,a.loading=null,a.loadingTopProposals=null,a.loadingProposalBox=null,a.sendProposalRedirectURI=null,a.search=a.$location.search(),a.error=!1},a.prototype.loadData=function(){var a=this;a.loading=!0,a.proposalStatus=null;var e=a.$state.params.slug;e||(a.$log.error("slug not defined."),a.$log.info("Rollback to home page."),a.$state.go("inicio",{},{location:!0})),a.DialogaService.getProgramBySlug(e,function(o){a.article=o,a.category=a.article.categories[0],a.sendProposalRedirectURI="state=programa&task=send-proposal&slug="+e,a.$rootScope.contentTitle=a.article.title,!a.banner&&a.article.image&&(a.banner={src:a.PATH.image+a.article.image.url,alt:"Imagem de destaque do conteúdo"}),a.article.body&&!a.article.bodyTrusted&&(a.article.bodyTrusted=a.$sce.trustAsHtml(a.article.body)),a.loadingTopProposals=!0,a.DialogaService.getProposalsByTopicId(a.article.id,{},function(e){a.proposals=e.articles,a.proposalsTopFive=a.proposals.slice(0,5),a.proposalsTopRated=a.proposals.slice(0,3),a.loadingTopProposals=!1},function(e){a.$log.error(e),a.loadingTopProposals=!1}),a.loadingProposalBox=!0,a.search.proposal_id?a.loadProposalById(a.search.proposal_id):a.loadRandomProposal(),a.loading=!1},function(e){a.$log.error(e),a.error=e,a.loading=!1})},a.prototype.attachListeners=function(){var a=this;a.$scope.$on("proposal-carousel:showProposalsList",function(){a.showProposalsList()}),a.$scope.$on("cadastro-proposa:startSendProposal",function(e,o){a.proposalStatus=a.PROPOSAL_STATUS.SENDING,a.DialogaService.createProposal(o,a.article.id,function(e){a.$log.debug("response",e),a.proposalStatus=a.PROPOSAL_STATUS.SUCCESS},function(e){a.$log.error(e),a.error=e,400===a.error.code&&(a.error.message="",a.error.message+="Não foi possível enviar a proposta.
",a.error.message+="Este problema já foi registrado em nossos servidores.
",a.error.message+="Por favor, tente novamente mais tarde."),a.proposalStatus=a.PROPOSAL_STATUS.ERROR})}),a.$scope.$on("proposal-box:vote",function(e,o){var s=o.proposal_id,r=o.OPTION;switch(r){case a.VOTE_OPTIONS.UP:case a.VOTE_OPTIONS.DOWN:case a.VOTE_OPTIONS.SKIP:a.vote(s,r);break;default:a.$log.error("Vote option not handled:",r)}})},a.prototype.loadProposalById=function(a){var e=this;e.DialogaService.getProposalById(a,{limit:"1"},e._handleSuccessOnGetProposal.bind(e),e._handleErrorOnGetProposal.bind(e))},a.prototype.loadRandomProposal=function(){var a=this;a.DialogaService.getProposalsByTopicId(a.article.id,{order:"random()",limit:"1"},a._handleSuccessOnGetProposal.bind(a),a._handleErrorOnGetProposal.bind(a))},a.prototype._handleSuccessOnGetProposal=function(a){var e=this;if(a&&a.articles){var o=a.articles.length;e.randomProposal=a.articles[Math.floor(Math.random()*o)],e.loadingProposalBox=!1,e.$scope.$broadcast("proposal-box:proposal-loaded",{success:!0})}e.search.proposal_id&&e.$timeout(function(){var a=angular.element(".focused-proposal");a&&a.length>0&&angular.element("body").animate({scrollTop:a.offset().top},"fast")},300)},a.prototype._handleErrorOnGetProposal=function(a){var e=this;e.$log.error(a),e.$scope.$broadcast("proposal-box:proposal-loaded",{error:!0})},a.prototype.voteSkip=function(){var a=this;a.loadRandomProposal()},a.prototype.vote=function(a,e){var o=this;return e===o.VOTE_OPTIONS.SKIP?void o.voteSkip():void(o.$rootScope.currentUser&&o.DialogaService.voteProposal(a,{value:e},function(a){o.$log.debug("response",a),a.success=!0,o.$scope.$broadcast("proposal-box:vote-response",a)},function(a){o.$log.error("error",a),a.error=!0,o.$scope.$broadcast("proposal-box:vote-response",a)}))},a.prototype.voteHasBeenComputed=function(){},a.prototype.showProposalsList=function(){var a=this;a.findAndShow("#section-proposal-list")},a.prototype.hideProposalsList=function(){var a=this;a.findAndHide("#section-proposal-list")},a.prototype.showProposalForm=function(){var a=this;a.findAndShow("#section-proposal-form")},a.prototype.hideProposalForm=function(){var a=this;a.findAndHide("#section-proposal-form")},a.prototype.findAndShow=function(a){var e=this,o=e.$element.find(a);o.slideDown(),angular.element("body").animate({scrollTop:o.offset().top},"fast")},a.prototype.findAndHide=function(a){var e=this;e.$element.find(a).slideUp()},a.prototype.sendAnotherProposal=function(){var a=this;a.proposalStatus=null}}(),function(){"use strict";function a(a,e,o,s){var r=this;r.DialogaService=a,r.$log=s,r.init(),r.loadData(),r.$log.debug("SitemapPageController")}function e(a){for(var e={},o=a.length,s=0;o>s;s++){var r=a[s],t=r.categories[0],i=e[t.slug]||{};angular.isArray(i.programs)||(i=t,i.programs=[],e[i.slug]=i),i.programs.push(r)}return e}angular.module("dialoga").controller("SitemapPageController",a),a.$inject=["DialogaService","$state","$sce","$log"],a.prototype.init=function(){var a=this;a.programsPerThemes=null},a.prototype.loadData=function(){var a=this;a.DialogaService.getPrograms(function(o){a.programsPerThemes=e(o)},function(e){a.error=e,a.$log.error(e)})}}(),function(){"use strict";function a(a,e,o,s,r,t){var i=this;i.DialogaService=a,i.$scope=e,i.$location=o,i.$filter=s,i.$sce=r,i.$log=t,i.init(),i.loadData(),i.attachListeners(),i.$log.debug("InicioPageController")}function e(a){for(var e=[],o={},s=0;s0)){var p=l.pop();e.push(p),c=!0}c||(n=!1)}return e}function o(){var a=document.createElement("script");a.src="https://www.youtube.com/iframe_api";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}function s(){var a=angular.element.find(".js-iframe iframe"),e=window.YT.Player;new e(a[0],{events:{onReady:r}})}function r(a){a.target.playVideo(),t(1e3)}function t(a){var e=angular.element.find(".video-background");angular.element(e).fadeOut(a||100)}angular.module("dialoga").controller("InicioPageController",a),a.$inject=["DialogaService","$scope","$location","$filter","$sce","$log"],a.prototype.init=function(){var a=this;a.article=null,a.events=null,a.featuredEvent=null,a.themes=null,a.selectedTheme=null,a.programs=null,a.filtredPrograms=null,a.query=null,a.search=a.$location.search(),a.search.tema&&(a._filtredByThemeSlug=a.search.tema),a.search.filtro&&(a._filtredByQuery=a.search.filtro),(a.search.tema||a.search.filtro)&&(a.loadingFilter=!0),a.loading=null,a.error=null},a.prototype.loadData=function(){function a(){e.loadingThemes=!0,e.DialogaService.getThemes(function(a){e.themes=a,e.loadingThemes=!1,e.filter()},function(a){e.$log.error("Error on getThemes.",a),e.loadingThemes=!1,e.errorThemes=a}),e.loadingPrograms=!0,e.DialogaService.getProgramsRandom({},function(a){e.programs=e.article.children,e.filtredPrograms=a.articles,e.loadingPrograms=!1,e.filter()},function(a){e.$log.error("Error on getPrograms.",a),e.loadingPrograms=!1,e.errorPrograms=a})}var e=this;e.loading=!0,e.DialogaService.getHome(function(o){e.article=o.article,e.article.videoIsLoaded&&t(2e3),a(),e.loading=!1},function(a){e.$log.error("Error on getHome.",a),e.loading=!1,e.error=a}),e.loadingEvents=!0,e.DialogaService.getEvents({},function(a){e.events=a,e.loadingEvents=!1},function(a){e.$log.error("Error on getEvents.",a),e.loadingEvents=!1,e.eventsError=a})},a.prototype.attachListeners=function(){var a=this;a.$scope.$on("change-selectedCategory",function(e,o){a.selectedTheme=o}),a.$scope.$watch("pageInicio.selectedTheme",function(e){a.search.tema=e?e.slug:null,a.$location.search("tema",a.search.tema),a.loadingFilter||(a.filtredPrograms=a.getFiltredPrograms())}),a.$scope.$watch("pageInicio.query",function(e){a.search.filtro=e?e:null,a.$location.search("filtro",a.search.filtro),a.loadingFilter||(a.filtredPrograms=a.getFiltredPrograms())})},a.prototype.showVideo=function(){var a=this;return a.article.videoIsLoaded?(t(0),void a.$log.debug("The content already cached. Show-it!")):(o(),window.onYouTubeIframeAPIReady=window.onYouTubeIframeAPIReady||s,window.onYouTubePlayerReady=window.onYouTubePlayerReady||r,void(a.article.videoIsLoaded=!0))},a.prototype.submitSearch=function(){var a=this;a.loadingFilter=!0;var e=angular.element("#search-result");e&&e.length>0?(angular.element("body").animate({scrollTop:e.offset().top},"fast"),a.filtredPrograms=a.getFiltredPrograms()):a.$log.warn("#search-result element not found.")},a.prototype.filter=function(){var a=this;if(a.loadingThemes||a.loadingPrograms)return void a.$log.info("No programs or themes loaded yet. Abort.");if(a._filtredByThemeSlug){var e=a._filtredByThemeSlug;a.DialogaService.getThemeBySlug(e,function(e){a.selectedTheme=e},function(e){a.$log.error('Error when try to "getThemeBySlug"',e)})}a._filtredByQuery&&(a.query=a._filtredByQuery),(a._filtredByThemeSlug||a._filtredByQuery)&&(a.filtredPrograms=a.getFiltredPrograms(),a.loadingFilter=!1)},a.prototype.showAllPrograms=function(a){var e=this;a.stopPropagation(),e.resetFilterValues(),e.filtredPrograms=e.getFiltredPrograms()},a.prototype.resetFilterValues=function(){var a=this;a.query=null,a.selectedTheme=null},a.prototype.getFiltredPrograms=function(){var a=this;if(!a.programs)return a.$log.debug("No programs loaded yet. Abort."),null;var o=a.programs,s=o,r=a.query,t=a.selectedTheme,i=a.$filter("filter");return a.loadingFilter=!0,t&&(s=a._filterByCategory(s,t)),r&&(s=i(s,r,!1)),r||t||(s=e(s)),a.loadingFilter=!1,s},a.prototype._filterByCategory=function(a,e){var o=this;if(a=a||[],!e)return a;for(var s=[],r=0;r0&&(a.params=JSON.parse('{"'+decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'),a.hasRedirect=!0),a.currentUser=a.Session.getCurrentUser(),a.$scope.$on(a.AUTH_EVENTS.loginSuccess,function(){a.currentUser=a.Session.getCurrentUser()}),a.$scope.$on(a.AUTH_EVENTS.logoutSuccess,function(){a.currentUser=a.Session.getCurrentUser()})},a.prototype.loadData=function(){var a=this;a.loadingTerms=!0,a.DialogaService.getTerms(function(e){a.loadingTerms=!1,a.terms=e.article},function(e){a.loadingTerms=!1,a.error=e})},a.prototype.attachListeners=function(){var a=this;a.$scope.$on(a.AUTH_EVENTS.registerSuccess,function(e,o){a.$log.debug("TODO: handle register success"),a.$log.debug("[register success] response",o)}),a.$scope.$on(a.AUTH_EVENTS.registerFailed,function(e,o){a.$log.debug("TODO: handle register error"),a.$log.debug("[register error] response",o);var s=o.data.message;a.errorMessage=s}),a.$scope.$on("oauthClientPluginResult",function(e,o){a.$log.debug("response",o)});var e=null;e=a.$interval(function(){var o=angular.element("#serpro_captcha");o&&o.length>0&&(a.$window.initCaptcha(o[0]),a.$interval.cancel(e),e=void 0)},200)},a.prototype.onClickLogout=function(){var a=this;a.AuthService.logout()},a.prototype.submitSignup=function(a,e){var o=this,s=a.target,r=angular.element(s),t=r.find('[name="txtToken_captcha_serpro_gov_br"]');e.txtToken_captcha_serpro_gov_br=t.val(),o.AuthService.register(e).then(function(a){o.$log.debug("register success.response",a),o.messageTitle="Cadastro efetuado com sucesso!",o.successMessage="Verifique seu e-mail para confirmar o cadastro.",o.redirectBack()},function(a){o.$log.debug("register error.response",a);var e=a.data.message;o.errorMessage=e,500===a.data.code&&(o.internalError=!0)})},a.prototype.submitSignin=function(a){var e=this;e.AuthService.login(a).then(function(a){e.$log.debug("user",a),e.successMessage="Login efetuado com sucesso!",e.redirectBack()},function(){})},a.prototype.submitRecover=function(a,e){var o=this,s={login:e.login.$modelValue,captcha_text:e.captcha_text.$modelValue},r=a.target,t=angular.element(r),i=t.find('[name="txtToken_captcha_serpro_gov_br"]');s.txtToken_captcha_serpro_gov_br=i.val(),o.AuthService.forgotPassword(s).then(function(a){o.$log.debug("recover success.response",a),o.successRecoverMessageTitle="Pedido enviado sucesso!",o.successRecoverMessage="Verifique seu e-mail. Em instantes você receberá um e-mail com um link para redefinir sua senha."},function(a){o.$log.debug("recover error.response",a);var e=a.data.message;o.errorRecoverMessage=e,500===a.data.code&&(o.internalError=!0)})["catch"](function(a){o.$log.debug("recover catch.error",a)})},a.prototype.redirectBack=function(){var a=this;if(!a.hasRedirect)return void a.$log.debug("No redirect params defined.");a.countdown=a.delay;var e=null;e=a.$interval(function(){a.countdown--,a.countdown<=0&&(a.$interval.cancel(e),e=void 0)},1e3),a.$timeout(function(){var e=a.params.state;switch(e){case"inicio":a.$state.go(e,{event_id:a.params.event_id,task:a.params.task});break;case"programa":a.$state.go(e,{slug:a.params.slug,task:a.params.task,proposal_id:a.params.proposal_id});break;default:a.$log.debug("State not handled yet:",e)}},1e3*a.delay)},a.prototype.authWithFacebook=function(){var a=this,e="http://hom.login.dialoga.gov.br/plugin/oauth_client/facebook?oauth_client_popup=true&id="+a.APP.facebook_app_id;a.$window.oauthClientAction(e)},a.prototype.authWithGooglePlus=function(){var a=this,e="http://hom.login.dialoga.gov.br/plugin/oauth_client/google_oauth2?oauth_client_popup=true&id="+a.APP.goople_app_id;a.$window.oauthClientAction(e)}}(),function(){"use strict";function a(a,e,o,s,r){var t=this;t.DialogaService=a,t.$rootScope=e,t.$state=o,t.$sce=s,t.$log=r,t.init(),t.loadData(),t.$rootScope.focusMainContent(),t.$log.debug("ArticlePageController")}angular.module("dialoga").controller("ArticlePageController",a),a.$inject=["DialogaService","$rootScope","$state","$sce","$log"],a.prototype.init=function(){var a=this;a.page=a.$state.current.name,a.article=null,a.loading=!0,a.$log.debug("vm.page",a.page)},a.prototype.loadData=function(){function a(a){o.loading=!1,o.article=a.article}function e(a){o.loading=!1,o.error=a}var o=this;switch(o.page){case"sobre":o.DialogaService.getAbout(a,e);break;case"termos-de-uso":o.DialogaService.getTerms(a,e);break;default:o.$log.debug("Page not handled:",o.page)}}}(),function(){"use strict";function a(){function a(a){a.debug("validationMessagesController");var e=this;e.$log=a,e.init()}a.$inject=["$log"],a.prototype.init=function(){var a=this;a.required||(a.required="Ops, o campo é obrigatório."),a.minlength||(a.minlength="O campo deve ser maior."),a.maxlength||(a.maxlength="O campo deve ser menor"),a.email||(a.email="O endereço de e-mail deve ser válido")};var e={restrict:"E",templateUrl:"app/components/validation-messages/validation-messages.html",scope:{field:"=",required:"=",minlength:"=",maxlength:"=",email:"="},controller:a,controllerAs:"vm",bindToController:!0};return e}angular.module("dialoga").directive("validationMessages",a)}(),function(){"use strict";function a(a,e,o){function s(e,o){return a.get(e,o).then(t)["catch"](i)}function r(e,o){return a.post(e,o).then(t)["catch"](i)}function t(a){return o.debug("[SUCCESS]",a),a.data._obj=a,a.data}function i(a){return o.debug("[ERROR]",a),o.error("XHR Failed on Service.\n"+angular.toJson(a.data,!0)),e.reject(angular.isObject(a.data)?a.data:"An unknown error occurred.")}o.debug("UtilService");var l={get:s,post:r,handleSuccess:t,handleError:i};return l}angular.module("dialoga").factory("UtilService",a),a.$inject=["$http","$q","$log"]}(),function(){"use strict";function a(){function a(a,e){e.debug("TopicsSelectController");var o=this;o.$rootScope=a,o.$log=e,o.init()}a.$inject=["$rootScope","$log"],a.prototype.init=function(){},a.prototype.selectTopic=function(){var a=this;return null===a.selectedTopic?void a.$log.debug("Default topic selected."):void a.$rootScope.$broadcast("change-selectedTopic",a.selectedTopic)};var e={restrict:"E",templateUrl:"app/components/topics-select/topics-select.html",scope:{topics:"=",selectedTopic:"="},controller:a,controllerAs:"vm",bindToController:!0};return e}angular.module("dialoga").directive("topicsSelect",a)}(),function(){"use strict";function a(){function a(a,e,o,s,r){r.debug("TopicListController");var t=this;t.$scope=a,t.$element=e,t.$location=o,t.$filter=s,t.$log=r,t.defaultLimit=6,t.init()}a.$inject=["$scope","$element","$location","$filter","$log"],a.prototype.init=function(){var a=this;if(!a.article)return void a.$log.debug("no article to display. Tip: use a ng-if before use this directive");if(a.categories=a.article.categories,a.programs=a.article.children,a.orderCriteries=[{label:"Título",name:"titulo"},{label:"Tema",name:"tema"},{label:"Aleatório",name:"aleatorio"}],a.filtredProgramList=a.getFiltredPrograms(),a.search=a.$location.search(),a.query=a.search&&a.search.filtro?a.search.filtro:null,a.limitTo=a.search&&a.search.limite?parseInt(a.search.limite,10):a.defaultLimit,a.categoryFilter=a.search&&a.search.tema?a.getCategoryBySlug(a.search.tema):null,a.orderCriteria=a.search&&a.search.ordem?{name:a.search.ordem}:null,a.reverse=a.search&&a.search.reverso?!0:!1,!angular.equals({},a.search)){var e=a.$element;angular.element("body").animate({scrollTop:e.offset().top},"slow")}a.$scope.$watch("vm.query",function(e){a.search.filtro=e?e:null,a.$location.search("filtro",a.search.filtro),a.limitTo=a.search.filtro?a.programs.length:a.defaultLimit,a.filtredProgramList=a.getFiltredPrograms()}),a.$scope.$watch("vm.limitTo",function(e){a.search.limite=e&&e!==a.defaultLimit?e:null,a.$location.search("limite",a.search.limite),a.filtredProgramList=a.getFiltredPrograms()}),a.$scope.$watch("vm.categoryFilter",function(e){a.search.tema=e?e.slug:null,a.$location.search("tema",a.search.tema),a.search.tema&&(a.limitTo=a.programs.length),a.filtredProgramList=a.getFiltredPrograms()}),a.$scope.$watch("vm.orderCriteria",function(e){a.search.ordem=e&&e.name?e.name:null,a.$location.search("ordem",a.search.ordem),a.filtredProgramList=a.getFiltredPrograms()}),a.$scope.$watch("vm.reverse",function(e){a.search.reverso=e?e:null,a.$location.search("reverso",a.search.reverso),a.filtredProgramList=a.getFiltredPrograms()})},a.prototype.resetFilterValues=function(){var a=this;a.query=null,a.limitTo=a.defaultLimit,a.categoryFilter=null,a.orderCriteria=null},a.prototype.getIconClasses=function(a){var e=this;return e.$log.debug("[TODO] getIconClasses of category:",a),"glyphicon glyphicon-exclamation-sign"},a.prototype.getCategoryBySlug=function(a){var e=this,o=null;return angular.forEach(e.categories,function(e){e.slug===a&&(o=e)}),o},a.prototype.filterByCategory=function(a,e){var o=this;e.stopPropagation(),o.categoryFilter=a!==o.categoryFilter?a:null},a.prototype.showAll=function(a){var e=this;a.stopPropagation(),e.resetFilterValues(),e.limitTo=e.programs.length},a.prototype.getFiltredPrograms=function(){var a=this,o=a.programs,s=o,r=a.query,t=a.categoryFilter,i=a.orderCriteria?a.orderCriteria:{name:"aleatorio"},l=a.$filter("filter"),n=a.$filter("orderBy"),c=a.$filter("limitTo"),p=a.limitTo?a.limitTo:4;switch(t&&(s=e(s,t)),r&&(s=l(s,r,!1)),i.name){case"titulo":s=n(s,"title",a.reverse);break;case"tema":s=n(s,"categories[0].name",a.reverse);break;case"more_participants":a.$log.info("Criteria not handled yet: ",i);break;case"aleatorio":s=a.filterShuffle(s),a.reverse&&(s=s.slice().reverse());break;default:a.$log.warn("Criteria not matched: ",i)}return s=c(s,p)},a.prototype.filterShuffle=function(a){for(var e=[],s={},r=0;r0)){var d=n.pop();e.push(d),p=!0}p||(c=!1)}return e};var s={restrict:"E",templateUrl:"app/components/programas/programas.html",scope:{article:"="},controller:a,controllerAs:"vm",bindToController:!0};return s}function e(a,e){if(a=a||[],!e)return a;for(var o=[],s=0;sÉ calculada pelo saldo de interações das propostas (curtidas - não curtidas) dividido pela diferença de exibições entre elas.

O objetivo dessa correção é compensar o saldo de interações e a diferença de exibições das propostas que não tiveram muitas oportunidades de visualização ou das propostas que tiveram mais oportunidades de visualização que a média.

Com essa correção, é possível comparar propostas que entraram em diferentes momentos, durante todo o período da consulta.

"})}a.$inject=["$state","$element","$timeout","$log"],a.prototype.init=function(){var a=this;if(!a.proposals)throw{name:"NotDefined",message:'The attribute "proposals" is undefined.'};a.$timeout(function(){e.call(a)},1e3)},a.prototype.showContent=function(a){var e=this;e.$state.go("programa",{slug:a.parent.slug,proposal_id:a.id},{location:!0,reload:!0})};var o={restrict:"E",templateUrl:"app/components/proposal-list/proposal-list.html",scope:{proposals:"="},controller:a,controllerAs:"vm",bindToController:!0};return o}angular.module("dialoga").directive("proposalList",a)}(),function(){"use strict";function a(){function a(a,e,o,s,r,t){t.debug("ProposalGridController");var i=this;i.$scope=a,i.$rootScope=e,i.$element=o,i.$location=s,i.$filter=r,i.$log=t,i.init(),i.attachListeners()}a.$inject=["$scope","$rootScope","$element","$location","$filter","$log"],a.prototype.init=function(){},a.prototype.attachListeners=function(){};var e={restrict:"E",templateUrl:"app/components/proposal-grid/proposal-grid.html",scope:{proposals:"="},controller:a,controllerAs:"vm",bindToController:!0};return e}angular.module("dialoga").directive("proposalGrid",a)}(),function(){"use strict";function a(){function a(a,e,o,s,r){r.debug("ProposalCarouselController");var t=this;t.$scope=a,t.$state=e,t.$element=o,t.$timeout=s,t.$log=r,t.init()}a.$inject=["$scope","$state","$element","$timeout","$log"],a.prototype.init=function(){var a=this;if(!a.proposals)throw{name:"NotDefined",message:'The attribute "proposals" is undefined.'};a.activeIndex=0,a.loading=!1,a.proposalsLength=a.proposals.length},a.prototype.swipeLeft=function(){var a=this;a.activeIndex=a.activeIndex0?--a.activeIndex:a.proposalsLength-1},a.prototype.switchProposal=function(a){var e=this;a>=0&&a=0;s--){var r=I.themes[s];if(r&&r.slug&&r.slug===a){o=r;break}}e(o)}I.themes?s(I.themes):p(s,o)}function g(a,e){I.programs?a(I.programs):l(function(){if(!I.hasOwnProperty("programs"))throw{name:"NotFound",message:'"programs" is not defined. "article.children" was handled?'};a(I.programs)},e)}function u(a,e,o){function s(){var o=I.programs.filter(function(e){return angular.equals(e.slug,a)?!0:!1});e(o[0])}I.programs?s():g(s,o)}function v(a,e,o){function s(){var o=I.programs.filter(function(e){var o=e.categories[0];return o&&angular.equals(o.id,a)?!0:!1});e(o)}I.programs?s():g(s,o)}function m(a,e,s){if(I.programsRandom)e(I.programsRandom);else{var t=!!I.programs,i=O.serviceDialoga+"random_topics/"+o.articleId.home,l=null;l=t?["id","title","slug"]:[];var n=angular.extend({"fields[]":l},a);r.get(i,{params:n}).then(function(a){k(t,a,e)})["catch"](function(a){s(a)})}}function h(a,e,r){var t=angular.extend({},a);s.getEvents(o.communityId,t,e,r)}function f(a){if(I.questions)a(I.questions);else{var e=[];I.questions=e,a(I.questions)}}function b(a,e,o){s.searchTopics({query:a},e,o)}function y(a,e,o){s.searchProposals(a,e,o)}function P(a,e){return angular.isArray(a)?a.filter(function(a){return a.parent?a.parent.categories&&0!==a.parent.categories.length?a.parent.categories[0].slug===e:(i.warn("Proposal parent has no categories."),!1):(i.warn("Proposal without a parent."),!1)}):(i.error("Input is not a Array."),[])}function $(a,e){return angular.isArray(a)?a.filter(function(a){return a.parent&&a.parent.id?a.parent.id===e:(i.warn("Proposal has no parent."),!1)}):(i.error("Input is not a Array."),[])}function w(a){var o=a.article["abstract"];o=_(o),o=E(o),a.article["abstract"]=o,a.article.abstractTrusted=e.trustAsHtml(o)}function S(a){a.article.slug||(a.article.slug=t.slugify(a.article.title));for(var e=a.article.children.length-1;e>=0;e--){var o=a.article.children[e];o.slug||(o.slug=t.slugify(o.title))}}function T(a){I.hasOwnProperty("themes")||(I.themes=a.article.categories),C(a)}function A(a){I.hasOwnProperty("programs")||(I.programs=a.article.children,I.programs_count=a.article.children_count),x(I.programs)}function x(e){if(angular.isArray(e))for(var o=null,s=null,r=e.length-1;r>=0;r--)o=e[r],o.summary||(s=o["abstract"].split("
"),o.summary=a.stripHtml(s[0]).trim(),s.length>1&&(o.summaryExtended=s[1].trim()))}function C(a){a.article.categories}function k(a,e,o){if(a){for(var s=[],r=e.articles,t=I.programs.length-1;t>=0;t--)for(var i=I.programs[t],l=r.length-1;l>=0;l--){var n=r[l];n.id===i.id&&s.push(i)}e.articles=s}o(e)}function _(a){var e='