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
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Arnaud
doodle
Commits
bb40d7c0
Commit
bb40d7c0
authored
May 07, 2019
by
Arnaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add list option
parent
a5615f8c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
9 deletions
+55
-9
workspace.xml
.idea/workspace.xml
+0
-0
doodle.css
dist/css/doodle.css
+8
-0
doodle.js
dist/js/doodle.js
+45
-8
app.js
test/js/app.js
+2
-1
No files found.
.idea/workspace.xml
View file @
bb40d7c0
This diff is collapsed.
Click to expand it.
dist/css/doodle.css
View file @
bb40d7c0
.doodle-list
{
list-style-type
:
none
;
}
.doodle-label
{
margin-left
:
15px
;
}
.doodle-table
{
.doodle-table
{
border-collapse
:
collapse
;
border-collapse
:
collapse
;
width
:
100%
;
width
:
100%
;
...
...
dist/js/doodle.js
View file @
bb40d7c0
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
*/
*/
let
DoodleFront
=
function
(
item
,
config
)
{
let
DoodleFront
=
function
(
item
,
config
)
{
this
.
item
=
item
;
this
.
item
=
item
;
this
.
config
=
config
;
this
.
config
=
config
;
this
.
json
=
null
;
this
.
json
=
null
;
...
@@ -20,6 +19,8 @@
...
@@ -20,6 +19,8 @@
this
.
initLoad
=
()
=>
{
this
.
initLoad
=
()
=>
{
this
.
getJsonData
();
this
.
getJsonData
();
console
.
log
(
this
.
json
);
if
(
!
this
.
json
)
{
if
(
!
this
.
json
)
{
console
.
warn
(
'Invalid Json data'
);
console
.
warn
(
'Invalid Json data'
);
return
;
return
;
...
@@ -27,21 +28,30 @@
...
@@ -27,21 +28,30 @@
this
.
getDays
();
this
.
getDays
();
this
.
getHours
();
this
.
getHours
();
this
.
createTable
();
this
.
createTable
(
config
);
this
.
initCSS
();
this
.
initCSS
(
config
);
//Remet l'overflow pour le responsive en front
//Remet l'overflow pour le responsive en front
if
(
!
config
.
vertical
)
{
$
(
'table'
).
parent
().
css
(
'overflow-x'
,
'auto'
);
$
(
'table'
).
parent
().
css
(
'overflow-x'
,
'auto'
);
}
};
};
/**
/**
* Create Table
* Create Table
*/
*/
this
.
createTable
=
()
=>
{
this
.
createTable
=
(
config
)
=>
{
console
.
log
(
config
);
$
(
document
).
on
(
'click'
,
'input[type=checkbox]'
,
this
.
eventInput
);
$
(
document
).
on
(
'click'
,
'input[type=checkbox]'
,
this
.
eventInput
);
if
(
config
.
vertical
)
{
this
.
item
.
append
(
`
<ul class="doodle-list">
${
this
.
createList
()}
</ul>
`
);
}
else
{
this
.
item
.
append
(
`
this
.
item
.
append
(
`
<table class="table doodle-table frontend">
<table class="table doodle-table frontend">
<thead>
<thead>
...
@@ -53,11 +63,39 @@
...
@@ -53,11 +63,39 @@
</tbody>
</tbody>
</table>
</table>
`
);
`
);
}
};
};
this
.
createList
=
function
()
{
let
div
=
$
(
'<div>'
);
// DAYS =>
for
(
let
index
in
this
.
days
)
{
let
formatDateDay
=
moment
(
this
.
days
[
index
],
this
.
dateFormat
).
locale
(
'fr'
).
format
(
'dddd DD'
);
let
formatDateMonth
=
moment
(
this
.
days
[
index
],
this
.
dateFormat
).
locale
(
'fr'
).
format
(
'MMMM'
);
let
$h3
=
$
(
'<h5><span class="date_format"><b>'
+
formatDateDay
+
'</b></span> '
+
formatDateMonth
+
'</td>'
);
div
.
append
(
$h3
);
for
(
let
index2
in
this
.
hours
)
{
let
$li
=
$
(
'<li class="p-3">'
);
if
(
this
.
json
[
this
.
days
[
index
]].
includes
(
this
.
hours
[
index2
]))
{
let
hour
=
this
.
hours
[
index2
];
if
(
hour
.
indexOf
(
':'
)
===
-
1
)
{
hour
+=
'h'
;
}
else
{
hour
=
hour
.
replace
(
':'
,
'h'
);
}
$li
.
html
(
this
.
createInputBox
(
this
.
hours
[
index2
],
formatDateDay
)
+
'<label class="doodle-label">'
+
hour
+
'</label>'
);
div
.
append
(
$li
);
}
}
}
return
div
.
html
();
}
this
.
initCSS
=
function
()
{
this
.
initCSS
=
function
()
{
$
(
'.empty'
).
css
(
'background'
,
'#fafafa'
)
$
(
'.empty'
).
css
(
'background'
,
'#fafafa'
)
};
};
/**
/**
...
@@ -185,9 +223,8 @@
...
@@ -185,9 +223,8 @@
this
.
json
=
JSON
.
parse
(
dataJson
);
this
.
json
=
JSON
.
parse
(
dataJson
);
}
else
{
}
else
{
let
data
=
this
.
fileExistsAndGetData
(
dataJson
);
let
data
=
this
.
fileExistsAndGetData
(
dataJson
);
if
(
data
){
if
(
data
)
{
let
json
=
JSON
.
parse
(
data
);
let
json
=
JSON
.
parse
(
data
);
if
(
!
$
.
isEmptyObject
(
json
))
{
if
(
!
$
.
isEmptyObject
(
json
))
{
this
.
json
=
json
;
this
.
json
=
json
;
}
}
...
...
test/js/app.js
View file @
bb40d7c0
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.doodle'
).
Doodle
({
$
(
'.doodle'
).
Doodle
({
editMode
:
tru
e
,
editMode
:
fals
e
,
inputSelector
:
'#inputVal'
inputSelector
:
'#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