Commit 610763c4f6a22b9db9bcf044a0fa990a50ded422

Authored by Rafael Reggiani Manzo
1 parent a9dd14ea
Exists in colab and in 2 other branches master, stable

Add latest Repositories and Configurations to home

The acceptance test has been refactored accordingly and got more
extended to untested features.
CHANGELOG.rdoc
@@ -7,6 +7,8 @@ Prezento is the web interface for Mezuro. @@ -7,6 +7,8 @@ Prezento is the web interface for Mezuro.
7 * Remove Show button for hotspot metric configurations 7 * Remove Show button for hotspot metric configurations
8 * Remove side menu 8 * Remove side menu
9 * Refactor footer as a grid 9 * Refactor footer as a grid
  10 +* Add latest repositories list to the homepage
  11 +* Add latest configurations list to the homepage
10 12
11 == v0.11.3 - 01/04/2016 13 == v0.11.3 - 01/04/2016
12 14
app/controllers/home_controller.rb
1 class HomeController < ApplicationController 1 class HomeController < ApplicationController
2 def index 2 def index
3 @latest_projects = Project.latest(5) 3 @latest_projects = Project.latest(5)
  4 + @latest_repositories = Repository.latest(5)
  5 + @latest_configurations = KalibroConfiguration.latest(5)
4 end 6 end
5 end 7 end
app/views/home/index.html.erb
@@ -20,10 +20,26 @@ @@ -20,10 +20,26 @@
20 </ul> 20 </ul>
21 </div> 21 </div>
22 <div class="col-md-4"> 22 <div class="col-md-4">
23 - <h2><%= t('latest_projects') %></h2> 23 + <h2><%= t('latest_repositories') %></h2>
  24 +
  25 + <ul>
  26 + <% cache do %>
  27 + <% @latest_repositories.each do |repository| %>
  28 + <li><%= link_to(repository.name, repository_path(repository.id)) %></li>
  29 + <% end %>
  30 + <% end %>
  31 + </ul>
24 </div> 32 </div>
25 <div class="col-md-4"> 33 <div class="col-md-4">
26 - <h2><%= t('latest_projects') %></h2> 34 + <h2><%= t('latest_configurations') %></h2>
  35 +
  36 + <ul>
  37 + <% cache do %>
  38 + <% @latest_configurations.each do |configuration| %>
  39 + <li><%= link_to(configuration.name, kalibro_configuration_path(configuration.id)) %></li>
  40 + <% end %>
  41 + <% end %>
  42 + </ul>
27 </div> 43 </div>
28 </div> 44 </div>
29 </div> 45 </div>
config/locales/views/home/en.yml
@@ -3,3 +3,5 @@ en: @@ -3,3 +3,5 @@ en:
3 body_home_index_html: "<p>This is Mezuro! A <strong>free/libre</strong> web platform for <strong>collaborative</strong> source code <strong>evaluation</strong>.</p> <p>Here you can evaluate your source code with the most popular SCMs (like Git and SVN), just by providing its URL. For now, you can evaluate <strong>C</strong>, <strong>C++</strong>, <strong>Java</strong>, <strong>Ruby</strong>, <strong>Python</strong> and <strong>PHP</strong> source codes, but we are looking forward to supporting more languages in the future.</p>" 3 body_home_index_html: "<p>This is Mezuro! A <strong>free/libre</strong> web platform for <strong>collaborative</strong> source code <strong>evaluation</strong>.</p> <p>Here you can evaluate your source code with the most popular SCMs (like Git and SVN), just by providing its URL. For now, you can evaluate <strong>C</strong>, <strong>C++</strong>, <strong>Java</strong>, <strong>Ruby</strong>, <strong>Python</strong> and <strong>PHP</strong> source codes, but we are looking forward to supporting more languages in the future.</p>"
4 body_feedback_home_index_html: "Mezuro is continuously under development. Try it and give us your %{href}." 4 body_feedback_home_index_html: "Mezuro is continuously under development. Try it and give us your %{href}."
5 latest_projects: "Latest projects" 5 latest_projects: "Latest projects"
  6 + latest_repositories: "Latest repositories"
  7 + latest_configurations: "Latest configurations"
