Skip to content

Commit

Permalink
Merge branch '2.3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
leomurta committed Jul 31, 2013
2 parents 437994f + 8ee3a43 commit 62b985b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/course_classes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class CourseClassesController < ApplicationController
authorize_resource
include NumbersHelper
helper :class_enrollments

active_scaffold :course_class do |config|

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/enrollments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class EnrollmentsController < ApplicationController
authorize_resource
include NumbersHelper
include ApplicationHelper
helper :class_enrollments


active_scaffold :enrollment do |config|
Expand Down Expand Up @@ -58,7 +59,7 @@ class EnrollmentsController < ApplicationController
config.columns[:student].form_ui = :record_select
config.create.columns = [:enrollment_number, :admission_date, :level, :enrollment_status, :obs, :student, :advisements, :accomplishments, :deferrals, :scholarship_durations, :dismissal, :class_enrollments]
config.update.columns = [:enrollment_number, :admission_date, :level, :enrollment_status, :obs, :student, :advisements, :accomplishments, :deferrals, :scholarship_durations, :dismissal, :class_enrollments]
config.show.columns = [:enrollment_number, :admission_date, :level, :enrollment_status, :obs, :student, :advisements, :accomplishments, :deferrals, :scholarship_durations, :dismissal]
config.show.columns = [:enrollment_number, :admission_date, :level, :enrollment_status, :obs, :student, :advisements, :accomplishments, :deferrals, :scholarship_durations, :dismissal, :class_enrollments]
end
record_select :per_page => 10, :search_on => [:enrollment_number], :order_by => 'enrollment_number', :full_text_search => true

Expand Down
4 changes: 4 additions & 0 deletions app/helpers/class_enrollments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file.

module ClassEnrollmentsHelper
def grade_form_column(record, options)
options = options.merge({:maxlength => 5, :class => "grade-input numeric-input text-input"})
text_field :record, :grade_to_view, options
end
end
4 changes: 4 additions & 0 deletions app/models/class_enrollment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def grade=(new_grade)
super(new_grade)
end

def grade_to_view
grade.nil? ? nil : (grade/10.0)
end

private
def grade_for_situation
if course_has_grade
Expand Down

0 comments on commit 62b985b

Please sign in to comment.