Commit 850bb21b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Create show page for tag and render release notes there and on index page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a4d75e3a
......@@ -9,9 +9,9 @@
.bs-callout {
margin: 20px 0;
padding: 20px;
border-left: 3px solid #eee;
color: #666;
background: #f9f9f9;
border-left: 3px solid $border-color;
color: $text-color;
background: $background-color;
}
.bs-callout h4 {
margin-top: 0;
......
......@@ -115,3 +115,10 @@ li.commit {
}
}
}
.branch-commit {
color: $gl-gray;
.commit-id, .commit-row-message {
color: $gl-gray;
}
}
......@@ -6,10 +6,6 @@ class Projects::ReleasesController < Projects::ApplicationController
before_action :tag
before_action :release
def show
@commit = @repository.commit(@tag.target)
end
def edit
end
......@@ -18,7 +14,7 @@ class Projects::ReleasesController < Projects::ApplicationController
release.update_attributes(description: description)
release.save
redirect_to namespace_project_tag_release_path(@project.namespace, @project, @tag.name)
redirect_to namespace_project_tag_path(@project.namespace, @project, @tag.name)
end
private
......
......@@ -8,6 +8,13 @@ class Projects::TagsController < Projects::ApplicationController
def index
sorted = VersionSorter.rsort(@repository.tag_names)
@tags = Kaminari.paginate_array(sorted).page(params[:page]).per(PER_PAGE)
@releases = project.releases.where(tag: @tags)
end
def show
@tag = @repository.find_tag(params[:id])
@release = @project.releases.find_or_initialize_by(tag: @tag.name)
@commit = @repository.commit(@tag.target)
end
def create
......
.branch-commit.light
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id"
.branch-commit
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit-id"
&middot;
%span.str-truncated
= link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message"
......
......@@ -13,6 +13,5 @@
.error-alert
.prepend-top-default
= f.submit 'Save changes', class: 'btn btn-save'
- if @release.persisted?
= link_to "Cancel", namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: "btn btn-default btn-cancel"
= link_to "Cancel", namespace_project_tag_path(@project.namespace, @project, @tag.name), class: "btn btn-default btn-cancel"
- commit = @repository.commit(tag.target)
- release = @releases.find { |release| release.tag == tag.name }
%li
%div
= link_to namespace_project_commits_path(@project.namespace, @project, tag.name), class: "" do
= link_to namespace_project_tag_path(@project.namespace, @project, tag.name) do
%strong
%i.fa.fa-tag
= tag.name
- if tag.message.present?
&nbsp;
= strip_gpg_signature(tag.message)
- if release
%span.label.label-success release
.controls
= link_to edit_namespace_project_tag_release_path(@project.namespace, @project, tag.name), class: 'btn-grouped btn' do
= icon("pencil")
......@@ -22,3 +26,8 @@
- else
%p
Cant find HEAD commit for this tag
- if release && release.description.present?
.description.prepend-top-default
.wiki
= preserve do
= markdown release.description
- page_title @release.tag, "Releases"
- page_title @tag.name, "Tags"
= render "projects/commits/header_title"
= render "projects/commits/head"
......@@ -6,7 +6,14 @@
.pull-right
= link_to edit_namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: 'btn-grouped btn' do
= icon("pencil")
.oneline Release notes for #{@tag.name}
- if @tag.message.present?
.title
%strong= @tag.name
= strip_gpg_signature(@tag.message)
- else
.oneline
.title
%strong= @tag.name
.append-bottom-default.prepend-top-default
- if @release.description.present?
......@@ -24,12 +31,14 @@
Commits
- if can? current_user, :download_code, @project
= render 'projects/repositories/download_archive', ref: @tag.name, btn_class: 'btn-grouped'
-#- if can?(current_user, :admin_project, @project)
= link_to namespace_project_tag_path(@project.namespace, @project, @tag.name), class: 'btn btn-remove remove-row grouped', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do
%i.fa.fa-trash-o
- if can?(current_user, :admin_project, @project)
.pull-right
= link_to namespace_project_tag_path(@project.namespace, @project, @tag.name), class: 'btn btn-remove remove-row grouped', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do
%i.fa.fa-trash-o
.gray-content-block.second-block
- if @commit
= render 'projects/commits/commit', commit: @commit, project: @project
- else
Cant find HEAD commit for this tag
......@@ -569,8 +569,8 @@ Gitlab::Application.routes.draw do
end
resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
resources :tags, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
resource :release
resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
resource :release, only: [:edit, :update]
end
resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment