Skip to content

Commit

Permalink
Sonar cloud fixes
Browse files Browse the repository at this point in the history
-Define a constant instead of duplicating this literal
-Remove this empty statement.
  • Loading branch information
RodrigoZambrana committed Dec 16, 2024
1 parent 44e875f commit e62f0c1
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.lacnic.elections.adminweb.wicket.util.UtilsParameters;
import net.lacnic.elections.domain.Election;


public class ElectionsListPanel extends Panel {

private static final long serialVersionUID = -7217245542954325281L;
Expand All @@ -38,7 +37,6 @@ public class ElectionsListPanel extends Panel {

private long userAdminId;


public ElectionsListPanel(String id, PageParameters pars) {
super(id);
List<Election> electionsList = new ArrayList<>();
Expand Down Expand Up @@ -89,22 +87,25 @@ protected void populateItem(ListItem<Election> item) {
BookmarkablePageLink<Void> census = new BookmarkablePageLink<>("manageCensus", ElectionCensusDashboard.class, UtilsParameters.getId(currentElection.getElectionId()));
census.setMarkupId("electionCensus" + currentElection.getElectionId());
census.setEnabled(!currentElection.isClosed());
String atribute = "class";
String btnClass = "btn-circle btn-primary btn-sm";

if (currentElection.isElectorsSet())
census.add(new AttributeModifier("class", "btn-circle btn-primary btn-sm"));
census.add(new AttributeModifier(atribute, btnClass));
item.add(census);

BookmarkablePageLink<Void> candidates = new BookmarkablePageLink<>("candidates", ElectionCandidatesDashboard.class, UtilsParameters.getId(currentElection.getElectionId()));
candidates.setMarkupId("electionCandidates" + currentElection.getElectionId());
candidates.setEnabled(!currentElection.isClosed());
if (currentElection.isCandidatesSet())
candidates.add(new AttributeModifier("class", "btn-circle btn-primary btn-sm"));
candidates.add(new AttributeModifier(atribute, btnClass));
item.add(candidates);

BookmarkablePageLink<Void> auditors = new BookmarkablePageLink<>("auditors", ElectionAuditorsDashboard.class, UtilsParameters.getId(currentElection.getElectionId()));
auditors.setMarkupId("electionAuditors" + currentElection.getElectionId());
auditors.setEnabled(!currentElection.isClosed());
if (currentElection.isAuditorsSet())
auditors.add(new AttributeModifier("class", "btn-circle btn-primary btn-sm"));
auditors.add(new AttributeModifier(atribute, btnClass));
item.add(auditors);

ButtonDeleteWithConfirmation buttonDeleteWithConfirmation = new ButtonDeleteWithConfirmation("removeElection", currentElection.getElectionId()) {
Expand All @@ -121,7 +122,7 @@ public void onConfirm() {
} else {
isNew = false;
isJoint = AppContext.getInstance().getManagerBeanRemote().isJointElection(currentElection.getElectionId());
};
}

if ((!isNew) && (isJoint)) {
SecurityUtils.error(getString("deleteElectionErrorJoint"));
Expand All @@ -147,7 +148,7 @@ public void onConfirm() {
BookmarkablePageLink<Void> manageEmailsLink = new BookmarkablePageLink<>("manageEmails", EmailTemplatesDashboard.class, UtilsParameters.getId(currentElection.getElectionId()));
manageEmailsLink.setMarkupId("manageEmails" + currentElection.getElectionId());
manageEmailsLink.setVisible(!currentElection.isClosed());
item.add(manageEmailsLink);
item.add(manageEmailsLink);

BookmarkablePageLink<Void> statsLink = new BookmarkablePageLink<>("seeStats", StatsDashboard.class, UtilsParameters.getId(currentElection.getElectionId()));
statsLink.setMarkupId("seeStats" + currentElection.getElectionId());
Expand Down

0 comments on commit e62f0c1

Please sign in to comment.