From a54434f26605687ccff821e0582e1dc295a1c9d6 Mon Sep 17 00:00:00 2001 From: Jonathan Hornung Date: Mon, 11 Jan 2016 17:58:34 +0100 Subject: [PATCH] fix: fixed items --- bower.json | 2 +- dist/aping-plugin-github.js | 15 +++++++-------- dist/aping-plugin-github.min.js | 4 ++-- package.json | 2 +- src/aping-github-directive.js | 6 +++--- src/aping-github-helper.js | 7 +++---- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/bower.json b/bower.json index fdb74b0..ac1f2a5 100644 --- a/bower.json +++ b/bower.json @@ -4,7 +4,7 @@ "authors": [ "Jonathan Hornung " ], - "version": "0.7.6", + "version": "0.7.7", "description": "GitHub plugin for apiNG", "main": "dist/aping-plugin-github.min.js", "moduleType": [], diff --git a/dist/aping-plugin-github.js b/dist/aping-plugin-github.js index 6c1bd76..b3bc95b 100644 --- a/dist/aping-plugin-github.js +++ b/dist/aping-plugin-github.js @@ -1,6 +1,6 @@ /** @name: aping-plugin-github - @version: 0.7.6 (11-01-2016) + @version: 0.7.7 (11-01-2016) @author: Jonathan Hornung @url: https://github.com/JohnnyTheTank/apiNG-plugin-github @license: MIT @@ -16,7 +16,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) link: function (scope, element, attrs, apingController) { var appSettings = apingController.getAppSettings(); - var requests = apingUtilityHelper.parseJsonFromAttributes(attrs.apingGithub, apingGithubHelper.getThisPlattformString(), appSettings); + var requests = apingUtilityHelper.parseJsonFromAttributes(attrs.apingGithub, apingGithubHelper.getThisPlatformString(), appSettings); requests.forEach(function (request) { @@ -32,7 +32,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) //create requestObject for api request call var requestObject = { - access_token: apingUtilityHelper.getApiCredentials(apingGithubHelper.getThisPlattformString(), "access_token"), + access_token: apingUtilityHelper.getApiCredentials(apingGithubHelper.getThisPlatformString(), "access_token"), }; if (typeof request.items !== "undefined") { @@ -41,7 +41,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) requestObject.per_page = appSettings.items; } - if (requestObject.count === 0 || requestObject.count === '0') { + if (requestObject.per_page === 0 || requestObject.per_page === '0') { return false; } @@ -112,7 +112,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) }]);;"use strict"; jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', 'apingUtilityHelper', function (apingModels, apingTimeHelper, apingUtilityHelper) { - this.getThisPlattformString = function () { + this.getThisPlatformString = function () { return "github"; }; @@ -191,7 +191,7 @@ jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', ' }; this.getRepoItemByJsonData = function (_item) { - var repoObject = apingModels.getNew("repo", this.getThisPlattformString()); + var repoObject = apingModels.getNew("repo", this.getThisPlatformString()); $.extend(true, repoObject, { owner_name: _item.owner ? _item.owner.login : undefined, @@ -226,7 +226,7 @@ jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', ' }; /* this.getActivityItemByJsonData = function (_item) { - var activityObject = apingModels.getNew("activity", this.getThisPlattformString()); + var activityObject = apingModels.getNew("activity", this.getThisPlatformString()); $.extend(true, activityObject, { body : undefined, @@ -304,7 +304,6 @@ jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', ' return returnObject; }; */ - }]);;"use strict"; angular.module("jtt_github", []) diff --git a/dist/aping-plugin-github.min.js b/dist/aping-plugin-github.min.js index ec52d64..0e08627 100644 --- a/dist/aping-plugin-github.min.js +++ b/dist/aping-plugin-github.min.js @@ -1,8 +1,8 @@ /** @name: aping-plugin-github - @version: 0.7.6 (11-01-2016) + @version: 0.7.7 (11-01-2016) @author: Jonathan Hornung @url: https://github.com/JohnnyTheTank/apiNG-plugin-github @license: MIT */ -"use strict";var jjtApingGithub=angular.module("jtt_aping_github",["jtt_github"]).directive("apingGithub",["apingGithubHelper","apingUtilityHelper","githubFactory",function(a,b,c){return{require:"?aping",restrict:"A",replace:"false",link:function(d,e,f,g){var h=g.getAppSettings(),i=b.parseJsonFromAttributes(f.apingGithub,a.getThisPlattformString(),h);i.forEach(function(d){var e={model:h.model};"undefined"!=typeof h.getNativeData?e.getNativeData=h.getNativeData:e.getNativeData=!1;var f={access_token:b.getApiCredentials(a.getThisPlattformString(),"access_token")};if("undefined"!=typeof d.items?f.per_page=d.items:f.per_page=h.items,0===f.count||"0"===f.count)return!1;if((f.per_page<0||isNaN(f.per_page))&&(f.per_page=void 0),f.per_page>100&&(f.per_page=100),d.user)switch(f.user=d.user,h.model){case"repo":d.repo?(f.repo=d.repo,c.getRepoByUserAndName(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))})):c.getReposByUser(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))});break;case"activity":c.getEventsByUser(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))})}else if(d.search)switch(f.q=d.search,"undefined"!=typeof d.sort&&(f.sort=d.sort),"undefined"!=typeof d.order&&(f.order=d.order),h.model){case"repo":c.getReposByName(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))})}})}}}]);jjtApingGithub.service("apingGithubHelper",["apingModels","apingTimeHelper","apingUtilityHelper",function(a,b,c){this.getThisPlattformString=function(){return"github"},this.getThisPlatformLink=function(){return"https://github.com/"},this.getObjectByJsonData=function(a,b){var c=[];if(a&&a.data){var d=this;if(a.data.constructor===Array)angular.forEach(a.data,function(a,e){var f;f=b.getNativeData===!0||"true"===b.getNativeData?a:d.getItemByJsonData(a,b.model),f&&c.push(f)});else if(a.data.items)angular.forEach(a.data.items,function(a,e){var f;f=b.getNativeData===!0||"true"===b.getNativeData?a:d.getItemByJsonData(a,b.model),f&&c.push(f)});else{var e;e=b.getNativeData===!0||"true"===b.getNativeData?a.data:d.getItemByJsonData(a,b.model),e&&c.push(e)}}return c},this.getItemByJsonData=function(a,b){var c={};if(a&&b)switch(b){case"repo":c=this.getRepoItemByJsonData(a);break;default:return!1}return c},this.getRepoItemByJsonData=function(c){var d=a.getNew("repo",this.getThisPlattformString());return $.extend(!0,d,{owner_name:c.owner?c.owner.login:void 0,owner_id:c.owner?c.owner.id:void 0,owner_link:c.owner?c.owner.html_url:void 0,owner_img_url:c.owner?c.owner.avatar_url:void 0,name:c.name,id:c.id,fullname:c.full_name,description:c.description||void 0,url:c.html_url,homepage:c.homepage||void 0,language:c.language||void 0,clone_url:c.clone_url,git_url:c.git_url,ssh_url:c.ssh_url,svn_url:c.svn_url,isFork:c.fork,openIssues:c.open_issues_count,watchers:c.watchers_count,stargazers:c.stargazers_count,forks:c.forks_count,created_timestamp:b.getTimestampFromDateString(c.created_at,1e3,36e5),created_date_time:new Date(c.created_at),updated_timestamp:c.updated_at?b.getTimestampFromDateString(c.updated_at,1e3,36e5):void 0,updated_date_time:c.updated_at?new Date(c.updated_at):void 0,pushed_timestamp:c.pushed_at?b.getTimestampFromDateString(c.pushed_at,1e3,36e5):void 0,pushed_date_time:c.pushed_at?new Date(c.pushed_at):void 0}),d}}]),angular.module("jtt_github",[]).factory("githubFactory",["$http","githubSearchDataService",function(a,b){var c={};return c.getUser=function(c){var d=b.getNew("user",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByUser=function(c){var d=b.getNew("reposByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByName=function(c){var d=b.getNew("reposByName",c);return a({method:"GET",url:d.url,params:d.object})},c.getRepoByUserAndName=function(c){var d=b.getNew("repoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsByUser=function(c){var d=b.getNew("eventsByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsFromRepoByUserAndName=function(c){var d=b.getNew("eventsFromRepoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("githubSearchDataService",function(){this.getApiBaseUrl=function(a){return"https://api.github.com/"},this.fillDataInObjectByList=function(a,b,c){return angular.forEach(c,function(c,d){"undefined"!=typeof b[c]&&(a.object[c]=b[c])}),a},this.getNew=function(a,b){var c={object:{access_token:b.access_token},url:""};switch("undefined"!=typeof b.per_page&&(c.object.per_page=b.per_page),a){case"user":c.object.per_page=void 0,c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"users/"+b.user;break;case"reposByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/repos";break;case"reposByName":c=this.fillDataInObjectByList(c,b,["sort","order","page"]),c.url=this.getApiBaseUrl()+"search/repositories?q="+b.q;break;case"repoByUserAndName":c.object={access_token:b.access_token},c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo;break;case"eventsByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/events";break;case"eventsFromRepoByUserAndName":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo+"/events"}return c}}); \ No newline at end of file +"use strict";var jjtApingGithub=angular.module("jtt_aping_github",["jtt_github"]).directive("apingGithub",["apingGithubHelper","apingUtilityHelper","githubFactory",function(a,b,c){return{require:"?aping",restrict:"A",replace:"false",link:function(d,e,f,g){var h=g.getAppSettings(),i=b.parseJsonFromAttributes(f.apingGithub,a.getThisPlatformString(),h);i.forEach(function(d){var e={model:h.model};"undefined"!=typeof h.getNativeData?e.getNativeData=h.getNativeData:e.getNativeData=!1;var f={access_token:b.getApiCredentials(a.getThisPlatformString(),"access_token")};if("undefined"!=typeof d.items?f.per_page=d.items:f.per_page=h.items,0===f.per_page||"0"===f.per_page)return!1;if((f.per_page<0||isNaN(f.per_page))&&(f.per_page=void 0),f.per_page>100&&(f.per_page=100),d.user)switch(f.user=d.user,h.model){case"repo":d.repo?(f.repo=d.repo,c.getRepoByUserAndName(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))})):c.getReposByUser(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))});break;case"activity":c.getEventsByUser(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))})}else if(d.search)switch(f.q=d.search,"undefined"!=typeof d.sort&&(f.sort=d.sort),"undefined"!=typeof d.order&&(f.order=d.order),h.model){case"repo":c.getReposByName(f).then(function(b){g.concatToResults(a.getObjectByJsonData(b,e))})}})}}}]);jjtApingGithub.service("apingGithubHelper",["apingModels","apingTimeHelper","apingUtilityHelper",function(a,b,c){this.getThisPlatformString=function(){return"github"},this.getThisPlatformLink=function(){return"https://github.com/"},this.getObjectByJsonData=function(a,b){var c=[];if(a&&a.data){var d=this;if(a.data.constructor===Array)angular.forEach(a.data,function(a,e){var f;f=b.getNativeData===!0||"true"===b.getNativeData?a:d.getItemByJsonData(a,b.model),f&&c.push(f)});else if(a.data.items)angular.forEach(a.data.items,function(a,e){var f;f=b.getNativeData===!0||"true"===b.getNativeData?a:d.getItemByJsonData(a,b.model),f&&c.push(f)});else{var e;e=b.getNativeData===!0||"true"===b.getNativeData?a.data:d.getItemByJsonData(a,b.model),e&&c.push(e)}}return c},this.getItemByJsonData=function(a,b){var c={};if(a&&b)switch(b){case"repo":c=this.getRepoItemByJsonData(a);break;default:return!1}return c},this.getRepoItemByJsonData=function(c){var d=a.getNew("repo",this.getThisPlatformString());return $.extend(!0,d,{owner_name:c.owner?c.owner.login:void 0,owner_id:c.owner?c.owner.id:void 0,owner_link:c.owner?c.owner.html_url:void 0,owner_img_url:c.owner?c.owner.avatar_url:void 0,name:c.name,id:c.id,fullname:c.full_name,description:c.description||void 0,url:c.html_url,homepage:c.homepage||void 0,language:c.language||void 0,clone_url:c.clone_url,git_url:c.git_url,ssh_url:c.ssh_url,svn_url:c.svn_url,isFork:c.fork,openIssues:c.open_issues_count,watchers:c.watchers_count,stargazers:c.stargazers_count,forks:c.forks_count,created_timestamp:b.getTimestampFromDateString(c.created_at,1e3,36e5),created_date_time:new Date(c.created_at),updated_timestamp:c.updated_at?b.getTimestampFromDateString(c.updated_at,1e3,36e5):void 0,updated_date_time:c.updated_at?new Date(c.updated_at):void 0,pushed_timestamp:c.pushed_at?b.getTimestampFromDateString(c.pushed_at,1e3,36e5):void 0,pushed_date_time:c.pushed_at?new Date(c.pushed_at):void 0}),d}}]),angular.module("jtt_github",[]).factory("githubFactory",["$http","githubSearchDataService",function(a,b){var c={};return c.getUser=function(c){var d=b.getNew("user",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByUser=function(c){var d=b.getNew("reposByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByName=function(c){var d=b.getNew("reposByName",c);return a({method:"GET",url:d.url,params:d.object})},c.getRepoByUserAndName=function(c){var d=b.getNew("repoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsByUser=function(c){var d=b.getNew("eventsByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsFromRepoByUserAndName=function(c){var d=b.getNew("eventsFromRepoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("githubSearchDataService",function(){this.getApiBaseUrl=function(a){return"https://api.github.com/"},this.fillDataInObjectByList=function(a,b,c){return angular.forEach(c,function(c,d){"undefined"!=typeof b[c]&&(a.object[c]=b[c])}),a},this.getNew=function(a,b){var c={object:{access_token:b.access_token},url:""};switch("undefined"!=typeof b.per_page&&(c.object.per_page=b.per_page),a){case"user":c.object.per_page=void 0,c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"users/"+b.user;break;case"reposByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/repos";break;case"reposByName":c=this.fillDataInObjectByList(c,b,["sort","order","page"]),c.url=this.getApiBaseUrl()+"search/repositories?q="+b.q;break;case"repoByUserAndName":c.object={access_token:b.access_token},c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo;break;case"eventsByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/events";break;case"eventsFromRepoByUserAndName":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo+"/events"}return c}}); \ No newline at end of file diff --git a/package.json b/package.json index 22f824a..ef1725e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aping-plugin-github", - "version": "0.7.6", + "version": "0.7.7", "description": "GitHub plugin for apiNG", "main": "dist/aping-plugin-github.min.js", "scripts": { diff --git a/src/aping-github-directive.js b/src/aping-github-directive.js index dcfff00..8b7ead3 100644 --- a/src/aping-github-directive.js +++ b/src/aping-github-directive.js @@ -9,7 +9,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) link: function (scope, element, attrs, apingController) { var appSettings = apingController.getAppSettings(); - var requests = apingUtilityHelper.parseJsonFromAttributes(attrs.apingGithub, apingGithubHelper.getThisPlattformString(), appSettings); + var requests = apingUtilityHelper.parseJsonFromAttributes(attrs.apingGithub, apingGithubHelper.getThisPlatformString(), appSettings); requests.forEach(function (request) { @@ -25,7 +25,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) //create requestObject for api request call var requestObject = { - access_token: apingUtilityHelper.getApiCredentials(apingGithubHelper.getThisPlattformString(), "access_token"), + access_token: apingUtilityHelper.getApiCredentials(apingGithubHelper.getThisPlatformString(), "access_token"), }; if (typeof request.items !== "undefined") { @@ -34,7 +34,7 @@ var jjtApingGithub = angular.module("jtt_aping_github", ['jtt_github']) requestObject.per_page = appSettings.items; } - if (requestObject.count === 0 || requestObject.count === '0') { + if (requestObject.per_page === 0 || requestObject.per_page === '0') { return false; } diff --git a/src/aping-github-helper.js b/src/aping-github-helper.js index eb6c4f8..989d563 100644 --- a/src/aping-github-helper.js +++ b/src/aping-github-helper.js @@ -1,7 +1,7 @@ "use strict"; jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', 'apingUtilityHelper', function (apingModels, apingTimeHelper, apingUtilityHelper) { - this.getThisPlattformString = function () { + this.getThisPlatformString = function () { return "github"; }; @@ -80,7 +80,7 @@ jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', ' }; this.getRepoItemByJsonData = function (_item) { - var repoObject = apingModels.getNew("repo", this.getThisPlattformString()); + var repoObject = apingModels.getNew("repo", this.getThisPlatformString()); $.extend(true, repoObject, { owner_name: _item.owner ? _item.owner.login : undefined, @@ -115,7 +115,7 @@ jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', ' }; /* this.getActivityItemByJsonData = function (_item) { - var activityObject = apingModels.getNew("activity", this.getThisPlattformString()); + var activityObject = apingModels.getNew("activity", this.getThisPlatformString()); $.extend(true, activityObject, { body : undefined, @@ -193,5 +193,4 @@ jjtApingGithub.service('apingGithubHelper', ['apingModels', 'apingTimeHelper', ' return returnObject; }; */ - }]); \ No newline at end of file