1
1
angular . module ( 'mainApp' )
2
- . controller ( 'projectPageController' , function ( $scope , $routeParams , $location , dataService , $rootScope , toaster , SweetAlert ) {
2
+ . controller ( 'projectPageController' , function ( $scope , Socialshare , $routeParams , $location , dataService , $rootScope , toaster , SweetAlert ) {
3
3
4
4
const id = $routeParams . id
5
5
6
6
dataService . getProjectPage ( id )
7
7
. then ( data => {
8
- $scope . project = data . data . data
9
- $scope . creator = data . data . creator
10
- } )
8
+ $scope . project = data . data . data
9
+ $scope . creator = data . data . creator
10
+ } )
11
11
12
12
$scope . enableEditor = function ( toggle ) {
13
13
if ( $scope . options === true ) {
@@ -121,42 +121,77 @@ $scope.followProject = function(){
121
121
SweetAlert . swal ( {
122
122
title : 'Project already following' ,
123
123
type : 'info' ,
124
- } )
125
- }
126
- } )
124
+ } )
127
125
}
126
+ } )
127
+ }
128
128
129
- $scope . clickMeToShowMessageEdit = function ( options ) {
130
- $scope . options = options
131
- if ( $scope . options === true ) {
132
- SweetAlert . swal ( {
133
- title : 'Edit mode ON' ,
134
- text : "You can edit content!" ,
135
- type : 'info' ,
136
- } )
137
- }
138
- }
129
+ $scope . clickMeToShowMessageEdit = function ( options ) {
130
+ $scope . options = options
131
+ if ( $scope . options === true ) {
132
+ SweetAlert . swal ( {
133
+ title : 'Edit mode ON' ,
134
+ text : "You can edit content!" ,
135
+ type : 'info' ,
136
+ } )
137
+ }
138
+ }
139
139
140
- $scope . joinProject = function ( ) {
141
- const user = $rootScope . loggedUser
142
- const { creatorName, creatorMail} = $scope . project
143
- toaster . info ( 'Sending mail to project admin' )
144
- dataService . joinProject ( user , creatorMail , creatorName )
145
- . then ( mail => {
146
- toaster . success ( "Mail sended succes, admin project will response you as soon as posible!" ) ;
147
- } )
140
+ $scope . joinProject = function ( ) {
141
+ const user = $rootScope . loggedUser
142
+ const { creatorName, creatorMail} = $scope . project
143
+ toaster . info ( 'Sending mail to project admin' )
144
+ dataService . joinProject ( user , creatorMail , creatorName )
145
+ . then ( mail => {
146
+ toaster . success ( "Mail sended succes, admin project will response you as soon as posible!" ) ;
147
+ } )
148
148
149
+ }
150
+
151
+ $ ( '.myAffix' ) . affix ( {
152
+ offset : {
153
+ top : 475 ,
154
+ bottom : function ( ) {
155
+ return ( this . bottom = $ ( '.footer' ) . outerHeight ( true ) )
149
156
}
157
+ }
158
+ } )
159
+
160
+ $scope . shareFacebook = function ( ) {
161
+ const actualUrl = $location . $$absUrl
162
+ Socialshare . share ( {
163
+ 'provider' : 'facebook' ,
164
+ 'attrs' : {
165
+ 'socialshareQuote' : 'One of the amazin proejcts of web-developers!' ,
166
+ 'socialshareUrl' : actualUrl
167
+ }
168
+ } ) ;
169
+ }
150
170
151
- $ ( '.myAffix' ) . affix ( {
152
- offset : {
153
- top : 475 ,
154
- bottom : function ( ) {
155
- return ( this . bottom = $ ( '.footer' ) . outerHeight ( true ) )
156
- }
171
+ $scope . shareTwitter = function ( ) {
172
+ const actualUrl = $location . $$absUrl
173
+ Socialshare . share ( {
174
+ 'provider' : 'twitter' ,
175
+ 'attrs' : {
176
+ 'socialshareText' : 'One of the amazin proejcts of web-developers!' ,
177
+ 'socialshareUrl' : actualUrl ,
178
+ 'socialshareHashtags' : 'webdeveloper, angular, project'
157
179
}
158
- } )
180
+ } ) ;
181
+ }
182
+
183
+ $scope . shareGoogle = function ( ) {
184
+ const actualUrl = $location . $$absUrl
185
+ Socialshare . share ( {
186
+ 'provider' : 'google' ,
187
+ 'attrs' : {
188
+ 'socialshareText' : 'One of the amazin proejcts of web-developers!' ,
189
+ 'socialshareUrl' : actualUrl ,
190
+ 'socialshareHashtags' : 'webdeveloper, angular, project'
191
+ }
192
+ } ) ;
193
+ }
159
194
160
195
161
196
162
- } )
197
+ } )
0 commit comments