Project

General

Profile

Feature #31353 » 0001-moved-user-links-under-a-drop-down-menu.patch

Bernhard Rohloff, 2021-12-06 17:58

View differences:

app/helpers/application_helper.rb
570 570
    end
571 571
    text ||= l(:label_jump_to_a_project)
572 572
    url = autocomplete_projects_path(:format => 'js', :jump => current_menu_item)
573
    trigger = content_tag('span', text, :class => 'drdn-trigger')
573
    trigger = content_tag('span', text, :class => 'drdn-trigger arrow')
574 574
    q = text_field_tag('q', '', :id => 'projects-quick-search',
575 575
                       :class => 'autocomplete',
576 576
                       :data => {:automcomplete_url => url},
app/views/layouts/_user_menu.html.erb
1
<% if User.current.logged? %>
2
  <div id="user-menu" class="drdn">
3
    <div class="drdn-trigger arrow">
4
      <% if Setting.gravatar_enabled? %>
5
        <%= avatar(User.current, :size => "20") %>
6
      <%else%>
7
        <%= content_tag('span', User.current, :format => :username) %>
8
      <% end %>
9
    </div>
10
    <div class="drdn-content">
11
      <div class="drdn-items info">
12
        <%= content_tag('span', "#{User.current.firstname} #{User.current.lastname}", :class => 'user-name') %>
13
        <%= content_tag('span', User.current.login, :class => 'login' ) %>
14
    </div>
15
      <div class="drdn-items menu">
16
        <%= render_menu :user_menu -%>
17
      </div>
18
    </div>
19
  </div>
20
<% end %>
app/views/layouts/base.html.erb
60 60

  
61 61

  
62 62
<div id="top-menu">
63
  <div id="top-menu-left">
64
    <nav id="global-nav">
65
    <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
66
  </nav>
67
  </div>
68
  <div id="top-menu-right">
63 69
    <div id="account">
64
        <%= render_menu :account_menu -%>
70
        <%= render_menu :account_menu if !User.current.logged? -%>
65 71
    </div>
66
    <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
67
    <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
72
    <%= render :partial => 'layouts/user_menu' %>
73
  </div>
68 74
</div>
69 75

  
70 76
<div id="header">
config/locales/en.yml
658 658
  label_password_lost: Lost password
659 659
  label_password_required: Confirm your password to continue
660 660
  label_home: Home
661
  label_profile: Profile
661 662
  label_my_page: My page
662 663
  label_my_account: My account
663 664
  label_my_projects: My projects
lib/redmine/preparation.rb
161 161

  
162 162
      MenuManager.map :top_menu do |menu|
163 163
        menu.push :home, :home_path
164
        menu.push :my_page, {:controller => 'my', :action => 'page'},
165
                  :if => Proc.new {User.current.logged?}
166 164
        menu.push :projects, {:controller => 'projects', :action => 'index'},
167 165
                  :caption => :label_project_plural
168 166
        menu.push :administration, {:controller => 'admin', :action => 'index'},
......
174 172
        menu.push :login, :signin_path, :if => Proc.new {!User.current.logged?}
175 173
        menu.push :register, :register_path,
176 174
                  :if => Proc.new {!User.current.logged? && Setting.self_registration?}
175
      end
176

  
177
      MenuManager.map :user_menu do |menu|
178
        menu.push :profile, {:controller => 'users', :action => 'show', :id => 'current' }
179
        menu.push :my_page, {:controller => 'my', :action => 'page'},
180
                  :if => Proc.new {User.current.logged?}
177 181
        menu.push :my_account, {:controller => 'my', :action => 'account'},
178 182
                  :if => Proc.new {User.current.logged?}
179 183
        menu.push :logout, :signout_path, :html => {:method => 'post'},
public/stylesheets/application.css
24 24
  flex-direction: column;
25 25
}
26 26

  
27
#top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 10px 0px 12px;}
27
#top-menu {
28
  display: flex;
29
  justify-content: space-between;
30
  align-items: center;
31
  padding: 0 16px;
32
  background: #3E5B76;
33
  color: #fff;
34
  height:3.2em;
35
  font-size: 0.9em;
36
}
37

  
38
#top-menu-left {
39
  display: flex;
40
  align-items: center;
41
}
42

  
43
#top-menu-right {
44
  display: flex;
45
  justify-content: flex-end;
46
  align-items: center;
47
}
48

  
28 49
#top-menu ul {margin: 0;  padding: 0;}
29 50
#top-menu li {
30 51
  float:left;
......
33 54
  padding: 0px 0px 0px 0px;
34 55
  white-space:nowrap;
