Commit 29089352 authored by Long Nguyen's avatar Long Nguyen

Routing refactoring

parent 3d462704
......@@ -6,7 +6,7 @@
%span
= snippet.title
by
= link_to snippets_user_path(snippet.author) do
= link_to user_snippets_path(snippet.author) do
= image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: ''
= snippet.author_name
%span.light #{time_ago_with_tooltip(snippet.created_at)}
......
......@@ -17,7 +17,7 @@
= "##{snippet_title.id}"
%span
by
= link_to snippets_user_path(snippet_title.author) do
= link_to user_snippets_path(snippet_title.author) do
= image_tag avatar_icon(snippet_title.author_email), class: "avatar avatar-inline s16", alt: ''
= snippet_title.author_name
%span.light #{time_ago_with_tooltip(snippet_title.created_at)}
......@@ -16,6 +16,6 @@
= link_to snippet.project.name_with_namespace, namespace_project_path(snippet.project.namespace, snippet.project)
.snippet-info
= link_to snippets_user_path(snippet.author) do
= link_to user_snippets_path(snippet.author) do
= snippet.author_name
authored #{time_ago_with_tooltip(snippet.created_at)}
......@@ -4,7 +4,7 @@
#{@timestamps.to_json},
#{@starting_year},
#{@starting_month},
'#{calendar_activities_user_path}'
'#{user_calendar_activities_path}'
);
.calendar-hint Summary of issues, merge requests, and push events
......@@ -70,19 +70,19 @@
%ul.nav-links.center.user-profile-nav
%li.js-activity-tab
= link_to calendar_activities_user_path, data: {target: 'div#activity', action: 'activity', toggle: 'tab'} do
= link_to user_calendar_activities_path, data: {target: 'div#activity', action: 'activity', toggle: 'tab'} do
Activity
%li.js-groups-tab
= link_to groups_user_path, data: {target: 'div#groups', action: 'groups', toggle: 'tab'} do
= link_to user_groups_path, data: {target: 'div#groups', action: 'groups', toggle: 'tab'} do
Groups
%li.js-contributed-tab
= link_to contributed_projects_user_path, data: {target: 'div#contributed', action: 'contributed', toggle: 'tab'} do
= link_to user_contributed_projects_path, data: {target: 'div#contributed', action: 'contributed', toggle: 'tab'} do
Contributed projects
%li.projects-tab
= link_to projects_user_path, data: {target: 'div#projects', action: 'projects', toggle: 'tab'} do
= link_to user_projects_path, data: {target: 'div#projects', action: 'projects', toggle: 'tab'} do
Personal projects
%li.snippets-tab
= link_to snippets_user_path, data: {target: 'div#snippets', action: 'snippets', toggle: 'tab'} do
= link_to user_snippets_path, data: {target: 'div#snippets', action: 'snippets', toggle: 'tab'} do
Snippets
%div{ class: container_class }
......@@ -90,7 +90,7 @@
#activity.tab-pane
.row-content-block.calender-block.white.second-block.hidden-xs
%div{ class: container_class }
.user-calendar{data: {href: calendar_user_path}}
.user-calendar{data: {href: user_calendar_path}}
%h4.center.light
%i.fa.fa-spinner.fa-spin
.user-calendar-activities
......
......@@ -343,19 +343,16 @@ Rails.application.routes.draw do
end
end
resources(:users,
path: 'u',
param: :username,
constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ },
only: :show) do
member do
get :calendar, as: :calendar
get :calendar_activities, as: :calendar_activities
get :groups, as: :groups
get :projects, as: :projects
get :contributed, as: :contributed_projects
get :snippets, as: :snippets
end
scope(path: 'u/:username',
constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ },
controller: :users) do
get :calendar, action: :calendar, as: :user_calendar
get :calendar_activities, action: :calendar_activities, as: :user_calendar_activities
get :groups, action: :groups, as: :user_groups
get :projects, action: :projects, as: :user_projects
get :contributed, action: :contributed, as: :user_contributed_projects
get :snippets, action: :snippets, as: :user_snippets
get '/', action: :show, as: :user
end
#
......
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