Skip to content

Commit

Permalink
SAKAI-3187 Improve student view
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Canessa authored and master-bob committed Feb 15, 2017
1 parent f03e604 commit d96a28b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ attendance.record.form.cancel = Cancel
attendance.record.form.add.comment = Add Comment
attendance.record.form.view.comment = Comment

attendance.no.record = Unrecorded

attendance.icon.record.form.no_comment = Comment
attendance.icon.record.form.yes_comment = Comment Present

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public void onClick() {
};
studentLink.add(stuName);
item.add(studentLink);
item.add(new AttendanceRecordFormDataPanel("record", item.getModel(), true, returnPage, feedbackPanel));
item.add(new AttendanceRecordFormDataPanel("record", item.getModel(), returnPage, feedbackPanel));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ <h3 class="takeAttendanceHeader">
});
</script>
</div>
<label wicket:id="student-view-hidden" hidden id="studentView" aria-hidden="true"/>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ private void init() {
hideNavigationLink(this.gradingLink);
}

add(new Label("student-view-hidden","") {
@Override
public boolean isVisible() {
return isStudent;
}
});

add(createHeader());
add(createGrade());
add(createStatistics());
Expand Down Expand Up @@ -208,7 +215,7 @@ public void onClick() {
}
item.add(eventLink);
item.add(new Label("event-date", item.getModelObject().getAttendanceEvent().getStartDateTime()));
item.add(new AttendanceRecordFormDataPanel("record", item.getModel(), false, returnPage, feedbackPanel));
item.add(new AttendanceRecordFormDataPanel("record", item.getModel(), returnPage, feedbackPanel));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
</wicket:container>
</div>
<div class="div-table-col comment-container" style="position:relative" wicket:id="comment-container">
<div class="div-table-col comment-container" wicket:id="comment-container">
<div class="commentToggle">
<div wicket:id="no-comment">
<span class="fa fa-comment-o fa-2x" aria-hidden="true"></span>
Expand Down Expand Up @@ -60,6 +60,7 @@ <h3><span wicket:id="add-header" /></h3>
</script>
</div>
</form>
<div wicket:id="no-record" class="noRecord"><wicket:message key="attendance.no.record"/></div>
</wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
public class AttendanceRecordFormDataPanel extends BasePanel {
private static final long serialVersionUID = 1L;
private IModel<AttendanceRecord> recordIModel;
private boolean isStudentView;
private boolean restricted ;
private boolean showCommentsToStudents;
private List<Component> ajaxTargets = new ArrayList<Component>();
Expand All @@ -60,16 +59,16 @@ public class AttendanceRecordFormDataPanel extends BasePanel {
private WebMarkupContainer noComment;
private WebMarkupContainer yesComment;

public AttendanceRecordFormDataPanel(String id, IModel<AttendanceRecord> aR, boolean iS, String rP, FeedbackPanel fP) {
public AttendanceRecordFormDataPanel(String id, IModel<AttendanceRecord> aR, String rP, FeedbackPanel fP) {
super(id, aR);
this.recordIModel = aR;
this.oldStatus = aR.getObject().getStatus();
this.showCommentsToStudents = recordIModel.getObject().getAttendanceEvent().getAttendanceSite().getShowCommentsToStudents();
this.isStudentView = iS;
this.restricted = this.role != null && this.role.equals("Student");
this.returnPage = rP;
this.pageFeedbackPanel = fP;
this.ajaxTargets.add(this.pageFeedbackPanel);

add(createRecordInputForm());
}

Expand Down Expand Up @@ -102,11 +101,17 @@ public boolean isEnabled() {
createStatusRadio(recordForm);
createCommentBox(recordForm);

boolean noRecordBool = recordForm.getModelObject().getStatus().equals(Status.UNKNOWN) && restricted;
recordForm.setVisibilityAllowed(!noRecordBool);

WebMarkupContainer noRecordContainer = new WebMarkupContainer("no-record");
noRecordContainer.setVisibilityAllowed(noRecordBool);
add(noRecordContainer);

return recordForm;
}

private void createStatusRadio(final Form<AttendanceRecord> rF) {

AttendanceStatusProvider attendanceStatusProvider = new AttendanceStatusProvider(attendanceLogic.getCurrentAttendanceSite(), AttendanceStatusProvider.ACTIVE);
DataView<AttendanceStatus> attendanceStatusRadios = new DataView<AttendanceStatus>("status-radios", attendanceStatusProvider) {
@Override
Expand Down
3 changes: 2 additions & 1 deletion tool/src/webapp/css/attendance.css
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ div.comment-container {

.comment-container {
float: right;
width: auto;
margin-right: .5em;
}
}

Expand Down Expand Up @@ -653,7 +655,6 @@ div.comment-container {
.comment-container {
float: right;
margin-left: 2em;
margin-top: 5em;
}
}

Expand Down
12 changes: 10 additions & 2 deletions tool/src/webapp/javascript/attendanceRecordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@

(function (attendance, $, undefined) {
// Set the status class (which applies a background) if the input is selected
function processInput (inputs) {
function processInput (inputs, isStudentView) {
for(var i = 0; i < inputs.length; i++) {
if(inputs[i].checked) {
var statusName = $(inputs[i]).siblings("label[hidden]").text();
$(inputs[i]).parent().addClass(statusName);
} else {
$(inputs[i]).parent().removeClass().addClass("div-table-col");
if(isStudentView && $(window).width() < 1205) {
$(inputs[i]).parent().removeClass().addClass("skip");
}
}
}
}
Expand All @@ -47,6 +50,11 @@
inputs.push(this);
});

processInput(inputs);
var isStudentView = false;
if($("#studentView").size() > 0) {
isStudentView = true;
}

processInput(inputs, isStudentView);
};
}(window.attendance = window.attendance || {}, jQuery ));

0 comments on commit d96a28b

Please sign in to comment.