Merge remote-tracking branch 'origin/master' into bug/#2259_charts_quality

This commit is contained in:
Jyri-Petteri Paloposki 2019-11-13 13:58:26 +02:00
commit f7bad05dad
20 changed files with 205 additions and 101 deletions

View file

@ -712,9 +712,8 @@ class TodosController < ApplicationController
def tags
# TODO: limit to current_user
tags_beginning = Tag.where(Tag.arel_table[:name].matches("#{params[:term]}%"))
tags_all = Tag.where(Tag.arel_table[:name].matches("%#{params[:term]}%"))
tags_beginning = current_user.tags.where(Tag.arel_table[:name].matches("#{params[:term]}%"))
tags_all = current_user.tags.where(Tag.arel_table[:name].matches("%#{params[:term]}%"))
tags_all = tags_all - tags_beginning
respond_to do |format|

View file

@ -570,7 +570,7 @@ module TodosHelper
end
def context_container_id(todo)
return "c#{todo.context_id}"
return "context_#{todo.context_id}"
end
def todo_container_id(todo)

View file

@ -3,13 +3,15 @@ class Tag < ApplicationRecord
has_many :taggings
has_many :taggable, :through => :taggings
belongs_to :user
DELIMITER = ",".freeze # Controls how to split and join tagnames from strings. You may need to change the <tt>validates_format_of parameters</tt> if you change this.
JOIN_DELIMITER = ", ".freeze
# If database speed becomes an issue, you could remove these validations and
# rescue the ActiveRecord database constraint errors instead.
validates_presence_of :name
validates_uniqueness_of :name, :case_sensitive => false
validates_uniqueness_of :name, :scope => "user_id", :case_sensitive => false
before_create :before_create

View file

@ -94,6 +94,7 @@ class User < ApplicationRecord
end
end
has_many :tags, dependent: :delete_all
has_many :notes, -> { order "created_at DESC" }, dependent: :delete_all
has_one :preference, dependent: :destroy
has_many :attachments, through: :todos