Skip to content

Commit 1ecc748

Browse files
committed
tabs: Fetch and Display forms from webservices
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
1 parent f19f787 commit 1ecc748

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
lines changed

index.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@
3838
<div class="row">
3939
<div class="col s12">
4040
<ul class="tabs uppercase">
41-
<li class="tab col m4"><a ng-click="tc.setTab('/projects')" onmousedown="keyPressed(event, '#/projects')" ng-class="{active:tc.isSet('/projects')}">Projects</a>
41+
<li class="tab col m3"><a ng-click="tc.setTab('/projects')" onmousedown="keyPressed(event, '#/projects')" ng-class="{active:tc.isSet('/projects')}">Projects</a>
4242
</li>
43-
<li class="tab col m4"><a ng-click="tc.setTab('/mentors')" onmousedown="keyPressed(event, '#/mentors')" ng-class="{active:tc.isSet('/mentors')}">Mentors</a>
43+
<li class="tab col m3"><a ng-click="tc.setTab('/mentors')" onmousedown="keyPressed(event, '#/mentors')" ng-class="{active:tc.isSet('/mentors')}">Mentors</a>
4444
</li>
45-
<li class="tab col m4"><a ng-click="tc.setTab('/faq')" onmousedown="keyPressed(event, '#/faq')" onerror="" ng-class="{active:tc.isSet('/faq')}">Faq</a>
45+
<li class="tab col m3"><a ng-click="tc.setTab('/faq')" onmousedown="keyPressed(event, '#/faq')" onerror="" ng-class="{active:tc.isSet('/faq')}">Faq</a>
46+
</li>
47+
<li class="tab col m3"><a ng-click="tc.setTab('/forms')" onmousedown="keyPressed(event, '#/forms')" onerror="" ng-class="{active:tc.isSet('/forms')}">Forms</a>
4648
</li>
4749
</ul>
4850
</div>

partials/tabs/forms.html

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<div class="main-content container-fluid">
3+
<div class="row">
4+
<div class="col m8 offset-m2">
5+
<h1 class="fine center">Open Source Forms</h1>
6+
<br>
7+
</div>
8+
</div>
9+
</div>
10+
<section>
11+
<div class="container">
12+
<table class="striped" ng-show="osforms.formsList.length !== 0" style="margin-bottom:20px;">
13+
<thead>
14+
<tr class="center-align-text">
15+
<th>Title</th>
16+
<th>Submissions Till</th>
17+
</tr>
18+
</thead>
19+
<tbody>
20+
<tr ng-repeat="form in osforms.formsList">
21+
<td>
22+
<div>
23+
<strong><a href="{{ form.url }}" data-proofer-ignore>{{ form.title }}</a></strong>
24+
<div style="padding-left: 10px;">
25+
<p ng-show="form.description !== null">{{ form.description }}</p>
26+
<p ng-show="form.user !== null">
27+
Uploaded by: <a href="https://github.com/{{ form.user }}" data-proofer-ignore>{{ form.user }}</a>
28+
</p>
29+
</div>
30+
</div>
31+
</td>
32+
<td>
33+
{{ form.expiry_date | date:"medium" }}
34+
</td>
35+
</tr>
36+
</tbody>
37+
</table>
38+
<div class="apply-flex" ng-show="osforms.formsList.length === 0" style="padding: 5% 0;">
39+
<h6>
40+
No forms have been uploaded! If you are already a member of organization and a developers,
41+
you can share it with us on <a href="https://community.coala.io/">Community website</a>
42+
by logging-in.
43+
</h6>
44+
</div>
45+
</div>
46+
</section>

resources/css/style.css

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
.apply-flex {
2+
display: flex;
3+
justify-content: center;
4+
}
5+
.center-align-text {
6+
text-align: center;
7+
}
18
.hash_value_dup {
29
position: 'absolute';
310
left: '-9999px';

resources/js/app.js

+20
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
when('/faq', {
5656
template: '<faq></faq>'
5757
}).
58+
when('/forms', {
59+
template: '<forms></forms>'
60+
}).
5861
otherwise({
5962
redirectTo: '/projects'
6063
});
@@ -416,4 +419,21 @@
416419
}
417420
}]);
418421

422+
app.directive('forms', ['$http', function ($http) {
423+
return {
424+
restrict: 'E',
425+
templateUrl: '/partials/tabs/forms.html',
426+
controller: function ($scope, $rootScope) {
427+
self = this
428+
self.formsList = []
429+
430+
$http.get('https://webservices.coala.io/osforms')
431+
.then(function (forms) {
432+
self.formsList = forms.data
433+
})
434+
},
435+
controllerAs: "osforms"
436+
}
437+
}]);
438+
419439
})();

0 commit comments

Comments
 (0)