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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
86cc493d
Commit
86cc493d
authored
Nov 13, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export project, projectAvatar and projectImport as ES6 modules
parent
c8d594e0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
142 additions
and
164 deletions
+142
-164
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+5
-5
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-2
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+119
-127
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 @
86cc493d
...
@@ -20,15 +20,15 @@ import groupsSelect from './groups_select';
...
@@ -20,15 +20,15 @@ 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 */
/* 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 */
...
@@ -378,7 +378,7 @@ import Diff from './diff';
...
@@ -378,7 +378,7 @@ import Diff from './diff';
initSettingsPanels
();
initSettingsPanels
();
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
'
));
...
@@ -604,7 +604,7 @@ import Diff from './diff';
...
@@ -604,7 +604,7 @@ import Diff from './diff';
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 @
86cc493d
...
@@ -69,8 +69,6 @@ import './notifications_dropdown';
...
@@ -69,8 +69,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 @
86cc493d
/* 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
'
);
...
@@ -29,7 +28,7 @@ import Cookies from 'js-cookie';
...
@@ -29,7 +28,7 @@ import Cookies from 'js-cookie';
return
$
(
'
.clone
'
).
text
(
url
);
return
$
(
'
.clone
'
).
text
(
url
);
});
});
// Ref switcher
// Ref switcher
this
.
initRefSwitcher
();
Project
.
initRefSwitcher
();
$
(
'
.project-refs-select
'
).
on
(
'
change
'
,
function
()
{
$
(
'
.project-refs-select
'
).
on
(
'
change
'
,
function
()
{
return
$
(
this
).
parents
(
'
form
'
).
submit
();
return
$
(
this
).
parents
(
'
form
'
).
submit
();
});
});
...
@@ -43,23 +42,19 @@ import Cookies from 'js-cookie';
...
@@ -43,23 +42,19 @@ import Cookies from 'js-cookie';
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
return
e
.
preventDefault
();
return
e
.
preventDefault
();
});
});
this
.
projectSelectDropdown
();
Project
.
projectSelectDropdown
();
}
}
Project
.
prototype
.
projectSelectDropdown
=
function
()
{
static
projectSelectDropdown
()
{
new
ProjectSelect
();
new
ProjectSelect
();
$
(
'
.project-item-select
'
).
on
(
'
click
'
,
(
function
(
_this
)
{
$
(
'
.project-item-select
'
).
on
(
'
click
'
,
e
=>
Project
.
changeProject
(
$
(
e
.
currentTarget
).
val
()));
return
function
(
e
)
{
}
return
_this
.
changeProject
(
$
(
e
.
currentTarget
).
val
());
};
static
changeProject
(
url
)
{
})(
this
));
};
Project
.
prototype
.
changeProject
=
function
(
url
)
{
return
window
.
location
=
url
;
return
window
.
location
=
url
;
};
}
Project
.
prototype
.
initRefSwitcher
=
function
()
{
static
initRefSwitcher
()
{
var
refListItem
=
document
.
createElement
(
'
li
'
);
var
refListItem
=
document
.
createElement
(
'
li
'
);
var
refLink
=
document
.
createElement
(
'
a
'
);
var
refLink
=
document
.
createElement
(
'
a
'
);
...
@@ -75,9 +70,9 @@ import Cookies from 'js-cookie';
...
@@ -75,9 +70,9 @@ import Cookies from 'js-cookie';
url
:
$dropdown
.
data
(
'
refs-url
'
),
url
:
$dropdown
.
data
(
'
refs-url
'
),
data
:
{
data
:
{
ref
:
$dropdown
.
data
(
'
ref
'
),
ref
:
$dropdown
.
data
(
'
ref
'
),
search
:
term
search
:
term
,
},
},
dataType
:
"
json
"
dataType
:
'
json
'
,
}).
done
(
function
(
refs
)
{
}).
done
(
function
(
refs
)
{
return
callback
(
refs
);
return
callback
(
refs
);
});
});
...
@@ -129,11 +124,8 @@ import Cookies from 'js-cookie';
...
@@ -129,11 +124,8 @@ import Cookies from 'js-cookie';
gl
.
utils
.
visitUrl
(
`
${
action
}${
divider
}${
$form
.
serialize
()}
`
);
gl
.
utils
.
visitUrl
(
`
${
action
}${
divider
}${
$form
.
serialize
()}
`
);
}
}
}
}
}
},
});
});
});
});
};
}
}
return
Project
;
})();
}).
call
(
window
);
app/assets/javascripts/project_avatar.js
View file @
86cc493d
/* 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
()
{
$
(
'
.js-choose-project-avatar-button
'
).
bind
(
'
click
'
,
function
()
{
var
form
;
form
=
$
(
this
).
closest
(
'
form
'
);
return
form
.
find
(
'
.js-project-avatar-input
'
).
click
();
return
form
.
find
(
'
.js-project-avatar-input
'
).
click
();
});
});
$
(
'
.js-project-avatar-input
'
).
bind
(
'
change
'
,
function
()
{
var
filename
,
form
;
$
(
'
.js-project-avatar-input
'
).
bind
(
'
change
'
,
function
onClickAvatarInput
()
{
form
=
$
(
this
).
closest
(
'
form
'
);
const
form
=
$
(
this
).
closest
(
'
form
'
);
filename
=
$
(
this
).
val
().
replace
(
/^.*
[\\\/]
/
,
''
);
// eslint-disable-next-line no-useless-escape
const
filename
=
$
(
this
).
val
().
replace
(
/^.*
[\\\/]
/
,
''
);
return
form
.
find
(
'
.js-avatar-filename
'
).
text
(
filename
);
return
form
.
find
(
'
.js-avatar-filename
'
).
text
(
filename
);
});
});
}
}
return
ProjectAvatar
;
})();
}).
call
(
window
);
app/assets/javascripts/project_import.js
View file @
86cc493d
/* 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
()
{
return
gl
.
utils
.
visitUrl
(
location
.
href
);
},
5000
);
},
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