config/locales/views/home/pt.yml
@@ -3,3 +3,5 @@ pt: @@ -3,3 +3,5 @@ pt:
3 body_home_index_html: "<p>Este é o Mezuro! Uma plataforma web <strong>livre</strong> para <strong>avaliação colaborativa</strong> de código fonte.</p> <p>Aqui você pode avaliar seu código fonte com os SCMs mais populares (como Git e SVN), apenas fornecendo sua URL. Por enquanto, você pode avaliar códigos em <strong>C</strong>, <strong>C++</strong>, <strong>Java</strong>, <strong>Ruby</strong>, <strong>Python</strong> e <strong>PHP</strong> mas nós pretendemos dar suporte a mais linguagens no futuro.</p>" 3 body_home_index_html: "<p>Este é o Mezuro! Uma plataforma web <strong>livre</strong> para <strong>avaliação colaborativa</strong> de código fonte.</p> <p>Aqui você pode avaliar seu código fonte com os SCMs mais populares (como Git e SVN), apenas fornecendo sua URL. Por enquanto, você pode avaliar códigos em <strong>C</strong>, <strong>C++</strong>, <strong>Java</strong>, <strong>Ruby</strong>, <strong>Python</strong> e <strong>PHP</strong> mas nós pretendemos dar suporte a mais linguagens no futuro.</p>"
4 body_feedback_home_index_html: "Mezuro está sob constante desenvolvimento. Experimente e nos dê o seu %{href}." 4 body_feedback_home_index_html: "Mezuro está sob constante desenvolvimento. Experimente e nos dê o seu %{href}."
5 latest_projects: "Últimos projetos" 5 latest_projects: "Últimos projetos"
  6 + latest_repositories: "Últimos repositórios"
  7 + latest_configurations: "Últimas configurações"
features/homepage.feature
@@ -4,20 +4,25 @@ Feature: Homepage @@ -4,20 +4,25 @@ Feature: Homepage
4 I want to have in one page useful links to manage my account and session 4 I want to have in one page useful links to manage my account and session
5 5
6 Scenario: Before signing in 6 Scenario: Before signing in
7 - Given I am at the homepage  
8 - Then I should see "Sign In" 7 + Then I am at the homepage
  8 + And I should see "Home"
  9 + And I should see "Project"
  10 + And I should see "Repository"
  11 + And I should see "Configuration"
  12 + And I should see "Reading Group"
  13 + And I should see "Sign In"
9 And I should see "Sign Up" 14 And I should see "Sign Up"
  15 + And I should see "Language"
10 And I should see "Latest projects" 16 And I should see "Latest projects"
11 - And I should see "Project" 17 + And I should see "Latest repositories"
  18 + And I should see "Latest configurations"
12 19
13 Scenario: Signed in 20 Scenario: Signed in
14 Given I am a regular user 21 Given I am a regular user
15 And I am signed in 22 And I am signed in
16 And I am at the homepage 23 And I am at the homepage
17 - Then I should see "Edit" 24 + Then I should see "Edit Account"
18 And I should see "Sign Out" 25 And I should see "Sign Out"
19 - And I should see "Latest projects"  
20 - And I should see "Project"  
21 And I should see "Your projects" 26 And I should see "Your projects"
22 27
23 Scenario: Language selection 28 Scenario: Language selection
spec/controllers/home_controller_spec.rb
@@ -5,6 +5,8 @@ describe HomeController, :type =&gt; :controller do @@ -5,6 +5,8 @@ describe HomeController, :type =&gt; :controller do
5 context '#index' do 5 context '#index' do
6 before :each do 6 before :each do
7 Project.expects(:latest).with(5).returns([]) 7 Project.expects(:latest).with(5).returns([])
  8 + Repository.expects(:latest).with(5).returns([])
  9 + KalibroConfiguration.expects(:latest).with(5).returns([])
8 end 10 end
9 11
10 describe 'Rendering' do 12 describe 'Rendering' do