Skip to content

Commit 7b6cb4c

Browse files
author
İsmail Akbudak
committed
#123 change application layout and add profile link to welcome page and navigation bar
1 parent 61cf830 commit 7b6cb4c

File tree

6 files changed

+46
-14
lines changed

6 files changed

+46
-14
lines changed

templates/app/controllers/user/profiles_controller.rb renamed to templates/app/controllers/user/profile_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class User::ProfilesController < User::UserApplicationController
1+
class User::ProfileController < User::UserApplicationController
22

33
before_action :set_profile, only: [:show, :edit, :update]
44
add_breadcrumb I18n.t('dock.profile'), :user_profile_path

templates/app/views/layouts/application.html.haml.erb

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,39 @@
1616
%body
1717
= render 'layouts/partials/warnings'
1818
.container-narrow
19-
.masthead
20-
%ul.nav.nav-pills.pull-right
21-
%li.active
22-
%a{href: "/"}
23-
= t('navbar.home_page')
24-
%h3.muted= link_to "<%= app_name.capitalize %>", root_path
25-
%hr/
19+
%nav.navbar.navbar-default
20+
.container-fluid
21+
/ Brand and toggle get grouped for better mobile display
22+
.navbar-header
23+
%button.navbar-toggle.collapsed{"aria-expanded" => "false", "data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", :type => "button"}
24+
%span.sr-only Toggle navigation
25+
%span.icon-bar
26+
%span.icon-bar
27+
%span.icon-bar
28+
= link_to root_path, class: 'navbar-brand' do
29+
%i.fa.fa-home
30+
= "<%= app_name.capitalize %>"
31+
/ Collect the nav links, forms, and other content for toggling
32+
#bs-example-navbar-collapse-1.collapse.navbar-collapse
33+
%ul.nav.navbar-nav.navbar-right
34+
- if user_signed_in?
35+
%li
36+
= link_to destroy_user_session_path, method: :delete do
37+
%i.fa.fa-sign-out
38+
= t('navbar.sign_out')
39+
%li
40+
= link_to user_profile_path(current_user) do
41+
%i.fa.fa-user
42+
= t('navbar.profile')
43+
- else
44+
%li
45+
= link_to new_user_session_path do
46+
%i.fa.fa-pencil-square-o{"aria-hidden" => "true"}
47+
= t('navbar.signin')
48+
%li
49+
= link_to new_user_registration_path do
50+
%i.fa.fa-user{"aria-hidden" => "true"}
51+
= t('navbar.signup')
2652
= render partial: 'layouts/partials/messages'
2753
= yield
2854
%hr/
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
- content_for :toolbar do
2-
= link_to edit_user_profile_path, class: 'btn btn-default' do
3-
%i.icon-pencil
4-
= t('action_button.edit')
51
.panel.panel-default
62
.panel-heading
73
%i.icon-edit.icon-large
@@ -12,4 +8,11 @@
128
= s.attribute :surname
139
= s.attribute :email
1410
= s.attribute :created_at
15-
= s.attribute :updated_at
11+
= s.attribute :updated_at
12+
.panel-footer
13+
= link_to root_path, class: 'btn-link' do
14+
%i.fa.fa-arrow-left
15+
= t('btn.back')
16+
= link_to edit_user_profile_path(@profile), class: 'btn btn-link' do
17+
%i.fa.fa-pencil
18+
= t('navbar.edit_profile_info')

templates/app/views/welcome/index.html.haml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
%strong Email:
1111
= current_user.email
1212
= link_to t('navbar.edit_login_info'), edit_user_registration_path, class: 'btn btn-large'
13+
= link_to t('navbar.profile'), user_profile_path(current_user), class: 'btn btn-link'
1314
- else
1415
= link_to t('navbar.signup'), new_user_registration_path, class: 'btn btn-large btn-success'
1516
= link_to t('navbar.signin'), new_user_session_path, class: 'btn btn-large'

templates/config/locales/view.tr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ tr:
3434
signin: Giriş Yap
3535
sign_out: Çıkış yap
3636
edit_login_info: Giriş bilgilerini güncelle
37+
edit_profile_info: Profil bilgilerini güncelle
3738
home_page: Anasayfa
3839
admin_portal: Yönetici Portalı
40+
profile: Profil
3941
tooltips:
4042
delete: Sil
4143
are_you_sure: Devam etmek istedğinize emin misiniz?

templates/config/routes.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Rails.application.routes.draw do
3838
namespace :user do
3939
root to: 'dashboard#index'
4040
resources :dashboard, only: [:index]
41-
resources :profile, only: [:index, :edit, :update]
41+
resources :profile, only: [:show, :edit, :update]
4242
end
4343

4444
# Common pages

0 commit comments

Comments
 (0)