Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
neuro-images
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
neuro-images
Commits
c5c8df46
Commit
c5c8df46
authored
May 30, 2022
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Правка в логике клика по выбранной картинке
parent
7cd233eb
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
20 deletions
+34
-20
fotos.global.php
src/config/autoload/fotos.global.php
+1
-0
styles-main.css
src/public/css/styles-main.css
+2
-1
script-main.js
src/public/js/script-main.js
+29
-18
Index.php
src/src/App/Action/Admin/Index.php
+1
-0
main.phtml
src/templates/app/main.phtml
+1
-1
No files found.
src/config/autoload/fotos.global.php
View file @
c5c8df46
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
return
[
return
[
'foto_conf'
=>
[
'foto_conf'
=>
[
'formats'
=>
[
'jpg'
,
'jpeg'
,
'webp'
],
'formats'
=>
[
'jpg'
,
'jpeg'
,
'webp'
],
'pairs_count'
=>
5
,
'colors_active'
=>
[
'colors_active'
=>
[
1
=>
'#2CA02C'
,
1
=>
'#2CA02C'
,
2
=>
'#D62728'
,
2
=>
'#D62728'
,
...
...
src/public/css/styles-main.css
View file @
c5c8df46
...
@@ -70,7 +70,8 @@
...
@@ -70,7 +70,8 @@
border-width
:
4px
;
border-width
:
4px
;
}
}
.b-foto_inner.paired
{
.b-folder-content.has-selected
.b-foto_inner.paired
{
cursor
:
default
;
opacity
:
0.5
;
opacity
:
0.5
;
}
}
...
...
src/public/js/script-main.js
View file @
c5c8df46
...
@@ -5,6 +5,7 @@ $(document).ready(function(){
...
@@ -5,6 +5,7 @@ $(document).ready(function(){
$loading
=
$
(
'.b-loading'
),
$loading
=
$
(
'.b-loading'
),
colorsActive
=
$foldersContentWrap
.
data
(
'colors'
),
colorsActive
=
$foldersContentWrap
.
data
(
'colors'
),
freeNumbers
=
[
1
,
2
,
3
,
4
,
5
],
freeNumbers
=
[
1
,
2
,
3
,
4
,
5
],
pairsCount
=
$foldersContentWrap
.
data
(
'pairs_count'
),
currentNumToSelect
=
{},
currentNumToSelect
=
{},
hasSelectedFoto
=
{};
hasSelectedFoto
=
{};
...
@@ -45,6 +46,20 @@ $(document).ready(function(){
...
@@ -45,6 +46,20 @@ $(document).ready(function(){
hasSelectedFoto
[
folderName
]
=
false
;
// Выбрали одну картинку (есть подсвеченное фото)
hasSelectedFoto
[
folderName
]
=
false
;
// Выбрали одну картинку (есть подсвеченное фото)
}
}
function
getCurrenNumToSelect
(
$folderWrap
)
{
for
(
let
n
=
1
;
n
<=
pairsCount
;
n
++
)
{
if
(
$
(
'.b-foto_inner[data-num="'
+
n
+
'"]'
,
$folderWrap
).
length
==
0
)
return
n
;
}
/*
freeNumbers.some(function(el) {
numValue = el;
return ($('.b-foto_inner[data-num="' + el + '"]', $folderWrap).length == 0);
});
return numValue;
*/
}
// Клик на папку для загрузки фотографий:
// Клик на папку для загрузки фотографий:
$
(
'.b-list_folders-item'
).
on
(
'click'
,
function
(){
$
(
'.b-list_folders-item'
).
on
(
'click'
,
function
(){
...
@@ -104,17 +119,6 @@ $(document).ready(function(){
...
@@ -104,17 +119,6 @@ $(document).ready(function(){
$currentFolderWrap
=
$this
.
parents
(
'.b-folder-content'
),
$currentFolderWrap
=
$this
.
parents
(
'.b-folder-content'
),
folderName
=
$currentFolderWrap
.
data
(
'folder'
);
folderName
=
$currentFolderWrap
.
data
(
'folder'
);
console
.
log
(
'AAA folderName '
,
folderName
);
/*
freeNumbers.some(function(el) {
currentNumToSelect = el;
return ($('.b-foto_inner[data-num="' + el + '"]', $currentFolderWrap).length == 0);
});
*/
console
.
log
(
'AAA currentNumToSelect '
,
currentNumToSelect
);
if
(
!
$this
.
hasClass
(
'selected'
))
if
(
!
$this
.
hasClass
(
'selected'
))
{
{
// Клик по фото без рамки
// Клик по фото без рамки
...
@@ -124,6 +128,7 @@ $(document).ready(function(){
...
@@ -124,6 +128,7 @@ $(document).ready(function(){
console
.
log
(
'AAA 1-е фото в пару'
);
console
.
log
(
'AAA 1-е фото в пару'
);
num
=
currentNumToSelect
[
folderName
];
num
=
currentNumToSelect
[
folderName
];
hasSelectedFoto
[
folderName
]
=
true
;
hasSelectedFoto
[
folderName
]
=
true
;
$currentFolderWrap
.
addClass
(
'has-selected'
);
}
else
{
}
else
{
// выбор второго фото для пары (пара сформирована):
// выбор второго фото для пары (пара сформирована):
console
.
log
(
'AAA 2-е фото в пару'
);
console
.
log
(
'AAA 2-е фото в пару'
);
...
@@ -132,11 +137,15 @@ $(document).ready(function(){
...
@@ -132,11 +137,15 @@ $(document).ready(function(){
$this
.
addClass
(
'paired'
);
$this
.
addClass
(
'paired'
);
$
(
'.b-foto_inner[data-num="'
+
num
+
'"]'
,
$currentFolderWrap
).
addClass
(
'paired'
);
$
(
'.b-foto_inner[data-num="'
+
num
+
'"]'
,
$currentFolderWrap
).
addClass
(
'paired'
);
/*
freeNumbers.some(function(el) {
freeNumbers.some(function(el) {
currentNumToSelect[folderName] = el;
currentNumToSelect[folderName] = el;
return ($('.b-foto_inner[data-num="' + el + '"]', $currentFolderWrap).length == 0);
return ($('.b-foto_inner[data-num="' + el + '"]', $currentFolderWrap).length == 0);
});
});
*/
currentNumToSelect
[
folderName
]
=
getCurrenNumToSelect
(
$currentFolderWrap
);
hasSelectedFoto
[
folderName
]
=
false
;
hasSelectedFoto
[
folderName
]
=
false
;
$currentFolderWrap
.
removeClass
(
'has-selected'
);
}
}
...
@@ -149,30 +158,32 @@ $(document).ready(function(){
...
@@ -149,30 +158,32 @@ $(document).ready(function(){
else
else
{
{
// Клик по фото с рамкой
// Клик по фото с рамкой
console
.
log
(
'AAA
убираем пару
'
);
console
.
log
(
'AAA
Клик по фото с рамкой
'
);
var
var
pairedNum
=
$this
.
attr
(
'data-num'
),
pairedNum
=
$this
.
attr
(
'data-num'
),
$pairedFotos
=
$
(
'.b-foto_inner[data-num="'
+
pairedNum
+
'"]'
,
$currentFolderWrap
),
$pairedFotos
=
$
(
'.b-foto_inner[data-num="'
+
pairedNum
+
'"]'
,
$currentFolderWrap
),
isFromPair
=
$this
.
hasClass
(
'paired'
);
isFromPair
=
$this
.
hasClass
(
'paired'
);
if
(
hasSelectedFoto
[
folderName
]
&&
isFromPair
)
{
return
false
;
}
$
(
'.b-foto_number'
,
$pairedFotos
).
text
(
''
);
$
(
'.b-foto_number'
,
$pairedFotos
).
text
(
''
);
$pairedFotos
.
attr
(
'data-num'
,
''
)
$pairedFotos
.
attr
(
'data-num'
,
''
)
.
removeClass
(
'paired'
)
.
removeClass
(
'paired'
)
.
removeClass
(
'selected'
)
.
removeClass
(
'selected'
)
.
css
(
'border-color'
,
'#8D9094'
);
.
css
(
'border-color'
,
'#8D9094'
);
// Клик по фото из пары при выделеной одной фото из другой пары:
if
(
!
hasSelectedFoto
[
folderName
]
||
!
isFromPair
)
{
hasSelectedFoto
[
folderName
]
=
false
;
hasSelectedFoto
[
folderName
]
=
false
;
$currentFolderWrap
.
removeClass
(
'has-selected'
);
/*
freeNumbers.some(function(el) {
freeNumbers.some(function(el) {
currentNumToSelect[folderName] = el;
currentNumToSelect[folderName] = el;
return ($('.b-foto_inner[data-num="' + el + '"]', $currentFolderWrap).length == 0);
return ($('.b-foto_inner[data-num="' + el + '"]', $currentFolderWrap).length == 0);
});
});
}
*/
currentNumToSelect
[
folderName
]
=
getCurrenNumToSelect
(
$currentFolderWrap
);
}
}
...
...
src/src/App/Action/Admin/Index.php
View file @
c5c8df46
...
@@ -68,6 +68,7 @@ class Index extends Common
...
@@ -68,6 +68,7 @@ class Index extends Common
$data
=
[
$data
=
[
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'colors_active'
=>
$this
->
container
->
get
(
'config'
)[
'foto_conf'
][
'colors_active'
],
'colors_active'
=>
$this
->
container
->
get
(
'config'
)[
'foto_conf'
][
'colors_active'
],
'pairs_count'
=>
$this
->
container
->
get
(
'config'
)[
'foto_conf'
][
'pairs_count'
],
'folders'
=>
$folders
,
'folders'
=>
$folders
,
'dir'
=>
$dir
,
'dir'
=>
$dir
,
];
];
...
...
src/templates/app/main.phtml
View file @
c5c8df46
...
@@ -63,7 +63,7 @@ $dir = $this->dir;
...
@@ -63,7 +63,7 @@ $dir = $this->dir;
<a
class=
"btn btn-primary save-folders"
href=
"#"
>
Сохранить
</a>
<a
class=
"btn btn-primary save-folders"
href=
"#"
>
Сохранить
</a>
</div>
</div>
<div
class=
"b-preview col"
data-colors=
<?=
(
$colors_active
?
json_encode
(
$colors_active
)
:
''
)
?>
>
<div
class=
"b-preview col"
data-colors=
<?=
(
$colors_active
?
json_encode
(
$colors_active
)
:
''
)
?>
data-pairs_count=
<?=
(
$pairs_count
?
json_encode
(
$pairs_count
)
:
''
)
?>
>
<div
class=
"b-loading"
></div>
<div
class=
"b-loading"
></div>
...
...
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