35 56
}
36
#top-menu a {color: #fff; margin-right: 8px; font-weight: bold;}
37
#top-menu #loggedas { float: right; margin-right: 0.5em; color: #fff; }
57
#global-nav a,
58
#account a {color: #fff; margin-right: 8px; font-weight: bold;}
59

  
38 60

  
39
#account {float:right;}
61
#user-menu a { color: 333; }
40 62

  
41 63
#header {min-height:5.3em;margin:0;background-color:#628DB6;color:#f8f8f8; padding: 4px 16px 20px 16px; position:relative;}
42
#header a {color:#f8f8f8;}
43 64
#header h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
44 65
#header h1 .breadcrumbs { display:block; font-size: .5em; font-weight: normal; }
66
#header h1 .breadcrumbs { display:block; font-size: .5em; font-weight: normal; }
67
#header h1 .breadcrumbs a {color:#f8f8f8;}
45 68

  
46 69
#quick-search {float:right;}
70
#quick-search label a {color:#f8f8f8;}
47 71
#quick-search #q {width:130px; height:24px; box-sizing:border-box; vertical-align:middle; border:1px solid #ccc; border-radius:3px;}
48 72

  
49 73
#main-menu {position: absolute;  bottom: 0px;  left: 10px; margin-right: -500px; width: 100%;}
......
164 188

  
165 189
/***** Dropdown *****/
166 190
.drdn {position:relative;}
191

  
167 192
.drdn-trigger {
168 193
  box-sizing:border-box;
169 194
  overflow:hidden;
......
173 198
  user-select:none;
174 199
  -moz-user-select:none;
175 200
  -webkit-user-select:none;
201
  padding:3px 16px 3px 6px;
202
  border-radius:4px;
176 203
}
204

  
205
.drdn-trigger.arrow::after {
206
  position: absolute;
207
  content: '';
208
  background: url(../images/arrow_down.png) no-repeat;
209
  right: 3px;
210
  top: calc(50% - 5px);
211
  width: 10px;
212
  height: 10px;
213
  z-index: 90;
214
}
215

  
177 216
.drdn-content {
178 217
  display:none;
179 218
  position:absolute;
......
186 225
  color:#555;
187 226
  z-index:99;
188 227
}
228

  
189 229
.drdn.expanded .drdn-content {display:block;}
190 230

  
191 231
.drdn-content .quick-search {margin:8px;}
192 232
.drdn-content .autocomplete {box-sizing: border-box; width:100% !important; height:28px;}
193 233
.drdn-content .autocomplete:focus {border-color:#5ad;}
194
.drdn-items {max-height:400px; overflow:auto;}
195 234
div + .drdn-items {border-top:1px solid #ccc;}
196 235
.drdn-items>* {
197 236
  display:block;
......
199 238
  overflow:hidden;
200 239
  text-overflow: ellipsis;
201 240
  white-space:nowrap;
202
  padding:4px 8px;
241
  padding:1px 5px;
203 242
}
204
.drdn-items>a:hover {text-decoration:none;}
205
.drdn-items>*:focus {border:1px dotted #bbb;}
243
.drdn-items a:hover {background-color:#759FCF; color:#fff;}
244
.drdn-items a:hover {text-decoration:none;}
245
.drdn-items *:focus {border:1px dotted #bbb;}
206 246

  
207 247
.drdn-items.selection>*:before {
208 248
  content:' ';
......
219 259
.drdn-items.selection:empty {
220 260
  border: none;
221 261
}
222
.drdn-items>span {color:#999;}
223 262

  
224 263
.contextual .drdn-content {top:18px;}
225 264
.contextual .drdn-items {padding:2px; min-width: 160px;}
......
227 266
.contextual .drdn-items>a.icon {padding-left: 24px; background-position-x: 4px;}
228 267
.contextual .drdn-items>a:hover {color:#2A5685; border:1px solid #628db6; background-color:#eef5fd; border-radius:3px;}
229 268

  
269
#user-menu { max-width: 150px;  border-radius: 4px; }
270
#user-menu .gravatar { background: #ffffffb2; }
271
#user-menu .user-name { font-weight: bold; font-size: 1em;}
272
#user-menu .drdn-content {
273
  min-width: 120px;
274
  max-width: 240px;
275
}
276
#user-menu .drdn-trigger span {
277
  font-weight: bold;
278
  padding: 4px;
279
  background-color: #00000033;
280
  border-radius: 4px;
281
  display: block;
282
  overflow: hidden;
283
  text-overflow: ellipsis;
284
}
285

  
286
#user-menu .drdn-items ul {
287
  display: flex;
288
  flex-direction: column;
289
}
290

  
291
#user-menu .drdn-items.menu a {
292
  display: block;
293
  padding: 5px;
294
}
295

  
230 296
#project-jump.drdn {width:200px;display:inline-block;}
231 297
#project-jump .drdn-trigger {
232 298
  width:100%;
233 299
  height:24px;
234 300
  display:inline-block;
235
  padding:3px 18px 3px 6px;
236 301
  border-radius:3px;
237 302
  border:1px solid #ccc;
238 303
  margin:0 !important;
239 304
  vertical-align:middle;
240 305
  color:#555;
241
  background:#fff url(../images/arrow_down.png) no-repeat 97% 50%;
306
  background-color: #fff;
242 307
}
243
#project-jump .drdn.expanded .drdn-trigger {background-image:url(../images/arrow_up.png);}
244 308
#project-jump .drdn-content {width:280px;}
245
#project-jump .drdn-items>* {color:#555 !important;}
246
#project-jump .drdn-items>a:hover {background-color:#759FCF; color:#fff !important;}
309
#project-jump .drdn-items {max-height:400px; overflow:auto;}
310
.drdn-items.projects a {
311
  padding: 4px 5px;
312
}
247 313

  
248 314
/***** Tables *****/
249 315
table.list, .table-list { border: 1px solid #e4e4e4; width: 100%; margin-bottom: 4px; border-radius: 3px; border-spacing: 0; overflow: hidden;}
public/stylesheets/responsive.css
121 121
    background: inherit;
122 122
  }
123 123

  
124
  #header #quick-search .drdn-trigger::after {
125
    display: none;
126
  }
127

  
124 128
  /* styles for combobox within quick-search (#project_quick_jump_box) */
125 129
  #project-jump.drdn {
126 130
    position: absolute;
(14-14/15)