Commit 6e1fdc22d213139462598e736b6e77b917dcc2eb
1 parent
565789d3
Exists in
master
and in
22 other branches
improved stylesheet and functional tests in community block plugin
Showing
4 changed files
with
128 additions
and
113 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1250,19 +1250,11 @@ module ApplicationHelper | @@ -1250,19 +1250,11 @@ module ApplicationHelper | ||
1250 | already_reported_message = _('You already reported this profile.') | 1250 | already_reported_message = _('You already reported this profile.') |
1251 | report_profile_message = _('Report this profile for abusive behaviour') | 1251 | report_profile_message = _('Report this profile for abusive behaviour') |
1252 | 1252 | ||
1253 | - if type == :button || type == :button_without_text | 1253 | + if type == :button |
1254 | if user.already_reported?(profile) | 1254 | if user.already_reported?(profile) |
1255 | - if type == :button | ||
1256 | - button(:alert, text, url, :class => klass+' disabled', :disabled => true, :title => already_reported_message) | ||
1257 | - elsif type == :button_without_text | ||
1258 | - button_without_text(:alert, text, url, :class => klass+' disabled', :disabled => true, :title => already_reported_message) | ||
1259 | - end | 1255 | + button(:alert, text, url, :class => klass+' disabled', :disabled => true, :title => already_reported_message) |
1260 | else | 1256 | else |
1261 | - if type == :button | ||
1262 | - button(:alert, text, url, :class => klass, :title => report_profile_message) | ||
1263 | - elsif type == :button_without_text | ||
1264 | - button_without_text(:alert, text, url, :class => klass, :title => report_profile_message) | ||
1265 | - end | 1257 | + button(:alert, text, url, :class => klass, :title => report_profile_message) |
1266 | end | 1258 | end |
1267 | elsif type == :link | 1259 | elsif type == :link |
1268 | if user.already_reported?(profile) | 1260 | if user.already_reported?(profile) |
plugins/community_block/public/style.css
@@ -20,15 +20,86 @@ | @@ -20,15 +20,86 @@ | ||
20 | margin-left: 2px; | 20 | margin-left: 2px; |
21 | } | 21 | } |
22 | 22 | ||
23 | -#content .box-1 .community-block .community-block-title { | 23 | +#content .box-1 .community-block .community-block-title .menu-submenu { |
24 | + bottom: 154px; | ||
25 | + right: -120px; | ||
26 | +} | ||
27 | + | ||
28 | +#content .box-1 .community-block .community-block-title .menu-submenu-header { | ||
29 | + display: none; | ||
30 | +} | ||
31 | + | ||
32 | +#content .box-1 .community-block .community-block-title .menu-submenu-content { | ||
33 | + border: 1px solid #888a85; | ||
34 | + border-radius: 4px; | ||
35 | + background-color: #efefef; | ||
36 | + background-image: none; | ||
37 | +} | ||
38 | + | ||
39 | +#content .box-1 .community-block .community-block-title .menu-submenu-content h4 { | ||
40 | + display: none; | ||
41 | +} | ||
42 | + | ||
43 | +#content .box-1 .community-block .community-block-title .menu-submenu-content ul { | ||
44 | + list-style: none; | ||
45 | +} | ||
46 | + | ||
47 | +#content .box-1 .community-block .community-block-title .menu-submenu-content li { | ||
48 | + padding: 7px; | ||
49 | + font-size: 10px; | ||
50 | +} | ||
51 | + | ||
52 | +#content .box-1 .community-block .community-block-title .menu-submenu-content a { | ||
53 | + color: #000; | ||
54 | +} | ||
55 | + | ||
56 | +#content .box-1 .community-block .community-block-title .menu-submenu-footer { | ||
57 | + display: none; | ||
58 | +} | ||
59 | + | ||
60 | +#content .box-1 .community-block .community-block-title h1 { | ||
24 | //border: 1px solid #00F; | 61 | //border: 1px solid #00F; |
25 | font-variant: small-caps; | 62 | font-variant: small-caps; |
26 | color: #555753; | 63 | color: #555753; |
27 | text-align: left; | 64 | text-align: left; |
28 | padding-left: 10px; | 65 | padding-left: 10px; |
29 | - margin: 0px; | 66 | + margin: 0px 0px 2px 0px; |
67 | +} | ||
68 | + | ||
69 | +#content .box-1 .community-block .community-block-button { | ||
70 | + border: 1px solid #CCCCCC; | ||
71 | + border-radius: 4px; | ||
72 | + float: right; | ||
73 | + height: 22px; | ||
74 | + line-height: 22px; | ||
75 | + margin-top: 1px; | ||
76 | + margin-right: 1px; | ||
77 | + background-color: #F4F4F4; | ||
78 | + background-position: center center; | ||
79 | + background-repeat: no-repeat; | ||
80 | + cursor: pointer; | ||
81 | +} | ||
82 | + | ||
83 | +#content .box-1 .community-block .community-block-button.icon-add { | ||
84 | + width: 20px; | ||
85 | + background-image: url('/designs/icons/default/Tango/16x16/actions/add.png'); | ||
86 | +} | ||
87 | + | ||
88 | +#content .box-1 .community-block .community-block-button.icon-remove { | ||
89 | + width: 20px; | ||
90 | + background-image: url('/designs/icons/default/Tango/16x16/actions/remove.png'); | ||
91 | +} | ||
92 | + | ||
93 | +#content .box-1 .community-block .community-block-button.icon-arrow { | ||
94 | + width: 16px; | ||
95 | + background-image: url('/images/top-arrow.png'); | ||
96 | +} | ||
97 | + | ||
98 | +#content .box-1 .community-block .community-block-button:hover { | ||
99 | + background-color: #DDDDDD; | ||
30 | } | 100 | } |
31 | 101 | ||
102 | + | ||
32 | #content .box-1 .community-block .community-block-description { | 103 | #content .box-1 .community-block .community-block-description { |
33 | //border: 1px solid #0F0; | 104 | //border: 1px solid #0F0; |
34 | font-style: italic; | 105 | font-style: italic; |
@@ -36,10 +107,3 @@ | @@ -36,10 +107,3 @@ | ||
36 | padding: 10px; | 107 | padding: 10px; |
37 | } | 108 | } |
38 | 109 | ||
39 | -#content .box-1 .community-block .community-block-buttons { | ||
40 | - //border: 1px solid #F00; | ||
41 | - text-align: left; | ||
42 | - margin-top: 3px; | ||
43 | - margin-left: 22px; | ||
44 | -} | ||
45 | - |
plugins/community_block/test/functional/commmunity_block_plugin_profile_design_controller_test.rb
@@ -42,77 +42,46 @@ class ProfileControllerTest < ActionController::TestCase | @@ -42,77 +42,46 @@ class ProfileControllerTest < ActionController::TestCase | ||
42 | get :index, :profile => @community.identifier | 42 | get :index, :profile => @community.identifier |
43 | assert_tag :div, :attributes => {:class => 'community-block-logo'} | 43 | assert_tag :div, :attributes => {:class => 'community-block-logo'} |
44 | assert_tag :div, :attributes => {:class => 'community-block-info'} | 44 | assert_tag :div, :attributes => {:class => 'community-block-info'} |
45 | - assert_tag :h1, :attributes => {:class => 'community-block-title'} | 45 | + assert_tag :div, :attributes => {:class => 'community-block-title'} |
46 | assert_tag :div, :attributes => {:class => 'community-block-description'} | 46 | assert_tag :div, :attributes => {:class => 'community-block-description'} |
47 | - assert_tag :div, :attributes => {:class => 'community-block-buttons'} | ||
48 | end | 47 | end |
49 | 48 | ||
50 | - | ||
51 | - # USER LOGGED IN AND COMMUNITY MEMBER # | ||
52 | - | ||
53 | should 'display *leave* button when the user is logged in and is a member of the community' do | 49 | should 'display *leave* button when the user is logged in and is a member of the community' do |
54 | get :index, :profile => @community.identifier | 50 | get :index, :profile => @community.identifier |
55 | - assert_tag :a, :attributes => {:class => 'button icon-remove'} | 51 | + assert_tag :span, :attributes => {:class => 'community-block-button icon-remove'} |
56 | end | 52 | end |
57 | 53 | ||
58 | should 'display *send email to administrators* button when the user is logged in and is a member of the community' do | 54 | should 'display *send email to administrators* button when the user is logged in and is a member of the community' do |
59 | get :index, :profile => @community.identifier | 55 | get :index, :profile => @community.identifier |
60 | - assert_tag :a, :attributes => {:class => 'button icon-menu-mail'} | 56 | + assert_match /\{"Send an e-mail":\{"href":"\/contact\/#{@community.identifier}\/new"\}\}/, @response.body |
61 | end | 57 | end |
62 | 58 | ||
63 | should 'display *report* button when the user is logged in and is a member of the community' do | 59 | should 'display *report* button when the user is logged in and is a member of the community' do |
64 | get :index, :profile => @community.identifier | 60 | get :index, :profile => @community.identifier |
65 | - assert_tag :a, :attributes => {:class => 'button icon-alert report-abuse-action'} | 61 | + assert_match /\{"Report abuse":\{"href":"\/profile\/#{@community.identifier}\/report_abuse"\}\}/, @response.body |
66 | end | 62 | end |
67 | 63 | ||
68 | - | ||
69 | - # USER LOGGED IN AND NOT MEMBER OF THE COMMUNITY | ||
70 | - | ||
71 | should 'display *join* button when the user is logged in and is not a member of the community' do | 64 | should 'display *join* button when the user is logged in and is not a member of the community' do |
72 | @community.remove_member @user | 65 | @community.remove_member @user |
73 | get :index, :profile => @community.identifier | 66 | get :index, :profile => @community.identifier |
74 | - assert_tag :a, :attributes => {:class => 'button icon-add'} | ||
75 | - end | ||
76 | - | ||
77 | - should 'display *send email to administrators* button when the user is logged in and is not a member of the community' do | ||
78 | - @community.remove_member @user | ||
79 | - get :index, :profile => @community.identifier | ||
80 | - assert_tag :a, :attributes => {:class => 'button icon-menu-mail'} | ||
81 | - end | ||
82 | - | ||
83 | - should 'display *report* button when the user is logged in and is not a member of the community' do | ||
84 | - @community.remove_member @user | ||
85 | - get :index, :profile => @community.identifier | ||
86 | - assert_tag :a, :attributes => {:class => 'button icon-alert report-abuse-action'} | 67 | + assert_tag :span, :attributes => {:class => 'community-block-button icon-add'} |
87 | end | 68 | end |
88 | 69 | ||
89 | - | ||
90 | - # USER LOGGED IN AND COMMUNITY ADMIN | ||
91 | - | ||
92 | - should 'display *configure* button when the user is logged in and is community admin' do | 70 | + should 'display *control panel* link option when the user is logged in and is community admin' do |
93 | get :index, :profile => @community.identifier | 71 | get :index, :profile => @community.identifier |
94 | - assert_tag :a, :attributes => {:class => 'button icon-menu-ctrl-panel'} | 72 | + assert_match /\{"Control panel":\{"href":"\/myprofile\/#{@community.identifier}"\}\}/, @response.body |
95 | end | 73 | end |
96 | 74 | ||
97 | - | ||
98 | - # USER NOT LOGGED IN | ||
99 | - | ||
100 | - should 'not display *send email to administrators* button when the user is not logged in' do | 75 | + should 'display *join* button when the user is not logged in' do |
101 | logout | 76 | logout |
102 | get :index, :profile => @community.identifier | 77 | get :index, :profile => @community.identifier |
103 | - assert_no_tag :a, :attributes => {:class => 'button icon-menu-mail'} | 78 | + assert_tag :span, :attributes => {:class => 'community-block-button icon-add'} |
104 | end | 79 | end |
105 | 80 | ||
106 | - should 'not display *report* button when the user is not logged in' do | 81 | + should 'not display *arrow* button when the user is not logged in' do |
107 | logout | 82 | logout |
108 | get :index, :profile => @community.identifier | 83 | get :index, :profile => @community.identifier |
109 | - assert_no_tag :a, :attributes => {:class => 'button icon-alert report-abuse-action'} | 84 | + assert_no_tag :span, :attributes => {:class => 'community-block-button icon-arrow'} |
110 | end | 85 | end |
111 | - | ||
112 | - should 'not display *configure* button when the user is logged in and is admin of the community' do | ||
113 | - logout | ||
114 | - get :index, :profile => @community.identifier | ||
115 | - assert_no_tag :a, :attributes => {:class => 'button icon-menu-ctrl-panel link-this-page'} | ||
116 | - end | ||
117 | - | 86 | + |
118 | end | 87 | end |
plugins/community_block/views/community_block.rhtml
@@ -3,60 +3,50 @@ | @@ -3,60 +3,50 @@ | ||
3 | <%= link_to profile_image(profile, :big), profile.url %> | 3 | <%= link_to profile_image(profile, :big), profile.url %> |
4 | </div> | 4 | </div> |
5 | <div class="community-block-info"> | 5 | <div class="community-block-info"> |
6 | - <h1 class="community-block-title"><%=profile.name%></h1> | ||
7 | - <div class="community-block-description"><%= profile.description %></div> | ||
8 | - </div> | ||
9 | - <div style="clear:both"></div> | ||
10 | - <div class="community-block-buttons"> | ||
11 | - <% if logged_in? %> | ||
12 | - | ||
13 | - <% if profile.members.include?(user) || profile.already_request_membership?(user) %> | ||
14 | - <%= button_without_text( | ||
15 | - :remove, | ||
16 | - __('Leave community'), | ||
17 | - profile.leave_url, | ||
18 | - :title => _("Leave community"), | ||
19 | - :style => 'position: relative;') %> | ||
20 | - <% else %> | ||
21 | - <%= button_without_text( | ||
22 | - :add, | ||
23 | - __('Join community'), | ||
24 | - profile.join_url, | ||
25 | - :title => _("Join community"), | ||
26 | - :style => 'position: relative;') %> | ||
27 | - <% end %> | ||
28 | - | ||
29 | - <% if profile.enable_contact? %> | ||
30 | - <%= button_without_text( | ||
31 | - :'menu-mail', | ||
32 | - __('Send an e-mail'), | ||
33 | - { :profile => profile.identifier, | ||
34 | - :controller => 'contact', | ||
35 | - :action => 'new' }, | ||
36 | - :title => _('Send an e-mail to the administrators'), | ||
37 | - :stle => 'position: relative;') %> | ||
38 | - <% end %> | ||
39 | - | ||
40 | - <%= report_abuse(profile, :button_without_text) %> | 6 | + <div class="community-block-title"> |
41 | 7 | ||
42 | - <% if !user.nil? && user.has_permission?('edit_profile', profile) %> | 8 | + <% |
9 | + links = [] | ||
43 | 10 | ||
44 | - <%= button_without_text( | ||
45 | - :'menu-ctrl-panel', | ||
46 | - __('Control Panel'), | ||
47 | - profile.admin_url, | ||
48 | - :title => _('Configure this community'), | ||
49 | - :style => 'position: relative;') %> | 11 | + if logged_in? |
50 | 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) %> | ||
51 | <% end %> | 45 | <% end %> |
52 | 46 | ||
53 | - <% else %> | ||
54 | - <%= button_without_text( | ||
55 | - :add, | ||
56 | - __('Join community'), | ||
57 | - profile.join_not_logged_url, | ||
58 | - :title => _("Join community"), | ||
59 | - :style => 'position: relative;') %> | ||
60 | - <% end %> | 47 | + <h1><%=profile.name%></h1> |
48 | + </div> | ||
49 | + <div class="community-block-description"><%= profile.description %></div> | ||
61 | </div> | 50 | </div> |
51 | + <div style="clear:both"></div> | ||
62 | </div> | 52 | </div> |