Skip to content

Commit

Permalink
#123 change application layout and add profile link to welcome page a…
Browse files Browse the repository at this point in the history
…nd navigation bar
  • Loading branch information
İsmail Akbudak committed Aug 3, 2016
1 parent 61cf830 commit 7b6cb4c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class User::ProfilesController < User::UserApplicationController
class User::ProfileController < User::UserApplicationController

before_action :set_profile, only: [:show, :edit, :update]
add_breadcrumb I18n.t('dock.profile'), :user_profile_path
Expand Down
40 changes: 33 additions & 7 deletions templates/app/views/layouts/application.html.haml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,39 @@
%body
= render 'layouts/partials/warnings'
.container-narrow
.masthead
%ul.nav.nav-pills.pull-right
%li.active
%a{href: "/"}
= t('navbar.home_page')
%h3.muted= link_to "<%= app_name.capitalize %>", root_path
%hr/
%nav.navbar.navbar-default
.container-fluid
/ Brand and toggle get grouped for better mobile display
.navbar-header
%button.navbar-toggle.collapsed{"aria-expanded" => "false", "data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to root_path, class: 'navbar-brand' do
%i.fa.fa-home
= "<%= app_name.capitalize %>"
/ Collect the nav links, forms, and other content for toggling
#bs-example-navbar-collapse-1.collapse.navbar-collapse
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li
= link_to destroy_user_session_path, method: :delete do
%i.fa.fa-sign-out
= t('navbar.sign_out')
%li
= link_to user_profile_path(current_user) do
%i.fa.fa-user
= t('navbar.profile')
- else
%li
= link_to new_user_session_path do
%i.fa.fa-pencil-square-o{"aria-hidden" => "true"}
= t('navbar.signin')
%li
= link_to new_user_registration_path do
%i.fa.fa-user{"aria-hidden" => "true"}
= t('navbar.signup')
= render partial: 'layouts/partials/messages'
= yield
%hr/
Expand Down
13 changes: 8 additions & 5 deletions templates/app/views/user/profiles/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
- content_for :toolbar do
= link_to edit_user_profile_path, class: 'btn btn-default' do
%i.icon-pencil
= t('action_button.edit')
.panel.panel-default
.panel-heading
%i.icon-edit.icon-large
Expand All @@ -12,4 +8,11 @@
= s.attribute :surname
= s.attribute :email
= s.attribute :created_at
= s.attribute :updated_at
= s.attribute :updated_at
.panel-footer
= link_to root_path, class: 'btn-link' do
%i.fa.fa-arrow-left
= t('btn.back')
= link_to edit_user_profile_path(@profile), class: 'btn btn-link' do
%i.fa.fa-pencil
= t('navbar.edit_profile_info')
1 change: 1 addition & 0 deletions templates/app/views/welcome/index.html.haml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
%strong Email:
= current_user.email
= link_to t('navbar.edit_login_info'), edit_user_registration_path, class: 'btn btn-large'
= link_to t('navbar.profile'), user_profile_path(current_user), class: 'btn btn-link'
- else
= link_to t('navbar.signup'), new_user_registration_path, class: 'btn btn-large btn-success'
= link_to t('navbar.signin'), new_user_session_path, class: 'btn btn-large'
2 changes: 2 additions & 0 deletions templates/config/locales/view.tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ tr:
signin: Giriş Yap
sign_out: Çıkış yap
edit_login_info: Giriş bilgilerini güncelle
edit_profile_info: Profil bilgilerini güncelle
home_page: Anasayfa
admin_portal: Yönetici Portalı
profile: Profil
tooltips:
delete: Sil
are_you_sure: Devam etmek istedğinize emin misiniz?
Expand Down
2 changes: 1 addition & 1 deletion templates/config/routes.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Rails.application.routes.draw do
namespace :user do
root to: 'dashboard#index'
resources :dashboard, only: [:index]
resources :profile, only: [:index, :edit, :update]
resources :profile, only: [:show, :edit, :update]
end

# Common pages
Expand Down

0 comments on commit 7b6cb4c

Please sign in to comment.