Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
doodle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jquery Plugin
doodle
Commits
e50432e3
Commit
e50432e3
authored
Mar 09, 2018
by
Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.1.1 fix de beugs doodle et ajout format date sur le front
parent
26b48bcc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
+31
-15
README.md
README.md
+9
-0
doodle.js
dist/js/doodle.js
+19
-12
package.json
package.json
+1
-1
app.js
test/js/app.js
+2
-2
No files found.
README.md
View file @
e50432e3
...
@@ -8,6 +8,15 @@
...
@@ -8,6 +8,15 @@
npm install
npm install
```
`
```
`
# Options
| Parameters | Options | Description |
|--|--|--|
|editMode| false (default) | Enable doodle's backend|
|input| '' | jQuery selector input to attach or select json|
|defaultHours|[] (default)|Set default hours|
|outputDateFormat|''|Define output date format|
## FrontEnd
## FrontEnd
app.js
app.js
```javascript
```javascript
...
...
dist/js/doodle.js
View file @
e50432e3
...
@@ -258,14 +258,20 @@
...
@@ -258,14 +258,20 @@
* @param data
* @param data
*/
*/
this
.
addInOutputObject
=
(
data
)
=>
{
this
.
addInOutputObject
=
(
data
)
=>
{
if
(
!
this
.
outputJson
[
data
[
0
]])
{
this
.
outputJson
[
data
[
0
]]
=
[];
let
dayFormat
=
moment
(
data
[
0
],
'DDMMYYYY'
).
format
(
this
.
dateFormat
);
if
(
!
this
.
outputJson
[
dayFormat
])
{
this
.
outputJson
[
dayFormat
]
=
[];
}
}
let
output
=
this
.
outputJson
[
da
ta
[
0
]
];
let
output
=
this
.
outputJson
[
da
yFormat
];
if
(
output
.
indexOf
(
data
[
1
])
===
-
1
)
{
if
(
output
.
indexOf
(
data
[
1
])
===
-
1
)
{
output
.
push
(
data
[
1
]);
output
.
push
(
data
[
1
]);
output
.
sort
(
function
(
a
,
b
)
{
return
moment
(
a
,
'HH:mm'
)
-
moment
(
b
,
'HH:mm'
);
});
}
}
};
};
...
@@ -274,15 +280,17 @@
...
@@ -274,15 +280,17 @@
* @param data
* @param data
*/
*/
this
.
removeInOutputObject
=
(
data
)
=>
{
this
.
removeInOutputObject
=
(
data
)
=>
{
if
(
this
.
outputJson
[
data
[
0
]])
{
let
dayFormat
=
moment
(
data
[
0
],
'DDMMYYYY'
).
format
(
this
.
dateFormat
);
let
output
=
this
.
outputJson
[
data
[
0
]];
if
(
this
.
outputJson
[
dayFormat
])
{
let
output
=
this
.
outputJson
[
dayFormat
];
let
index
=
output
.
indexOf
(
data
[
1
]);
let
index
=
output
.
indexOf
(
data
[
1
]);
if
(
index
!==
-
1
)
{
if
(
index
!==
-
1
)
{
output
.
splice
(
index
,
1
);
output
.
splice
(
index
,
1
);
if
(
output
.
length
===
0
)
{
if
(
output
.
length
===
0
)
{
delete
this
.
outputJson
[
da
ta
[
0
]
];
delete
this
.
outputJson
[
da
yFormat
];
}
}
}
}
}
}
...
@@ -620,7 +628,7 @@
...
@@ -620,7 +628,7 @@
* Get Json data
* Get Json data
*/
*/
this
.
getJsonData
=
()
=>
{
this
.
getJsonData
=
()
=>
{
let
dataJson
=
$
(
this
.
config
.
input
).
val
();
let
dataJson
=
$
(
this
.
config
.
input
Selector
).
val
();
if
(
this
.
isJsonString
(
dataJson
)){
if
(
this
.
isJsonString
(
dataJson
)){
this
.
json
=
JSON
.
parse
(
dataJson
);
this
.
json
=
JSON
.
parse
(
dataJson
);
...
@@ -687,7 +695,7 @@
...
@@ -687,7 +695,7 @@
* Generate JSON
* Generate JSON
*/
*/
this
.
createJSON
=
()
=>
{
this
.
createJSON
=
()
=>
{
let
$input
=
$
(
this
.
config
.
output
);
let
$input
=
$
(
this
.
config
.
inputSelector
);
if
(
$input
.
length
>
0
)
{
if
(
$input
.
length
>
0
)
{
$input
.
val
(
JSON
.
stringify
(
this
.
outputJson
));
$input
.
val
(
JSON
.
stringify
(
this
.
outputJson
));
...
@@ -776,7 +784,7 @@
...
@@ -776,7 +784,7 @@
//Permet de mettre dans le bon format DD:mm, le timePicker retourne mauvais format
//Permet de mettre dans le bon format DD:mm, le timePicker retourne mauvais format
if
(
splitHour
[
0
].
length
===
1
)
{
if
(
splitHour
[
0
].
length
===
1
)
{
let
goodHourFormat
=
'0'
+
splitHour
[
0
]
+
':'
+
splitHour
[
1
]
;
let
goodHourFormat
=
'0'
+
splitHour
[
0
];
if
(
this
.
keyExist
(
goodHourFormat
))
{
if
(
this
.
keyExist
(
goodHourFormat
))
{
this
.
hours
.
push
(
goodHourFormat
);
this
.
hours
.
push
(
goodHourFormat
);
}
}
...
@@ -882,7 +890,7 @@
...
@@ -882,7 +890,7 @@
* @param data
* @param data
*/
*/
this
.
removeInOutputObject
=
(
data
)
=>
{
this
.
removeInOutputObject
=
(
data
)
=>
{
let
dayFormat
=
moment
(
data
[
0
],
'DDMMYYYY'
).
format
(
this
.
dateFormat
);
let
dayFormat
=
moment
(
data
[
0
],
this
.
dateFormat
).
format
(
this
.
dateFormat
);
if
(
this
.
outputJson
[
dayFormat
])
{
if
(
this
.
outputJson
[
dayFormat
])
{
let
output
=
this
.
outputJson
[
dayFormat
];
let
output
=
this
.
outputJson
[
dayFormat
];
...
@@ -927,8 +935,7 @@
...
@@ -927,8 +935,7 @@
function
initializeConfig
()
{
function
initializeConfig
()
{
let
defaultOptions
=
{
let
defaultOptions
=
{
editMode
:
false
,
editMode
:
false
,
output
:
''
,
inputSelector
:
''
,
input
:
''
,
defaultHours
:
[],
defaultHours
:
[],
outputDateFormat
:
''
outputDateFormat
:
''
};
};
...
...
package.json
View file @
e50432e3
{
{
"name"
:
"
doodle
"
,
"name"
:
"
doodle
"
,
"author"
:
"Simon <simon@appolo.fr>"
,
"author"
:
"Simon <simon@appolo.fr>"
,
"version"
:
"1.1.
0
"
,
"version"
:
"1.1.
1
"
,
"main"
:
"dist/js/doodle.js"
,
"main"
:
"dist/js/doodle.js"
,
"repository"
:
{
"repository"
:
{
"type"
:
"git"
,
"type"
:
"git"
,
...
...
test/js/app.js
View file @
e50432e3
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.doodle'
).
Doodle
({
$
(
'.doodle'
).
Doodle
({
editMode
:
true
,
editMode
:
true
,
output
:
'#inputVal'
,
inputSelector
:
'#inputVal'
input
:
'#inputVal'
});
});
});
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment