Commit 403638b8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Feature: add git tag via ui

parent d2284b41
...@@ -12,7 +12,9 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -12,7 +12,9 @@ class Projects::TagsController < Projects::ApplicationController
end end
def create def create
# TODO: implement @project.repository.add_tag(params[:tag_name], params[:ref])
redirect_to project_tags_path(@project)
end end
def destroy def destroy
......
...@@ -41,6 +41,12 @@ class Repository ...@@ -41,6 +41,12 @@ class Repository
gitlab_shell.add_branch(path_with_namespace, branch_name, ref) gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
end end
def add_tag(tag_name, ref)
Rails.cache.delete(cache_key(:tag_names))
gitlab_shell.add_tag(path_with_namespace, tag_name, ref)
end
def rm_branch(branch_name) def rm_branch(branch_name)
Rails.cache.delete(cache_key(:branch_names)) Rails.cache.delete(cache_key(:branch_names))
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%i.icon-home %i.icon-home
- if project_nav_tab? :files - if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame)) do = nav_link(controller: %w(tree blob blame edit_tree)) do
= link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref) = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref)
- if project_nav_tab? :commits - if project_nav_tab? :commits
......
= render "projects/commits/head" = render "projects/commits/head"
- if can? current_user, :push_code, @project
.pull-right
= link_to new_project_tag_path(@project), class: 'btn btn-create' do
%i.icon-add-sign
New tag
%p
Tags give ability to mark specific points in history as being important
%hr
- unless @tags.empty? - unless @tags.empty?
%ul.bordered-list %ul.bordered-list
- @tags.each do |tag| - @tags.each do |tag|
...@@ -26,7 +37,7 @@ ...@@ -26,7 +37,7 @@
%i.icon-download-alt %i.icon-download-alt
Download Download
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
= link_to project_tag_path(@project, tag.name), class: 'btn grouped btn-small remove-row', method: :delete, confirm: 'Removed tag cannot be restored. Are you sure?', remote: true do = link_to project_tag_path(@project, tag.name), class: 'btn btn-small remove-row', method: :delete, confirm: 'Removed tag cannot be restored. Are you sure?', remote: true do
%i.icon-trash %i.icon-trash
= paginate @tags, theme: 'gitlab' = paginate @tags, theme: 'gitlab'
......
%h3.page-title
%i.icon-code-fork
New tag
= form_tag project_tags_path, method: :post do
.control-group
= label_tag :tag_name, 'Name for new tag', class: 'control-label'
.controls
= text_field_tag :tag_name, nil, placeholder: 'v3.0.1', required: true, tabindex: 1
.control-group
= label_tag :ref, 'Create from', class: 'control-label'
.controls
= text_field_tag :ref, nil, placeholder: 'master', required: true, tabindex: 2
.light Branch name or commit SHA
.form-actions
= submit_tag 'Create tag', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', project_tags_path(@project), class: 'btn btn-cancel'
:javascript
var availableTags = #{@project.repository.ref_names.to_json};
$("#ref").autocomplete({
source: availableTags,
minLength: 1
});
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