Commit 2e81b155 authored by Tap's avatar Tap

Label description and Label row

- Add label description
- Show label row when filtering issues or merge requests by label
parent 943bed68
...@@ -62,6 +62,8 @@ v 8.5.0 (unreleased) ...@@ -62,6 +62,8 @@ v 8.5.0 (unreleased)
- Replaces "Create merge request" link with one to the "Merge Request" when one exists - Replaces "Create merge request" link with one to the "Merge Request" when one exists
- Fix CI builds badge, add a new link to builds badge, deprecate the old one - Fix CI builds badge, add a new link to builds badge, deprecate the old one
- Fix broken link to project in build notification emails - Fix broken link to project in build notification emails
- Add label description
- Show label row when filtering issues or merge requests by label
v 8.4.4 v 8.4.4
- Update omniauth-saml gem to 1.4.2 - Update omniauth-saml gem to 1.4.2
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
} }
} }
.manage-labels-list { .label-row {
.label { .label {
padding: 9px; padding: 9px;
font-size: 14px; font-size: 14px;
......
...@@ -53,6 +53,6 @@ class Admin::LabelsController < Admin::ApplicationController ...@@ -53,6 +53,6 @@ class Admin::LabelsController < Admin::ApplicationController
end end
def label_params def label_params
params[:label].permit(:title, :color) params[:label].permit(:title, :description, :color)
end end
end end
...@@ -6,6 +6,8 @@ module IssuesAction ...@@ -6,6 +6,8 @@ module IssuesAction
@issues = @issues.page(params[:page]).per(ApplicationController::PER_PAGE) @issues = @issues.page(params[:page]).per(ApplicationController::PER_PAGE)
@issues = @issues.preload(:author, :project) @issues = @issues.preload(:author, :project)
@label = Label.where(project: @projects).find_by(title: params[:label_name])
respond_to do |format| respond_to do |format|
format.html format.html
format.atom { render layout: false } format.atom { render layout: false }
......
...@@ -5,5 +5,7 @@ module MergeRequestsAction ...@@ -5,5 +5,7 @@ module MergeRequestsAction
@merge_requests = get_merge_requests_collection @merge_requests = get_merge_requests_collection
@merge_requests = @merge_requests.page(params[:page]).per(ApplicationController::PER_PAGE) @merge_requests = @merge_requests.page(params[:page]).per(ApplicationController::PER_PAGE)
@merge_requests = @merge_requests.preload(:author, :target_project) @merge_requests = @merge_requests.preload(:author, :target_project)
@label = Label.where(project: @projects).find_by(title: params[:label_name])
end end
end end
...@@ -32,6 +32,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -32,6 +32,7 @@ class Projects::IssuesController < Projects::ApplicationController
end end
@issues = @issues.page(params[:page]).per(PER_PAGE) @issues = @issues.page(params[:page]).per(PER_PAGE)
@label = @project.labels.find_by(title: params[:label_name])
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -69,7 +69,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -69,7 +69,7 @@ class Projects::LabelsController < Projects::ApplicationController
end end
def label_params def label_params
params.require(:label).permit(:title, :color) params.require(:label).permit(:title, :description, :color)
end end
def label def label
......
...@@ -34,6 +34,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -34,6 +34,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE)
@merge_requests = @merge_requests.preload(:target_project) @merge_requests = @merge_requests.preload(:target_project)
@label = @project.labels.find_by(title: params[:label_name])
respond_to do |format| respond_to do |format|
format.html format.html
format.json do format.json do
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
# #
# Table name: labels # Table name: labels
# #
# id :integer not null, primary key # id :integer not null, primary key
# title :string(255) # title :string(255)
# color :string(255) # color :string(255)
# project_id :integer # project_id :integer
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# template :boolean default(FALSE) # template :boolean default(FALSE)
# description :string(255)
# #
class Label < ActiveRecord::Base class Label < ActiveRecord::Base
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
= f.label :title, class: 'control-label' = f.label :title, class: 'control-label'
.col-sm-10 .col-sm-10
= f.text_field :title, class: "form-control", required: true = f.text_field :title, class: "form-control", required: true
.form-group
= f.label :description, class: 'control-label'
.col-sm-10
= f.text_field :description, class: "form-control js-quick-submit"
.form-group .form-group
= f.label :color, "Background color", class: 'control-label' = f.label :color, "Background color", class: 'control-label'
.col-sm-10 .col-sm-10
......
%li{id: dom_id(label)} %li{id: dom_id(label)}
= render_colored_label(label) .label-row
.pull-right = render_colored_label(label)
= link_to 'Edit', edit_admin_label_path(label), class: 'btn btn-sm' = markdown(label.description, pipeline: :single_line)
= link_to 'Delete', admin_label_path(label), class: 'btn btn-sm btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Delete this label? Are you sure?"} .pull-right
= link_to 'Edit', edit_admin_label_path(label), class: 'btn btn-sm'
= link_to 'Delete', admin_label_path(label), class: 'btn btn-sm btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Delete this label? Are you sure?"}
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
= f.label :title, class: 'control-label' = f.label :title, class: 'control-label'
.col-sm-10 .col-sm-10
= f.text_field :title, class: "form-control js-quick-submit", required: true, autofocus: true = f.text_field :title, class: "form-control js-quick-submit", required: true, autofocus: true
.form-group
= f.label :description, class: 'control-label'
.col-sm-10
= f.text_field :description, class: "form-control js-quick-submit"
.form-group .form-group
= f.label :color, "Background color", class: 'control-label' = f.label :color, "Background color", class: 'control-label'
.col-sm-10 .col-sm-10
......
%li{id: dom_id(label)} %li{id: dom_id(label)}
= link_to_label(label) = render "shared/label_row", label: label, editable: true
.pull-right
%strong.append-right-20
= link_to_label(label) do
= pluralize label.open_issues_count, 'open issue'
- if can? current_user, :admin_label, @project
= link_to 'Edit', edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm'
= link_to 'Delete', namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"}
.label-row
= link_to_label(label)
= markdown(label.description, pipeline: :single_line)
.pull-right
%strong.append-right-20
= link_to_label(label) do
= pluralize label.open_issues_count, 'open issue'
- if defined?(editable) && editable && can?(current_user, :admin_label, @project)
= link_to 'Edit', edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm'
= link_to 'Delete', namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"}
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
.filter-item.inline .filter-item.inline
= button_tag "Update issues", class: "btn update_selected_issues btn-save" = button_tag "Update issues", class: "btn update_selected_issues btn-save"
- if @label.present?
.gray-content-block.second-block
= render "shared/label_row", label: @label
:javascript :javascript
new UsersSelect(); new UsersSelect();
$('form.filter-form').on('submit', function (event) { $('form.filter-form').on('submit', function (event) {
......
class AddDescriptionToLabel < ActiveRecord::Migration
def change
add_column :labels, :description, :string
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160209130428) do ActiveRecord::Schema.define(version: 20160217100506) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -442,7 +442,8 @@ ActiveRecord::Schema.define(version: 20160209130428) do ...@@ -442,7 +442,8 @@ ActiveRecord::Schema.define(version: 20160209130428) do
t.integer "project_id" t.integer "project_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "template", default: false t.boolean "template", default: false
t.string "description"
end end
add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree
......
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