advenced menu items

This commit is contained in:
Michele Artini 2020-11-12 11:44:46 +01:00
parent e5394b008e
commit e240af83fb
4 changed files with 38 additions and 16 deletions

View File

@ -519,7 +519,7 @@ CREATE VIEW suggestions_info_by_country_view AS SELECT c.val AS country,
coalesce(t2.n_conflicts, 0) AS n_conflicts, coalesce(t2.n_conflicts, 0) AS n_conflicts,
coalesce(t3.n_pending_orgs, 0) AS n_pending_orgs coalesce(t3.n_pending_orgs, 0) AS n_pending_orgs
FROM countries c FROM countries c
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT d.*) AS n_duplicates FROM oa_duplicates d LEFT OUTER JOIN organizations o ON (d.local_id = o.id) WHERE d.reltype = 'suggested' AND o.status = 'approved' GROUP BY o.country) AS t1 ON (t1.country = c.val) LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT d.local_id) AS n_duplicates FROM oa_duplicates d LEFT OUTER JOIN organizations o ON (d.local_id = o.id) WHERE d.reltype = 'suggested' AND o.status = 'approved' GROUP BY o.country) AS t1 ON (t1.country = c.val)
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT c.idgroup) AS n_conflicts FROM oa_conflicts c LEFT OUTER JOIN organizations o ON (c.id1 = o.id) WHERE c.reltype = 'suggested' AND o.status = 'approved' GROUP BY o.country) AS t2 ON (t2.country = c.val) LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT c.idgroup) AS n_conflicts FROM oa_conflicts c LEFT OUTER JOIN organizations o ON (c.id1 = o.id) WHERE c.reltype = 'suggested' AND o.status = 'approved' GROUP BY o.country) AS t2 ON (t2.country = c.val)
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT o.id) AS n_pending_orgs FROM organizations o WHERE o.status = 'suggested' GROUP BY o.country) AS t3 ON (t3.country = c.val); LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT o.id) AS n_pending_orgs FROM organizations o WHERE o.status = 'suggested' GROUP BY o.country) AS t3 ON (t3.country = c.val);

View File

@ -0,0 +1,7 @@
<div class="dropdown-divider" ng-if="!first"></div>
<a class="dropdown-item" href="{{url}}">
{{menu}}
<span class="badge badge-primary badge-pill" ng-if="badge">{{badge}}</span>
<br/>
<span class="small text-muted">{{description}}</span>
</a>

View File

@ -78,6 +78,21 @@ orgsModule.directive('selectOrgModal', function($http, $timeout) {
} }
}); });
orgsModule.directive('advancedMenuItem', function($http, $location, $route) {
return {
restrict: 'E',
scope: {
'menu' : '@',
'description' : '@',
'url' : '@',
'badge' : '@',
'first' : '@'
},
templateUrl: 'resources/html/parts/advanced_menu_item.html',
link: function(scope, element, attrs, ctrl) {}
}
});
orgsModule.directive('resolveConflictsModal', function($http, $route) { orgsModule.directive('resolveConflictsModal', function($http, $route) {
return { return {
restrict: 'E', restrict: 'E',

View File

@ -65,38 +65,38 @@ fieldset > legend { font-size : 1.2rem !important; }
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Search</a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Search</a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="#!/search">simple search</a> <a class="dropdown-item" href="#!/search">Simple search</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="#!/countries/1" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">browse by country</a> <a class="dropdown-item" href="#!/countries/1" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">Browse by country</a>
<a class="dropdown-item" href="#!/countries/0" sec:authorize="hasRole('ROLE_OPENORGS_USER')">browse by country</a> <a class="dropdown-item" href="#!/countries/0" sec:authorize="hasRole('ROLE_OPENORGS_USER')">Browse by country</a>
<a class="dropdown-item" href="#!/types/1" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">browse by type</a> <a class="dropdown-item" href="#!/types/1" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">Browse by type</a>
<a class="dropdown-item" href="#!/types/0" sec:authorize="hasRole('ROLE_OPENORGS_USER')">browse by type</a> <a class="dropdown-item" href="#!/types/0" sec:authorize="hasRole('ROLE_OPENORGS_USER')">Browse by type</a>
</div> </div>
</li> </li>
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')"> <li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Curation</a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Curation</a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item d-flex justify-content-between align-items-center" href="#!/pendings/_"><span class="pr-2">suggested</span><span class="badge badge-primary badge-pill">{{info.data.total.nPendingOrgs}}</span></a> <advanced-menu-item menu="Suggested organizations" description="Organizations that have been suggested by an User or by the Dedup OpenAIRE Workflow" url="#!/pendings/_" badge="{{info.data.total.nPendingOrgs}}" first="1"></advanced-menu-item>
<a class="dropdown-item d-flex justify-content-between align-items-center" href="#!/duplicates/_"><span class="pr-2">new duplicates</span><span class="badge badge-primary badge-pill">{{info.data.total.nDuplicates}}</span></a> <advanced-menu-item menu="Organizations with new duplicates" description="Organizations that presents duplicates suggested by the Dedup OpenAIRE Workflow" url="#!/duplicates/_" badge="{{info.data.total.nDuplicates}}"></advanced-menu-item>
<a class="dropdown-item d-flex justify-content-between align-items-center" href="#!/conflicts/_"><span class="pr-2">potential conflicts</span><span class="badge badge-danger badge-pill">{{info.data.total.nConflicts}}</span></a> <advanced-menu-item menu="Potential conflicts" description="Approved Organizations that need to be merged" url="#!/conflicts/_" badge="{{info.data.total.nConflicts}}"></advanced-menu-item>
</div> </div>
</li> </li>
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')"> <li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">New</a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Create</a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="#!/new">new organization</a> <a class="dropdown-item" href="#!/new">A new organization</a>
</div> </div>
</li> </li>
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_USER')"> <li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_USER')">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Curation</a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Curation</a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item d-flex justify-content-between align-items-center" href="#!/duplicates/_"><span class="pr-2">new duplicates</span><span class="badge badge-primary badge-pill">{{info.data.total.nDuplicates}}</span></a> <advanced-menu-item menu="Organizations with new duplicates" description="Organizations that presents duplicates suggested by the Dedup OpenAIRE Workflow" url="#!/duplicates/_" badge="{{info.data.total.nDuplicates}}" first="1"></advanced-menu-item>
</div> </div>
</li> </li>
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_USER')"> <li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_USER')">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Suggest</a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Suggest</a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="#!/new">suggest a new organization</a> <a class="dropdown-item" href="#!/new">A new organization</a>
</div> </div>
</li> </li>
</ul> </ul>
@ -104,7 +104,7 @@ fieldset > legend { font-size : 1.2rem !important; }
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')"> <li class="nav-item dropdown" sec:authorize="hasRole('ROLE_OPENORGS_ADMIN') or hasRole('ROLE_OPENORGS_NATIONAL_ADMIN')">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown"><i class="fa fa-cog"></i></a> <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown"><i class="fa fa-cog"></i></a>
<div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#!/users">manage users</a> <a class="dropdown-item" href="#!/users">Manage users</a>
</div> </div>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">