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 @@ ...@@ -9,9 +9,9 @@
.bs-callout { .bs-callout {
margin: 20px 0; margin: 20px 0;
padding: 20px; padding: 20px;
border-left: 3px solid #eee; border-left: 3px solid $border-color;
color: #666; color: $text-color;
background: #f9f9f9; background: $background-color;
} }
.bs-callout h4 { .bs-callout h4 {
margin-top: 0; margin-top: 0;
......
...@@ -115,3 +115,10 @@ li.commit { ...@@ -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 ...@@ -6,10 +6,6 @@ class Projects::ReleasesController < Projects::ApplicationController
before_action :tag before_action :tag
before_action :release before_action :release
def show
@commit = @repository.commit(@tag.target)
end
def edit def edit
end end
...@@ -18,7 +14,7 @@ class Projects::ReleasesController < Projects::ApplicationController ...@@ -18,7 +14,7 @@ class Projects::ReleasesController < Projects::ApplicationController
release.update_attributes(description: description) release.update_attributes(description: description)
release.save 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 end
private private
......
...@@ -8,6 +8,13 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -8,6 +8,13 @@ class Projects::TagsController < Projects::ApplicationController
def index def index
sorted = VersionSorter.rsort(@repository.tag_names) sorted = VersionSorter.rsort(@repository.tag_names)
@tags = Kaminari.paginate_array(sorted).page(params[:page]).per(PER_PAGE) @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 end
def create def create
......
.branch-commit.light .branch-commit
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit-id"
&middot; &middot;
%span.str-truncated %span.str-truncated
= link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message"
......
...@@ -13,6 +13,5 @@ ...@@ -13,6 +13,5 @@
.error-alert .error-alert
.prepend-top-default .prepend-top-default
= f.submit 'Save changes', class: 'btn btn-save' = f.submit 'Save changes', class: 'btn btn-save'
- if @release.persisted? = link_to "Cancel", namespace_project_tag_path(@project.namespace, @project, @tag.name), class: "btn btn-default btn-cancel"
= link_to "Cancel", namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: "btn btn-default btn-cancel"
- commit = @repository.commit(tag.target) - commit = @repository.commit(tag.target)
- release = @releases.find { |release| release.tag == tag.name }
%li %li
%div %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 %strong
%i.fa.fa-tag %i.fa.fa-tag
= tag.name = tag.name
- if tag.message.present? - if tag.message.present?
&nbsp; &nbsp;
= strip_gpg_signature(tag.message) = strip_gpg_signature(tag.message)
- if release
%span.label.label-success release
.controls .controls
= link_to edit_namespace_project_tag_release_path(@project.namespace, @project, tag.name), class: 'btn-grouped btn' do = link_to edit_namespace_project_tag_release_path(@project.namespace, @project, tag.name), class: 'btn-grouped btn' do
= icon("pencil") = icon("pencil")
...@@ -22,3 +26,8 @@ ...@@ -22,3 +26,8 @@
- else - else
%p %p
Cant find HEAD commit for this tag 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/header_title"
= render "projects/commits/head" = render "projects/commits/head"
...@@ -6,7 +6,14 @@ ...@@ -6,7 +6,14 @@
.pull-right .pull-right
= link_to edit_namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: 'btn-grouped btn' do = link_to edit_namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: 'btn-grouped btn' do
= icon("pencil") = 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 .append-bottom-default.prepend-top-default
- if @release.description.present? - if @release.description.present?
...@@ -24,12 +31,14 @@ ...@@ -24,12 +31,14 @@
Commits Commits
- if can? current_user, :download_code, @project - if can? current_user, :download_code, @project
= render 'projects/repositories/download_archive', ref: @tag.name, btn_class: 'btn-grouped' = render 'projects/repositories/download_archive', ref: @tag.name, btn_class: 'btn-grouped'
-#- if can?(current_user, :admin_project, @project) - 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 .pull-right
%i.fa.fa-trash-o = 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 .gray-content-block.second-block
- if @commit - if @commit
= render 'projects/commits/commit', commit: @commit, project: @project = render 'projects/commits/commit', commit: @commit, project: @project
- else - else
Cant find HEAD commit for this tag Cant find HEAD commit for this tag
...@@ -569,8 +569,8 @@ Gitlab::Application.routes.draw do ...@@ -569,8 +569,8 @@ Gitlab::Application.routes.draw do
end end
resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } 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 resources :tags, only: [:index, :show, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
resource :release resource :release, only: [:edit, :update]
end end
resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } 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