Commit f1963accc80485560d2c315e1d47abae5c092beb
1 parent
d32f8c9f
Exists in
master
and in
22 other branches
rails3: fix community_block plugin
Showing
4 changed files
with
54 additions
and
54 deletions
Show diff stats
plugins/community_block/lib/community_block.rb
plugins/community_block/test/functional/commmunity_block_plugin_profile_design_controller_test.rb
... | ... | @@ -27,7 +27,7 @@ class ProfileControllerTest < ActionController::TestCase |
27 | 27 | @environment.save! |
28 | 28 | |
29 | 29 | CommunityBlock.delete_all |
30 | - @box1 = Box.create!(:owner => @community) | |
30 | + @box1 = create(Box, :owner => @community) | |
31 | 31 | @community.boxes = [@box1] |
32 | 32 | |
33 | 33 | @block = CommunityBlock.new | ... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<div class="community-block"> | |
2 | + <div class="community-block-logo"> | |
3 | + <%= link_to profile_image(profile, :big), profile.url %> | |
4 | + </div> | |
5 | + <div class="community-block-info"> | |
6 | + <div class="community-block-title"> | |
7 | + | |
8 | + <% | |
9 | + links = [] | |
10 | + | |
11 | + if logged_in? | |
12 | + | |
13 | + if profile.enable_contact? | |
14 | + links.push(_('Send an e-mail') => {:href => url_for({:controller => 'contact', :action => 'new', :profile => profile.identifier})}) | |
15 | + end | |
16 | + | |
17 | + links.push(_('Report abuse') => {:href => url_for({:controller => 'profile', :action => 'report_abuse', :profile => profile.identifier})}) | |
18 | + | |
19 | + if !user.nil? && user.has_permission?('edit_profile', profile) | |
20 | + links.push(_('Control panel') => {:href => url_for({:controller => 'profile_editor', :profile => profile.identifier})}) | |
21 | + end %> | |
22 | + | |
23 | + <%= link_to( | |
24 | + content_tag('span','',:class => 'community-block-button icon-arrow'), | |
25 | + '#', | |
26 | + :onclick => "toggleSubmenu(this,'',#{j links.to_json}); return false;", | |
27 | + :class => 'simplemenu-trigger') %> | |
28 | + | |
29 | + <% end %> | |
30 | + | |
31 | + <% if logged_in? %> | |
32 | + <% if profile.members.include?(user) || profile.already_request_membership?(user) %> | |
33 | + <%= link_to( | |
34 | + content_tag('span', '', :class => 'community-block-button icon-remove'), | |
35 | + profile.leave_url) %> | |
36 | + <% else %> | |
37 | + <%= link_to( | |
38 | + content_tag('span', '', :class => 'community-block-button icon-add'), | |
39 | + profile.join_url) %> | |
40 | + <% end %> | |
41 | + <% else %> | |
42 | + <%= link_to( | |
43 | + content_tag('span', '', :class => 'community-block-button icon-add'), | |
44 | + profile.join_not_logged_url) %> | |
45 | + <% end %> | |
46 | + | |
47 | + <h1><%=profile.name%></h1> | |
48 | + </div> | |
49 | + <div class="community-block-description"><%= profile.description %></div> | |
50 | + </div> | |
51 | + <div style="clear:both"></div> | |
52 | +</div> | ... | ... |
plugins/community_block/views/community_block.rhtml
... | ... | @@ -1,52 +0,0 @@ |
1 | -<div class="community-block"> | |
2 | - <div class="community-block-logo"> | |
3 | - <%= link_to profile_image(profile, :big), profile.url %> | |
4 | - </div> | |
5 | - <div class="community-block-info"> | |
6 | - <div class="community-block-title"> | |
7 | - | |
8 | - <% | |
9 | - links = [] | |
10 | - | |
11 | - if logged_in? | |
12 | - | |
13 | - if profile.enable_contact? | |
14 | - links.push(_('Send an e-mail') => {:href => url_for({:controller => 'contact', :action => 'new', :profile => profile.identifier})}) | |
15 | - end | |
16 | - | |
17 | - links.push(_('Report abuse') => {:href => url_for({:controller => 'profile', :action => 'report_abuse', :profile => profile.identifier})}) | |
18 | - | |
19 | - if !user.nil? && user.has_permission?('edit_profile', profile) | |
20 | - links.push(_('Control panel') => {:href => url_for({:controller => 'profile_editor', :profile => profile.identifier})}) | |
21 | - end %> | |
22 | - | |
23 | - <%= link_to( | |
24 | - content_tag('span','',:class => 'community-block-button icon-arrow'), | |
25 | - '#', | |
26 | - :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false;", | |
27 | - :class => 'simplemenu-trigger') %> | |
28 | - | |
29 | - <% end %> | |
30 | - | |
31 | - <% if logged_in? %> | |
32 | - <% if profile.members.include?(user) || profile.already_request_membership?(user) %> | |
33 | - <%= link_to( | |
34 | - content_tag('span', '', :class => 'community-block-button icon-remove'), | |
35 | - profile.leave_url) %> | |
36 | - <% else %> | |
37 | - <%= link_to( | |
38 | - content_tag('span', '', :class => 'community-block-button icon-add'), | |
39 | - profile.join_url) %> | |
40 | - <% end %> | |
41 | - <% else %> | |
42 | - <%= link_to( | |
43 | - content_tag('span', '', :class => 'community-block-button icon-add'), | |
44 | - profile.join_not_logged_url) %> | |
45 | - <% end %> | |
46 | - | |
47 | - <h1><%=profile.name%></h1> | |
48 | - </div> | |
49 | - <div class="community-block-description"><%= profile.description %></div> | |
50 | - </div> | |
51 | - <div style="clear:both"></div> | |
52 | -</div> |