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
57b4884e
Commit
57b4884e
authored
Oct 05, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using ivars in BlobHelper template methods
parent
331c4f4d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+5
-5
app/views/projects/blob/_template_selectors.html.haml
app/views/projects/blob/_template_selectors.html.haml
+4
-4
app/views/projects/blob/edit.html.haml
app/views/projects/blob/edit.html.haml
+1
-1
app/views/projects/blob/new.html.haml
app/views/projects/blob/new.html.haml
+1
-1
No files found.
app/helpers/blob_helper.rb
View file @
57b4884e
...
...
@@ -183,23 +183,23 @@ module BlobHelper
end
private
:template_dropdown_names
def
licenses_for_select
(
project
=
@project
)
def
licenses_for_select
(
project
)
@licenses_for_select
||=
template_dropdown_names
(
TemplateFinder
.
build
(
:licenses
,
project
).
execute
)
end
def
gitignore_names
(
project
=
@project
)
def
gitignore_names
(
project
)
@gitignore_names
||=
template_dropdown_names
(
TemplateFinder
.
build
(
:gitignores
,
project
).
execute
)
end
def
gitlab_ci_ymls
(
project
=
@project
)
def
gitlab_ci_ymls
(
project
)
@gitlab_ci_ymls
||=
template_dropdown_names
(
TemplateFinder
.
build
(
:gitlab_ci_ymls
,
project
).
execute
)
end
def
dockerfile_names
(
project
=
@project
)
def
dockerfile_names
(
project
)
@dockerfile_names
||=
template_dropdown_names
(
TemplateFinder
.
build
(
:dockerfiles
,
project
).
execute
)
end
def
blob_editor_paths
(
project
=
@project
)
def
blob_editor_paths
(
project
)
{
'relative-url-root'
=>
Rails
.
application
.
config
.
relative_url_root
,
'assets-prefix'
=>
Gitlab
::
Application
.
config
.
assets
.
prefix
,
...
...
app/views/projects/blob/_template_selectors.html.haml
View file @
57b4884e
...
...
@@ -5,13 +5,13 @@
.template-type-selector.js-template-type-selector-wrap.hidden
=
dropdown_tag
(
"Choose type"
,
options:
{
toggle_class:
'js-template-type-selector qa-template-type-dropdown'
,
title:
"Choose a template type"
}
)
.license-selector.js-license-selector-wrap.js-template-selector-wrap.hidden
=
dropdown_tag
(
"Apply a license template"
,
options:
{
toggle_class:
'js-license-selector qa-license-dropdown'
,
title:
"Apply a license"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
licenses_for_select
,
project:
@project
.
name
,
fullname:
@project
.
namespace
.
human_name
}
}
)
=
dropdown_tag
(
"Apply a license template"
,
options:
{
toggle_class:
'js-license-selector qa-license-dropdown'
,
title:
"Apply a license"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
licenses_for_select
(
@project
)
,
project:
@project
.
name
,
fullname:
@project
.
namespace
.
human_name
}
}
)
.gitignore-selector.js-gitignore-selector-wrap.js-template-selector-wrap.hidden
=
dropdown_tag
(
"Apply a .gitignore template"
,
options:
{
toggle_class:
'js-gitignore-selector qa-gitignore-dropdown'
,
title:
"Apply a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitignore_names
}
}
)
=
dropdown_tag
(
"Apply a .gitignore template"
,
options:
{
toggle_class:
'js-gitignore-selector qa-gitignore-dropdown'
,
title:
"Apply a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitignore_names
(
@project
)
}
}
)
.gitlab-ci-yml-selector.js-gitlab-ci-yml-selector-wrap.js-template-selector-wrap.hidden
=
dropdown_tag
(
"Apply a GitLab CI Yaml template"
,
options:
{
toggle_class:
'js-gitlab-ci-yml-selector qa-gitlab-ci-yml-dropdown'
,
title:
"Apply a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitlab_ci_ymls
}
}
)
=
dropdown_tag
(
"Apply a GitLab CI Yaml template"
,
options:
{
toggle_class:
'js-gitlab-ci-yml-selector qa-gitlab-ci-yml-dropdown'
,
title:
"Apply a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitlab_ci_ymls
(
@project
)
}
}
)
.dockerfile-selector.js-dockerfile-selector-wrap.js-template-selector-wrap.hidden
=
dropdown_tag
(
"Apply a Dockerfile template"
,
options:
{
toggle_class:
'js-dockerfile-selector qa-dockerfile-dropdown'
,
title:
"Apply a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
dockerfile_names
}
}
)
=
dropdown_tag
(
"Apply a Dockerfile template"
,
options:
{
toggle_class:
'js-dockerfile-selector qa-dockerfile-dropdown'
,
title:
"Apply a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
dockerfile_names
(
@project
)
}
}
)
.template-selectors-undo-menu.hidden
%span
.text-info
Template applied
%button
.btn.btn-sm.btn-info
Undo
app/views/projects/blob/edit.html.haml
View file @
57b4884e
...
...
@@ -24,7 +24,7 @@
=
link_to
'#preview'
,
'data-preview-url'
=>
project_preview_blob_path
(
@project
,
@id
,
legacy_render:
params
[
:legacy_render
])
do
=
editing_preview_title
(
@blob
.
name
)
=
form_tag
(
project_update_blob_path
(
@project
,
@id
),
method: :put
,
class:
'js-quick-submit js-requires-input js-edit-blob-form'
,
data:
blob_editor_paths
)
do
=
form_tag
(
project_update_blob_path
(
@project
,
@id
),
method: :put
,
class:
'js-quick-submit js-requires-input js-edit-blob-form'
,
data:
blob_editor_paths
(
@project
)
)
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
...
...
app/views/projects/blob/new.html.haml
View file @
57b4884e
...
...
@@ -7,7 +7,7 @@
New file
=
render
'template_selectors'
.file-editor
=
form_tag
(
project_create_blob_path
(
@project
,
@id
),
method: :post
,
class:
'js-edit-blob-form js-new-blob-form js-quick-submit js-requires-input'
,
data:
blob_editor_paths
)
do
=
form_tag
(
project_create_blob_path
(
@project
,
@id
),
method: :post
,
class:
'js-edit-blob-form js-new-blob-form js-quick-submit js-requires-input'
,
data:
blob_editor_paths
(
@project
)
)
do
=
render
'projects/blob/editor'
,
ref:
@ref
=
render
'shared/new_commit_form'
,
placeholder:
"Add new file"
...
...
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