diff --git a/app/assets/stylesheets/_dashboard.scss b/app/assets/stylesheets/_dashboard.scss index 77caff72d..2944d7ca1 100644 --- a/app/assets/stylesheets/_dashboard.scss +++ b/app/assets/stylesheets/_dashboard.scss @@ -125,4 +125,10 @@ vertical-align: top; } +} + +#admin-listing { + .section { + margin-top: 2em; + } } \ No newline at end of file diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index f9faf75fe..f3287f101 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -5,8 +5,8 @@ class WelcomeController < ApplicationController def index return if current_user.nil? - @pending_projects = Project.pending_projects - @approved_projects = Project.approved_projects + @pending_projects = Project.pending_projects.map { |project| ProjectDashboardPresenter.new(project) } + @approved_projects = Project.approved_projects.map { |project| ProjectDashboardPresenter.new(project) } @eligible_data_user = true if !current_user.eligible_sponsor? && !current_user.eligible_manager? @dashboard_projects = Project.users_projects(@current_user).map { |project| ProjectDashboardPresenter.new(project) } diff --git a/app/views/welcome/_admin_listing.html.erb b/app/views/welcome/_admin_listing.html.erb new file mode 100644 index 000000000..b73bba102 --- /dev/null +++ b/app/views/welcome/_admin_listing.html.erb @@ -0,0 +1,61 @@ +
+ <% if current_user.eligible_sysadmin?%> +
+

Pending Projects

+ <% if !@pending_projects.empty? %> + + <% else %> +

(none)

+ <% end %> +
+
+

Recently Approved Projects

+ <% if !@approved_projects.empty? %> + + <% else %> +

(none)

+ <% end %> +
+ <% unless current_user.superuser? %> + <%= render partial: "recent_activity" %> + <% end %> + <%end%> +
\ No newline at end of file diff --git a/app/views/welcome/_projects_listing.html.erb b/app/views/welcome/_projects_listing.html.erb index dbfb43641..0c195df5e 100644 --- a/app/views/welcome/_projects_listing.html.erb +++ b/app/views/welcome/_projects_listing.html.erb @@ -3,7 +3,7 @@ <% @dashboard_projects.each do |project| %>
-
+
">

<%= project.title %>

    diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index a7b96f37e..33dfbf695 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -22,42 +22,7 @@ <% elsif @dashtab == "activity" %> <%= render partial: "recent_activity" %> <% elsif @dashtab == "admin" %> -
    - <% if current_user.eligible_sysadmin?%> -
    -

    Project Administration

    -

    Pending Projects

    - <% if !@pending_projects.empty? %> -
      - <% @pending_projects.each do |project| %> -
    • - <%= link_to(project.title, project) %> -
    • - <% end %> -
    - <% else %> -

    (none)

    - <% end %> -

    Recently Approved Projects

    - <% if !@approved_projects.empty? %> - - <% @approved_projects.each_with_index do |project, index| %> - <% @row_css = index < 5 ? "visible-row top-section" : "invisible-row bottom-section" %> - - - - <% end %> -
    <%= link_to(project.title, project) %>
    - - <% else %> -

    (none)

    - <% end %> -
    - <% unless current_user.superuser? %> - <%= render partial: "recent_activity" %> - <% end %> - <%end%> -
    + <%= render partial: "admin_listing" %> <% end %> <% end %>
diff --git a/spec/system/project_spec.rb b/spec/system/project_spec.rb index 10c27e193..2496ebd00 100644 --- a/spec/system/project_spec.rb +++ b/spec/system/project_spec.rb @@ -458,7 +458,7 @@ click_on "Return to Dashboard" click_on "Administration" - expect(page).to have_content "Project Administration" + expect(page).to have_content "Pending Projects" end end diff --git a/spec/system/welcome_spec.rb b/spec/system/welcome_spec.rb index f03eab4f2..671474672 100644 --- a/spec/system/welcome_spec.rb +++ b/spec/system/welcome_spec.rb @@ -137,9 +137,11 @@ it "shows the system administrator dashboard" do sign_in current_user visit "/" + visit "/" click_on "Administration" expect(page).to have_content("Pending Projects") expect(page).to have_content("Approved Projects") + expect(page).to have_content("Activity") end end