Commit 4d27b784c039b4304510b8cedc423283056c8701
Committed by
Rafael Manzo
1 parent
3af54fad
Exists in
colab
and in
4 other branches
Range's new feature has reading listing now
Pending select action to choose reading Pending unit and acceptance test
Showing
6 changed files
with
32 additions
and
8 deletions
Show diff stats
app/controllers/mezuro_ranges.rb
app/controllers/mezuro_ranges_controller.rb
| ... | ... | @@ -6,6 +6,8 @@ class MezuroRangesController < ApplicationController |
| 6 | 6 | @mezuro_range = MezuroRange.new |
| 7 | 7 | @mezuro_range.metric_configuration_id = params[:metric_configuration_id].to_i |
| 8 | 8 | @mezuro_range.mezuro_configuration_id = params[:mezuro_configuration_id].to_i |
| 9 | + @reading_group_id = MetricConfiguration.find(@mezuro_range.metric_configuration_id).reading_group_id | |
| 10 | + @reading_group = ReadingGroup.find(@reading_group_id) | |
| 9 | 11 | end |
| 10 | 12 | |
| 11 | 13 | def show |
| ... | ... | @@ -26,5 +28,4 @@ class MezuroRangesController < ApplicationController |
| 26 | 28 | def edit |
| 27 | 29 | end |
| 28 | 30 | |
| 29 | - | |
| 30 | 31 | end |
| 31 | 32 | \ No newline at end of file | ... | ... |
app/views/mezuro_ranges/_form.html.erb
| 1 | 1 | <%= render :partial => 'shared/form_errors', :locals => {:object => @mezuro_range} %> |
| 2 | - | |
| 2 | + | |
| 3 | 3 | <div class="form-group"> |
| 4 | 4 | <%= f.label :beginning, class: 'control-label' %><br> |
| 5 | 5 | <%= f.text_field :beginning, class: 'form-control' %> |
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | <div class="form-group"> |
| 9 | 9 | <%= f.label :end, class: 'control-label' %><br> |
| 10 | - <%= f.text_area :end, class: 'form-control' %> | |
| 10 | + <%= f.text_field :end, class: 'form-control' %> | |
| 11 | 11 | </div> |
| 12 | 12 | |
| 13 | 13 | <div class="form-group"> | ... | ... |
app/views/mezuro_ranges/new.html.erb
| 1 | 1 | <h1>New Range</h1> |
| 2 | 2 | |
| 3 | - | |
| 4 | 3 | <%= form_for(@mezuro_range, :url => mezuro_configuration_metric_configuration_path(@mezuro_range.mezuro_configuration_id, |
| 5 | 4 | @mezuro_range.metric_configuration_id)) do |f| %> |
| 6 | 5 | <%= render partial: 'form', locals: {f: f} %> |
| 7 | 6 | <% end %> |
| 7 | + | |
| 8 | +<table class="table table-hover"> | |
| 9 | + <thead> | |
| 10 | + <tr> | |
| 11 | + <th>Label</th> | |
| 12 | + <th>Grade</th> | |
| 13 | + <th>Color</th> | |
| 14 | + </tr> | |
| 15 | + </thead> | |
| 16 | + | |
| 17 | + <tbody> | |
| 18 | + <% if @reading_group.readings.size == 0 %> | |
| 19 | + <%= render partial: 'no_readings' %> | |
| 20 | + <% else %> | |
| 21 | + <%= render partial: 'reading', collection: @reading_group.readings, as: :reading %> | |
| 22 | + <% end %> | |
| 23 | + </tbody> | |
| 24 | + | |
| 25 | +</table> | ... | ... |