Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-03 15:09:58 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-03 15:09:58 +0300
commit7455d950bcd0152ee30c024a30a652886970ac3f (patch)
treec8aded95124437644a8f32b9370000fc11360c93 /app/views
parent7e710acc1c72de7d11ad393ee3e111e250e0cb66 (diff)
Refactor projects list
1. Fix double bottom border if pagination 2. Fix broken search on forks page 4. Remove duplicate js logic 4. Remove unused show all link 5. Remove duplicate “no project” message in different views After this merge request you can easily render shared projects template with all necessary html/js included to make searchable list with pagination. All you need to provide is controller that returns projects list with seach nad pagination and render html form with project-filter-form id and text field with filter_projects name. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views')
-rw-r--r--app/views/dashboard/projects/_projects.html.haml7
-rw-r--r--app/views/explore/projects/_projects.html.haml7
-rw-r--r--app/views/groups/_projects.html.haml3
-rw-r--r--app/views/projects/forks/_projects.html.haml2
-rw-r--r--app/views/projects/forks/index.html.haml25
-rw-r--r--app/views/shared/projects/_list.html.haml23
6 files changed, 22 insertions, 45 deletions
diff --git a/app/views/dashboard/projects/_projects.html.haml b/app/views/dashboard/projects/_projects.html.haml
index 933a3edd0f0..0ebd7c01bab 100644
--- a/app/views/dashboard/projects/_projects.html.haml
+++ b/app/views/dashboard/projects/_projects.html.haml
@@ -1,6 +1 @@
-.projects-list-holder
-
- = render 'shared/projects/list', projects: @projects, ci: true
-
- :javascript
- Dashboard.init()
+= render 'shared/projects/list', projects: @projects, ci: true
diff --git a/app/views/explore/projects/_projects.html.haml b/app/views/explore/projects/_projects.html.haml
index 999a933390b..708fbc27f55 100644
--- a/app/views/explore/projects/_projects.html.haml
+++ b/app/views/explore/projects/_projects.html.haml
@@ -1,6 +1 @@
-- if projects.any?
- .projects-list-holder
- = render 'shared/projects/list', projects: projects
-- else
- .nothing-here-block
- No such projects
+= render 'shared/projects/list', projects: projects
diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml
index 209729dc7ee..4eab070dc93 100644
--- a/app/views/groups/_projects.html.haml
+++ b/app/views/groups/_projects.html.haml
@@ -8,5 +8,4 @@
= icon('plus')
New Project
-.projects-list-holder
- = render 'shared/projects/list', projects: @projects, projects_limit: 20, stars: false, skip_namespace: true
+= render 'shared/projects/list', projects: @projects, projects_limit: 20, stars: false, skip_namespace: true
diff --git a/app/views/projects/forks/_projects.html.haml b/app/views/projects/forks/_projects.html.haml
new file mode 100644
index 00000000000..2946e6dcbd0
--- /dev/null
+++ b/app/views/projects/forks/_projects.html.haml
@@ -0,0 +1,2 @@
+= render 'shared/projects/list', projects: projects, use_creator_avatar: true,
+ forks: true, show_last_commit_as_description: true
diff --git a/app/views/projects/forks/index.html.haml b/app/views/projects/forks/index.html.haml
index ace22625d1d..4bcf2d9d533 100644
--- a/app/views/projects/forks/index.html.haml
+++ b/app/views/projects/forks/index.html.haml
@@ -4,8 +4,9 @@
== #{pluralize(@total_forks_count, 'fork')}: #{full_count_title}
.nav-controls
- = search_field_tag :filter_projects, nil, placeholder: 'Search forks', class: 'projects-list-filter project-filter-form-field form-control input-short',
- spellcheck: false, data: { 'filter-selector' => 'span.namespace-name' }
+ = form_tag request.original_url, method: :get, class: 'project-filter-form', id: 'project-filter-form' do |f|
+ = search_field_tag :filter_projects, nil, placeholder: 'Search forks', class: 'projects-list-filter project-filter-form-field form-control input-short',
+ spellcheck: false, data: { 'filter-selector' => 'span.namespace-name' }
.dropdown
%button.dropdown-toggle.btn.sort-forks{type: 'button', 'data-toggle' => 'dropdown'}
@@ -38,18 +39,10 @@
Fork
-.projects-list-holder
- - if @forks.blank?
- %ul.content-list
- %li
- .nothing-here-block No forks to show
- - else
- = render 'shared/projects/list', projects: @forks, use_creator_avatar: true,
- forks: true, show_last_commit_as_description: true
+= render 'projects', projects: @forks
- - if @private_forks_count > 0
- %ul.projects-list.private-forks-notice
- %li.project-row
- = icon('lock fw', base: 'circle', class: 'fa-lg private-fork-icon')
- %strong= pluralize(@private_forks_count, 'private fork')
- %span you have no access to.
+- if @private_forks_count > 0
+ .private-forks-notice
+ = icon('lock fw', base: 'circle', class: 'fa-lg private-fork-icon')
+ %strong= pluralize(@private_forks_count, 'private fork')
+ %span you have no access to.
diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml
index e4bc9998163..2e08bb2ac08 100644
--- a/app/views/shared/projects/_list.html.haml
+++ b/app/views/shared/projects/_list.html.haml
@@ -8,24 +8,17 @@
- show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true
- remote = false unless local_assigns[:remote] == true
-%ul.projects-list.content-list
+.projects-list-holder
- if projects.any?
- - projects.each_with_index do |project, i|
- - css_class = (i >= projects_limit) ? 'hide' : nil
- = render "shared/projects/project", project: project, skip_namespace: skip_namespace,
- avatar: avatar, stars: stars, css_class: css_class, ci: ci, use_creator_avatar: use_creator_avatar,
- forks: forks, show_last_commit_as_description: show_last_commit_as_description
-
- - if projects.size > projects_limit && projects.kind_of?(Array)
- %li.bottom.center
- .light
- #{projects_limit} of #{pluralize(projects.count, 'project')} displayed.
- = link_to '#', class: 'js-expand' do
- Show all
+ %ul.projects-list.content-list
+ - projects.each_with_index do |project, i|
+ - css_class = (i >= projects_limit) ? 'hide' : nil
+ = render "shared/projects/project", project: project, skip_namespace: skip_namespace,
+ avatar: avatar, stars: stars, css_class: css_class, ci: ci, use_creator_avatar: use_creator_avatar,
+ forks: forks, show_last_commit_as_description: show_last_commit_as_description
= paginate(projects, remote: remote, theme: "gitlab") if projects.respond_to? :total_pages
- else
.nothing-here-block No projects found
:javascript
- new ProjectsList();
- Dashboard.init();
+ ProjectsList.init();