diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-23 13:29:49 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-23 13:29:49 -0800 |
commit | abdeb21ccbb25aee564335dbbfca4a8afaf49384 (patch) | |
tree | 0e17fdf96cc6a2f7ccde3afe8757e431e9479f53 | |
parent | 06ef3885b30be843a7c86a93f5642680ab881b1c (diff) |
Add a user_menu method to the Admin_View and then use this method to get the
user menu. Since the information displayed is identical in both admin and
theme views, it makes sense to combine the generation to it is done in a common
location.
-rw-r--r-- | modules/gallery/helpers/gallery_event.php | 3 | ||||
-rw-r--r-- | modules/gallery/libraries/Admin_View.php | 10 | ||||
-rw-r--r-- | themes/admin_wind/css/screen.css | 5 | ||||
-rw-r--r-- | themes/admin_wind/views/admin.html.php | 15 |
4 files changed, 17 insertions, 16 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 982bf094..6175e049 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -111,12 +111,11 @@ class gallery_event_Core { ->label(t("Login"))); } else { $csrf = access::csrf_token(); - $item = $theme->item(); $menu->append(Menu::factory("dialog") ->id("user_menu_edit_profile") ->css_id("g-user-profile-link") ->view("login_current_user.html") - ->url(url::site("form/edit/users/{$user->id}")) + ->url(url::site("form/edit/user/{$user->id}")) ->label($user->display_name())); $menu->append(Menu::factory("link") ->id("user_menu_logout") diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index a990e4ca..e3f9dff0 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -36,6 +36,8 @@ class Admin_View_Core extends Gallery_View { $this->sidebar = ""; $this->set_global("theme", $this); $this->set_global("user", identity::active_user()); + $this->set_global("page_type", "admin"); + $this->set_global("page_subtype", $name); } public function admin_menu() { @@ -44,6 +46,14 @@ class Admin_View_Core extends Gallery_View { return $menu->render(); } + public function user_menu() { + $menu = Menu::factory("root") + ->css_id("g-login-menu") + ->css_class("g-inline ui-helper-clear-fix"); + module::event("user_menu", $menu, $this); + return $menu->render(); + } + /** * Print out any site wide status information. */ diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index 73ec8ac5..ac47a3db 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -229,6 +229,7 @@ th { #g-header #g-login-menu { margin-top: 1em; + float: right; } /* View container ~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -473,6 +474,10 @@ th { right: 150px; } +.rtl #g-header #g-login-menu { + float: left; +} + .rtl #g-header #g-login-menu li { margin-left: 0; padding-left: 0; diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php index 25ba1c97..fa79119a 100644 --- a/themes/admin_wind/views/admin.html.php +++ b/themes/admin_wind/views/admin.html.php @@ -43,23 +43,10 @@ <?= $theme->site_status() ?> <div id="g-header" class="ui-helper-clearfix"> <?= $theme->admin_header_top() ?> - <ul id="g-login-menu" class="g-inline g-right"> - <li class="g-first"> - <? if (identity::is_writable()): ?> - <?= t('Logged in as %name', array('name' => html::mark_clean( - '<a href="' . url::site("form/edit/users/{$user->id}") . - '" title="' . t("Edit your profile")->for_html_attr() . - '" id="g-user-profile-link" class="g-dialog-link">' . - html::clean($user->display_name()) . '</a>'))) ?> - <? else: ?> - <?= t('Logged in as %name', array('name' => html::clean($user->display_name()))) ?> - <? endif ?> - </li> - <li id="g-logout-link"><a href="<?= url::site("logout?csrf=$csrf&continue=" . urlencode(item::root()->url())) ?>"><?= t("Logout") ?></a></li> - </ul> <a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery")->for_html_attr() ?>"> ← <?= t("back to the ...") ?> </a> + <?= $theme->user_menu() ?> <div id="g-site-admin-menu" class="ui-helper-clearfix"> <?= $theme->admin_menu() ?> </div> |