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
2ea79e09
Commit
2ea79e09
authored
Nov 14, 2017
by
Filipa Lacerda
Committed by
Phil Hughes
Nov 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export project, projectAvatar and projectImport as ES6 modules
parent
74344616
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
151 additions
and
173 deletions
+151
-173
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+6
-6
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-2
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+127
-135
app/assets/javascripts/project_avatar.js
app/assets/javascripts/project_avatar.js
+12
-19
app/assets/javascripts/project_import.js
app/assets/javascripts/project_import.js
+6
-11
No files found.
app/assets/javascripts/dispatcher.js
View file @
2ea79e09
...
@@ -20,8 +20,8 @@ import groupsSelect from './groups_select';
...
@@ -20,8 +20,8 @@ import groupsSelect from './groups_select';
import
NamespaceSelect
from
'
./namespace_select
'
;
import
NamespaceSelect
from
'
./namespace_select
'
;
/* global NewCommitForm */
/* global NewCommitForm */
/* global NewBranchForm */
/* global NewBranchForm */
/* global Project */
import
Project
from
'
./project
'
;
/* global ProjectAvatar */
import
projectAvatar
from
'
./project_avatar
'
;
/* global MergeRequest */
/* global MergeRequest */
/* global Compare */
/* global Compare */
/* global CompareAutocomplete */
/* global CompareAutocomplete */
...
@@ -29,7 +29,7 @@ import NamespaceSelect from './namespace_select';
...
@@ -29,7 +29,7 @@ import NamespaceSelect from './namespace_select';
/* global ProjectFindFile */
/* global ProjectFindFile */
/* global ProjectNew */
/* global ProjectNew */
/* global ProjectShow */
/* global ProjectShow */
/* global ProjectImport */
import
projectImport
from
'
./project_import
'
;
import
Labels
from
'
./labels
'
;
import
Labels
from
'
./labels
'
;
import
LabelManager
from
'
./label_manager
'
;
import
LabelManager
from
'
./label_manager
'
;
/* global Sidebar */
/* global Sidebar */
...
@@ -386,7 +386,7 @@ import initGroupAnalytics from './init_group_analytics';
...
@@ -386,7 +386,7 @@ import initGroupAnalytics from './init_group_analytics';
GpgBadges
.
fetch
();
GpgBadges
.
fetch
();
break
;
break
;
case
'
projects:imports:show
'
:
case
'
projects:imports:show
'
:
new
P
rojectImport
();
p
rojectImport
();
break
;
break
;
case
'
projects:show
'
:
case
'
projects:show
'
:
shortcut_handler
=
new
ShortcutsNavigation
();
shortcut_handler
=
new
ShortcutsNavigation
();
...
@@ -416,7 +416,7 @@ import initGroupAnalytics from './init_group_analytics';
...
@@ -416,7 +416,7 @@ import initGroupAnalytics from './init_group_analytics';
new
UserCallout
({
className
:
'
js-mr-approval-callout
'
});
new
UserCallout
({
className
:
'
js-mr-approval-callout
'
});
break
;
break
;
case
'
projects:imports:show
'
:
case
'
projects:imports:show
'
:
new
P
rojectImport
();
p
rojectImport
();
break
;
break
;
case
'
projects:pipelines:new
'
:
case
'
projects:pipelines:new
'
:
new
NewBranchForm
(
$
(
'
.js-new-pipeline-form
'
));
new
NewBranchForm
(
$
(
'
.js-new-pipeline-form
'
));
...
@@ -686,7 +686,7 @@ import initGroupAnalytics from './init_group_analytics';
...
@@ -686,7 +686,7 @@ import initGroupAnalytics from './init_group_analytics';
break
;
break
;
case
'
projects
'
:
case
'
projects
'
:
new
Project
();
new
Project
();
new
P
rojectAvatar
();
p
rojectAvatar
();
switch
(
path
[
1
])
{
switch
(
path
[
1
])
{
case
'
compare
'
:
case
'
compare
'
:
new
CompareAutocomplete
();
new
CompareAutocomplete
();
...
...
app/assets/javascripts/main.js
View file @
2ea79e09
...
@@ -72,8 +72,6 @@ import './notifications_dropdown';
...
@@ -72,8 +72,6 @@ import './notifications_dropdown';
import
'
./notifications_form
'
;
import
'
./notifications_form
'
;
import
'
./pager
'
;
import
'
./pager
'
;
import
'
./preview_markdown
'
;
import
'
./preview_markdown
'
;
import
'
./project
'
;
import
'
./project_avatar
'
;
import
'
./project_find_file
'
;
import
'
./project_find_file
'
;
import
'
./project_import
'
;
import
'
./project_import
'
;
import
'
./project_label_subscription
'
;
import
'
./project_label_subscription
'
;
...
...
app/assets/javascripts/project.js
View file @
2ea79e09
/* eslint-disable func-names, space-before-function-paren,
wrap-iife, no-var, quotes, consistent-return, no-new, prefer-arrow-callback, no-return-assign, one-var, one-var-declaration-per-line, object-shorthand, comma-dangle
, no-else-return, newline-per-chained-call, no-shadow, vars-on-top, prefer-template, max-len */
/* eslint-disable func-names, space-before-function-paren,
no-var, consistent-return, no-new, prefer-arrow-callback, no-return-assign, one-var, one-var-declaration-per-line, object-shorthand
, no-else-return, newline-per-chained-call, no-shadow, vars-on-top, prefer-template, max-len */
/* global ProjectSelect */
/* global ProjectSelect */
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
(
function
()
{
export
default
class
Project
{
this
.
Project
=
(
function
()
{
constructor
()
{
function
Project
()
{
const
$cloneOptions
=
$
(
'
ul.clone-options-dropdown
'
);
const
$cloneOptions
=
$
(
'
ul.clone-options-dropdown
'
);
const
$projectCloneField
=
$
(
'
#project_clone
'
);
const
$projectCloneField
=
$
(
'
#project_clone
'
);
const
$cloneBtnText
=
$
(
'
a.clone-dropdown-btn span
'
);
const
$cloneBtnText
=
$
(
'
a.clone-dropdown-btn span
'
);
const
selectedCloneOption
=
$cloneBtnText
.
text
().
trim
();
const
selectedCloneOption
=
$cloneBtnText
.
text
().
trim
();
if
(
selectedCloneOption
.
length
>
0
)
{
if
(
selectedCloneOption
.
length
>
0
)
{
$
(
`a:contains('
${
selectedCloneOption
}
')`
,
$cloneOptions
).
addClass
(
'
is-active
'
);
$
(
`a:contains('
${
selectedCloneOption
}
')`
,
$cloneOptions
).
addClass
(
'
is-active
'
);
}
}
$
(
'
a
'
,
$cloneOptions
).
on
(
'
click
'
,
(
e
)
=>
{
const
$this
=
$
(
e
.
currentTarget
);
const
url
=
$this
.
attr
(
'
href
'
);
e
.
preventDefault
();
$
(
'
a
'
,
$cloneOptions
).
on
(
'
click
'
,
(
e
)
=>
{
const
$this
=
$
(
e
.
currentTarget
);
const
url
=
$this
.
attr
(
'
href
'
);
$
(
'
.is-active
'
,
$cloneOptions
).
not
(
$this
).
removeClass
(
'
is-active
'
);
e
.
preventDefault
();
$this
.
toggleClass
(
'
is-active
'
);
$projectCloneField
.
val
(
url
);
$cloneBtnText
.
text
(
$this
.
text
());
$
(
'
#modal-geo-info
'
).
data
({
$
(
'
.is-active
'
,
$cloneOptions
).
not
(
$this
).
removeClass
(
'
is-active
'
);
cloneUrlSecondary
:
$this
.
attr
(
'
href
'
),
$this
.
toggleClass
(
'
is-active
'
);
cloneUrlPrimary
:
$this
.
data
(
'
primaryUrl
'
)
||
''
$projectCloneField
.
val
(
url
);
}
);
$cloneBtnText
.
text
(
$this
.
text
()
);
return
$
(
'
.clone
'
).
text
(
url
);
$
(
'
#modal-geo-info
'
).
data
({
});
cloneUrlSecondary
:
$this
.
attr
(
'
href
'
),
// Ref switcher
cloneUrlPrimary
:
$this
.
data
(
'
primaryUrl
'
)
||
''
,
this
.
initRefSwitcher
();
$
(
'
.project-refs-select
'
).
on
(
'
change
'
,
function
()
{
return
$
(
this
).
parents
(
'
form
'
).
submit
();
});
$
(
'
.hide-no-ssh-message
'
).
on
(
'
click
'
,
function
(
e
)
{
Cookies
.
set
(
'
hide_no_ssh_message
'
,
'
false
'
);
$
(
this
).
parents
(
'
.no-ssh-key-message
'
).
remove
();
return
e
.
preventDefault
();
});
$
(
'
.hide-no-password-message
'
).
on
(
'
click
'
,
function
(
e
)
{
Cookies
.
set
(
'
hide_no_password_message
'
,
'
false
'
);
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
return
e
.
preventDefault
();
});
$
(
'
.hide-shared-runner-limit-message
'
).
on
(
'
click
'
,
function
(
e
)
{
var
$alert
=
$
(
this
).
parents
(
'
.shared-runner-quota-message
'
);
var
scope
=
$alert
.
data
(
'
scope
'
);
Cookies
.
set
(
'
hide_shared_runner_quota_message
'
,
'
false
'
,
{
path
:
scope
});
$alert
.
remove
();
e
.
preventDefault
();
});
});
this
.
projectSelectDropdown
();
}
Project
.
prototype
.
projectSelectDropdown
=
function
()
{
return
$
(
'
.clone
'
).
text
(
url
);
new
ProjectSelect
();
});
$
(
'
.project-item-select
'
).
on
(
'
click
'
,
(
function
(
_this
)
{
// Ref switcher
return
function
(
e
)
{
Project
.
initRefSwitcher
();
return
_this
.
changeProject
(
$
(
e
.
currentTarget
).
val
());
$
(
'
.project-refs-select
'
).
on
(
'
change
'
,
function
()
{
};
return
$
(
this
).
parents
(
'
form
'
).
submit
();
})(
this
));
});
};
$
(
'
.hide-no-ssh-message
'
).
on
(
'
click
'
,
function
(
e
)
{
Cookies
.
set
(
'
hide_no_ssh_message
'
,
'
false
'
);
Project
.
prototype
.
changeProject
=
function
(
url
)
{
$
(
this
).
parents
(
'
.no-ssh-key-message
'
).
remove
();
return
window
.
location
=
url
;
return
e
.
preventDefault
();
};
});
$
(
'
.hide-no-password-message
'
).
on
(
'
click
'
,
function
(
e
)
{
Project
.
prototype
.
initRefSwitcher
=
function
()
{
Cookies
.
set
(
'
hide_no_password_message
'
,
'
false
'
);
var
refListItem
=
document
.
createElement
(
'
li
'
);
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
var
refLink
=
document
.
createElement
(
'
a
'
);
return
e
.
preventDefault
();
});
refLink
.
href
=
'
#
'
;
$
(
'
.hide-shared-runner-limit-message
'
).
on
(
'
click
'
,
function
(
e
)
{
var
$alert
=
$
(
this
).
parents
(
'
.shared-runner-quota-message
'
);
return
$
(
'
.js-project-refs-dropdown
'
).
each
(
function
()
{
var
scope
=
$alert
.
data
(
'
scope
'
);
var
$dropdown
,
selected
;
Cookies
.
set
(
'
hide_shared_runner_quota_message
'
,
'
false
'
,
{
path
:
scope
});
$dropdown
=
$
(
this
);
$alert
.
remove
();
selected
=
$dropdown
.
data
(
'
selected
'
);
e
.
preventDefault
();
return
$dropdown
.
glDropdown
({
});
data
:
function
(
term
,
callback
)
{
Project
.
projectSelectDropdown
();
return
$
.
ajax
({
}
url
:
$dropdown
.
data
(
'
refs-url
'
),
data
:
{
static
projectSelectDropdown
()
{
ref
:
$dropdown
.
data
(
'
ref
'
),
new
ProjectSelect
();
search
:
term
$
(
'
.project-item-select
'
).
on
(
'
click
'
,
e
=>
Project
.
changeProject
(
$
(
e
.
currentTarget
).
val
()));
},
}
dataType
:
"
json
"
}).
done
(
function
(
refs
)
{
static
changeProject
(
url
)
{
return
callback
(
refs
);
return
window
.
location
=
url
;
});
}
},
selectable
:
true
,
static
initRefSwitcher
()
{
filterable
:
true
,
var
refListItem
=
document
.
createElement
(
'
li
'
);
filterRemote
:
true
,
var
refLink
=
document
.
createElement
(
'
a
'
);
filterByText
:
true
,
inputFieldName
:
$dropdown
.
data
(
'
input-field-name
'
),
refLink
.
href
=
'
#
'
;
fieldName
:
$dropdown
.
data
(
'
field-name
'
),
renderRow
:
function
(
ref
)
{
return
$
(
'
.js-project-refs-dropdown
'
).
each
(
function
()
{
var
li
=
refListItem
.
cloneNode
(
false
);
var
$dropdown
,
selected
;
$dropdown
=
$
(
this
);
if
(
ref
.
header
!=
null
)
{
selected
=
$dropdown
.
data
(
'
selected
'
);
li
.
className
=
'
dropdown-header
'
;
return
$dropdown
.
glDropdown
({
li
.
textContent
=
ref
.
header
;
data
:
function
(
term
,
callback
)
{
}
else
{
return
$
.
ajax
({
var
link
=
refLink
.
cloneNode
(
false
);
url
:
$dropdown
.
data
(
'
refs-url
'
),
data
:
{
if
(
ref
===
selected
)
{
ref
:
$dropdown
.
data
(
'
ref
'
),
link
.
className
=
'
is-active
'
;
search
:
term
,
}
},
dataType
:
'
json
'
,
link
.
textContent
=
ref
;
}).
done
(
function
(
refs
)
{
link
.
dataset
.
ref
=
ref
;
return
callback
(
refs
);
});
li
.
appendChild
(
link
);
},
selectable
:
true
,
filterable
:
true
,
filterRemote
:
true
,
filterByText
:
true
,
inputFieldName
:
$dropdown
.
data
(
'
input-field-name
'
),
fieldName
:
$dropdown
.
data
(
'
field-name
'
),
renderRow
:
function
(
ref
)
{
var
li
=
refListItem
.
cloneNode
(
false
);
if
(
ref
.
header
!=
null
)
{
li
.
className
=
'
dropdown-header
'
;
li
.
textContent
=
ref
.
header
;
}
else
{
var
link
=
refLink
.
cloneNode
(
false
);
if
(
ref
===
selected
)
{
link
.
className
=
'
is-active
'
;
}
}
return
li
;
link
.
textContent
=
ref
;
},
link
.
dataset
.
ref
=
ref
;
id
:
function
(
obj
,
$el
)
{
return
$el
.
attr
(
'
data-ref
'
);
li
.
appendChild
(
link
);
},
}
toggleLabel
:
function
(
obj
,
$el
)
{
return
$el
.
text
().
trim
();
return
li
;
},
},
clicked
:
function
(
options
)
{
id
:
function
(
obj
,
$el
)
{
const
{
e
}
=
options
;
return
$el
.
attr
(
'
data-ref
'
);
e
.
preventDefault
();
},
if
(
$
(
'
input[name="ref"]
'
).
length
)
{
toggleLabel
:
function
(
obj
,
$el
)
{
var
$form
=
$dropdown
.
closest
(
'
form
'
);
return
$el
.
text
().
trim
();
},
var
$visit
=
$dropdown
.
data
(
'
visit
'
);
clicked
:
function
(
options
)
{
var
shouldVisit
=
$visit
?
true
:
$visit
;
const
{
e
}
=
options
;
var
action
=
$form
.
attr
(
'
action
'
);
e
.
preventDefault
();
var
divider
=
action
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
;
if
(
$
(
'
input[name="ref"]
'
).
length
)
{
if
(
shouldVisit
)
{
var
$form
=
$dropdown
.
closest
(
'
form
'
);
gl
.
utils
.
visitUrl
(
`
${
action
}${
divider
}${
$form
.
serialize
()}
`
);
}
var
$visit
=
$dropdown
.
data
(
'
visit
'
);
var
shouldVisit
=
$visit
?
true
:
$visit
;
var
action
=
$form
.
attr
(
'
action
'
);
var
divider
=
action
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
;
if
(
shouldVisit
)
{
gl
.
utils
.
visitUrl
(
`
${
action
}${
divider
}${
$form
.
serialize
()}
`
);
}
}
}
}
}
);
}
,
});
});
};
});
}
return
Project
;
}
})();
}).
call
(
window
);
app/assets/javascripts/project_avatar.js
View file @
2ea79e09
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, one-var-declaration-per-line, no-useless-escape, max-len */
export
default
function
projectAvatar
()
{
(
function
()
{
$
(
'
.js-choose-project-avatar-button
'
).
bind
(
'
click
'
,
function
onClickAvatar
()
{
this
.
ProjectAvatar
=
(
function
()
{
const
form
=
$
(
this
).
closest
(
'
form
'
);
function
ProjectAvatar
()
{
return
form
.
find
(
'
.js-project-avatar-input
'
).
click
();
$
(
'
.js-choose-project-avatar-button
'
).
bind
(
'
click
'
,
function
()
{
});
var
form
;
form
=
$
(
this
).
closest
(
'
form
'
);
return
form
.
find
(
'
.js-project-avatar-input
'
).
click
();
});
$
(
'
.js-project-avatar-input
'
).
bind
(
'
change
'
,
function
()
{
var
filename
,
form
;
form
=
$
(
this
).
closest
(
'
form
'
);
filename
=
$
(
this
).
val
().
replace
(
/^.*
[\\\/]
/
,
''
);
return
form
.
find
(
'
.js-avatar-filename
'
).
text
(
filename
);
});
}
return
ProjectAvatar
;
$
(
'
.js-project-avatar-input
'
).
bind
(
'
change
'
,
function
onClickAvatarInput
()
{
})();
const
form
=
$
(
this
).
closest
(
'
form
'
);
}).
call
(
window
);
// eslint-disable-next-line no-useless-escape
const
filename
=
$
(
this
).
val
().
replace
(
/^.*
[\\\/]
/
,
''
);
return
form
.
find
(
'
.js-avatar-filename
'
).
text
(
filename
);
});
}
app/assets/javascripts/project_import.js
View file @
2ea79e09
/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len */
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
(
function
()
{
export
default
function
projectImport
()
{
this
.
ProjectImport
=
(
function
()
{
setTimeout
(()
=>
{
function
ProjectImport
()
{
visitUrl
(
location
.
href
);
setTimeout
(
function
()
{
},
5000
);
return
gl
.
utils
.
visitUrl
(
location
.
href
);
}
},
5000
);
}
return
ProjectImport
;
})();
}).
call
(
window
);
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