Commit 115454f3ed35d136c2edd77296ffff97570a6822
1 parent
15b121d6
Exists in
master
and in
4 other branches
created-by-me filter for issues inside project. Fixed global project.issues order
Showing
5 changed files
with
14 additions
and
5 deletions
Show diff stats
app/contexts/issues_list_context.rb
| ... | ... | @@ -7,12 +7,13 @@ class IssuesListContext < BaseContext |
| 7 | 7 | @issues = case params[:status] |
| 8 | 8 | when issues_filter[:all] then @project.issues |
| 9 | 9 | when issues_filter[:closed] then @project.issues.closed |
| 10 | - when issues_filter[:to_me] then @project.issues.opened.assigned(current_user) | |
| 10 | + when issues_filter[:to_me] then @project.issues.assigned(current_user) | |
| 11 | + when issues_filter[:by_me] then @project.issues.authored(current_user) | |
| 11 | 12 | else @project.issues.opened |
| 12 | 13 | end |
| 13 | 14 | |
| 14 | 15 | @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present? |
| 15 | - @issues = @issues.includes(:author, :project).order("updated_at") | |
| 16 | + @issues = @issues.includes(:author, :project) | |
| 16 | 17 | |
| 17 | 18 | # Filter by specific assignee_id (or lack thereof)? |
| 18 | 19 | if params[:assignee_id].present? | ... | ... |
app/helpers/issues_helper.rb
| ... | ... | @@ -27,6 +27,7 @@ module IssuesHelper |
| 27 | 27 | all: "all", |
| 28 | 28 | closed: "closed", |
| 29 | 29 | to_me: "assigned-to-me", |
| 30 | + by_me: "created-by-me", | |
| 30 | 31 | open: "open" |
| 31 | 32 | } |
| 32 | 33 | end |
| ... | ... | @@ -45,7 +46,7 @@ module IssuesHelper |
| 45 | 46 | return "" if @project.nil? |
| 46 | 47 | |
| 47 | 48 | if @project.used_default_issues_tracker? |
| 48 | - project_issues_filter_path(@project) | |
| 49 | + project_issues_filter_path(@project) | |
| 49 | 50 | else |
| 50 | 51 | url = Settings[:issues_tracker][@project.issues_tracker]["project_url"] |
| 51 | 52 | url.gsub(':project_id', @project.id.to_s) | ... | ... |
app/models/issue.rb
app/models/project.rb
| ... | ... | @@ -45,7 +45,7 @@ class Project < ActiveRecord::Base |
| 45 | 45 | |
| 46 | 46 | has_many :events, dependent: :destroy |
| 47 | 47 | has_many :merge_requests, dependent: :destroy |
| 48 | - has_many :issues, dependent: :destroy, order: "state, created_at DESC" | |
| 48 | + has_many :issues, dependent: :destroy, order: "state DESC, created_at DESC" | |
| 49 | 49 | has_many :milestones, dependent: :destroy |
| 50 | 50 | has_many :users_projects, dependent: :destroy |
| 51 | 51 | has_many :notes, dependent: :destroy | ... | ... |
app/views/issues/_filter.html.haml
| ... | ... | @@ -6,7 +6,10 @@ |
| 6 | 6 | Open |
| 7 | 7 | %li{class: ("active" if params[:status] == 'assigned-to-me')} |
| 8 | 8 | = link_to project_issues_path(@project, status: 'assigned-to-me') do |
| 9 | - Assigned To Me | |
| 9 | + Assigned to me | |
| 10 | + %li{class: ("active" if params[:status] == 'created-by-me')} | |
| 11 | + = link_to project_issues_path(@project, status: 'created-by-me') do | |
| 12 | + Created by me | |
| 10 | 13 | %li{class: ("active" if params[:status] == 'closed')} |
| 11 | 14 | = link_to project_issues_path(@project, status: 'closed') do |
| 12 | 15 | Closed | ... | ... |