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
1e5aa0ef
Commit
1e5aa0ef
authored
Nov 05, 2011
by
Aleksei Kvitinskii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tags autocomplete
parent
6323cdda
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
0 deletions
+63
-0
app/controllers/tags_controller.rb
app/controllers/tags_controller.rb
+15
-0
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+10
-0
app/views/tags/autocomplete.html.haml
app/views/tags/autocomplete.html.haml
+2
-0
app/views/tags/index.html.haml
app/views/tags/index.html.haml
+2
-0
config/routes.rb
config/routes.rb
+3
-0
spec/requests/tags_spec.rb
spec/requests/tags_spec.rb
+31
-0
No files found.
app/controllers/tags_controller.rb
0 → 100644
View file @
1e5aa0ef
class
TagsController
<
ApplicationController
def
index
end
def
autocomplete
tags
=
Project
.
tag_counts
.
limit
8
tags
=
tags
.
where
(
'name like ?'
,
"%
#{
params
[
:term
]
}
%"
)
unless
params
[
:term
].
blank?
tags
=
tags
.
map
{
|
t
|
t
.
name
}
respond_to
do
|
format
|
format
.
json
{
render
json:
tags
}
end
end
end
app/views/projects/_form.html.haml
View file @
1e5aa0ef
...
...
@@ -57,9 +57,19 @@
$
(
function
(){
var
tag_field
=
$
(
'
#tag_field
'
).
tagify
();
tag_field
.
tagify
(
'
inputField
'
).
autocomplete
({
source
:
'
/tags/autocomplete.json
'
,
position
:
{
of
:
tag_field
.
tagify
(
'
containerDiv
'
)
},
close
:
function
(
event
,
ui
)
{
tag_field
.
tagify
(
'
add
'
);
},
});
$
(
'
form
'
).
submit
(
function
()
{
var
tag_field
=
$
(
'
#tag_field
'
)
tag_field
.
val
(
tag_field
.
tagify
(
'
serialize
'
)
);
return
true
;
});
})
app/views/tags/autocomplete.html.haml
0 → 100644
View file @
1e5aa0ef
%h1
Tags#autocomplete
%p
Find me in app/views/tags/autocomplete.html.haml
\ No newline at end of file
app/views/tags/index.html.haml
0 → 100644
View file @
1e5aa0ef
%h1
Tags#index
%p
Find me in app/views/tags/index.html.haml
\ No newline at end of file
config/routes.rb
View file @
1e5aa0ef
Gitlab
::
Application
.
routes
.
draw
do
get
"tags/index"
get
"tags/autocomplete"
namespace
:admin
do
resources
:users
resources
:projects
...
...
spec/requests/tags_spec.rb
0 → 100644
View file @
1e5aa0ef
require
'spec_helper'
describe
"Tags"
do
before
{
login_as
:user
}
# describe "GET 'tags/index'" do
# it "should be successful" do
# get 'tags/index'
# response.should be_success
# end
# end
describe
"GET '/tags/autocomplete'"
do
before
do
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
)
@project
.
tag_list
=
'demo1'
@project
.
save
visit
'/tags/autocomplete.json'
end
it
"should contains tags"
do
page
.
should
have_content
(
'demo1'
)
end
end
end
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