Commit 878fa51be6769ac2e2c2b7491df3775c6b72b84b

Authored by Tallys Martins
1 parent 343a24b4
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Add page Members header

Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
lib/ext/profile_controller.rb
... ... @@ -20,4 +20,21 @@ class ProfileController
20 20 @communities = type.paginate(:per_page => per_page, :page => params[:npage], :total_entries => type.count)
21 21 end
22 22 end
  23 +
  24 + def members
  25 + if is_cache_expired?(profile.members_cache_key(params))
  26 + all_members = if params[:sort] and params[:sort] == "desc"
  27 + profile.members.order("name desc")
  28 + else
  29 + profile.members.order("name asc")
  30 + end
  31 + @profile_admins = profile.admins
  32 + @profile_members = all_members - @profile_admins
  33 + @profile_members = @profile_members.paginate(:per_page => members_per_page, :page => params[:npage], :total_entries => @profile_members.size)
  34 + @profile_admins = @profile_admins.paginate(:per_page => members_per_page, :page => params[:npage], :total_entries => @profile_admins.size)
  35 + @total_members = all_members.size
  36 + @profile_members_url = url_for(:controller => "profile", :action => "members")
  37 + end
  38 + end
  39 +
23 40 end
... ...
views/profile/_profile_members_list.html.erb 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 + <div id="profile-members-sort-options">
  2 + <%= label_tag("sort-#{role}", _("Sort by:")) %>
  3 + <%= select_tag("sort-#{role}",
  4 + options_for_select([
  5 + [_("Name A-Z"), 'asc'],
  6 + [_("Name Z-A"), 'desc'],
  7 + ], :selected=>params[:sort])
  8 + ) %>
  9 + </div>
  10 + <ul class="profile-list-<%= role %>" >
  11 + <% users.each do |u| %>
  12 + <%= profile_image_link(u) %>
  13 + <% end %>
  14 +</ul>
... ...
views/profile/members.html.erb 0 → 100644
... ... @@ -0,0 +1,72 @@
  1 +
  2 +<div class="page-members-header">
  3 + <h1><%= _("Members") + " (#{@total_members})" %></h1>
  4 + <h3 class="community-name-members"><%= _("%s") % profile.name %></h3>
  5 + <%= render "blocks/profile_info_actions/community" %>
  6 +</div>
  7 +
  8 +<% cache_timeout(profile.members_cache_key(params), 4.hours) do %>
  9 +<div class="profile-members-tabs-container">
  10 + <% tabs = [] %>
  11 +
  12 + <% div_members = content_tag :div, :class => "profile-members" do
  13 + render :partial => 'profile_members_list',
  14 + :locals => {
  15 + :users => @profile_members,
  16 + :role => "members"
  17 + }
  18 +
  19 + end %>
  20 +
  21 + <% members_pagination = content_tag :div, :class => "pagination-profile-members" do
  22 + pagination_links @profile_members, :param_name => 'npage'
  23 + end %>
  24 +
  25 +
  26 + <% tabs << {:title => "#{@profile_members.size} "+_("Members"),
  27 + :id => "members-tab",
  28 + :content => (div_members + members_pagination)
  29 + } %>
  30 +
  31 + <% div_admins = content_tag :div, :class => "profile-admins" do
  32 + render :partial => 'profile_members_list',
  33 + :locals => {
  34 + :users => @profile_admins,
  35 + :role => "admins"
  36 + }
  37 + end %>
  38 +
  39 + <% admins_pagination = content_tag :div, :class => "pagination-profile-admins" do
  40 + pagination_links @profile_admins, :param_name => 'npage'
  41 + end %>
  42 +
  43 + <% tabs << {:title => "#{@profile_admins.size} "+_("Administrators"),
  44 + :id => "admins-tab",
  45 + :content => (div_admins+admins_pagination)
  46 + } %>
  47 +
  48 +
  49 +
  50 +
  51 + <%= render_tabs(tabs) %>
  52 + <% end %>
  53 +</div>
  54 +
  55 +
  56 +<% button_bar do %>
  57 + <%= button :back, _('Go back'), { :controller => 'profile' } %>
  58 + <% if profile.community? and user %>
  59 + <% if user.has_permission?(:invite_members, profile) %>
  60 + <%= button :person, _('Invite people to join'), :controller => 'invite', :action => 'invite_friends' %>
  61 + <% end %>
  62 + <% if user.has_permission?(:send_mail_to_members, profile) %>
  63 + <%= button :send, _('Send e-mail to members'), :controller => 'profile', :action => 'send_mail' %>
  64 + <% end %>
  65 + <% end %>
  66 +<% end %>
  67 +
  68 +<%= hidden_field_tag "profile_url", @profile_members_url %>
  69 +<%= hidden_field_tag "sort", "asc" %>
  70 +</div><!-- fim class="common-profile-list-block" -->
  71 +
  72 +<%= javascript_include_tag "members_page.js" %>
... ...