diff --git a/plugins/community_block/lib/community_block.rb b/plugins/community_block/lib/community_block.rb index 235f8b1..bcd36b9 100644 --- a/plugins/community_block/lib/community_block.rb +++ b/plugins/community_block/lib/community_block.rb @@ -7,13 +7,4 @@ class CommunityBlock < Block def help _("Help for Community Description Block.") end - - def content(arg={}) - block = self - - proc do - render :file => 'community_block', :locals => { :block => block } - end - end - end diff --git a/plugins/community_block/test/unit/commmunity_block_test.rb b/plugins/community_block/test/unit/commmunity_block_test.rb deleted file mode 100644 index 3e87396..0000000 --- a/plugins/community_block/test/unit/commmunity_block_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -require_relative '../test_helper' - -class CommunityBlockTest < ActiveSupport::TestCase - - should "display community block" do - block = CommunityBlock.new - self.expects(:render).with(:file => 'community_block', :locals => { :block => block }) - instance_eval(& block.content) - end - -end diff --git a/plugins/community_block/views/blocks/community.html.erb b/plugins/community_block/views/blocks/community.html.erb new file mode 100644 index 0000000..a5a4a1c --- /dev/null +++ b/plugins/community_block/views/blocks/community.html.erb @@ -0,0 +1,52 @@ +
+ +
+
+ + <% + links = [] + + if logged_in? + + if profile.enable_contact? + links.push(c_('Send an e-mail') => {:href => url_for({:controller => 'contact', :action => 'new', :profile => profile.identifier})}) + end + + links.push(c_('Report abuse') => {:href => url_for({:controller => 'profile', :action => 'report_abuse', :profile => profile.identifier})}) + + if !user.nil? && user.has_permission?('edit_profile', profile) + links.push(c_('Control panel') => {:href => url_for({:controller => 'profile_editor', :profile => profile.identifier})}) + end %> + + <%= link_to( + content_tag('span','',:class => 'community-block-button icon-arrow'), + '#', + :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false;", + :class => 'simplemenu-trigger') %> + + <% end %> + + <% if logged_in? %> + <% if profile.members.include?(user) || profile.already_request_membership?(user) %> + <%= link_to( + content_tag('span', '', :class => 'community-block-button icon-remove'), + profile.leave_url, :class => 'join-community') %> + <% else %> + <%= link_to( + content_tag('span', '', :class => 'community-block-button icon-add'), + profile.join_url, :class => 'join-community') %> + <% end %> + <% else %> + <%= link_to( + content_tag('span', '', :class => 'community-block-button icon-add'), + profile.join_not_logged_url) %> + <% end %> + +

<%=profile.name%>

+
+
<%= profile.description %>
+
+
+
diff --git a/plugins/community_block/views/community_block.html.erb b/plugins/community_block/views/community_block.html.erb deleted file mode 100644 index a5a4a1c..0000000 --- a/plugins/community_block/views/community_block.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -
- -
-
- - <% - links = [] - - if logged_in? - - if profile.enable_contact? - links.push(c_('Send an e-mail') => {:href => url_for({:controller => 'contact', :action => 'new', :profile => profile.identifier})}) - end - - links.push(c_('Report abuse') => {:href => url_for({:controller => 'profile', :action => 'report_abuse', :profile => profile.identifier})}) - - if !user.nil? && user.has_permission?('edit_profile', profile) - links.push(c_('Control panel') => {:href => url_for({:controller => 'profile_editor', :profile => profile.identifier})}) - end %> - - <%= link_to( - content_tag('span','',:class => 'community-block-button icon-arrow'), - '#', - :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false;", - :class => 'simplemenu-trigger') %> - - <% end %> - - <% if logged_in? %> - <% if profile.members.include?(user) || profile.already_request_membership?(user) %> - <%= link_to( - content_tag('span', '', :class => 'community-block-button icon-remove'), - profile.leave_url, :class => 'join-community') %> - <% else %> - <%= link_to( - content_tag('span', '', :class => 'community-block-button icon-add'), - profile.join_url, :class => 'join-community') %> - <% end %> - <% else %> - <%= link_to( - content_tag('span', '', :class => 'community-block-button icon-add'), - profile.join_not_logged_url) %> - <% end %> - -

<%=profile.name%>

-
-
<%= profile.description %>
-
-
-
-- libgit2 0.21.2