Project

General

Profile

« Previous | Next » 

Revision 56201

[Connect|Trunk]

App:
rename some routes
for my communites menu disable marking as active

Community page
center tab layout
correct tab content issues

View differences:

app.component.ts
21 21
  template: `
22 22
    <div [class]="(community)?(community.id +'App'):'connectApp'" >
23 23
        <navbar *ngIf= "properties && showMenu && !community"   portal="connect" [onlyTop]=false    [userMenuItems]=userMenuItems [menuItems]=menuItems
24
          [showMenu]=showMenu [properties]="properties"></navbar>
24
          [showMenu]=showMenu [properties]="properties" [showHomeMenuItem]="true"></navbar>
25 25
        <navbar *ngIf= "properties && showMenu  && community"    portal="connect" [onlyTop]=false [communityId]="community.id"  [userMenuItems]=userMenuItems [menuItems]=menuItems
26
        [community]=community [showMenu]=showMenu [properties]="properties" [enableSearch]="true"></navbar>
26
        [community]=community [showMenu]=showMenu [properties]="properties" [enableSearch]="true" [showHomeMenuItem]="true"></navbar>
27 27

  
28 28
                   <div class="custom-main-content"   >
29 29
                      <main>
......
86 86
                   communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
87 87
                   this.buildMenu(communityId);
88 88
                 }
89
/*
90
     this.route.queryParams.subscribe(data => {
91
       var community = null;
92
       this.community = null;
93
       this.showMenu = false;
94
       this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe (
95
         communities => {
96 89

  
97
                for(var com of communities){
98
                  if( (
99
                    ((data['communityId'] && data['communityId']!="" &&  com.communityId  == data['communityId'])
100
                  || (ConnectHelper.getCommunityFromDomain(this.properties.domain) ==  com.communityId ))
101
                   && community !=null) ||
102
                    (
103
                      !((data['communityId'] && data['communityId']!="" &&  com.communityId  == data['communityId'])
104
                      || (ConnectHelper.getCommunityFromDomain(this.properties.domain) ==  com.communityId ))
105
                      &&
106
                      this.managerOfCommunities && this.subscriberOfCommunities)){
107
                      break;
108
                    }
109
                  if(Session.isLoggedIn() && com['status'] != "hidden"){
110
                    if(Session.isCommunityCurator() || Session.isPortalAdministrator()){
111
                      this.managerOfCommunities = true;
112
                    }else if(com.managers.indexOf(Session.getUserEmail())!=-1){
113
                      this.managerOfCommunities = true;
114
                    }
115
                    // else if(!this.subscriberOfCommunities){
116
                    //   // check if subscriber
117
                    //   this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
118
                    //     isSubscriber => {
119
                    //       if(isSubscriber) {
120
                    //         this.subscriberOfCommunities = true;
121
                    //       }
122
                    //     },
123
                    //     error => {
124
                    //       console.error("Error fetching your subscribed communities")
125
                    //     });
126
                    //
127
                    // }
128
                  }
129

  
130

  
131

  
132
                   if((data['communityId'] && data['communityId']!="" &&  com.communityId  == data['communityId'])
133
                   || (ConnectHelper.getCommunityFromDomain(this.properties.domain) ==  com.communityId )  ){
134
                    community = com;
135
                     // this._layoutService.getLayout(com.communityId,
136
                     //     this.properties.adminToolsAPIURL + '/').subscribe (
137
                     //     layout => {
138
                     //       this.layout = layout;
139
                     //       document.documentElement.style.setProperty('--portal-main-color', this.layout.color);
140
                     //     }
141
                     // );
142
                    this.community = {id: community.communityId, name: (community.shortTitle)?community.shortTitle:community.title, logoUrl:community.logoUrl};
143
                    this.menuItems= [
144
                      {rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find", "/search/find/publications", "/search/find/datasets", "/search/find/software", "/search/find/other", "/search/find/projects", "/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
145
                        items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
146
                        new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
147
                        new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
148
                        new MenuItem("","Other Research Products","","/search/find/other",false,["orp"],["/search/find/other"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
149
                       new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
150
                       new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
151
                      ]},
152
                      {
153
                        rootItem: new MenuItem("monitor","Monitor","","/monitor",false,[],["/monitor"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
154
                        items: []
155
                      },
156
                      {
157
                      rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets","/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
158
                      items: [
159
                      new MenuItem("","Zenodo Communities","","/participate/share-zenodo",false,[],["/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
160
                      new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
161
                      new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId})]
162
                      },
163
                      {
164
                      rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
165
                      items: []
166
                      }
167
                  ];
168

  
169
                  }
170

  
171
                }
172
                if(community == null){
173
                  this.menuItems= [];
174
                  var myCommunities = [];
175
                  if(this.managerOfCommunities){
176
                    myCommunities.push( new MenuItem("","Managing communities","","/search/find/communities",false,[],[],{role:"%22manager%22"}))
177
                  }
178
                  if(Session.isLoggedIn()){
179
                    this._subscribeService.getCommunitiesSubscribedTo(Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
180
                      pids => {
181
                        if(pids.length > 0 ) {
182
                          myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"}))
183
                        }
184
                      },
185
                      error => {
186
                        console.error("Error fetching your subscribed communities")
187
                      });
188
                  }
189
                  // if(this.subscriberOfCommunities){
190
                  //   myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"}))
191
                  // }
192

  
193
                  this.menuItems.push({rootItem: new MenuItem("communities","Communities","","/search/find/communities",false,[],null,{}), items: []});
194
                  if(this.managerOfCommunities || this.subscriberOfCommunities){
195
                    this.menuItems.push({rootItem: new MenuItem("myCommunities","My Communities","","",false,[],[],{}), items: myCommunities});
196
                  }
197
                  this.menuItems.push({rootItem: new MenuItem("howto","Create Community","","/how-to-create-community",false,[],null,{}), items: []});
198

  
199

  
200

  
201
                  this.bottomMenuItems =[
202
                  new MenuItem("","About","https://beta.openaire.eu/project-factsheets","",false,[],[],{}),
203
                  new MenuItem("","News - Events","https://beta.openaire.eu/news-events","",false,[],[],{}),
204
                  new MenuItem("","Blog","https://blogs.openaire.eu/","",false,[],[],{}),
205
                  new MenuItem("","Contact us","https://beta.openaire.eu/contact-us","",false,[],[],{})
206
                ];
207
                // if(this.properties.showContent){
208
                //   this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
209
                // }
210
                this.userMenuItems =[
211
                   // new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],(data['communityId'] && typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:data['communityId']}),
212
                 ];
213

  
214
              }else{
215
                this.bottomMenuItems = [
216
                  new MenuItem("","About","","/about",false,[],["/about"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
217
                  new MenuItem("","Organizations","","/organizations",false,[],["/organizations"],this.properties.environment!="development"?{}:{communityId:community.communityId})
218
                ];
219
                if(this.properties.showContent){
220
                  this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
221
                }
222
                this.userMenuItems =[ new MenuItem("","My profile","","",false,[],[],{}),
223
                   new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
224
                   new MenuItem("","Invite users","","/invite",false,[],[],this.properties.environment!="development"?{}:{communityId:community.communityId}),
225
                 ];
226
                 if(this.managerOfCommunities ){
227
                   this.userMenuItems.push(new MenuItem("","Support","https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611","",false,[],[],{}))
228
                 }
229
              }
230
                this.showMenu = true;
231
         });
232

  
233

  
234
   });
235
*/
236 90
     if (typeof document !== 'undefined') {
237 91
       try{
238 92
         this.isClient = true;
......
266 120
                    this.managerOfCommunities = true;
267 121
                  }else if(com.managers.indexOf(Session.getUserEmail())!=-1){
268 122
                    this.managerOfCommunities = true;
269
                  }/*else if(!this.subscriberOfCommunities){
270
                    // check if subscriber
271
                    this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
272
                      isSubscriber => {
273
                        if(isSubscriber) {
274
                          this.subscriberOfCommunities = true;
275
                        }
276
                      },
277
                      error => {
278
                        console.error("Error fetching your subscribed communities")
279
                      });
280

  
281
                  }*/
123
                  }
282 124
                }
283 125

  
284 126

  
......
294 136
                   //       document.documentElement.style.setProperty('--portal-main-color', this.layout.color);
295 137
                   //     }
296 138
                   // );
297
                   let iSommunitymanager: boolean = false;
139
                   let isCommunityManager: boolean = false;
298 140
                   if(Session.isCommunityCurator() || Session.isPortalAdministrator()){
299
                     iSommunitymanager = true;
141
                     isCommunityManager = true;
300 142
                   }else if(com.managers.indexOf(Session.getUserEmail())!=-1){
301
                     iSommunitymanager = true;
143
                     isCommunityManager = true;
302 144
                   }
303 145
                  this.community = {id: community.communityId, name: (community.shortTitle)?community.shortTitle:community.title, logoUrl:community.logoUrl};
304 146
                  this.menuItems= [];
305
                   if(iSommunitymanager){
306
                     this.menuItems.push(
307
                     {
308
                       rootItem: new MenuItem("manage","Manage",'https://beta.admin.connect.openaire.eu/dashboard?communityId='+community.communityId,"",false,[],[],{}),
309
                         items: []
310
                     });
311
                   }
147

  
312 148
                   this.menuItems.push(
313 149
                    {rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find", "/search/find/publications", "/search/find/datasets", "/search/find/software", "/search/find/other", "/search/find/projects", "/search/find/dataproviders"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
314 150
                      items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
......
331 167
                    rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],this.properties.environment!="development"?{}:{communityId:community.communityId}),
332 168
                    items: []
333 169
                    });
170
                   if(isCommunityManager){
171
                     this.menuItems.push(
172
                       {
173
                         rootItem: new MenuItem("manage","Manage",'https://beta.admin.connect.openaire.eu/dashboard?communityId='+community.communityId,"",false,[],[],{}),
174
                         items: []
175
                       });
176
                   }
334 177

  
335

  
336 178
                }
337 179

  
338 180
              }
339 181
              if(community == null){
340 182
                this.menuItems= [];
183
                this.menuItems.push({rootItem: new MenuItem("about","About","","/about",false,[],null,{}), items: []});
341 184
                var myCommunities = [];
342 185
                if(this.managerOfCommunities){
343 186
                  myCommunities.push( new MenuItem("","Managing communities","","/search/find/communities",false,[],[],{role:"%22manager%22"}))
......
354 197
                    });
355 198
                }
356 199
                this.menuItems.push({rootItem: new MenuItem("communities","Communities","","/search/find/communities",false,[],null,{}), items: []});
200
                this.menuItems.push({rootItem: new MenuItem("join","Join","","/contact-us",false,[],null,{}), items: []});
357 201
                if(this.managerOfCommunities || this.subscriberOfCommunities){
358
                  this.menuItems.push({rootItem: new MenuItem("myCommunities","My Communities","","",false,[],[],{}), items: myCommunities});
202
                  let myCommunitiesMenu =   new MenuItem("myCommunities","My Communities","","",false,[],[],{});
203
                  myCommunitiesMenu.setMarkAsActive(false);
204
                  this.menuItems.push({rootItem: myCommunitiesMenu, items: myCommunities});
359 205
                }
360
                this.menuItems.push({rootItem: new MenuItem("howto","Create Community","","/how-to-create-community",false,[],null,{}), items: []});
361 206

  
362 207

  
363 208

  
209

  
364 210
                this.bottomMenuItems =[
365 211
                new MenuItem("","About","https://beta.openaire.eu/project-factsheets","",false,[],[],{}),
366 212
                new MenuItem("","News - Events","https://beta.openaire.eu/news-events","",false,[],[],{}),

Also available in: Unified diff