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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
6e08b5cc
Commit
6e08b5cc
authored
Nov 05, 2011
by
Aleksei Kvitinskii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create tags page and made tag filter for projects
parent
1e5aa0ef
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
62 additions
and
24 deletions
+62
-24
app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss
+14
-0
app/assets/stylesheets/tags.css.css
app/assets/stylesheets/tags.css.css
+16
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+3
-1
app/controllers/tags_controller.rb
app/controllers/tags_controller.rb
+4
-8
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+1
-6
app/views/projects/_list.html.haml
app/views/projects/_list.html.haml
+6
-1
app/views/tags/autocomplete.html.haml
app/views/tags/autocomplete.html.haml
+0
-2
app/views/tags/index.html.haml
app/views/tags/index.html.haml
+11
-2
config/routes.rb
config/routes.rb
+5
-2
spec/requests/tags_spec.rb
spec/requests/tags_spec.rb
+2
-2
No files found.
app/assets/stylesheets/projects.css.scss
View file @
6e08b5cc
...
...
@@ -270,6 +270,20 @@ input.ssh_project_url {
}
}
#projects-list
.small-tags
a
{
font-size
:
9px
;
display
:
inline-block
;
padding
:
2px
3px
1px
3px
;
margin
:
0px
3px
0px
0px
;
border-radius
:
2px
;
background-color
:
#3b6bce
;
color
:
#FFF
;
text-shadow
:
none
;
font-weight
:
bold
;
}
.clear
{
clear
:
both
;
}
...
...
app/assets/stylesheets/tags.css.css
0 → 100644
View file @
6e08b5cc
.tags-list
{
padding
:
0px
10px
10px
10px
;
}
.tags-list
a
{
display
:
inline-block
;
padding
:
8px
11px
8px
11px
;
margin
:
1px
5px
0px
0px
;
border-radius
:
4px
;
border
:
1px
solid
#d0e1ff
;
background-color
:
#d0e1ff
;
color
:
#0f326d
;
font-weight
:
bold
;
font-size
:
14px
;
}
\ No newline at end of file
app/controllers/projects_controller.rb
View file @
6e08b5cc
...
...
@@ -10,7 +10,9 @@ class ProjectsController < ApplicationController
before_filter
:require_non_empty_project
,
:only
=>
[
:blob
,
:tree
]
def
index
@projects
=
current_user
.
projects
.
all
source
=
current_user
.
projects
source
=
source
.
tagged_with
(
params
[
:tag
])
unless
params
[
:tag
].
blank?
@projects
=
source
.
all
end
def
new
...
...
app/controllers/tags_controller.rb
View file @
6e08b5cc
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
}
@tags
=
Project
.
tag_counts
.
order
(
'count DESC'
)
@tags
=
@tags
.
where
(
'name like ?'
,
"%
#{
params
[
:term
]
}
%"
)
unless
params
[
:term
].
blank?
respond_to
do
|
format
|
format
.
json
{
render
json:
tags
}
format
.
html
format
.
json
{
render
json:
@tags
.
limit
(
8
).
map
{
|
t
|
t
.
name
}}
end
end
end
app/views/projects/_form.html.haml
View file @
6e08b5cc
...
...
@@ -57,11 +57,8 @@
$
(
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
'
);
},
source
:
'
/tags.json
'
});
...
...
@@ -70,6 +67,4 @@
tag_field
.
val
(
tag_field
.
tagify
(
'
serialize
'
)
);
return
true
;
});
})
app/views/projects/_list.html.haml
View file @
6e08b5cc
...
...
@@ -10,7 +10,12 @@
-
@projects
.
each
do
|
project
|
%tr
{
:class
=>
"project"
,
:url
=>
project_path
(
project
)
}
%td
=
project
.
name
%td
=
project
.
name
.small-tags
-
project
.
tag_list
.
each
do
|
tag
|
=
link_to
tag
,
"/tags/
#{
tag
}
"
%td
=
truncate
project
.
url_to_repo
%td
=
project
.
code
%td
=
check_box_tag
"read"
,
1
,
project
.
readers
.
include?
(
current_user
),
:disabled
=>
:disabled
...
...
app/views/tags/autocomplete.html.haml
deleted
100644 → 0
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
View file @
6e08b5cc
%h1
Tags#index
%p
Find me in app/views/tags/index.html.haml
\ No newline at end of file
-
content_for
(
:body_class
,
"projects-page"
)
-
content_for
(
:page_title
)
do
.grid_4
%h2
Tags
.tags-list
-
@tags
.
all
.
each
do
|
tag
|
=
link_to
"
#{
tag
.
name
}
(
#{
tag
.
count
}
)"
,
"/tags/
#{
tag
.
name
}
"
config/routes.rb
View file @
6e08b5cc
Gitlab
::
Application
.
routes
.
draw
do
get
"tags/index"
get
"tags/autocomplete"
get
'tags'
=>
'tags#index'
get
'tags/:tag'
=>
'projects#index'
namespace
:admin
do
resources
:users
...
...
@@ -23,6 +25,7 @@ Gitlab::Application.routes.draw do
resources
:projects
,
:only
=>
[
:new
,
:create
,
:index
]
resources
:keys
devise_for
:users
resources
:projects
,
:except
=>
[
:new
,
:create
,
:index
],
:path
=>
"/"
do
...
...
spec/requests/tags_spec.rb
View file @
6e08b5cc
...
...
@@ -11,13 +11,13 @@ describe "Tags" do
# end
describe
"GET '/tags
/autocomplete
'"
do
describe
"GET '/tags
.json
'"
do
before
do
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
)
@project
.
tag_list
=
'demo1'
@project
.
save
visit
'/tags
/autocomplete
.json'
visit
'/tags.json'
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