Skip to content

Commit

Permalink
Merge pull request sakaiproject#1566 from payten/1469-add-missing-pop…
Browse files Browse the repository at this point in the history
…over-close-to-externalflag

1469: Add missing popover close action to the external item flag
  • Loading branch information
steveswinsburg committed Jan 14, 2016
2 parents 8767892 + 5b9a20f commit 59225a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ label.coursegrade.released=Course grade has been released to students.
label.coursegrade.notreleased=Course grade has not been released to students.
label.coursegrade.nopermission=-

label.gradeitem.externalAppPrefix=Gradebook Item coming from
label.gradeitem.externalapplabel=Gradebook Item coming from {0}
label.gradeitem.released=Gradebook Item has been released and is visible to students.
label.gradeitem.notreleased=Gradebook Item not released to students.
label.gradeitem.counted=Gradebook Item is included in the course grade calculation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ label.coursegrade.released=La nota del curso ha sido publicada para los estudian
label.coursegrade.notreleased=La nota del curso no ha sido publicada para los estudiantes.
label.coursegrade.nopermission=-

label.gradeitem.externalAppPrefix=Elemento de Calificaciones que viene de
label.gradeitem.externalapplabel=Elemento de Calificaciones que viene de {0}
label.gradeitem.released=El elemento ha sido publicado y es visible para los estudiantes.
label.gradeitem.notreleased=El elemento de calificaciones no ha sido publicado para los estudiantes.
label.gradeitem.counted=El elemento est\u00e1 incluido en el c\u00e1lculo de la nota del curso.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,24 @@ protected void disableLink(final Link<Void> l) {
public WebMarkupContainer buildFlagWithPopover(final String componentId, final String message) {
final WebMarkupContainer flagWithPopover = new WebMarkupContainer(componentId);

final String popoverHTML = "<a href='javascript:void(0);' class='gb-popover-close'></a><ul class='gb-popover-notifications'><li class='text-info'>%s</li></ul>";
final String wrappedPopoverContent = String.format(popoverHTML, message);

flagWithPopover.add(new AttributeModifier("data-toggle", "popover"));
flagWithPopover.add(new AttributeModifier("data-trigger", "focus"));
flagWithPopover.add(new AttributeModifier("data-placement", "bottom"));
flagWithPopover.add(new AttributeModifier("data-html", "true"));
flagWithPopover.add(new AttributeModifier("data-content", wrappedPopoverContent));
flagWithPopover.add(new AttributeModifier("data-content", generatePopoverContent(message)));
flagWithPopover.add(new AttributeModifier("tabindex", "0"));

return flagWithPopover;
}


/**
* Helper to generate content for a Bootstrap popover with close button
*/
public String generatePopoverContent(final String message) {
final String popoverHTML = "<a href='javascript:void(0);' class='gb-popover-close'></a><ul class='gb-popover-notifications'><li class='text-info'>%s</li></ul>";
final String wrappedPopoverContent = String.format(popoverHTML, message);

return wrappedPopoverContent;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.sakaiproject.gradebookng.business.GbCategoryType;
import org.sakaiproject.gradebookng.business.GbRole;
Expand Down Expand Up @@ -104,7 +105,8 @@ public void onClick() {
} else {
externalAppFlag.setVisible(true);
externalAppFlag.add(new AttributeModifier("data-content",
getString("label.gradeitem.externalAppPrefix") + " " + assignment.getExternalAppName()));
gradebookPage.generatePopoverContent(new StringResourceModel("label.gradeitem.externalapplabel",
null, new Object[] { assignment.getExternalAppName() }).getString())));
String iconClass = "icon-sakai";
if ("Assignments".equals(assignment.getExternalAppName())) {
iconClass = "icon-sakai-assignment-grades";
Expand Down

0 comments on commit 59225a7

Please sign in to comment.