Skip to content

Commit

Permalink
Finished compound metric form view conform to the tooltips specification
Browse files Browse the repository at this point in the history
  • Loading branch information
fllsouto committed Apr 30, 2014
1 parent d8a4aab commit 1800ca3
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 41 deletions.
81 changes: 58 additions & 23 deletions app/views/compound_metric_configurations/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,33 +1,68 @@
<%= render :partial => 'shared/form_errors', :locals => {:object => @compound_metric_configuration} %>
<div class="row margin-left-none">
<div class="form-table span9">

<%= f.fields_for :metric do |metric| %>
<%= render partial: "metric_options", :locals => {:f => metric, :metric => @compound_metric_configuration.metric} %>
<% end %>
<%= f.fields_for :metric do |metric| %>
<%= render partial: "metric_options", :locals => {:f => metric, :metric => @compound_metric_configuration.metric} %>
<% end %>

<div class="form-group">
<%= f.label :code, class: 'control-label' %>
<%= f.text_field :code, class: 'form-control' %>
</div>
<div class="form-row">
<div class="field-container">
<%= f.label :code, class: 'control-label' %>
<%= f.text_field :code, class: 'text-field' %>
</div>
<div class="help-container">
<p>
Code it is a variable that holds the value of a metric analysis. It's used inside a compound metric
</p>
<p>
Example :
Code foo := 10
</p>
</div>
</div>

<div class="form-group">
<%= f.label :weight, class: 'control-label' %>
<%= f.text_field :weight, class: 'form-control' %>
</div>
<div class="form-row">
<div class="field-container">
<%= f.label :weight, class: 'control-label' %>
<%= f.text_field :weight, class: 'text-field' %>
</div>
<div class="help-container">
<p>
It's the weight of the metric
</p>
</div>
</div>

<div class="form-group">
<%= f.label :aggregation_form, 'Aggregation Form', class: 'control-label' %>
<%= f.select( :aggregation_form, aggregation_options, {class: 'form-control'} ) %>
</div>
<div class="form-row">
<div class="field-container">
<%= f.label :aggregation_form, 'Aggregation Form', class: 'control-label' %>
<%= f.select( :aggregation_form, aggregation_options, {class: 'form-control'} ) %>
</div>
<div class="help-container">
<p>
It's the aggregation form of the metric
</p>
</div>
</div>

<% if @compound_metric_configuration.persisted? %>
<%= hidden_field_tag(:reading_group_id, @compound_metric_configuration.reading_group_id) %>
<% else %>
<div class="form-group">
<%= f.label :reading_group_id, 'Reading Group', class: 'control-label' %>
<%= f.select( :reading_group_id, reading_group_options, {class: 'form-control'} ) %>
<% if @metric_configuration.persisted? %>
<%= hidden_field_tag(:reading_group_id, @metric_configuration.reading_group_id) %>
<% else %>
<div class="form-row">
<div class="field-container">
<%= f.label :reading_group_id, 'Reading Group', class: 'control-label' %>
<%= f.select( :reading_group_id, reading_group_options, {class: 'form-control'} ) %>
</div>
<div class="help-container">
<p>
The reading group that is associated with this metric
</p>
</div>
</div>
<% end %>
</div>
<% end %>

</div>
<br>
<%= f.submit 'Save', class: 'btn btn-primary' %>
<%= link_to 'Back', mezuro_configuration_path(@compound_metric_configuration.configuration_id), class: 'btn btn-default' %>
63 changes: 45 additions & 18 deletions app/views/compound_metric_configurations/_metric_options.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
<div class="form-group">
<%= f.label :name, class: 'control-label' %>
<%= f.text_field :name, class: 'form-control', value: (metric.name unless metric.nil?) %>
</div>
<div class="form-row">
<div class="field-container">
<%= f.label :name, class: 'control-label' %>
<%= f.text_field :name, class: 'text-field', value: (metric.name unless metric.nil?) %>
</div>
<div class="help-container">
<p>
A custom name for your compound metric.
</p>
</div>
</div>

<div class="form-group">
<%= f.label :description, class: 'control-label' %>
<%= f.text_field :description, class: 'form-control', value: (metric.description unless metric.nil?) %>
</div>
<div class="form-row">
<div class="field-container">
<%= f.label :description, class: 'control-label' %>
<%= f.text_field :description, class: 'text-field', value: (metric.description unless metric.nil?) %>
</div>
<div class="help-container">
<p>
A short description about your compound metric.
</p>
</div>
</div>

<div class="form-group">
<%= f.label :script, class: 'control-label' %>
<%= f.text_area :script, class: 'form-control', value: (metric.script unless metric.nil?) %>
</div>
<div class="form-row">
<div class="field-container">
<%= f.label :script, class: 'control-label' %>
<%= f.text_area :script, class: 'text-area', value: (metric.script unless metric.nil?) %>
</div>
<div class="help-container">
<p>
A mathematic expression to calculate your compound metric.
</p>
</div>
</div>

<div class="form-group">
<%= f.label :scope, 'Scope', class: 'control-label' %>
<%= f.select( :scope, scope_options, {class: 'form-control', selected: (metric.scope unless metric.nil?)} ) %>
</div>

<%= f.hidden_field(:compound, { value: "true"}) %>
<div class="form-row">
<div class="field-container">
<%= f.label :scope, 'Scope', class: 'control-label' %>
<%= f.select( :scope, scope_options, {class: 'form-control', selected: (metric.scope unless metric.nil?)} ) %>
</div>
<div class="help-container">
<p>
With which code type your metric is designed to work?
</p>
</div>
</div>
<%= f.hidden_field(:compound, { value: "true"}) %>

1 comment on commit 1800ca3

@rafamanzo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder: was doing some review for releasing a new version and found that the metric_options file was idented with tabs instead of spaces :)

No action needed I've already fixed this.

Please sign in to comment.