Skip to content

Commit

Permalink
tabs: Fetch and Display forms from webservices
Browse files Browse the repository at this point in the history
The forms uploaded by developers from community
website, are being fetched from Webservices
where the request to add a new form is being
processed. If a valid request is created, the form
is added to the database. Therefore, we can fetch
those forms and display them on the projects website.

Closes #284
  • Loading branch information
KVGarg committed Aug 10, 2019
1 parent f19f787 commit 1f8c775
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 3 deletions.
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>
7 changes: 7 additions & 0 deletions resources/css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.apply-flex {
display: flex;
justify-content: center;
}
.center-align-text {
text-align: center;
}
.hash_value_dup {
position: 'absolute';
left: '-9999px';
Expand Down
20 changes: 20 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 @@ -416,4 +419,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"
}
}]);

})();

0 comments on commit 1f8c775

Please sign in to comment.