Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabs: Fetch and Display forms from webservices #730

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
<div class="row">
<div class="col s12">
<ul class="tabs uppercase">
<li class="tab col m4"><a ng-click="tc.setTab('/projects')" onmousedown="keyPressed(event, '#/projects')" ng-class="{active:tc.isSet('/projects')}">Projects</a>
<li class="tab col m3"><a ng-click="tc.setTab('/projects')" onmousedown="keyPressed(event, '#/projects')" ng-class="{active:tc.isSet('/projects')}">Projects</a>
</li>
<li class="tab col m4"><a ng-click="tc.setTab('/mentors')" onmousedown="keyPressed(event, '#/mentors')" ng-class="{active:tc.isSet('/mentors')}">Mentors</a>
<li class="tab col m3"><a ng-click="tc.setTab('/mentors')" onmousedown="keyPressed(event, '#/mentors')" ng-class="{active:tc.isSet('/mentors')}">Mentors</a>
</li>
<li class="tab col m4"><a ng-click="tc.setTab('/faq')" onmousedown="keyPressed(event, '#/faq')" onerror="" ng-class="{active:tc.isSet('/faq')}">Faq</a>
<li class="tab col m3"><a ng-click="tc.setTab('/faq')" onmousedown="keyPressed(event, '#/faq')" onerror="" ng-class="{active:tc.isSet('/faq')}">Faq</a>
</li>
<li class="tab col m3"><a ng-click="tc.setTab('/forms')" onmousedown="keyPressed(event, '#/forms')" onerror="" ng-class="{active:tc.isSet('/forms')}">Forms</a>
</li>
</ul>
</div>
Expand Down
46 changes: 46 additions & 0 deletions partials/tabs/forms.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<div class="main-content container-fluid">
<div class="row">
<div class="col m8 offset-m2">
<h1 class="fine center">Open Source Forms</h1>
<br>
</div>
</div>
</div>
<section>
<div class="container">
<table class="striped" ng-show="osforms.formsList.length !== 0" style="margin-bottom:20px;">
<thead>
<tr class="center-align-text">
<th>Title</th>
<th>Submissions Till</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="form in osforms.formsList">
<td>
<div>
<strong><a href="{{ form.url }}" data-proofer-ignore>{{ form.title }}</a></strong>
<div style="padding-left: 10px;">
<p ng-show="form.description !== null">{{ form.description }}</p>
<p ng-show="form.user !== null">
Uploaded by: <a href="https://github.com/{{ form.user }}" data-proofer-ignore>{{ form.user }}</a>
</p>
</div>
</div>
</td>
<td>
{{ form.expiry_date | date:"medium" }}
</td>
</tr>
</tbody>
</table>
<div class="apply-flex" ng-show="osforms.formsList.length === 0" style="padding: 5% 0;">
<h6>
No forms have been uploaded, yet! If you are already a member of organization and a developer,
you can share it with us on <a href="https://community.coala.io/">Community website</a>
by logging-in.
</h6>
</div>
</div>
</section>
8 changes: 4 additions & 4 deletions partials/tabs/mentors.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col m8 offset-m2">
<h1 class="fine center">Hello there!</h1>
<h4 class="light center">
We are the mentors for coala in GSoC 2018.
We are the mentors for coala in GSoC {{ gic.nextProgramYear }}.
</h4>
<h4 class="light center">
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a> -
Expand All @@ -18,7 +18,7 @@ <h4 class="light center">
<div class="row user">
<div class="parent-wrapper">
<div class="parent">
<div ng-repeat="member in gic.mentorsList" class="card child card-main sc">
<div ng-repeat="member in gic.mentorsList" class="card child card-main sc black-shadow">
<a ng-href="https://github.com/{{member.github_handle}}">
<div class="empty"></div>
<!-- data-proofer-ignore as html-proofer doesn't recognise ng-src -->
Expand All @@ -42,7 +42,7 @@ <h4 class="light center">
<div class="col m8 offset-m2">
<h1 class="fine center">Admins</h1>
<h4 class="light center">
We are the admins for coala in GSoC 2018.
We are the admins for coala in GSoC {{ gic.nextProgramYear }}.
</h4>
<h4 class="light center">
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a>
Expand All @@ -55,7 +55,7 @@ <h4 class="light center">
<div class="row user">
<div class="parent-wrapper">
<div class="parent">
<div ng-repeat="member in gic.adminsList" class="card card-main child sc">
<div ng-repeat="member in gic.adminsList" class="card card-main child sc black-shadow">
<a ng-href="https://github.com/{{member.github_handle}}">
<div class="empty"></div>
<!-- data-proofer-ignore as html-proofer doesn't recognise ng-src -->
Expand Down
10 changes: 10 additions & 0 deletions resources/css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
.apply-flex {
display: flex;
justify-content: center;
}
.black-shadow {
box-shadow: 0 0 15px 2px black;
}
.center-align-text {
text-align: center;
}
.hash_value_dup {
position: 'absolute';
left: '-9999px';
Expand Down
44 changes: 44 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
when('/faq', {
template: '<faq></faq>'
}).
when('/forms', {
template: '<forms></forms>'
}).
otherwise({
redirectTo: '/projects'
});
Expand Down Expand Up @@ -386,6 +389,30 @@
self.mentorsList = {}
self.adminsList = {}

$scope.getMentorsWebservicesURL = function(year){
return 'https://webservices.coala.io/mentors?year='+year+'&program=GSoC'
}

var today = new Date()
if (today.getMonth() >= 6){
self.nextProgramYear = today.getFullYear() + 1
}
else {
self.nextProgramYear = today.getFullYear()
}

var mentorsWebservicesURL = $scope.getMentorsWebservicesURL(self.nextProgramYear);

$http.get(mentorsWebservicesURL)
.then(function(response){
var mentors = response.data
angular.forEach(mentors, function (data) {
self.mentorsList[data.user.login] = {
"github_handle": data.user.login,
"github_avatar_url": "https://avatars.githubusercontent.com/" + data.user.login
}
});
})
$http.get('data/projects.liquid')
.then(function (res) {
$scope.projects = res.data.filter(project => project.status != "completed")
Expand Down Expand Up @@ -416,4 +443,21 @@
}
}]);

app.directive('forms', ['$http', function ($http) {
return {
restrict: 'E',
templateUrl: '/partials/tabs/forms.html',
controller: function ($scope, $rootScope) {
self = this
self.formsList = []

$http.get('https://webservices.coala.io/osforms')
.then(function (forms) {
self.formsList = forms.data
})
},
controllerAs: "osforms"
}
}]);

})();