Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
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
ulakbus
ulakbus-ui
Commits
f8b1665a
Commit
f8b1665a
authored
Jul 27, 2016
by
Vladimir Baranov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rref #5385. Add widget for table cell state change
parent
c56e0cba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
directives.js
app/shared/directives.js
+47
-0
timetable-action-selector.html
...hared/templates/directives/timetable-action-selector.html
+19
-0
No files found.
app/shared/directives.js
View file @
f8b1665a
...
...
@@ -707,4 +707,51 @@ angular.module('ulakbus')
});
}
};
})
.
directive
(
'timetableActionSelector'
,
function
(
$timeout
){
// Display/hide popover with actions
// global listener used to close popover when user clicks outside of the popover
$
(
'html'
).
on
(
'click'
,
function
(
e
)
{
var
target
=
$
(
e
.
target
);
if
(
target
.
parents
().
is
(
'.action-selector'
)){
target
.
parents
(
'.action-selector'
).
children
(
'.popover'
).
toggleClass
(
'ng-hide'
);
return
;
}
if
(
target
.
hasClass
(
'action-selector'
)){
target
.
children
(
'.popover'
).
toggleClass
(
'ng-hide'
);
return
;
};
$
(
'.course-prg-scheduler .action-selector>.popover'
).
toggleClass
(
'ng-hide'
,
true
);
});
return
{
templateUrl
:
'shared/templates/directives/timetable-action-selector.html'
,
scope
:
{
externalModel
:
'=ngModel'
,
onChange
:
"&ngChange"
},
link
:
function
(
iScope
,
iElem
,
iAttrs
){
var
valueToClassMap
=
{
1
:
'action-indicator_appropriate'
,
2
:
'action-indicator_uncertain'
,
3
:
'action-indicator_busy'
};
iScope
.
$watch
(
'externalModel'
,
function
(
value
){
iScope
.
value
=
valueToClassMap
[
value
];
});
iScope
.
setModelValue
=
function
(
value
){
var
oldValue
=
iScope
.
externalModel
;
iScope
.
externalModel
=
value
;
// call change in next digest
$timeout
(
function
(){
if
(
iScope
.
onChange
&&
value
!=
oldValue
)
{
iScope
.
onChange
();
}
});
}
}
}
});
app/shared/templates/directives/timetable-action-selector.html
0 → 100644
View file @
f8b1665a
<div
class=
"action-selector"
>
<span
class=
"action-indicator"
ng-class=
"value"
></span>
<div
class=
"popover bottom ng-hide"
>
<div
class=
"arrow"
></div>
<div
class=
"popover-content"
>
<ul
class=
"actions-selector-select"
>
<li
ng-click=
"setModelValue(1)"
>
<span
class=
"action-indicator action-indicator_appropriate"
></span>
</li>
<li
ng-click=
"setModelValue(2)"
>
<span
class=
"action-indicator action-indicator_uncertain"
></span>
</li>
<li
ng-click=
"setModelValue(3)"
>
<span
class=
"action-indicator action-indicator_busy"
></span>
</li>
</ul>
</div>
</div>
</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