Skip to content

Commit

Permalink
changed sub-title and added download on enter press
Browse files Browse the repository at this point in the history
  • Loading branch information
MinhasKamal committed Nov 7, 2017
1 parent fd6d2e7 commit 32dc974
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<div class="vertical-space"></div>
<h1><a href="https://minhaskamal.github.io/DownGit">DownGit</a></h1>
<div class="center-row"></div>
<h4>Create GitHub Directory Download Link</h4>
<h4>Create GitHub Resource Download Link</h4>


<div class="vertical-space"></div>
<div class="col-md-6 center-row">
<input name="url" type="url" placeholder="GitHub Directory Link" class="form-control" ng-model="url" ></input>
<input name="url" type="url" placeholder="GitHub File or Directory Link" class="form-control" ng-model="url" ng-keypress="catchEnter($event)"></input>
</div>
<div class="btn-group center-row">
<button type="button" class="btn btn-default" ng-click="createDownLink()">Create Download Link</button>
<a type="button" class="btn btn-default" ng-href="#home?url={{url}}">Download</a>
<button type="button" class="btn btn-default" ng-click="download()">Download</button>
</div>


Expand All @@ -35,4 +35,4 @@ <h4>Create GitHub Directory Download Link</h4>
</div>

</div>
</div>
</div>
13 changes: 12 additions & 1 deletion app/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ homeModule.config([
totalFiles: $scope.totalFiles};
homeService.downloadZippedFiles(parameter, progress, toastr);
}else if($scope.url!=""){
$scope.url = "";
toastr.warning("Invalid URL", {iconClass: 'toast-down'});
}

$scope.catchEnter = function(keyEvent){
if(keyEvent.which == 13){
$scope.download();
}
};

$scope.createDownLink = function(){
$scope.downUrl="";

Expand All @@ -64,6 +71,10 @@ homeModule.config([
}
};

$scope.download = function(){
window.location = "#home?url="+$scope.url;
};

}],
});
}
Expand All @@ -90,7 +101,7 @@ homeModule.factory('homeService', [
info.resPath = repoPath.substring(
repoPath.indexOf(splitPath[4])+splitPath[4].length+1);
}
info.urlPrefix = "https://api.github.com/repos/"+info.author+
info.urlPrefix = "https://api.github.com/repos/"+info.author+
"/"+info.repository+"/contents/";
info.urlPostfix = "?ref="+info.branch;

Expand Down

0 comments on commit 32dc974

Please sign in to comment.