From c51f902b0a8112c43993b9eded72a9d22d67c7db Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Thu, 5 Jun 2014 23:46:22 -0300 Subject: [PATCH] Lots of cosmetic changes and fixing mass-assignment bug --- app/models/community.rb | 4 ---- app/views/blocks/members.html.erb | 5 ----- plugins/people_block/lib/friends_block.rb | 5 ++--- plugins/people_block/lib/members_block.rb | 19 +++++++++++++++---- plugins/people_block/lib/people_block.rb | 4 ++-- plugins/people_block/lib/people_block_base.rb | 12 +++++++----- plugins/people_block/public/style.css | 47 ++++++++++++++++++++++++++++++++++++++++++++++- plugins/people_block/views/blocks/friends.html.erb | 1 + plugins/people_block/views/blocks/members.html.erb | 5 +++++ plugins/people_block/views/blocks/people.html.erb | 1 + plugins/people_block/views/box_organizer/_friends_block.rhtml | 1 - plugins/people_block/views/box_organizer/_members_block.rhtml | 1 - plugins/people_block/views/box_organizer/_people_block.rhtml | 1 - plugins/people_block/views/box_organizer/_people_block_base.html.erb | 10 ++++++++++ plugins/people_block/views/people_block_plugin.rhtml | 26 -------------------------- public/designs/themes/base/style.css | 30 ++---------------------------- 16 files changed, 91 insertions(+), 81 deletions(-) delete mode 100644 app/views/blocks/members.html.erb create mode 100644 plugins/people_block/views/blocks/friends.html.erb create mode 100644 plugins/people_block/views/blocks/members.html.erb create mode 100644 plugins/people_block/views/blocks/people.html.erb delete mode 120000 plugins/people_block/views/box_organizer/_friends_block.rhtml delete mode 120000 plugins/people_block/views/box_organizer/_members_block.rhtml delete mode 120000 plugins/people_block/views/box_organizer/_people_block.rhtml create mode 100644 plugins/people_block/views/box_organizer/_people_block_base.html.erb delete mode 100644 plugins/people_block/views/people_block_plugin.rhtml diff --git a/app/models/community.rb b/app/models/community.rb index 21151f3..0e198b9 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -85,10 +85,6 @@ class Community < Organization recent_documents(limit, ["articles.type != ? AND articles.highlighted = ?", 'Folder', highlight]) end - def blocks_to_expire_cache - [] - end - def each_member(offset=0) while member = self.members.first(:order => :id, :offset => offset) yield member diff --git a/app/views/blocks/members.html.erb b/app/views/blocks/members.html.erb deleted file mode 100644 index 4bd47e1..0000000 --- a/app/views/blocks/members.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%= link_to _('View all'), :profile => profile.identifier, :controller => 'profile', :action => 'members' %> - -<% if show_join_leave_button %> - <%= render :partial => 'blocks/profile_info_actions/join_leave_community' %> -<% end %> diff --git a/plugins/people_block/lib/friends_block.rb b/plugins/people_block/lib/friends_block.rb index f949875..e810a78 100644 --- a/plugins/people_block/lib/friends_block.rb +++ b/plugins/people_block/lib/friends_block.rb @@ -17,9 +17,9 @@ class FriendsBlock < PeopleBlockBase end def footer - owner = self.owner + profile = self.owner proc do - link_to _('View all'), :profile => owner.identifier, :controller => 'profile', :action => 'friends' + render :file => 'blocks/friends', :locals => { :profile => profile } end end @@ -28,4 +28,3 @@ class FriendsBlock < PeopleBlockBase end end - diff --git a/plugins/people_block/lib/members_block.rb b/plugins/people_block/lib/members_block.rb index 30252b5..61693a1 100644 --- a/plugins/people_block/lib/members_block.rb +++ b/plugins/people_block/lib/members_block.rb @@ -1,6 +1,7 @@ class MembersBlock < PeopleBlockBase - + settings_items :show_join_leave_button, :type => :boolean, :default => false settings_items :visible_role, :type => :string, :default => nil + attr_accessible :show_join_leave_button, :visible_role def self.description _('Members') @@ -20,10 +21,11 @@ class MembersBlock < PeopleBlockBase end def footer - owner = self.owner + profile = self.owner role_key = visible_role + s = show_join_leave_button proc do - link_to _('View all'), :profile => owner.identifier, :controller => 'people_block_plugin_profile', :action => 'members', :role_key => role_key + render :file => 'blocks/members', :locals => { :profile => profile, :show_join_leave_button => s, :role_key => role_key} end end @@ -35,5 +37,14 @@ class MembersBlock < PeopleBlockBase Profile::Roles.organization_member_roles(owner.environment) end -end + def extra_option + data = { + :human_name => _("Show join leave button"), + :name => 'block[show_join_leave_button]', + :value => true, + :checked => show_join_leave_button, + :options => {} + } + end +end diff --git a/plugins/people_block/lib/people_block.rb b/plugins/people_block/lib/people_block.rb index c23fb66..6b3fe90 100644 --- a/plugins/people_block/lib/people_block.rb +++ b/plugins/people_block/lib/people_block.rb @@ -17,8 +17,8 @@ class PeopleBlock < PeopleBlockBase end def footer - lambda do |context| - link_to _('View all'), :controller => 'search', :action => 'people' + proc do + render :file => 'blocks/people' end end diff --git a/plugins/people_block/lib/people_block_base.rb b/plugins/people_block/lib/people_block_base.rb index c42e8f3..114ae8a 100644 --- a/plugins/people_block/lib/people_block_base.rb +++ b/plugins/people_block/lib/people_block_base.rb @@ -1,9 +1,9 @@ class PeopleBlockBase < Block - - settings_items :prioritize_people_with_image, :type => :boolean, :default => true + settings_items :prioritize_profiles_with_image, :type => :boolean, :default => true settings_items :limit, :type => :integer, :default => 6 settings_items :name, :type => String, :default => "" settings_items :address, :type => String, :default => "" + attr_accessible :name, :address, :prioritize_profiles_with_image def self.description _('Random people') @@ -28,7 +28,7 @@ class PeopleBlockBase < Block def profile_list result = nil visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment]) - if !prioritize_people_with_image + if !prioritize_profiles_with_image result = visible_profiles.all(:limit => limit, :order => 'updated_at DESC').sort_by{ rand } elsif visible_profiles.with_image.count >= limit result = visible_profiles.with_image.all(:limit => limit * 5, :order => 'updated_at DESC').sort_by{ rand } @@ -43,7 +43,6 @@ class PeopleBlockBase < Block end def content(args={}) - profiles = self.profile_list title = self.view_title @@ -94,5 +93,8 @@ class PeopleBlockBase < Block end end -end + def extra_option + { } + end +end diff --git a/plugins/people_block/public/style.css b/plugins/people_block/public/style.css index 88ecedd..1c00554 100644 --- a/plugins/people_block/public/style.css +++ b/plugins/people_block/public/style.css @@ -9,7 +9,6 @@ color: #000; text-decoration: none; padding-right: 15px; - background: url(/designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; } .people-block .banner-span { @@ -57,3 +56,49 @@ margin: 0px 0px 0px -3px; padding: 0px; } + +/******************************************************************* + * BLOCKs * + *******************************************************************/ +#content .friends-block ul, +#content .members-block ul { + min-width: 196px; + width: 192px; + margin: 0px 0px 0px -3px; + padding: 0px; +} +#content .box-1 .people-block ul, +#content .box-1 .friends-block ul, +#content .box-1 .members-block ul { + width: auto; + display: block; +} +#content .people-block .block-footer-content a, +#content .friends-block .block-footer-content a, +#content .members-block .block-footer-content a { + position: absolute; + top: 2px; + right: 0px; + font-size: 11px; + color: #000; + text-decoration: none; + padding-right: 15px; +} +#content .members-block .block-footer-content .join-leave-button a { + position: relative; + background-color: #EEE; + border: 1px solid #CCC; + color: #555; + padding-right: inherit; +} +#content .members-block .block-footer-content .join-leave-button a:hover { + color: #FFF; + background-color: #555; + border: 1px solid #2e3436; + text-decoration: none; +} +#content .people-block .block-footer-content a.view-all, +#content .friends-block .block-footer-content a.view-all, +#content .members-block .block-footer-content a.view-all { + background: url(/designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; +} diff --git a/plugins/people_block/views/blocks/friends.html.erb b/plugins/people_block/views/blocks/friends.html.erb new file mode 100644 index 0000000..04410ae --- /dev/null +++ b/plugins/people_block/views/blocks/friends.html.erb @@ -0,0 +1 @@ +<%= link_to s_('friends|View all'), {:profile => profile.identifier, :controller => 'profile', :action => 'friends'}, :class => 'view-all' %> diff --git a/plugins/people_block/views/blocks/members.html.erb b/plugins/people_block/views/blocks/members.html.erb new file mode 100644 index 0000000..f1c1202 --- /dev/null +++ b/plugins/people_block/views/blocks/members.html.erb @@ -0,0 +1,5 @@ +<%= link_to _('View all'), {:profile => profile.identifier, :controller => 'people_block_plugin_profile', :action => 'members', :role_key => role_key}, :class => 'view-all' %> + +<% if show_join_leave_button %> + <%= render :partial => 'blocks/profile_info_actions/join_leave_community' %> +<% end %> diff --git a/plugins/people_block/views/blocks/people.html.erb b/plugins/people_block/views/blocks/people.html.erb new file mode 100644 index 0000000..843a87f --- /dev/null +++ b/plugins/people_block/views/blocks/people.html.erb @@ -0,0 +1 @@ +<%= link_to _('View all'), {:controller => 'search', :action => 'people'}, :class => 'view-all' %> diff --git a/plugins/people_block/views/box_organizer/_friends_block.rhtml b/plugins/people_block/views/box_organizer/_friends_block.rhtml deleted file mode 120000 index cd647df..0000000 --- a/plugins/people_block/views/box_organizer/_friends_block.rhtml +++ /dev/null @@ -1 +0,0 @@ -../people_block_plugin.rhtml \ No newline at end of file diff --git a/plugins/people_block/views/box_organizer/_members_block.rhtml b/plugins/people_block/views/box_organizer/_members_block.rhtml deleted file mode 120000 index cd647df..0000000 --- a/plugins/people_block/views/box_organizer/_members_block.rhtml +++ /dev/null @@ -1 +0,0 @@ -../people_block_plugin.rhtml \ No newline at end of file diff --git a/plugins/people_block/views/box_organizer/_people_block.rhtml b/plugins/people_block/views/box_organizer/_people_block.rhtml deleted file mode 120000 index cd647df..0000000 --- a/plugins/people_block/views/box_organizer/_people_block.rhtml +++ /dev/null @@ -1 +0,0 @@ -../people_block_plugin.rhtml \ No newline at end of file diff --git a/plugins/people_block/views/box_organizer/_people_block_base.html.erb b/plugins/people_block/views/box_organizer/_people_block_base.html.erb new file mode 100644 index 0000000..0ec382e --- /dev/null +++ b/plugins/people_block/views/box_organizer/_people_block_base.html.erb @@ -0,0 +1,10 @@ +<%= labelled_form_field _('Name:'), text_field(:block, :name) %> + +<%= labelled_form_field _('Address:'), text_field(:block, :address) %> + +<% if @block.kind_of?(MembersBlock) %> + <%= labelled_form_field _('Filter by role:'), '' %> + <%= select_tag 'block[visible_role]', options_for_select(@block.roles.map{|r| [r.name, r.key]}.insert(0,''), @block.visible_role) %> +<% end %> + +<%= render :partial => 'profile_list_block' %> diff --git a/plugins/people_block/views/people_block_plugin.rhtml b/plugins/people_block/views/people_block_plugin.rhtml deleted file mode 100644 index c0e3c9f..0000000 --- a/plugins/people_block/views/people_block_plugin.rhtml +++ /dev/null @@ -1,26 +0,0 @@ -
- -

