diff --git a/app/views/account/_login.rhtml b/app/views/account/_login.rhtml new file mode 100644 index 00000000..d003425f --- /dev/null +++ b/app/views/account/_login.rhtml @@ -0,0 +1,33 @@ + diff --git a/app/views/account/login.rhtml b/app/views/account/login.rhtml index fad59e9a..eddb02a0 100644 --- a/app/views/account/login.rhtml +++ b/app/views/account/login.rhtml @@ -5,7 +5,7 @@ - + diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index 3a4e9dee..06e88d45 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -83,10 +83,27 @@ <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %> <% end %> + <% unless User.current.logged? %> +
  • + <%= link_to l(:label_login), {:controller => 'account', :action => 'login'}, :class => 'login' %> + + +
  • + <% else %> + + <% end %> <% end %> - <% main_menu = render_main_menu(@project) %> diff --git a/config/locales/de.yml b/config/locales/de.yml index 264919a4..e220c8e1 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -546,6 +546,7 @@ de: label_news_view_all: Alle News anzeigen label_news_added: News hinzugefügt label_settings: Konfiguration + label_user_settings: Einstellungen label_overview: Übersicht label_version: Version label_version_new: Neue Version diff --git a/config/locales/en.yml b/config/locales/en.yml index 8560fc8f..93044b27 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -543,6 +543,7 @@ en: label_news_added: News added label_news_comment_added: Comment added to a news label_settings: Settings + label_user_settings: Settings label_overview: Overview label_version: Version label_version_new: New version diff --git a/lib/redmine.rb b/lib/redmine.rb index 16f59228..e5500359 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -170,9 +170,7 @@ Redmine::MenuManager.map :top_menu do |menu| end Redmine::MenuManager.map :account_menu do |menu| - menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } - menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } - menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } + menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }, :caption => :label_user_settings menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 05f08f9a..2f8f3ecd 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -481,6 +481,20 @@ jQuery(document).ready(function($) { return false; }); + // show/hide login box + $("#account a.login").click(function() { + $(this).parent().toggleClass("open"); + // Focus the username field if the login field has opened + $("#nav-login").slideToggle(animRate, function () { + if ($(this).parent().hasClass("open")) { + $("input#username").focus() + } + }); + $("#account .drop-down.open").toggleClass("open").find("ul").mySlide(); + + return false; + }); + // file table thumbnails $("table a.has-thumb").hover(function() { $(this).removeAttr("title").toggleClass("active"); @@ -546,45 +560,35 @@ jQuery(document).ready(function($) { return false; }); - // remove .drop-down class from empty dropdowns - $("#account .drop-down").each(function(index) { - if ($(this).find("li").size() < 1) { - $(this).removeClass("drop-down"); - } - }); + jQuery("#account-nav > li").hover(function() { + if ($("#account-nav").hasClass("hover") && ($("#account-nav > li.drop-down.open").get(0) !== $(this).get(0))){ + //Close all other open menus + //Used to work around the rendering bug TODO: fix + jQuery("input#username-pulldown").blur(); + $("#account-nav > li.drop-down.open").toggleClass("open").find("> ul").mySlide(); + $(this).slideAndFocus(); + return false; + } + }, + function(){ + return false; + }); + jQuery("#account-nav > li.drop-down").click(function() { + if (($("#account-nav > li.drop-down.open").get(0) !== $(this).get(0))){ + $("#account-nav > li.drop-down.open").toggleClass("open").find("> ul").mySlide(); + } + $(this).slideAndFocus(); + $("#account-nav").toggleClass("hover"); - $("#account .drop-down").hover(function() { - $(this).addClass("open").find("ul").show(); - $("#top-menu").addClass("open"); - - // wraps long dropdown menu in an overflow:auto div to keep long project lists on the page - var $projectDrop = $("#account .drop-down:has(.projects) ul"); - - // only do the wrapping if it's the project dropdown, and more than 15 items - if ( $projectDrop.children().size() > 15 && $(this).find("> a").hasClass("projects") ) { - - var overflowHeight = 15 * $projectDrop.find("li:eq(1)").outerHeight() - 2; - - $projectDrop - .wrapInner("
    ").end() - .find(".overflow").css({overflow: 'auto', height: overflowHeight, position: 'relative'}) - .find("li a").css('paddingRight', '25px'); - - // do hack-y stuff for IE6 & 7. don't ask why, I don't know. - if (parseInt($.browser.version, 10) < 8 && $.browser.msie) { - - $projectDrop.find(".overflow").css({width: 325, zoom: '1'}); - $projectDrop.find("li a").css('marginLeft', '-15px'); - $("#top-menu").css('z-index', '10000'); - } - - } - - - }, function() { - $(this).removeClass("open").find("ul").hide(); - $("#top-menu").removeClass("open"); - }); + $("#account .drop-down:has(ul) > a").click(function() { + //Close all other open menus + $("#account .drop-down.open:has(ul)").not($(this).parent()).toggleClass("open").find("ul").mySlide(); + //Close login pull down when open + $("li.open div#nav-login").parent().toggleClass("open").find("div#nav-login").slideToggle(animRate); + //Toggle clicked menu item + $(this).parent().toggleClass("open").find("ul").mySlide(); + return false; + }); // deal with potentially problematic super-long titles $(".title-bar h2").css({paddingRight: $(".title-bar-actions").outerWidth() + 15 }); @@ -608,4 +612,13 @@ jQuery(document).ready(function($) { } }); + $('html').click(function() { + //Close all open menus + $("#account .drop-down.open").toggleClass("open").find("ul").mySlide(); + $("li.open div#nav-login").parent().toggleClass("open").find("div#nav-login").slideToggle(animRate); + }); + // Do not close the login window when using it + $('#nav-login-content').click(function(event){ + event.stopPropagation(); + }); }); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 841588d8..9029194d 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1187,7 +1187,44 @@ a:hover { margin:5px 5px; width:94%; } +#nav-login { + display:none; + width: 500px; + position: absolute; + right:-1px; + top:23px; + background: transparent; + border:0px; + border-top:0; +} +#nav-login-content { + position: relative; + float: right; + background: white; + border:1px solid #194E60; + border-top:0; + padding-left:5px; + padding-top:5px; + padding-right:10px; + padding-bottom:8px;; +} +#nav-login input[type=text], #nav-login input[type=password] { + height: 20px; + width: 150px; +} +#nav-login div a { + display: inline; + padding-left: 2px; +} +#nav-login div a:hover { + background-color: transparent; + text-decoration:underline; +} +div#optional_login_fields { + top:10px; + white-space:nowrap; +} /*------------------------------------------------------------------------------- * =02 - Main Menu *
    <%= text_field_tag 'username', nil, :tabindex => '1' %><%= text_field_tag 'username', nil, :tabindex => '2' %>