Add ability to edit and show release notes

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-11-05 12:15:25 +01:00
parent ba67af79a9
commit a4d75e3aec
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
7 changed files with 60 additions and 9 deletions

View file

@ -39,6 +39,9 @@ class Dispatcher
shortcut_handler = new ShortcutsNavigation()
new DropzoneInput($('.merge-request-form'))
new IssuableForm($('.merge-request-form'))
when 'projects:releases:edit'
new ZenMode()
new DropzoneInput($('.release-form'))
when 'projects:merge_requests:show'
new Diff()
shortcut_handler = new ShortcutsIssuable()

View file

@ -16,6 +16,7 @@
.append-bottom-10 { margin-bottom:10px }
.append-bottom-15 { margin-bottom:15px }
.append-bottom-20 { margin-bottom:20px }
.append-bottom-default { margin-bottom: $gl-padding; }
.inline { display: inline-block }
.center { text-align: center }

View file

@ -7,6 +7,7 @@ class Projects::ReleasesController < Projects::ApplicationController
before_action :release
def show
@commit = @repository.commit(@tag.target)
end
def edit

View file

@ -32,7 +32,7 @@
Files
- if project_nav_tab? :commits
= nav_link(controller: %w(commit commits compare repositories tags branches)) do
= nav_link(controller: %w(commit commits compare repositories tags branches releases)) do
= link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits', data: {placement: 'right'} do
= icon('history fw')
%span

View file

@ -12,7 +12,7 @@
Branches
%span.badge.js-totalbranch-count= @repository.branches.size
= nav_link(controller: :tags) do
= nav_link(controller: [:tags, :releases]) do
= link_to namespace_project_tags_path(@project.namespace, @project) do
Tags
%span.badge.js-totaltags-count= @repository.tags.length

View file

@ -1,6 +1,18 @@
= form_for(@release, method: :put, url: namespace_project_tag_release_path(@project.namespace, @project, @tag.name), html: { class: 'form-horizontal gfm-form' }) do |f|
= render "projects/commits/header_title"
= render "projects/commits/head"
.gray-content-block
.oneline
Release notes for #{@tag.name}
.prepend-top-default
= form_for(@release, method: :put, url: namespace_project_tag_release_path(@project.namespace, @project, @tag.name), html: { class: 'form-horizontal gfm-form release-form' }) do |f|
= render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do
= render 'projects/zen', f: f, attr: :description, classes: 'js-quick-submit'
= render 'projects/zen', f: f, attr: :description, classes: 'description js-quick-submit'
= render 'projects/notes/hints'
.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"

View file

@ -1 +1,35 @@
= debug @release
- page_title @release.tag, "Releases"
= render "projects/commits/header_title"
= render "projects/commits/head"
.gray-content-block
.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}
.append-bottom-default.prepend-top-default
- if @release.description.present?
.description
.wiki
= preserve do
= markdown @release.description
- else
This tag has no release notes yet. Press edit button to add one
.gray-content-block.middle-block.clearfix
= link_to namespace_project_tree_path(@project.namespace, @project, @tag.name), class: 'btn btn-grouped' do
Browse code
= link_to namespace_project_commits_path(@project.namespace, @project, @tag.name), class: 'btn btn-grouped' do
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
.gray-content-block.second-block
- if @commit
= render 'projects/commits/commit', commit: @commit, project: @project
- else
Cant find HEAD commit for this tag