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

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-11-05 13:49:34 +01:00
parent a4d75e3aec
commit 850bb21b12
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
9 changed files with 47 additions and 20 deletions

View file

@ -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;

View file

@ -115,3 +115,10 @@ li.commit {
}
}
}
.branch-commit {
color: $gl-gray;
.commit-id, .commit-row-message {
color: $gl-gray;
}
}

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,5 @@
.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"

View file

@ -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"

View file

@ -1,13 +1,17 @@
- 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

View file

@ -1,4 +1,4 @@
- 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

View file

@ -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 }