Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
697967c1
Commit
697967c1
authored
Oct 12, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove members and memberExpirationDate from window object
parent
01903274
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
120 deletions
+110
-120
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+7
-5
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-2
app/assets/javascripts/member_expiration_date.js
app/assets/javascripts/member_expiration_date.js
+42
-45
app/assets/javascripts/members.js
app/assets/javascripts/members.js
+61
-68
No files found.
app/assets/javascripts/dispatcher.js
View file @
697967c1
...
@@ -81,6 +81,8 @@ import AbuseReports from './abuse_reports';
...
@@ -81,6 +81,8 @@ import AbuseReports from './abuse_reports';
import
{
ajaxGet
,
convertPermissionToBoolean
}
from
'
./lib/utils/common_utils
'
;
import
{
ajaxGet
,
convertPermissionToBoolean
}
from
'
./lib/utils/common_utils
'
;
import
AjaxLoadingSpinner
from
'
./ajax_loading_spinner
'
;
import
AjaxLoadingSpinner
from
'
./ajax_loading_spinner
'
;
import
U2FAuthenticate
from
'
./u2f/authenticate
'
;
import
U2FAuthenticate
from
'
./u2f/authenticate
'
;
import
Members
from
'
./members
'
;
import
memberExpirationDate
from
'
./member_expiration_date
'
;
(
function
()
{
(
function
()
{
var
Dispatcher
;
var
Dispatcher
;
...
@@ -397,15 +399,15 @@ import U2FAuthenticate from './u2f/authenticate';
...
@@ -397,15 +399,15 @@ import U2FAuthenticate from './u2f/authenticate';
new
ProjectsList
();
new
ProjectsList
();
break
;
break
;
case
'
groups:group_members:index
'
:
case
'
groups:group_members:index
'
:
new
gl
.
M
emberExpirationDate
();
m
emberExpirationDate
();
new
gl
.
Members
();
new
Members
();
new
UsersSelect
();
new
UsersSelect
();
break
;
break
;
case
'
projects:project_members:index
'
:
case
'
projects:project_members:index
'
:
new
gl
.
M
emberExpirationDate
(
'
.js-access-expiration-date-groups
'
);
m
emberExpirationDate
(
'
.js-access-expiration-date-groups
'
);
new
GroupsSelect
();
new
GroupsSelect
();
new
gl
.
M
emberExpirationDate
();
m
emberExpirationDate
();
new
gl
.
Members
();
new
Members
();
new
UsersSelect
();
new
UsersSelect
();
break
;
break
;
case
'
groups:new
'
:
case
'
groups:new
'
:
...
...
app/assets/javascripts/main.js
View file @
697967c1
...
@@ -84,8 +84,6 @@ import './layout_nav';
...
@@ -84,8 +84,6 @@ import './layout_nav';
import
LazyLoader
from
'
./lazy_loader
'
;
import
LazyLoader
from
'
./lazy_loader
'
;
import
'
./line_highlighter
'
;
import
'
./line_highlighter
'
;
import
'
./logo
'
;
import
'
./logo
'
;
import
'
./member_expiration_date
'
;
import
'
./members
'
;
import
'
./merge_request
'
;
import
'
./merge_request
'
;
import
'
./merge_request_tabs
'
;
import
'
./merge_request_tabs
'
;
import
'
./milestone
'
;
import
'
./milestone
'
;
...
...
app/assets/javascripts/member_expiration_date.js
View file @
697967c1
...
@@ -2,54 +2,51 @@
...
@@ -2,54 +2,51 @@
import
Pikaday
from
'
pikaday
'
;
import
Pikaday
from
'
pikaday
'
;
(()
=>
{
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// children of an element with the `clearable-input` class, and have a sibling
// children of an element with the `clearable-input` class, and have a sibling
// `js-clear-input` element, then show that element when there is a value in the
// `js-clear-input` element, then show that element when there is a value in the
// datepicker, and make clicking on that element clear the field.
// datepicker, and make clicking on that element clear the field.
//
//
export
default
function
memberExpirationDate
(
selector
=
'
.js-access-expiration-date
'
)
{
window
.
gl
=
window
.
gl
||
{};
function
toggleClearInput
()
{
gl
.
MemberExpirationDate
=
(
selector
=
'
.js-access-expiration-date
'
)
=>
{
$
(
this
).
closest
(
'
.clearable-input
'
).
toggleClass
(
'
has-value
'
,
$
(
this
).
val
()
!==
''
);
function
toggleClearInput
()
{
}
$
(
this
).
closest
(
'
.clearable-input
'
).
toggleClass
(
'
has-value
'
,
$
(
this
).
val
()
!==
''
);
const
inputs
=
$
(
selector
);
}
const
inputs
=
$
(
selector
);
inputs
.
each
((
i
,
el
)
=>
{
const
$input
=
$
(
el
);
inputs
.
each
((
i
,
el
)
=>
{
const
$input
=
$
(
el
);
const
calendar
=
new
Pikaday
({
field
:
$input
.
get
(
0
),
const
calendar
=
new
Pikaday
({
theme
:
'
gitlab-theme animate-picker
'
,
field
:
$input
.
get
(
0
),
format
:
'
yyyy-mm-dd
'
,
theme
:
'
gitlab-theme animate-picker
'
,
minDate
:
new
Date
(),
format
:
'
yyyy-mm-dd
'
,
container
:
$input
.
parent
().
get
(
0
),
minDate
:
new
Date
(),
onSelect
(
dateText
)
{
container
:
$input
.
parent
().
get
(
0
),
$input
.
val
(
dateFormat
(
new
Date
(
dateText
),
'
yyyy-mm-dd
'
));
onSelect
(
dateText
)
{
$input
.
val
(
dateFormat
(
new
Date
(
dateText
),
'
yyyy-mm-dd
'
));
$input
.
trigger
(
'
change
'
);
$input
.
trigger
(
'
change
'
);
toggleClearInput
.
call
(
$input
);
},
toggleClearInput
.
call
(
$input
);
},
});
calendar
.
setDate
(
new
Date
(
$input
.
val
()));
$input
.
data
(
'
pikaday
'
,
calendar
);
});
});
inputs
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
clicked
(
event
)
{
calendar
.
setDate
(
new
Date
(
$input
.
val
()));
event
.
preventDefault
();
$input
.
data
(
'
pikaday
'
,
calendar
);
});
const
input
=
$
(
this
).
closest
(
'
.clearable-input
'
).
find
(
selector
);
inputs
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
clicked
(
event
)
{
const
calendar
=
input
.
data
(
'
pikaday
'
);
event
.
preventDefault
(
);
calendar
.
setDate
(
null
);
const
input
=
$
(
this
).
closest
(
'
.clearable-input
'
).
find
(
selector
);
input
.
trigger
(
'
change
'
);
const
calendar
=
input
.
data
(
'
pikaday
'
);
toggleClearInput
.
call
(
input
);
});
calendar
.
setDate
(
null
);
input
.
trigger
(
'
change
'
);
toggleClearInput
.
call
(
input
);
});
inputs
.
on
(
'
blur
'
,
toggleClearInput
);
inputs
.
on
(
'
blur
'
,
toggleClearInput
);
inputs
.
each
(
toggleClearInput
);
inputs
.
each
(
toggleClearInput
);
};
}
}).
call
(
window
);
app/assets/javascripts/members.js
View file @
697967c1
/* eslint-disable class-methods-use-this */
export
default
class
Members
{
(()
=>
{
constructor
()
{
window
.
gl
=
window
.
gl
||
{};
this
.
addListeners
();
this
.
initGLDropdown
();
class
Members
{
}
constructor
()
{
this
.
addListeners
();
this
.
initGLDropdown
();
}
addListeners
()
{
addListeners
()
{
$
(
'
.project_member, .group_member
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
removeRow
);
$
(
'
.project_member, .group_member
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
removeRow
);
$
(
'
.js-member-update-control
'
).
off
(
'
change
'
).
on
(
'
change
'
,
this
.
formSubmit
.
bind
(
this
));
$
(
'
.js-member-update-control
'
).
off
(
'
change
'
).
on
(
'
change
'
,
this
.
formSubmit
.
bind
(
this
));
$
(
'
.js-edit-member-form
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
formSuccess
.
bind
(
this
));
$
(
'
.js-edit-member-form
'
).
off
(
'
ajax:success
'
).
on
(
'
ajax:success
'
,
this
.
formSuccess
.
bind
(
this
));
gl
.
utils
.
disableButtonIfEmptyField
(
'
#user_ids
'
,
'
input[name=commit]
'
,
'
change
'
);
gl
.
utils
.
disableButtonIfEmptyField
(
'
#user_ids
'
,
'
input[name=commit]
'
,
'
change
'
);
}
}
initGLDropdown
()
{
initGLDropdown
()
{
$
(
'
.js-member-permissions-dropdown
'
).
each
((
i
,
btn
)
=>
{
$
(
'
.js-member-permissions-dropdown
'
).
each
((
i
,
btn
)
=>
{
const
$btn
=
$
(
btn
);
const
$btn
=
$
(
btn
);
$btn
.
glDropdown
({
$btn
.
glDropdown
({
selectable
:
true
,
selectable
:
true
,
isSelectable
(
selected
,
$el
)
{
isSelectable
(
selected
,
$el
)
{
return
!
$el
.
hasClass
(
'
is-active
'
);
return
!
$el
.
hasClass
(
'
is-active
'
);
},
},
fieldName
:
$btn
.
data
(
'
field-name
'
),
fieldName
:
$btn
.
data
(
'
field-name
'
),
id
(
selected
,
$el
)
{
id
(
selected
,
$el
)
{
return
$el
.
data
(
'
id
'
);
return
$el
.
data
(
'
id
'
);
},
},
toggleLabel
(
selected
,
$el
)
{
toggleLabel
(
selected
,
$el
)
{
return
$el
.
text
();
return
$el
.
text
();
},
},
clicked
:
(
options
)
=>
{
clicked
:
(
options
)
=>
{
this
.
formSubmit
(
null
,
options
.
$el
);
this
.
formSubmit
(
null
,
options
.
$el
);
},
},
});
});
});
}
});
}
removeRow
(
e
)
{
// eslint-disable-next-line class-methods-use-this
const
$target
=
$
(
e
.
target
);
removeRow
(
e
)
{
const
$target
=
$
(
e
.
target
);
if
(
$target
.
hasClass
(
'
btn-remove
'
))
{
if
(
$target
.
hasClass
(
'
btn-remove
'
))
{
$target
.
closest
(
'
.member
'
)
$target
.
closest
(
'
.member
'
)
.
fadeOut
(
function
fadeOutMemberRow
()
{
.
fadeOut
(
function
fadeOutMemberRow
()
{
$
(
this
).
remove
();
$
(
this
).
remove
();
});
});
}
}
}
}
formSubmit
(
e
,
$el
=
null
)
{
formSubmit
(
e
,
$el
=
null
)
{
const
$this
=
e
?
$
(
e
.
currentTarget
)
:
$el
;
const
$this
=
e
?
$
(
e
.
currentTarget
)
:
$el
;
const
{
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$this
);
const
{
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$this
);
$this
.
closest
(
'
form
'
).
trigger
(
'
submit.rails
'
);
$toggle
.
disable
();
$dateInput
.
disable
();
}
formSuccess
(
e
)
{
$this
.
closest
(
'
form
'
).
trigger
(
'
submit.rails
'
);
const
{
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$
(
e
.
currentTarget
).
closest
(
'
.member
'
));
$toggle
.
en
able
();
$toggle
.
dis
able
();
$dateInput
.
en
able
();
$dateInput
.
dis
able
();
}
}
getMemberListItems
(
$el
)
{
formSuccess
(
e
)
{
const
$memberListItem
=
$el
.
is
(
'
.member
'
)
?
$el
:
$
(
`#
${
$el
.
data
(
'
el-id
'
)}
`
);
const
{
$toggle
,
$dateInput
}
=
this
.
getMemberListItems
(
$
(
e
.
currentTarget
).
closest
(
'
.member
'
)
);
return
{
$toggle
.
enable
();
$memberListItem
,
$dateInput
.
enable
();
$toggle
:
$memberListItem
.
find
(
'
.dropdown-menu-toggle
'
),
$dateInput
:
$memberListItem
.
find
(
'
.js-access-expiration-date
'
),
};
}
}
}
// eslint-disable-next-line class-methods-use-this
getMemberListItems
(
$el
)
{
const
$memberListItem
=
$el
.
is
(
'
.member
'
)
?
$el
:
$
(
`#
${
$el
.
data
(
'
el-id
'
)}
`
);
gl
.
Members
=
Members
;
return
{
})();
$memberListItem
,
$toggle
:
$memberListItem
.
find
(
'
.dropdown-menu-toggle
'
),
$dateInput
:
$memberListItem
.
find
(
'
.js-access-expiration-date
'
),
};
}
}
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