Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-block_course_overview_campus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
elc
moodle-block_course_overview_campus
Commits
978c7a39
Commit
978c7a39
authored
7 years ago
by
Alexander Bias
Browse files
Options
Downloads
Patches
Plain Diff
Add a nice slide animation when hiding a course
parent
e618b3b1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES.md
+1
-0
1 addition, 0 deletions
CHANGES.md
amd/build/hidecourse.min.js
+1
-1
1 addition, 1 deletion
amd/build/hidecourse.min.js
amd/src/hidecourse.js
+14
-4
14 additions, 4 deletions
amd/src/hidecourse.js
with
16 additions
and
5 deletions
CHANGES.md
+
1
−
0
View file @
978c7a39
...
...
@@ -6,6 +6,7 @@ Changes
### Unreleased
*
2018-03-07 - Add a nice slide animation when hiding a course.
*
2018-03-06 - Add a note about the future of the course news feature to README.
*
2018-03-06 - Bugfix: Add a default title string to this plugin instead of fetching it from block_course_overview which is EOL.
*
2018-03-06 - Activity icons should be rendered with image_icon() and not with pix_icon anymore.
...
...
This diff is collapsed.
Click to expand it.
amd/build/hidecourse.min.js
+
1
−
1
View file @
978c7a39
define
([
"
jquery
"
],
function
(
a
){
"
use strict
"
;
function
b
(
b
){
var
c
;
void
0
!==
b
&&
b
.
preventDefault
(),
1
===
b
.
data
.
manage
&&
(
a
(
"
#coc-hidecourseicon-
"
+
b
.
data
.
course
).
addClass
(
"
coc-hidden
"
),
a
(
"
#coc-showcourseicon-
"
+
b
.
data
.
course
).
removeClass
(
"
coc-hidden
"
)),
0
===
b
.
data
.
manage
&&
(
a
(
"
.coc-hidecourse-
"
+
b
.
data
.
course
).
addClass
(
"
coc-hidden
"
),
c
=
parseInt
(
a
(
"
#coc-hiddencoursescount
"
).
html
(),
10
),
a
(
"
#coc-hiddencoursescount
"
).
html
(
c
+
1
),
a
(
"
#coc-hiddencoursesmanagement-bottom .row
"
).
removeClass
(
"
coc-hidden
"
)),
M
.
util
.
set_user_preference
(
"
block_course_overview_campus-hidecourse-
"
+
b
.
data
.
course
,
1
)}
function
c
(
b
){
void
0
!==
b
&&
b
.
preventDefault
(),
1
===
b
.
data
.
manage
&&
(
a
(
"
#coc-showcourseicon-
"
+
b
.
data
.
course
).
addClass
(
"
coc-hidden
"
),
a
(
"
#coc-hidecourseicon-
"
+
b
.
data
.
course
).
removeClass
(
"
coc-hidden
"
)),
M
.
util
.
set_user_preference
(
"
block_course_overview_campus-hidecourse-
"
+
b
.
data
.
course
,
0
)}
function
d
(){
var
b
=
new
Array
;
a
(
"
.coc-course
"
).
each
(
function
(
c
,
d
){
0
==
a
(
d
).
height
()
&&
b
.
push
(
d
.
id
.
slice
(
11
))});
var
c
=
JSON
.
stringify
(
b
);
M
.
util
.
set_user_preference
(
"
local_boostcoc-notshowncourses
"
,
c
)}
function
e
(){
var
b
=
new
Array
;
a
(
"
#coc-filterterm, #coc-filtercategory, #coc-filtertoplevelcategory, #coc-filterteacher
"
).
each
(
function
(
c
,
d
){
"
all
"
!==
a
(
d
).
val
()
&&
b
.
push
(
d
.
id
.
slice
(
4
))});
var
c
=
parseInt
(
a
(
"
#coc-hiddencoursescount
"
).
html
(),
10
);
c
>
0
&&
b
.
push
(
"
hidecourses
"
);
var
d
=
JSON
.
stringify
(
b
);
M
.
util
.
set_user_preference
(
"
local_boostcoc-activefilters
"
,
d
)}
return
{
initHideCourse
:
function
(
f
){
var
g
,
h
=
f
.
courses
.
split
(
"
"
);
for
(
g
=
0
;
g
<
h
.
length
;
g
++
)
a
(
"
#coc-hidecourseicon-
"
+
h
[
g
]).
on
(
"
click
"
,{
course
:
h
[
g
],
manage
:
f
.
manage
},
b
),
a
(
"
#coc-showcourseicon-
"
+
h
[
g
]).
on
(
"
click
"
,{
course
:
h
[
g
],
manage
:
f
.
manage
},
c
),
1
==
f
.
local_boostcoc
&&
0
==
f
.
manage
&&
a
(
"
#coc-hidecourseicon-
"
+
h
[
g
]).
on
(
"
click
"
,
d
).
on
(
"
click
"
,
e
)}}});
\ No newline at end of file
define
([
"
jquery
"
],
function
(
a
){
"
use strict
"
;
function
b
(
b
){
var
c
;
if
(
void
0
!==
b
&&
b
.
preventDefault
(),
1
===
b
.
data
.
manage
&&
(
a
(
"
#coc-hidecourseicon-
"
+
b
.
data
.
course
).
addClass
(
"
coc-hidden
"
),
a
(
"
#coc-showcourseicon-
"
+
b
.
data
.
course
).
removeClass
(
"
coc-hidden
"
)),
0
===
b
.
data
.
manage
){
a
(
"
#coc-hidecourseicon-
"
+
b
.
data
.
course
).
addClass
(
"
coc-hidden
"
),
a
(
"
#coc-showcourseicon-
"
+
b
.
data
.
course
).
removeClass
(
"
coc-hidden
"
);
var
d
=
b
.
data
.
course
;
a
(
"
.coc-hidecourse-
"
+
b
.
data
.
course
).
slideUp
(
function
(){
a
(
"
.coc-hidecourse-
"
+
d
).
addClass
(
"
coc-hidden
"
),
c
=
parseInt
(
a
(
"
#coc-hiddencoursescount
"
).
html
(),
10
),
a
(
"
#coc-hiddencoursescount
"
).
html
(
c
+
1
),
a
(
"
#coc-hiddencoursesmanagement-bottom .row
"
).
removeClass
(
"
coc-hidden
"
)})}
M
.
util
.
set_user_preference
(
"
block_course_overview_campus-hidecourse-
"
+
b
.
data
.
course
,
1
)}
function
c
(
b
){
void
0
!==
b
&&
b
.
preventDefault
(),
1
===
b
.
data
.
manage
&&
(
a
(
"
#coc-showcourseicon-
"
+
b
.
data
.
course
).
addClass
(
"
coc-hidden
"
),
a
(
"
#coc-hidecourseicon-
"
+
b
.
data
.
course
).
removeClass
(
"
coc-hidden
"
)),
M
.
util
.
set_user_preference
(
"
block_course_overview_campus-hidecourse-
"
+
b
.
data
.
course
,
0
)}
function
d
(){
var
b
=
new
Array
;
a
(
"
.coc-course
"
).
each
(
function
(
c
,
d
){
0
==
a
(
d
).
height
()
&&
b
.
push
(
d
.
id
.
slice
(
11
))});
var
c
=
JSON
.
stringify
(
b
);
M
.
util
.
set_user_preference
(
"
local_boostcoc-notshowncourses
"
,
c
)}
function
e
(){
var
b
=
new
Array
;
a
(
"
#coc-filterterm, #coc-filtercategory, #coc-filtertoplevelcategory, #coc-filterteacher
"
).
each
(
function
(
c
,
d
){
"
all
"
!==
a
(
d
).
val
()
&&
b
.
push
(
d
.
id
.
slice
(
4
))});
var
c
=
parseInt
(
a
(
"
#coc-hiddencoursescount
"
).
html
(),
10
);
c
>
0
&&
b
.
push
(
"
hidecourses
"
);
var
d
=
JSON
.
stringify
(
b
);
M
.
util
.
set_user_preference
(
"
local_boostcoc-activefilters
"
,
d
)}
return
{
initHideCourse
:
function
(
f
){
var
g
,
h
=
f
.
courses
.
split
(
"
"
);
for
(
g
=
0
;
g
<
h
.
length
;
g
++
)
a
(
"
#coc-hidecourseicon-
"
+
h
[
g
]).
on
(
"
click
"
,{
course
:
h
[
g
],
manage
:
f
.
manage
},
b
),
a
(
"
#coc-showcourseicon-
"
+
h
[
g
]).
on
(
"
click
"
,{
course
:
h
[
g
],
manage
:
f
.
manage
},
c
),
1
==
f
.
local_boostcoc
&&
0
==
f
.
manage
&&
a
(
"
#coc-hidecourseicon-
"
+
h
[
g
]).
on
(
"
click
"
,
d
).
on
(
"
click
"
,
e
)}}});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
amd/src/hidecourse.js
+
14
−
4
View file @
978c7a39
...
...
@@ -21,15 +21,24 @@ define(['jquery'], function($) {
// When hidden course managing is active.
if
(
e
.
data
.
manage
===
1
)
{
// Change the icon.
$
(
'
#coc-hidecourseicon-
'
+
e
.
data
.
course
).
addClass
(
'
coc-hidden
'
);
$
(
'
#coc-showcourseicon-
'
+
e
.
data
.
course
).
removeClass
(
'
coc-hidden
'
);
}
// When hidden course managing is not active.
if
(
e
.
data
.
manage
===
0
)
{
$
(
'
.coc-hidecourse-
'
+
e
.
data
.
course
).
addClass
(
'
coc-hidden
'
);
// Change the icon.
$
(
'
#coc-hidecourseicon-
'
+
e
.
data
.
course
).
addClass
(
'
coc-hidden
'
);
$
(
'
#coc-showcourseicon-
'
+
e
.
data
.
course
).
removeClass
(
'
coc-hidden
'
);
// Use a nice slide animation to make clear where the course is going.
var
courseId
=
e
.
data
.
course
;
$
(
'
.coc-hidecourse-
'
+
e
.
data
.
course
).
slideUp
(
function
()
{
$
(
'
.coc-hidecourse-
'
+
courseId
).
addClass
(
'
coc-hidden
'
);
hiddenCount
=
parseInt
(
$
(
'
#coc-hiddencoursescount
'
).
html
(),
10
);
$
(
'
#coc-hiddencoursescount
'
).
html
(
hiddenCount
+
1
);
$
(
'
#coc-hiddencoursesmanagement-bottom .row
'
).
removeClass
(
'
coc-hidden
'
);
});
}
// Store the course status (Uses AJAX to save to the database).
...
...
@@ -47,6 +56,7 @@ define(['jquery'], function($) {
// When hidden course managing is active.
if
(
e
.
data
.
manage
===
1
)
{
// Change the icon.
$
(
'
#coc-showcourseicon-
'
+
e
.
data
.
course
).
addClass
(
'
coc-hidden
'
);
$
(
'
#coc-hidecourseicon-
'
+
e
.
data
.
course
).
removeClass
(
'
coc-hidden
'
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment