"Missing partial users/avatar" with Redmine 2.0.3

Bug #1054938 reported by Max Sudyin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Redmine Local Avatars Plugin
New
High
Unassigned

Bug Description

Hello,

I am running Redmine 2.0.3 with the latest version of redmine_local_avatars plugin:
------
Environment:
  Redmine version 2.0.3.stable.10070
  Ruby version 1.9.3 (x86_64-linux)
  Rails version 3.2.6
  Environment production
  Database adapter PostgreSQL
Redmine plugins:
  redmine_backlogs v0.9.9
  redmine_ics_export 2.0.0.dev
  redmine_local_avatars 0.1.1
------

Upon installation of revision 28 I faced the bug described in https://bugs.launchpad.net/redminelocalavatars/+bug/1010406
To get it working I had to rename all $partialname.erb.html to $partialname.html.erb, create app/views/my with avatar.html.erb and comment out line in my_controller_path.rb:
------
root@dev:~# diff -rq redminelocalavatars_modified/ redminelocalavatars_rev28/
Only in redminelocalavatars_rev28/app/views/hooks/redmine_local_avatars: _view_my_account_contextual.erb.html
Only in redminelocalavatars_modified/app/views/hooks/redmine_local_avatars: _view_my_account_contextual.html.erb
Only in redminelocalavatars_modified/app/views: my
Only in redminelocalavatars_rev28/app/views/users: _avatar.erb.html
Only in redminelocalavatars_modified/app/views/users: avatar.html.erb
Files redminelocalavatars_modified/lib/my_controller_patch.rb and redminelocalavatars_rev28/lib/my_controller_patch.rb differ

root@dev:~# diff -pruN redminelocalavatars_modified/lib/my_controller_patch.rb redminelocalavatars_rev28/lib/my_controller_patch.rb
--- redminelocalavatars_modified/lib/my_controller_patch.rb 2012-09-23 17:33:26.148732397 +0700
+++ redminelocalavatars_rev28/lib/my_controller_patch.rb 2012-09-23 17:29:09.384835000 +0700
@@ -31,7 +31,7 @@ module LocalAvatarsPlugin

        def avatar
          @user = User.current
-# render :partial => 'users/avatar', :layout => true
+ render :partial => 'users/avatar', :layout => true
        end

        def save_avatar
------

After that I was able to click My Account > Change Local Avatar and submit new avatar.

However, if I try to go to Administration > Users and pick any user for editing, I get the error in my redmine log:
------
Started GET "/users/11/edit" for 117.239.142.194 at 2012-09-23 17:43:55 +0700
Processing by UsersController#edit as HTML
  Parameters: {"id"=>"11"}
DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm =>
 'Text' }' instead. (called from _app_views_users_edit_html_erb___3765354091315162513_62397640 at /var/www/rails_a
pps/redmine-2.0/app/views/users/edit.html.erb:4)
  Rendered users/_mail_notifications.html.erb (8.7ms)
  Rendered users/_preferences.html.erb (4.0ms)
  Rendered users/_form.html.erb (61.8ms)
  Rendered users/_general.html.erb (62.7ms)
  Rendered users/_memberships.html.erb (5.6ms)
  Rendered common/_tabs.html.erb (70.7ms)
  Rendered users/edit.html.erb within layouts/admin (73.1ms)
Completed 500 Internal Server Error in 77ms

ActionView::Template::Error (Missing partial users/avatar with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :rsb, :rjs]}. Searched in:
  * "/var/www/rails_apps/redmine-2.0/plugins/redmine_local_avatars/app/views"
  * "/var/www/rails_apps/redmine-2.0/plugins/redmine_ics_export/app/views"
  * "/var/www/rails_apps/redmine-2.0/plugins/redmine_backlogs/app/views"
  * "/var/www/rails_apps/redmine-2.0/app/views"
):
    21: </script>
    22:
    23: <% tabs.each do |tab| -%>
    24: <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
    25: :id => "tab-content-#{tab[:name]}",
    26: :style => (tab[:name] != selected_tab ? 'display:none' : nil),
    27: :class => 'tab-content') %>
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb__3664506575773517099_60619460'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__3664506575773517099_60619460'
  app/helpers/application_helper.rb:231:in `render_tabs'
  app/views/users/edit.html.erb:9:in `_app_views_users_edit_html_erb___3765354091315162513_62397640'
------

It is not clear, why I am facing that issue, as the partial file is present:
------
root@dev:~# ls -l app/views/users/
total 4
-rw-r--r-- 1 root root 429 Sep 23 17:01 avatar.html.erb
------
Could you please help me to work around this issue?

Revision history for this message
Max Sudyin (msudyin) wrote :

Update with step-by-step instructions how to get Local Avatars working on Redmine 2.x:
1. Check out the latest revision of redmine_local_avatars:
~# cd /your/redmine/directory/plugins
~# bzr branch lp:redminelocalavatars

2. Create missing view folder:
~# mkdir redminelocalavatars/app/views/my

3. Rename .erb.html files to .html.erb:
~# mv redminelocalavatars/app/views/users/{_avatar.erb.html,avatar.html.erb}
~# mv redminelocalavatars/app/views/hooks/redmine_local_avatars/_view_my_account_contextual{.erb.html,.html.erb}

4. Put copy of avatars.html.erb to app/views/my:
~# cp redminelocalavatars/app/views/{users,my}/avatar.html.erb

5. Comment out render: partial line in lib/my_controller_patch.rb:
~# sed '/render :partial/s~^~#~' -i redminelocalavatars/lib/my_controller_patch.rb

6. Restart your redmine service. For me it is thin:
~# /etc/init.d/thin restart

Luca Pireddu (pireddu)
Changed in redminelocalavatars:
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.