Commit c51f902b0a8112c43993b9eded72a9d22d67c7db
1 parent
510b32de
Exists in
master
and in
22 other branches
Lots of cosmetic changes and fixing mass-assignment bug
(ActionItem2859)
Showing
16 changed files
with
91 additions
and
81 deletions
Show diff stats
app/models/community.rb
| @@ -85,10 +85,6 @@ class Community < Organization | @@ -85,10 +85,6 @@ class Community < Organization | ||
| 85 | recent_documents(limit, ["articles.type != ? AND articles.highlighted = ?", 'Folder', highlight]) | 85 | recent_documents(limit, ["articles.type != ? AND articles.highlighted = ?", 'Folder', highlight]) |
| 86 | end | 86 | end |
| 87 | 87 | ||
| 88 | - def blocks_to_expire_cache | ||
| 89 | - [] | ||
| 90 | - end | ||
| 91 | - | ||
| 92 | def each_member(offset=0) | 88 | def each_member(offset=0) |
| 93 | while member = self.members.first(:order => :id, :offset => offset) | 89 | while member = self.members.first(:order => :id, :offset => offset) |
| 94 | yield member | 90 | yield member |
app/views/blocks/members.html.erb
plugins/people_block/lib/friends_block.rb
| @@ -17,9 +17,9 @@ class FriendsBlock < PeopleBlockBase | @@ -17,9 +17,9 @@ class FriendsBlock < PeopleBlockBase | ||
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | def footer | 19 | def footer |
| 20 | - owner = self.owner | 20 | + profile = self.owner |
| 21 | proc do | 21 | proc do |
| 22 | - link_to _('View all'), :profile => owner.identifier, :controller => 'profile', :action => 'friends' | 22 | + render :file => 'blocks/friends', :locals => { :profile => profile } |
| 23 | end | 23 | end |
| 24 | end | 24 | end |
| 25 | 25 | ||
| @@ -28,4 +28,3 @@ class FriendsBlock < PeopleBlockBase | @@ -28,4 +28,3 @@ class FriendsBlock < PeopleBlockBase | ||
| 28 | end | 28 | end |
| 29 | 29 | ||
| 30 | end | 30 | end |
| 31 | - |
plugins/people_block/lib/members_block.rb
| 1 | class MembersBlock < PeopleBlockBase | 1 | class MembersBlock < PeopleBlockBase |
| 2 | - | 2 | + settings_items :show_join_leave_button, :type => :boolean, :default => false |
| 3 | settings_items :visible_role, :type => :string, :default => nil | 3 | settings_items :visible_role, :type => :string, :default => nil |
| 4 | + attr_accessible :show_join_leave_button, :visible_role | ||
| 4 | 5 | ||
| 5 | def self.description | 6 | def self.description |
| 6 | _('Members') | 7 | _('Members') |
| @@ -20,10 +21,11 @@ class MembersBlock < PeopleBlockBase | @@ -20,10 +21,11 @@ class MembersBlock < PeopleBlockBase | ||
| 20 | end | 21 | end |
| 21 | 22 | ||
| 22 | def footer | 23 | def footer |
| 23 | - owner = self.owner | 24 | + profile = self.owner |
| 24 | role_key = visible_role | 25 | role_key = visible_role |
| 26 | + s = show_join_leave_button | ||
| 25 | proc do | 27 | proc do |
| 26 | - link_to _('View all'), :profile => owner.identifier, :controller => 'people_block_plugin_profile', :action => 'members', :role_key => role_key | 28 | + render :file => 'blocks/members', :locals => { :profile => profile, :show_join_leave_button => s, :role_key => role_key} |
| 27 | end | 29 | end |
| 28 | end | 30 | end |
| 29 | 31 | ||
| @@ -35,5 +37,14 @@ class MembersBlock < PeopleBlockBase | @@ -35,5 +37,14 @@ class MembersBlock < PeopleBlockBase | ||
| 35 | Profile::Roles.organization_member_roles(owner.environment) | 37 | Profile::Roles.organization_member_roles(owner.environment) |
| 36 | end | 38 | end |
| 37 | 39 | ||
| 38 | -end | 40 | + def extra_option |
| 41 | + data = { | ||
| 42 | + :human_name => _("Show join leave button"), | ||
| 43 | + :name => 'block[show_join_leave_button]', | ||
| 44 | + :value => true, | ||
| 45 | + :checked => show_join_leave_button, | ||
| 46 | + :options => {} | ||
| 47 | + } | ||
| 48 | + end | ||
| 39 | 49 | ||
| 50 | +end |
plugins/people_block/lib/people_block.rb
| @@ -17,8 +17,8 @@ class PeopleBlock < PeopleBlockBase | @@ -17,8 +17,8 @@ class PeopleBlock < PeopleBlockBase | ||
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | def footer | 19 | def footer |
| 20 | - lambda do |context| | ||
| 21 | - link_to _('View all'), :controller => 'search', :action => 'people' | 20 | + proc do |
| 21 | + render :file => 'blocks/people' | ||
| 22 | end | 22 | end |
| 23 | end | 23 | end |
| 24 | 24 |
plugins/people_block/lib/people_block_base.rb
| 1 | class PeopleBlockBase < Block | 1 | class PeopleBlockBase < Block |
| 2 | - | ||
| 3 | - settings_items :prioritize_people_with_image, :type => :boolean, :default => true | 2 | + settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true |
| 4 | settings_items :limit, :type => :integer, :default => 6 | 3 | settings_items :limit, :type => :integer, :default => 6 |
| 5 | settings_items :name, :type => String, :default => "" | 4 | settings_items :name, :type => String, :default => "" |
| 6 | settings_items :address, :type => String, :default => "" | 5 | settings_items :address, :type => String, :default => "" |
| 6 | + attr_accessible :name, :address, :prioritize_profiles_with_image | ||
| 7 | 7 | ||
| 8 | def self.description | 8 | def self.description |
| 9 | _('Random people') | 9 | _('Random people') |
| @@ -28,7 +28,7 @@ class PeopleBlockBase < Block | @@ -28,7 +28,7 @@ class PeopleBlockBase < Block | ||
| 28 | def profile_list | 28 | def profile_list |
| 29 | result = nil | 29 | result = nil |
| 30 | visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment]) | 30 | visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment]) |
| 31 | - if !prioritize_people_with_image | 31 | + if !prioritize_profiles_with_image |
| 32 | result = visible_profiles.all(:limit => limit, :order => 'updated_at DESC').sort_by{ rand } | 32 | result = visible_profiles.all(:limit => limit, :order => 'updated_at DESC').sort_by{ rand } |
| 33 | elsif visible_profiles.with_image.count >= limit | 33 | elsif visible_profiles.with_image.count >= limit |
| 34 | result = visible_profiles.with_image.all(:limit => limit * 5, :order => 'updated_at DESC').sort_by{ rand } | 34 | result = visible_profiles.with_image.all(:limit => limit * 5, :order => 'updated_at DESC').sort_by{ rand } |
| @@ -43,7 +43,6 @@ class PeopleBlockBase < Block | @@ -43,7 +43,6 @@ class PeopleBlockBase < Block | ||
| 43 | end | 43 | end |
| 44 | 44 | ||
| 45 | def content(args={}) | 45 | def content(args={}) |
| 46 | - | ||
| 47 | profiles = self.profile_list | 46 | profiles = self.profile_list |
| 48 | title = self.view_title | 47 | title = self.view_title |
| 49 | 48 | ||
| @@ -94,5 +93,8 @@ class PeopleBlockBase < Block | @@ -94,5 +93,8 @@ class PeopleBlockBase < Block | ||
| 94 | end | 93 | end |
| 95 | end | 94 | end |
| 96 | 95 | ||
| 97 | -end | 96 | + def extra_option |
| 97 | + { } | ||
| 98 | + end | ||
| 98 | 99 | ||
| 100 | +end |
plugins/people_block/public/style.css
| @@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
| 9 | color: #000; | 9 | color: #000; |
| 10 | text-decoration: none; | 10 | text-decoration: none; |
| 11 | padding-right: 15px; | 11 | padding-right: 15px; |
| 12 | - background: url(/designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; | ||
| 13 | } | 12 | } |
| 14 | 13 | ||
| 15 | .people-block .banner-span { | 14 | .people-block .banner-span { |
| @@ -57,3 +56,49 @@ | @@ -57,3 +56,49 @@ | ||
| 57 | margin: 0px 0px 0px -3px; | 56 | margin: 0px 0px 0px -3px; |
| 58 | padding: 0px; | 57 | padding: 0px; |
| 59 | } | 58 | } |
| 59 | + | ||
| 60 | +/******************************************************************* | ||
| 61 | + * BLOCKs * | ||
| 62 | + *******************************************************************/ | ||
| 63 | +#content .friends-block ul, | ||
| 64 | +#content .members-block ul { | ||
| 65 | + min-width: 196px; | ||
| 66 | + width: 192px; | ||
| 67 | + margin: 0px 0px 0px -3px; | ||
| 68 | + padding: 0px; | ||
| 69 | +} | ||
| 70 | +#content .box-1 .people-block ul, | ||
| 71 | +#content .box-1 .friends-block ul, | ||
| 72 | +#content .box-1 .members-block ul { | ||
| 73 | + width: auto; | ||
| 74 | + display: block; | ||
| 75 | +} | ||
| 76 | +#content .people-block .block-footer-content a, | ||
| 77 | +#content .friends-block .block-footer-content a, | ||
| 78 | +#content .members-block .block-footer-content a { | ||
| 79 | + position: absolute; | ||
| 80 | + top: 2px; | ||
| 81 | + right: 0px; | ||
| 82 | + font-size: 11px; | ||
| 83 | + color: #000; | ||
| 84 | + text-decoration: none; | ||
| 85 | + padding-right: 15px; | ||
| 86 | +} | ||
| 87 | +#content .members-block .block-footer-content .join-leave-button a { | ||
| 88 | + position: relative; | ||
| 89 | + background-color: #EEE; | ||
| 90 | + border: 1px solid #CCC; | ||
| 91 | + color: #555; | ||
| 92 | + padding-right: inherit; | ||
| 93 | +} | ||
| 94 | +#content .members-block .block-footer-content .join-leave-button a:hover { | ||
| 95 | + color: #FFF; | ||
| 96 | + background-color: #555; | ||
| 97 | + border: 1px solid #2e3436; | ||
| 98 | + text-decoration: none; | ||
| 99 | +} | ||
| 100 | +#content .people-block .block-footer-content a.view-all, | ||
| 101 | +#content .friends-block .block-footer-content a.view-all, | ||
| 102 | +#content .members-block .block-footer-content a.view-all { | ||
| 103 | + background: url(/designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; | ||
| 104 | +} |
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +<%= link_to s_('friends|View all'), {:profile => profile.identifier, :controller => 'profile', :action => 'friends'}, :class => 'view-all' %> |
| @@ -0,0 +1,5 @@ | @@ -0,0 +1,5 @@ | ||
| 1 | +<%= link_to _('View all'), {:profile => profile.identifier, :controller => 'people_block_plugin_profile', :action => 'members', :role_key => role_key}, :class => 'view-all' %> | ||
| 2 | + | ||
| 3 | +<% if show_join_leave_button %> | ||
| 4 | + <%= render :partial => 'blocks/profile_info_actions/join_leave_community' %> | ||
| 5 | +<% end %> |
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +<%= link_to _('View all'), {:controller => 'search', :action => 'people'}, :class => 'view-all' %> |
plugins/people_block/views/box_organizer/_friends_block.rhtml
plugins/people_block/views/box_organizer/_members_block.rhtml
plugins/people_block/views/box_organizer/_people_block.rhtml
plugins/people_block/views/box_organizer/_people_block_base.html.erb
0 → 100644
| @@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
| 1 | +<%= labelled_form_field _('Name:'), text_field(:block, :name) %> | ||
| 2 | + | ||
| 3 | +<%= labelled_form_field _('Address:'), text_field(:block, :address) %> | ||
| 4 | + | ||
| 5 | +<% if @block.kind_of?(MembersBlock) %> | ||
| 6 | + <%= labelled_form_field _('Filter by role:'), '' %> | ||
| 7 | + <%= select_tag 'block[visible_role]', options_for_select(@block.roles.map{|r| [r.name, r.key]}.insert(0,''), @block.visible_role) %> | ||
| 8 | +<% end %> | ||
| 9 | + | ||
| 10 | +<%= render :partial => 'profile_list_block' %> |
plugins/people_block/views/people_block_plugin.rhtml
| @@ -1,26 +0,0 @@ | @@ -1,26 +0,0 @@ | ||
| 1 | -<div id="people_block_plugin"> | ||
| 2 | - | ||
| 3 | - <p> | ||
| 4 | - <span>Limit</span> | ||
| 5 | - <br /> | ||
| 6 | - <%= text_field_tag 'block[limit]', @block.limit, :maxlength => 2 %> | ||
| 7 | - </p> | ||
| 8 | - | ||
| 9 | - <p> | ||
| 10 | - <span>Name</span> | ||
| 11 | - <br /> | ||
| 12 | - <%= text_field_tag 'block[name]', @block.name %> | ||
| 13 | - </p> | ||
| 14 | - | ||
| 15 | - <p> | ||
| 16 | - <span>Address</span> | ||
| 17 | - <br /> | ||
| 18 | - <%= text_field_tag 'block[address]', @block.address %> | ||
| 19 | - </p> | ||
| 20 | - | ||
| 21 | - <% if @block.kind_of?(MembersBlock) %> | ||
| 22 | - <%= labelled_form_field _('Filter by role:'), '' %> | ||
| 23 | - <%= select_tag 'block[visible_role]', options_for_select(@block.roles.map{|r| [r.name, r.key]}.insert(0,''), @block.visible_role) %> | ||
| 24 | - <% end %> | ||
| 25 | - | ||
| 26 | -</div> |
public/designs/themes/base/style.css
| @@ -478,12 +478,9 @@ div#notice { | @@ -478,12 +478,9 @@ div#notice { | ||
| 478 | 478 | ||
| 479 | /************************** Profile List *****************************/ | 479 | /************************** Profile List *****************************/ |
| 480 | 480 | ||
| 481 | -#content .people-block ul, | ||
| 482 | #content .profile-list-block ul, | 481 | #content .profile-list-block ul, |
| 483 | #content .enterprises-block ul, | 482 | #content .enterprises-block ul, |
| 484 | -#content .members-block ul, | ||
| 485 | #content .communities-block ul, | 483 | #content .communities-block ul, |
| 486 | -#content .friends-block ul, | ||
| 487 | #content .fans-block ul { | 484 | #content .fans-block ul { |
| 488 | min-width: 196px; | 485 | min-width: 196px; |
| 489 | width: 192px; | 486 | width: 192px; |
| @@ -491,24 +488,18 @@ div#notice { | @@ -491,24 +488,18 @@ div#notice { | ||
| 491 | padding: 0px; | 488 | padding: 0px; |
| 492 | } | 489 | } |
| 493 | 490 | ||
| 494 | -#content .box-1 .people-block ul, | ||
| 495 | #content .box-1 .profile-list-block ul, | 491 | #content .box-1 .profile-list-block ul, |
| 496 | #content .box-1 .enterprises-block ul, | 492 | #content .box-1 .enterprises-block ul, |
| 497 | -#content .box-1 .members-block ul, | ||
| 498 | #content .box-1 .communities-block ul, | 493 | #content .box-1 .communities-block ul, |
| 499 | -#content .box-1 .friends-block ul, | ||
| 500 | #content .box-1 .fans-block ul { | 494 | #content .box-1 .fans-block ul { |
| 501 | width: auto; | 495 | width: auto; |
| 502 | display: block; | 496 | display: block; |
| 503 | } | 497 | } |
| 504 | 498 | ||
| 505 | #content .tags-block .block-footer-content a, | 499 | #content .tags-block .block-footer-content a, |
| 506 | -#content .people-block .block-footer-content a, | ||
| 507 | #content .profile-list-block .block-footer-content a, | 500 | #content .profile-list-block .block-footer-content a, |
| 508 | #content .enterprises-block .block-footer-content a, | 501 | #content .enterprises-block .block-footer-content a, |
| 509 | -#content .members-block .block-footer-content a, | ||
| 510 | -#content .communities-block .block-footer-content a, | ||
| 511 | -#content .friends-block .block-footer-content a { | 502 | +#content .communities-block .block-footer-content a { |
| 512 | position: absolute; | 503 | position: absolute; |
| 513 | top: 2px; | 504 | top: 2px; |
| 514 | right: 0px; | 505 | right: 0px; |
| @@ -518,29 +509,12 @@ div#notice { | @@ -518,29 +509,12 @@ div#notice { | ||
| 518 | padding-right: 15px; | 509 | padding-right: 15px; |
| 519 | } | 510 | } |
| 520 | #content .tags-block .block-footer-content a, | 511 | #content .tags-block .block-footer-content a, |
| 521 | -#content .people-block .block-footer-content a, | ||
| 522 | #content .profile-list-block .block-footer-content a, | 512 | #content .profile-list-block .block-footer-content a, |
| 523 | #content .enterprises-block .block-footer-content a, | 513 | #content .enterprises-block .block-footer-content a, |
| 524 | -#content .communities-block .block-footer-content a, | ||
| 525 | -#content .friends-block .block-footer-content a { | 514 | +#content .communities-block .block-footer-content a { |
| 526 | background: url(imgs/arrow-right-p.png) 100% 50% no-repeat; | 515 | background: url(imgs/arrow-right-p.png) 100% 50% no-repeat; |
| 527 | } | 516 | } |
| 528 | 517 | ||
| 529 | -#content .members-block .block-footer-content .join-leave-button a { | ||
| 530 | - position: relative; | ||
| 531 | - background-color: #EEE; | ||
| 532 | - border: 1px solid #CCC; | ||
| 533 | - color: #555; | ||
| 534 | - padding-right: inherit; | ||
| 535 | -} | ||
| 536 | - | ||
| 537 | -#content .members-block .block-footer-content .join-leave-button a:hover { | ||
| 538 | - color: #FFF; | ||
| 539 | - background-color: #555; | ||
| 540 | - border: 1px solid #2e3436; | ||
| 541 | - text-decoration: none; | ||
| 542 | -} | ||
| 543 | - | ||
| 544 | #content .profile-list-block .block-title { | 518 | #content .profile-list-block .block-title { |
| 545 | text-align: left; | 519 | text-align: left; |
| 546 | } | 520 | } |