- Limit -
- <%= text_field_tag 'block[limit]', @block.limit, :maxlength => 2 %> -

- -

- Name -
- <%= text_field_tag 'block[name]', @block.name %> -

- -

- Address -
- <%= text_field_tag 'block[address]', @block.address %> -

- - <% if @block.kind_of?(MembersBlock) %> - <%= labelled_form_field _('Filter by role:'), '' %> - <%= select_tag 'block[visible_role]', options_for_select(@block.roles.map{|r| [r.name, r.key]}.insert(0,''), @block.visible_role) %> - <% end %> - -
diff --git a/public/designs/themes/base/style.css b/public/designs/themes/base/style.css index 6f868a9..38019d3 100644 --- a/public/designs/themes/base/style.css +++ b/public/designs/themes/base/style.css @@ -478,12 +478,9 @@ div#notice { /************************** Profile List *****************************/ -#content .people-block ul, #content .profile-list-block ul, #content .enterprises-block ul, -#content .members-block ul, #content .communities-block ul, -#content .friends-block ul, #content .fans-block ul { min-width: 196px; width: 192px; @@ -491,24 +488,18 @@ div#notice { padding: 0px; } -#content .box-1 .people-block ul, #content .box-1 .profile-list-block ul, #content .box-1 .enterprises-block ul, -#content .box-1 .members-block ul, #content .box-1 .communities-block ul, -#content .box-1 .friends-block ul, #content .box-1 .fans-block ul { width: auto; display: block; } #content .tags-block .block-footer-content a, -#content .people-block .block-footer-content a, #content .profile-list-block .block-footer-content a, #content .enterprises-block .block-footer-content a, -#content .members-block .block-footer-content a, -#content .communities-block .block-footer-content a, -#content .friends-block .block-footer-content a { +#content .communities-block .block-footer-content a { position: absolute; top: 2px; right: 0px; @@ -518,29 +509,12 @@ div#notice { padding-right: 15px; } #content .tags-block .block-footer-content a, -#content .people-block .block-footer-content a, #content .profile-list-block .block-footer-content a, #content .enterprises-block .block-footer-content a, -#content .communities-block .block-footer-content a, -#content .friends-block .block-footer-content a { +#content .communities-block .block-footer-content a { background: url(imgs/arrow-right-p.png) 100% 50% no-repeat; } -#content .members-block .block-footer-content .join-leave-button a { - position: relative; - background-color: #EEE; - border: 1px solid #CCC; - color: #555; - padding-right: inherit; -} - -#content .members-block .block-footer-content .join-leave-button a:hover { - color: #FFF; - background-color: #555; - border: 1px solid #2e3436; - text-decoration: none; -} - #content .profile-list-block .block-title { text-align: left; } -- libgit2 0.21.2