Project

General

Profile

Feature #31353 » 0001-move-user-accounts-menu-links-under-a-dropdown-wip.patch

Marius BĂLTEANU, 2019-09-09 21:41

View differences:

app/helpers/application_helper.rb
530 530
    content_tag('div', trigger + content, :id => "project-jump", :class => "drdn")
531 531
  end
532 532

  
533
  # Returns user gravatar if Gravatar is enabled
534
  # Otherwise, returns user generic image for logged users
535
  # Or anonymous image for non logged users
536
  def render_menu_user_avatar
537
    if Setting.gravatar_enabled?
538
      link_to(avatar(User.current, :size => '20'), user_path(User.current))
539
    elsif User.current.logged?
540
      image_tag 'user_logged.png', GravatarHelper::DEFAULT_OPTIONS.merge({:size => '20'})
541
    else
542
      image_tag 'anonymous.png', GravatarHelper::DEFAULT_OPTIONS.merge({:size => '20'})
543
    end
544
  end
545

  
533 546
  def project_tree_options_for_select(projects, options = {})
534 547
    s = ''.html_safe
535 548
    if blank_text = options[:include_blank]
app/views/layouts/base.html.erb
35 35
    <% end %>
36 36

  
37 37
    <% if User.current.logged? %>
38
        <div class="flyout-menu__avatar <% if !Setting.gravatar_enabled? %>flyout-menu__avatar--no-avatar<% end %>">
39
            <% if Setting.gravatar_enabled? %>
40
                <%= link_to(avatar(User.current, :size => "80"), user_path(User.current)) %>
41
            <% end %>
38
        <div class="flyout-menu__avatar">
39
            <%= render_menu_user_avatar %>
42 40
            <%= link_to_user(User.current, :format => :username) %>
43 41
        </div>
44 42
    <% end %>
......
61 59
<div id="wrapper2">
62 60
<div id="wrapper3">
63 61
<div id="top-menu">
64
    <div id="account">
65
        <%= render_menu :account_menu -%>
62
    <div id="header-user" class="header-item header-item-user dropdown">
63
        <a class="user-avatar" href="#">
64
            <%= render_menu_user_avatar %>
65
            <span class="icon-only icon-arrow-down"></span>
66
        </a>
67
        <div class="menu-dropdown drdn-content">
68
            <% if User.current.logged? %>
69
                <ul id="loggedas"><li>
70
                    <span><%= l(:label_logged_as) %></span>
71
                    <%= link_to_user(User.current, :format => :username) %>
72
                </li></ul>
73
            <% end %>
74
            <%= render_menu :account_menu -%>
75
        </div>
66 76
    </div>
67
    <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
68 77
    <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
69 78
</div>
70 79

  
public/stylesheets/application.css
15 15
#wrapper {background: white;overflow: hidden;}
16 16
#wrapper3 { display: flex; flex-direction: column; }
17 17

  
18
#top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;}
18
#top-menu {background: #3E5B76; color: #fff; height:2.5em; font-size: 0.8em; padding: 0 8px 0 6px;}
19 19
#top-menu ul {margin: 0;  padding: 0;}
20
#top-menu li {
20
#top-menu a {font-weight: bold; line-height: 2.5em;}
21
#top-menu > ul li {
21 22
  float:left;
22 23
  list-style-type:none;
23 24
  margin: 0px 0px 0px 0px;
24 25
  padding: 0px 0px 0px 0px;
25 26
  white-space:nowrap;
26 27
}
27
#top-menu a {color: #fff; margin-right: 8px; font-weight: bold;}
28
#top-menu #loggedas { float: right; margin-right: 0.5em; color: #fff; }
28
#top-menu > ul a { color: #fff; margin-right: 8px;}
29
#top-menu #header-user {float: right; color: #fff; position: relative; height: 100%;}
30
#top-menu #loggedas {border-bottom: 1px solid #ccc;}
31
#top-menu #loggedas span {display: block;}
29 32

  
30
#account {float:right;}
33
#top-menu .header-item.dropdown a {text-decoration: none;}
34
#top-menu .header-item.dropdown:hover .menu-dropdown {display: block;}
35

  
36
#top-menu .menu-dropdown {
37
  display: none;
38
  width: 100%;
39
  left: auto;
40
  right: 0;
41
  margin-top: -1px;
42
}
43
#top-menu .menu-dropdown li {
44
  list-style-type: none;
45
  padding: 4px 8px;
46
  white-space: nowrap;
47
}
48
#top-menu .menu-dropdown li:hover {background-color: #3E5B76; border-radius: 3px;}
49
#top-menu .menu-dropdown li:hover * {color: #fff;}
50
#top-menu .menu-dropdown a {
51
  color: #555;
52
  width: 100%;
53
  display: block;
54
  margin-right: 0;
55
}
31 56

  
32 57
#header {min-height:5.3em;margin:0;background-color:#628DB6;color:#f8f8f8; padding: 4px 8px 20px 6px; position:relative;}
33 58
#header a {color:#f8f8f8;}
......
1477 1502
.icon-zoom-out { background-image: url(../images/zoom_out.png); }
1478 1503
.icon-magnifier { background-image: url(../images/magnifier.png); }
1479 1504
.icon-passwd { background-image: url(../images/textfield_key.png); }
1505
.icon-arrow-down { background-image: url(../images/arrow_down_white.png); }
1480 1506
.icon-arrow-right, .icon-test, .icon-sticky { background-image: url(../images/bullet_go.png); }
1481 1507
.icon-email { background-image: url(../images/email.png); }
1482 1508
.icon-email-disabled { background-image: url(../images/email_disabled.png); }
public/stylesheets/responsive.css
116 116
    display: none;
117 117
  }
118 118

  
119
  .js-profile-menu .current-user {
120
    display: none;
121
  }
119 122
  /* the quick search within header holding search form and #project_quick_jump_box box*/
120 123
  #header #quick-search {
121 124
    float: none;
......
530 533
            flex-grow: 1;
531 534
  }
532 535

  
533
  /* user link when no avatar is present */
534
  .flyout-menu__avatar--no-avatar a.user {
535
    line-height: 40px;
536
    padding-left: 8px;
537
  }
538

  
539 536
  .flyout-is-active body {
540 537
    overflow: hidden; /* for body not to have scrollbars when left flyout menu is active */
541 538
  }
(2-2/15)