BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0baaf490
Commit
0baaf490
authored
Jun 24, 2016
by
Connor Shea
Committed by
Sean McGivern
Aug 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only load Ace on Snippets and file edit pages.
parent
d97c8309
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
17 deletions
+40
-17
application.js
app/assets/javascripts/application.js
+0
-2
blob_edit_bundle.js
app/assets/javascripts/blob_edit/blob_edit_bundle.js
+12
-0
edit_blob.js
app/assets/javascripts/blob_edit/edit_blob.js
+0
-0
ace.js
app/assets/javascripts/lib/ace.js
+2
-0
snippet_bundle.js
app/assets/javascripts/snippet/snippet_bundle.js
+12
-0
edit.html.haml
app/views/projects/blob/edit.html.haml
+4
-5
new.html.haml
app/views/projects/blob/new.html.haml
+4
-5
_form.html.haml
app/views/shared/snippets/_form.html.haml
+4
-5
application.rb
config/application.rb
+2
-0
No files found.
app/assets/javascripts/application.js
View file @
0baaf490
...
...
@@ -26,8 +26,6 @@
/*= require bootstrap/tooltip */
/*= require bootstrap/popover */
/*= require select2 */
/*= require ace-rails-ap */
/*= require ace/ext-searchbox */
/*= require underscore */
/*= require dropzone */
/*= require mousetrap */
...
...
app/assets/javascripts/blob_edit/blob_edit_bundle.js
0 → 100644
View file @
0baaf490
/*= require_tree . */
(
function
()
{
$
(
function
()
{
url
=
$
(
".js-edit-blob-form"
).
data
(
"relative-url-root"
);
url
+=
$
(
".js-edit-blob-form"
).
data
(
"assets-prefix"
);
blob
=
new
EditBlob
(
url
,
$
(
'.js-edit-blob-form'
).
data
(
'blob-language'
));
new
NewCommitForm
(
$
(
'.js-edit-blob-form'
));
});
}).
call
(
this
);
app/assets/javascripts/blob/edit_blob.js
→
app/assets/javascripts/blob
_edit
/edit_blob.js
View file @
0baaf490
File moved
app/assets/javascripts/lib/ace.js
0 → 100644
View file @
0baaf490
/*= require ace-rails-ap */
/*= require ace/ext-searchbox */
app/assets/javascripts/snippet/snippet_bundle.js
0 → 100644
View file @
0baaf490
/*= require_tree . */
(
function
()
{
$
(
function
()
{
editor
=
ace
.
edit
(
"editor"
)
$
(
".snippet-form-holder form"
).
on
(
'submit'
,
function
()
{
$
(
".snippet-file-content"
).
val
(
editor
.
getValue
());
});
});
}).
call
(
this
);
app/views/projects/blob/edit.html.haml
View file @
0baaf490
-
page_title
"Edit"
,
@blob
.
path
,
@ref
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_tag
(
'lib/ace.js'
)
=
page_specific_javascript_tag
(
'blob_edit/blob_edit_bundle.js'
)
-
if
@conflict
.alert.alert-danger
...
...
@@ -16,14 +19,10 @@
=
link_to
'#preview'
,
'data-preview-url'
=>
namespace_project_preview_blob_path
(
@project
.
namespace
,
@project
,
@id
)
do
=
editing_preview_title
(
@blob
.
name
)
=
form_tag
(
namespace_project_update_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :put
,
class:
'form-horizontal js-quick-submit js-requires-input js-edit-blob-form'
)
do
=
form_tag
(
namespace_project_update_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :put
,
class:
'form-horizontal js-quick-submit js-requires-input js-edit-blob-form'
,
data:
{
'relative-url-root'
=>
"
#{
Rails
.
application
.
config
.
relative_url_root
}
"
,
'assets-prefix'
=>
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
,
'blob-language'
=>
"
#{
@blob
.
language
.
try
(
:ace_mode
)
}
"
}
)
do
=
render
'projects/blob/editor'
,
ref:
@ref
,
path:
@path
,
blob_data:
@blob
.
data
=
render
'shared/new_commit_form'
,
placeholder:
"Update
#{
@blob
.
name
}
"
=
hidden_field_tag
'last_commit_sha'
,
@last_commit_sha
=
hidden_field_tag
'content'
,
''
,
id:
"file-content"
=
hidden_field_tag
'from_merge_request_id'
,
params
[
:from_merge_request_id
]
=
render
'projects/commit_button'
,
ref:
@ref
,
cancel_path:
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
)
:javascript
blob
=
new
EditBlob
(
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
,
"
#{
@blob
.
language
.
try
(
:ace_mode
)
}
"
)
new
NewCommitForm
(
$
(
'.js-edit-blob-form'
))
app/views/projects/blob/new.html.haml
View file @
0baaf490
-
page_title
"New File"
,
@path
.
presence
,
@ref
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_tag
(
'lib/ace.js'
)
=
page_specific_javascript_tag
(
'blob_edit/blob_edit_bundle.js'
)
%h3
.page-title
New File
.file-editor
=
form_tag
(
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
,
class:
'form-horizontal js-
new-blob-form js-quick-submit js-requires-input'
)
do
=
form_tag
(
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
,
class:
'form-horizontal js-
edit-blob-form js-new-blob-form js-quick-submit js-requires-input'
,
data:
{
'relative-url-root'
=>
"
#{
Rails
.
application
.
config
.
relative_url_root
}
"
,
'assets-prefix'
=>
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
}
)
do
=
render
'projects/blob/editor'
,
ref:
@ref
=
render
'shared/new_commit_form'
,
placeholder:
"Add new file"
=
hidden_field_tag
'content'
,
''
,
id:
'file-content'
=
render
'projects/commit_button'
,
ref:
@ref
,
cancel_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@id
)
:javascript
blob
=
new
EditBlob
(
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
)
new
NewCommitForm
(
$
(
'.js-new-blob-form'
))
app/views/shared/snippets/_form.html.haml
View file @
0baaf490
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_tag
(
'lib/ace.js'
)
=
page_specific_javascript_tag
(
'snippet/snippet_bundle.js'
)
.snippet-form-holder
=
form_for
@snippet
,
url:
url
,
html:
{
class:
"form-horizontal snippet-form js-requires-input"
}
do
|
f
|
=
form_errors
(
@snippet
)
...
...
@@ -31,8 +35,3 @@
-
else
=
link_to
"Cancel"
,
snippets_path
(
@project
),
class:
"btn btn-cancel"
:javascript
var
editor
=
ace
.
edit
(
"editor"
);
$
(
".snippet-form-holder form"
).
submit
(
function
(){
$
(
".snippet-file-content"
).
val
(
editor
.
getValue
());
});
config/application.rb
View file @
0baaf490
...
...
@@ -87,6 +87,8 @@ module Gitlab
config
.
assets
.
precompile
<<
"profile/profile_bundle.js"
config
.
assets
.
precompile
<<
"boards/boards_bundle.js"
config
.
assets
.
precompile
<<
"boards/test_utils/simulate_drag.js"
config
.
assets
.
precompile
<<
"blob_edit/blob_edit_bundle.js"
config
.
assets
.
precompile
<<
"snippet/snippet_bundle.js"
config
.
assets
.
precompile
<<
"lib/utils/*.js"
config
.
assets
.
precompile
<<
"lib/*.js"
config
.
assets
.
precompile
<<
"u2f.js"
...
...
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