diff --git a/app/controllers/my_profile/manage_products_controller.rb b/app/controllers/my_profile/manage_products_controller.rb
index bbb6df9..ed181dc 100644
--- a/app/controllers/my_profile/manage_products_controller.rb
+++ b/app/controllers/my_profile/manage_products_controller.rb
@@ -138,7 +138,7 @@ class ManageProductsController < ApplicationController
def display_inputs_cost
@product = @profile.products.find(params[:id])
- render :partial => 'inputs_cost'
+ render :inline => "<%= float_to_currency(@product.inputs_cost) %>"
end
def destroy
diff --git a/app/views/manage_products/_display_price_details.rhtml b/app/views/manage_products/_display_price_details.rhtml
index 5ac2ae4..a65b18b 100644
--- a/app/views/manage_products/_display_price_details.rhtml
+++ b/app/views/manage_products/_display_price_details.rhtml
@@ -5,7 +5,7 @@
<%= _('Inputs:') %>
- <%= render :partial => 'inputs_cost' %>
+ <%= float_to_currency(@product.inputs_cost) %>
<% @product.price_details.each do |price_detail| %>
diff --git a/app/views/manage_products/_inputs_cost.rhtml b/app/views/manage_products/_inputs_cost.rhtml
deleted file mode 100644
index bae2240..0000000
--- a/app/views/manage_products/_inputs_cost.rhtml
+++ /dev/null
@@ -1,5 +0,0 @@
-<%= float_to_currency(@product.inputs_cost) %>
-
-
- <%= _("Congratulations! Now the product's price is open to the public") %>
-
diff --git a/app/views/manage_products/_manage_product_details.rhtml b/app/views/manage_products/_manage_product_details.rhtml
index 85051a4..a588e9d 100644
--- a/app/views/manage_products/_manage_product_details.rhtml
+++ b/app/views/manage_products/_manage_product_details.rhtml
@@ -7,8 +7,12 @@
<%= _('Inputs') %> |
- <%= float_to_currency(@product.inputs_cost) %> |
- <%= _('This value is composed by the total value of registered inputs') %> |
+
+ <%= float_to_currency(@product.inputs_cost) %>
+ |
+
+ <%= _('This value is composed by the total value of registered inputs') %>
+ |
<%= render :partial => 'edit_price_details', :locals => {:price_details => @product.price_details} %>
diff --git a/app/views/manage_products/_price_composition_bar.rhtml b/app/views/manage_products/_price_composition_bar.rhtml
index d2395db..57f19e4 100644
--- a/app/views/manage_products/_price_composition_bar.rhtml
+++ b/app/views/manage_products/_price_composition_bar.rhtml
@@ -17,7 +17,6 @@
<%= price_composition_progressbar_text(@product) %>
-
- <%= _("The production cost of your product is not described yet. If you want to display the price composition, please add all the costs") %>
- <%= _("The production cost of your product is fully described and will be displayed on your product's page") %>
+ ' data-price-described-notice='<%= _("Congratulations! Now the price is open to the public") %>'>
+
diff --git a/public/javascripts/manage-products.js b/public/javascripts/manage-products.js
index 748d7fd..20094e1 100644
--- a/public/javascripts/manage-products.js
+++ b/public/javascripts/manage-products.js
@@ -32,7 +32,7 @@
$("#manage-product-details-button").show();
});
if ($('#progressbar-icon').hasClass('ui-icon-check')) {
- display_notice($('#price-described-notice').show());
+ display_notice($('#progressbar-icon').attr('data-price-described-notice'));
}
return false;
});
@@ -55,11 +55,11 @@
$("form.edit_input").live('submit', function(data) {
var form = this;
- updatePriceCompositionBar(form);
inputs_cost_update_url = $(form).find('#inputs-cost-update-url').val();
$.get(inputs_cost_update_url, function(data){
$(".inputs-cost span").html(data);
});
+ updatePriceCompositionBar(form);
return false;
});
@@ -71,18 +71,18 @@
$("#display-manage-price-details").html('');
};
- function updatePriceCompositionBar(form) {
- bar_url = $(form).find('.bar-update-url').val();
- $.get(bar_url, function(data){
- $("#price-composition-bar").html(data);
- $('form #product_price').val(currencyToFloat($('#progressbar-text .product_price').html(), currency_format.separator, currency_format.delimiter));
- $('form #product_inputs_cost').val(currencyToFloat($('#display-product-price-details .inputs-cost span').html(), currency_format.separator, currency_format.delimiter, currency_format.unit));
- calculateValuesForBar();
- });
- };
-
})(jQuery);
+function updatePriceCompositionBar(form) {
+ bar_url = jQuery(form).find('.bar-update-url').val();
+ jQuery.get(bar_url, function(data){
+ jQuery("#price-composition-bar").html(data);
+ jQuery('form #product_price').val(currencyToFloat(jQuery('#progressbar-text .product_price').html(), currency_format.separator, currency_format.delimiter));
+ jQuery('form #product_inputs_cost').val(currencyToFloat(jQuery('#display-product-price-details .inputs-cost span').html(), currency_format.separator, currency_format.delimiter, currency_format.unit));
+ calculateValuesForBar();
+ });
+};
+
function enablePriceDetailSubmit() {
jQuery('#manage-product-details-form input.submit').removeAttr("disabled").removeClass('disabled');
}
@@ -125,7 +125,7 @@ function floatToCurrency(value, sep, del, cur) {
function currencyToFloat(value, sep, del, cur) {
var val = value;
- if (cur) val.replace(cur + ' ', '');
+ if (cur) val = val.replace(cur + ' ', '');
if (!sep) sep = '.';
if (!del) del = ',';
return parseFloat(val.replace(del, '').replace(sep, '.'));
@@ -166,11 +166,11 @@ function priceCompositionBar(value, described, total_cost, price) {
$(bar_area).find('.product_price').html(floatToCurrency(price, currency_format.separator, currency_format.delimiter));
if (described) {
$(bar_area).find('#progressbar-icon').addClass('ui-icon-check');
- $(bar_area).find('#progressbar-icon').attr('title', $('#price-described-message').html());
+ $(bar_area).find('#progressbar-icon').attr('title', $('#progressbar-icon').attr('data-price-described-message'));
$(bar_area).find('div.ui-progressbar-value').addClass('price-described');
} else {
$(bar_area).find('#progressbar-icon').removeClass('ui-icon-check');
- $(bar_area).find('#progressbar-icon').attr('title', $('#price-not-described-message').html());
+ $(bar_area).find('#progressbar-icon').attr('title', $('#progressbar-icon').attr('data-price-not-described-message'));
$(bar_area).find('div.ui-progressbar-value').removeClass('price-described');
}
--
libgit2 0.21.2