diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-12-07 12:16:13 +0100 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-12-07 12:16:13 +0100 |
commit | 047d1545500d6912f2c8acd69298153a0baaeecd (patch) | |
tree | fff56369fba64fff2e4562dfe3c11f9d546d9d57 | |
parent | 7d564029e1226e8eb12c2de67124311466170fab (diff) | |
download | gitlab-ce-ac-releases.tar.gz |
Add Releases indexac-releases
-rw-r--r-- | app/controllers/projects/releases_controller.rb | 11 | ||||
-rw-r--r-- | app/views/projects/releases/_release.html.haml | 41 | ||||
-rw-r--r-- | app/views/projects/releases/index.html.haml | 18 | ||||
-rw-r--r-- | config/routes/project.rb | 2 |
4 files changed, 69 insertions, 3 deletions
diff --git a/app/controllers/projects/releases_controller.rb b/app/controllers/projects/releases_controller.rb index 55827075896..d4b8c38967b 100644 --- a/app/controllers/projects/releases_controller.rb +++ b/app/controllers/projects/releases_controller.rb @@ -4,9 +4,14 @@ class Projects::ReleasesController < Projects::ApplicationController # Authorize before_action :require_non_empty_project before_action :authorize_download_code! - before_action :authorize_push_code! - before_action :tag - before_action :release + before_action :authorize_push_code!, except: [:index] + before_action :tag, except: [:index] + before_action :release, except: [:index] + + def index + @releases = project.releases + @releases = Kaminari.paginate_array(@releases).page(params[:page]) + end def edit end diff --git a/app/views/projects/releases/_release.html.haml b/app/views/projects/releases/_release.html.haml new file mode 100644 index 00000000000..16b487dc184 --- /dev/null +++ b/app/views/projects/releases/_release.html.haml @@ -0,0 +1,41 @@ +- tag = @repository.find_tag(release.tag) +- commit = @repository.commit(tag.dereferenced_target) +%li.flex-row + .row-main-content.str-truncated + %span.item-title.ref-name.prepend-left-4 + = release.tag + + - if protected_tag?(@project, tag) + %span.badge.badge-success.prepend-left-4 + = s_('TagsPage|protected') + + - if commit + .block-truncated + .branch-commit + .icon-container.commit-icon + = custom_icon("icon_commit") + = link_to commit.short_id, project_commit_path(@project, commit.id), class: "commit-sha" + · + %span.str-truncated + = icon('tag') + = link_to tag.name, project_tag_path(@project, tag.name), class: 'ref-name prepend-left-4' + · + #{time_ago_with_tooltip(commit.committed_date)} + - else + %p + = s_("TagsPage|Can't find HEAD commit for this tag") + - if release.description.present? + .description.prepend-top-default + .wiki + = markdown_field(release, :description) + + .row-fixed-content.controls.flex-row + -# = render 'projects/buttons/download', project: @project, ref: tag.name, pipeline: @tags_pipelines[tag.name] + + - if can?(current_user, :push_code, @project) + = link_to edit_project_tag_release_path(@project, tag.name), class: 'btn has-tooltip', title: s_('TagsPage|Edit release notes'), data: { container: "body" } do + = icon("pencil") + + -# if can?(current_user, :admin_project, @project) + = link_to project_tag_path(@project, tag.name), class: "btn btn-remove remove-row has-tooltip prepend-left-10 #{protected_tag?(@project, tag) ? 'disabled' : ''}", title: s_('TagsPage|Delete tag'), method: :delete, data: { confirm: s_('TagsPage|Deleting the %{tag_name} tag cannot be undone. Are you sure?') % { tag_name: tag.name }, container: 'body' }, remote: true do + = icon("trash-o") diff --git a/app/views/projects/releases/index.html.haml b/app/views/projects/releases/index.html.haml new file mode 100644 index 00000000000..554b9e045d3 --- /dev/null +++ b/app/views/projects/releases/index.html.haml @@ -0,0 +1,18 @@ +- @no_container = true +- page_title s_('ReleasesPage|Releases') += content_for :meta_tags do + = auto_discovery_link_tag(:atom, project_tags_url(@project, rss_url_options), title: "#{@project.name} tags") + +.flex-list{ class: container_class } + .tags + - if @releases.any? + %ul.flex-list.content-list + = render partial: 'release', collection: @releases + + = paginate @releases, theme: 'gitlab' + + - else + .nothing-here-block + = s_('ReleasesPage|Repository has no releases yet.') + %br + %small explain how to use it diff --git a/config/routes/project.rb b/config/routes/project.rb index 7d0623cb904..5941b688146 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -95,6 +95,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end + resources :releases, only: [:index] + resources :forks, only: [:index, :new, :create] resource :import, only: [:new, :create, :show] |