Commit 2a1ea20528e44e636dfd1f7ddfdbcec3ee3d8da0
1 parent
05b73d10
Exists in
master
and in
29 other branches
ActionItem111: added more links to the user_options bar
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@727 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
46 additions
and
11 deletions
Show diff stats
app/controllers/public/home_controller.rb
| @@ -2,6 +2,6 @@ class HomeController < PublicController | @@ -2,6 +2,6 @@ class HomeController < PublicController | ||
| 2 | 2 | ||
| 3 | design :holder => 'environment' | 3 | design :holder => 'environment' |
| 4 | def index | 4 | def index |
| 5 | -# redirect_to homepage_path(:profile => 'anhetegua') | 5 | + redirect_to homepage_path(:profile => 'noosfero') if Profile.find_by_identifier('noosfero') |
| 6 | end | 6 | end |
| 7 | end | 7 | end |
app/helpers/application_helper.rb
| @@ -115,14 +115,20 @@ module ApplicationHelper | @@ -115,14 +115,20 @@ module ApplicationHelper | ||
| 115 | # FIXME: uncomment "My enterprises" links | 115 | # FIXME: uncomment "My enterprises" links |
| 116 | def user_links | 116 | def user_links |
| 117 | links = [ | 117 | links = [ |
| 118 | - ( link_to_homepage(current_user.login) ), | ||
| 119 | - ( link_to(_('My account'), { :controller => 'account' }) ), | 118 | + ( link_to_homepage( _('My account') )), |
| 120 | ( link_to_myprofile _('My Enterprises'), {:controller => 'membership_editor'} ), | 119 | ( link_to_myprofile _('My Enterprises'), {:controller => 'membership_editor'} ), |
| 121 | ( link_to(_('Admin'), { :controller => 'admin_panel' }) if current_user.person.is_admin?), | 120 | ( link_to(_('Admin'), { :controller => 'admin_panel' }) if current_user.person.is_admin?), |
| 121 | + ( link_to_document (about_document), _('About') if about_document ), | ||
| 122 | ].join("\n") | 122 | ].join("\n") |
| 123 | content_tag('span', links, :id => 'user_links') | 123 | content_tag('span', links, :id => 'user_links') |
| 124 | end | 124 | end |
| 125 | 125 | ||
| 126 | + def about_document | ||
| 127 | + Article.find_all_by_title('About').select do |a| | ||
| 128 | + a.full_path.split(/\//).shift == 'noosfero' | ||
| 129 | + end[0] | ||
| 130 | + end | ||
| 131 | + | ||
| 126 | def header | 132 | def header |
| 127 | login_or_register_or_logout | 133 | login_or_register_or_logout |
| 128 | end | 134 | end |
| @@ -190,30 +196,58 @@ module ApplicationHelper | @@ -190,30 +196,58 @@ module ApplicationHelper | ||
| 190 | ] | 196 | ] |
| 191 | end | 197 | end |
| 192 | 198 | ||
| 199 | + def myprofile_links | ||
| 200 | + links = [ | ||
| 201 | + [(link_to _('Change password'), {:controller => 'account', :action => 'change_password'}), 'edit_profile', profile] | ||
| 202 | + ] | ||
| 203 | + end | ||
| 204 | + | ||
| 205 | + def about_links | ||
| 206 | + links = [ | ||
| 207 | + [(link_to _('Report bug'), 'http://www.colivre.coop.br/Noosfero/BugItem')], | ||
| 208 | + ] | ||
| 209 | + end | ||
| 210 | + | ||
| 211 | + def design_links | ||
| 212 | + links = [ | ||
| 213 | + [(link_to _('Change template'), :controller => 'profile_editor', :action => 'design_editor_change_template')], | ||
| 214 | + [(link_to _('Change block theme'), :controller => 'profile_editor', :action => 'design_editor_change_theme')], | ||
| 215 | + [(link_to _('Change icon theme'), :controller => 'profile_editor', :action => 'design_editor_change_icon_theme')], | ||
| 216 | + ] | ||
| 217 | + end | ||
| 193 | 218 | ||
| 194 | - #FIXME: find a way of accessing environment from here | ||
| 195 | def user_options | 219 | def user_options |
| 196 | - profile = params[:profile] | 220 | + profile = Profile.find_by_identifier(params[:profile]) |
| 197 | case params[:controller] | 221 | case params[:controller] |
| 198 | when 'admin_panel' | 222 | when 'admin_panel' |
| 199 | admin_links | 223 | admin_links |
| 200 | when 'membership_editor' | 224 | when 'membership_editor' |
| 201 | membership_links | 225 | membership_links |
| 202 | when 'profile_editor' | 226 | when 'profile_editor' |
| 203 | - if profile.kind_of?(Enterprise) | 227 | + if profile.kind_of?(Enterprise) && params[:action] == 'index' |
| 204 | enterprise_links | 228 | enterprise_links |
| 205 | - elsif profile.kind_of?(Person) | ||
| 206 | - person_links | 229 | + elsif profile.kind_of?(Person) && params[:action] == 'index' |
| 230 | + myprofile_links | ||
| 231 | + elsif params[:action] == 'design_editor' | ||
| 232 | + design_links | ||
| 207 | else | 233 | else |
| 208 | [] | 234 | [] |
| 209 | end | 235 | end |
| 210 | when 'content_viewer' | 236 | when 'content_viewer' |
| 211 | - person_links | 237 | + if params[:profile] == 'noosfero' && params[:page][0] == 'about' |
| 238 | + about_links | ||
| 239 | + else | ||
| 240 | + person_links | ||
| 241 | + end | ||
| 212 | else | 242 | else |
| 213 | [] | 243 | [] |
| 214 | end.map{|l| link_if_permitted(l[0], l[1], l[2]) } | 244 | end.map{|l| link_if_permitted(l[0], l[1], l[2]) } |
| 215 | end | 245 | end |
| 216 | 246 | ||
| 247 | + def accessibility_link | ||
| 248 | + link_to _('Accessibility') | ||
| 249 | + end | ||
| 250 | + | ||
| 217 | def footer | 251 | def footer |
| 218 | # FIXME: add some information from the environment | 252 | # FIXME: add some information from the environment |
| 219 | [ | 253 | [ |
app/views/layouts/application.rhtml
| @@ -63,7 +63,8 @@ | @@ -63,7 +63,8 @@ | ||
| 63 | <div id='noosfero_bar' class='category<%= category_color %>'> | 63 | <div id='noosfero_bar' class='category<%= category_color %>'> |
| 64 | <div id='top_bar' class='category<%= category_color %>'> | 64 | <div id='top_bar' class='category<%= category_color %>'> |
| 65 | <div id='accessibility_menu'> | 65 | <div id='accessibility_menu'> |
| 66 | - <a href='#content' title='Ir para o conteúdo'>Ir para conteúdo</a> | 66 | + <a href='#content' title='Ir para o conteúdo'>Ir para conteúdo</a> |
| 67 | + <%= accessibility_link %> | ||
| 67 | <a href='#'>Acessibilidade</a> | 68 | <a href='#'>Acessibilidade</a> |
| 68 | </div><!-- accessibility_menu --> | 69 | </div><!-- accessibility_menu --> |
| 69 | <div id='path_category'> | 70 | <div id='path_category'> |
script/populate
| 1 | #!/usr/bin/env ruby | 1 | #!/usr/bin/env ruby |
| 2 | require File.dirname(__FILE__) + '/../config/environment' | 2 | require File.dirname(__FILE__) + '/../config/environment' |
| 3 | 3 | ||
| 4 | -anhetegua = Profile.create!(:name => 'anhetegua', :identifier => 'anhetegua') | 4 | +anhetegua = Profile.create!(:name => 'noosfero', :identifier => 'noosfero') |
| 5 | 5 | ||
| 6 | User.create!(:login => 'testprofile', :email => 'admin@localhost.localdomain', :password => 'test', :password_confirmation => 'test') | 6 | User.create!(:login => 'testprofile', :email => 'admin@localhost.localdomain', :password => 'test', :password_confirmation => 'test') |
| 7 | User.create!(:login => 'user', :email => 'user@localhost.localdomain', :password => 'user', :password_confirmation => 'user') | 7 | User.create!(:login => 'user', :email => 'user@localhost.localdomain', :password => 'user', :password_confirmation => 'user') |