Skip to content

Commit

Permalink
Fix import problem
Browse files Browse the repository at this point in the history
  • Loading branch information
3mp3ri0r committed Dec 10, 2016
1 parent afa2af4 commit 34d8496
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 70 deletions.
110 changes: 54 additions & 56 deletions cpol-currency.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="import" href="./bower_components/polymer/polymer.html">
<link rel="import" href="../polymer/polymer.html">

<!--
# &lt;cpol-currency&gt;
Expand Down Expand Up @@ -79,9 +79,7 @@

<dom-module id="cpol-currency">


<template>

<style>
/* local DOM styles go here */
:host {
Expand All @@ -94,66 +92,66 @@
</template>

<script>
Polymer({
is: 'cpol-currency',
properties: {

/** Amount of money you want to convert to currency format. */
amount: {
type: Number,
value: 0,
},
Polymer({
is: 'cpol-currency',
properties: {

/** The maximum number of decimal. */
fixed: {
type: Number,
value: 2,
},
/** Amount of money you want to convert to currency format. */
amount: {
type: Number,
value: 0,
},

/** Character for separate decimal. */
decimalSeparator: {
type: String,
value: '.',
},
/** The maximum number of decimal. */
fixed: {
type: Number,
value: 2,
},

/** Character for separate thousand in amount. */
valueSeparator: {
type: String,
value: ',',
},
/** Character for separate decimal. */
decimalSeparator: {
type: String,
value: '.',
},

/** Prefix character of currency symbol. */
currencyPrefix: {
type: String,
value: '$',
},
/** Character for separate thousand in amount. */
valueSeparator: {
type: String,
value: ',',
},

/** Suffix character of currency symbol. */
currencySuffix: {
type: String,
value: '',
/** Prefix character of currency symbol. */
currencyPrefix: {
type: String,
value: '$',
},

/** Suffix character of currency symbol. */
currencySuffix: {
type: String,
value: '',
},
},
},

observers: [
'_generateCurrency(amount, fixed, decimalSeparator, valueSeparator, currencyPrefix, currencySuffix)'
],

/**
* Returns input amount in currency format.
*/
_generateCurrency: function(amount, fixed, decimalSeparator, valueSeparator, currencyPrefix, currencySuffix) {
money = amount;
if(!money || isNaN(money)) {
money = '0';

observers: [
'_generateCurrency(amount, fixed, decimalSeparator, valueSeparator, currencyPrefix, currencySuffix)'
],

/**
* Returns input amount in currency format.
*/
_generateCurrency: function(amount, fixed, decimalSeparator, valueSeparator, currencyPrefix, currencySuffix) {
money = amount;
if(!money || isNaN(money)) {
money = '0';
}
moneyToFixed = Number(money).toFixed(fixed);
parts = moneyToFixed.split('.');
fnum = parts[0];
decimal = parts[1] ? decimalSeparator + parts[1] : decimalSeparator + '00';
this.generateCurrency = currencyPrefix + ' ' + fnum.replace(/(\d)(?=(?:\d{3})+$)/g, '$1' + valueSeparator) + decimal + currencySuffix;
}
moneyToFixed = Number(money).toFixed(fixed);
parts = moneyToFixed.split('.');
fnum = parts[0];
decimal = parts[1] ? decimalSeparator + parts[1] : decimalSeparator + '00';
this.generateCurrency = currencyPrefix + ' ' + fnum.replace(/(\d)(?=(?:\d{3})+$)/g, '$1' + valueSeparator) + decimal + currencySuffix;
}
});
});
</script>

</dom-module>
Expand Down
20 changes: 9 additions & 11 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<!doctype html>
<html>
<head>
<script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<title>cpol-currency demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-input/paper-input.html">
<link rel="import" href="../bower_components/iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../bower_components/iron-demo-helpers/demo-pages-shared-styles.html">
<link rel="import" href="../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">

<link rel="import" href="../cpol-currency.html">
<link rel="import" href="cpol-currency-demo.html">

<style is="custom-style" include="demo-pages-shared-styles">
.vertical-section-container {
max-width: 500px;
}
paper-checkbox {
display: block;
margin-right: 24px;
}
</style>
</head>

Expand Down
5 changes: 2 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script src="./bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="./bower_components/polymer/polymer.html">
<link rel="import" href="./bower_components/iron-component-page/iron-component-page.html">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>

Expand Down

0 comments on commit 34d8496

Please sign in to comment.