Commit 0b3288001e43c8e16ab82700f2f9e539646cbbe4
Exists in
colab
and in
2 other branches
Merge pull request #337 from mezuro/update_home_again
Update home and remove menu
Showing
19 changed files
with
210 additions
and
113 deletions
Show diff stats
CHANGELOG.rdoc
... | ... | @@ -5,6 +5,10 @@ Prezento is the web interface for Mezuro. |
5 | 5 | == Unreleased |
6 | 6 | |
7 | 7 | * Remove Show button for hotspot metric configurations |
8 | +* Remove side menu | |
9 | +* Refactor footer as a grid | |
10 | +* Add latest repositories list to the homepage | |
11 | +* Add latest configurations list to the homepage | |
8 | 12 | |
9 | 13 | == v0.11.3 - 01/04/2016 |
10 | 14 | ... | ... |
app/assets/stylesheets/bootstrap_and_overrides.css.less
... | ... | @@ -40,19 +40,6 @@ |
40 | 40 | |
41 | 41 | //@import "datepicker/datepicker"; |
42 | 42 | |
43 | -footer div { | |
44 | - width: 50%; | |
45 | -} | |
46 | - | |
47 | -.footer-right { | |
48 | - float: right; | |
49 | - text-align: right; | |
50 | -} | |
51 | - | |
52 | -.footer-left { | |
53 | - float: left; | |
54 | -} | |
55 | - | |
56 | 43 | #error_explanation { |
57 | 44 | background-color: #F2DEDE; |
58 | 45 | border-color: #EED3D7; | ... | ... |
app/controllers/home_controller.rb
app/models/kalibro_configuration.rb
... | ... | @@ -28,4 +28,8 @@ class KalibroConfiguration < KalibroClient::Entities::Configurations::KalibroCon |
28 | 28 | @attributes = nil |
29 | 29 | super |
30 | 30 | end |
31 | + | |
32 | + def self.latest(count=1) | |
33 | + all.sort { |one, another| another.id <=> one.id }.select { |kalibro_configuration| kalibro_configuration.attributes.public }.first(count) | |
34 | + end | |
31 | 35 | end | ... | ... |
app/models/repository.rb
app/views/home/index.html.erb
... | ... | @@ -6,12 +6,40 @@ |
6 | 6 | </p> |
7 | 7 | </div> |
8 | 8 | |
9 | -<h2><%= t('latest_projects') %></h2> | |
9 | +<div class="container-fluid"> | |
10 | + <div class="row"> | |
11 | + <div class="col-md-4"> | |
12 | + <h2><%= t('latest_projects') %></h2> | |
10 | 13 | |
11 | -<ul> | |
12 | - <% cache do %> | |
13 | - <% @latest_projects.each do |project| %> | |
14 | - <li><%= link_to(project.name, project_path(project.id)) %></li> | |
15 | - <% end %> | |
16 | - <% end %> | |
17 | -</ul> | |
14 | + <ul> | |
15 | + <% cache action_suffix: 'latest_projects' do %> | |
16 | + <% @latest_projects.each do |project| %> | |
17 | + <li><%= link_to(project.name, project_path(project.id)) %></li> | |
18 | + <% end %> | |
19 | + <% end %> | |
20 | + </ul> | |
21 | + </div> | |
22 | + <div class="col-md-4"> | |
23 | + <h2><%= t('latest_repositories') %></h2> | |
24 | + | |
25 | + <ul> | |
26 | + <% cache action_suffix: 'latest_repositories' do %> | |
27 | + <% @latest_repositories.each do |repository| %> | |
28 | + <li><%= link_to(repository.name, repository_path(repository.id)) %></li> | |
29 | + <% end %> | |
30 | + <% end %> | |
31 | + </ul> | |
32 | + </div> | |
33 | + <div class="col-md-4"> | |
34 | + <h2><%= t('latest_configurations') %></h2> | |
35 | + | |
36 | + <ul> | |
37 | + <% cache action_suffix: 'latest_configurations' 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> | |
43 | + </div> | |
44 | + </div> | |
45 | +</div> | ... | ... |
app/views/layouts/application.html.erb
... | ... | @@ -45,95 +45,29 @@ |
45 | 45 | </head> |
46 | 46 | <body> |
47 | 47 | |
48 | - <div class="navbar navbar-default"> | |
49 | - <div class="navbar-inner"> | |
50 | - <div class="container-fluid"> | |
51 | - <div class="navbar-header"> | |
52 | - <button type="button" class="navbar-toggle collapsed" data-target="#nav-collapse" data-toggle="collapse"> | |
53 | - <span class="icon-bar"></span> | |
54 | - <span class="icon-bar"></span> | |
55 | - <span class="icon-bar"></span> | |
56 | - </button> | |
57 | - <a><%= link_to image_tag('logo.png'), root_path, class: 'navbar-brand' %></a> | |
58 | - </div> | |
59 | - <div class="collapse navbar-collapse" id="nav-collapse"> | |
60 | - <ul class="nav navbar-nav"> | |
61 | - <li><%= link_to t('home'), root_path %></li> | |
62 | - <li><%= link_to Project.model_name.human, projects_path %></li> | |
63 | - <li><%= link_to Repository.model_name.human, repositories_path %></li> | |
64 | - <li><%= link_to KalibroConfiguration.model_name.human, kalibro_configurations_path %></li> | |
65 | - <li><%= link_to ReadingGroup.model_name.human, reading_groups_path %></li> | |
66 | - </ul> | |
67 | - <ul class="nav navbar-nav navbar-right"> | |
68 | - <% if user_signed_in? %> | |
69 | - <li><%= link_to t('edit_account'), edit_user_registration_path %></li> | |
70 | - <li><%= link_to t('sign_out'), destroy_user_session_path, :method => :delete %></li> | |
71 | - <% else %> | |
72 | - <li><%= link_to t('sign_in'), new_user_session_path %></li> | |
73 | - <li><%= link_to t('sign_up'), new_user_registration_path %></li> | |
74 | - <% end %> | |
75 | - <li class="dropdown"> | |
76 | - <a class="dropdown-toggle" aria-expanded="true" role="button" data-toggle="dropdown" href="#"> | |
77 | - <%= t('language') %> | |
78 | - <span class="caret"></span> | |
79 | - </a> | |
80 | - <ul class="dropdown-menu" role="menu"> | |
81 | - <% I18n.available_locales.each do |locale| %> | |
82 | - <li><%= link_to(locale.to_s, url_for(locale: locale), data: { no_turbolink: true }) %></li> | |
83 | - <% end %> | |
84 | - </ul> | |
85 | - </li> | |
86 | - </ul> | |
87 | - </div><!--/.nav-collapse --> | |
88 | - </div> | |
89 | - </div> | |
90 | - </div> | |
48 | + <%= render partial: 'shared/navbar' %> | |
91 | 49 | |
92 | 50 | <div class="container-fluid"> |
93 | 51 | <div class="row"> |
94 | - <div class="col-sm-3 col-md-3"> | |
95 | - <div class="well sidebar-nav"> | |
96 | - <ul class="list-group"> | |
97 | - <% if user_signed_in? %> | |
98 | - <li class="nav-header"><%= t('hello_html', user: current_user.name) %></li> | |
99 | - <li class="list-group-item"><%= link_to t('your_projects'), user_projects_path(current_user.id) %></li> | |
100 | - <% end %> | |
101 | - <li class="nav-header"><%= t('tutorials') %></li> | |
102 | - <li class="list-group-item"><%= link_to t('analysis'), tutorials_path('analyzing') %></li> | |
103 | - <li class="list-group-item"><%= link_to t('configuring'), tutorials_path('configuring') %></li> | |
104 | - <li class="list-group-item" ><%= link_to t('keywords'), tutorials_path('keywords') %></li> | |
105 | - <% if content_for?(:sidebar) %> | |
106 | - <%= yield :sidebar %> | |
107 | - <% else %> | |
108 | - <%= render 'shared/short_about' %> | |
109 | - <% end %> | |
110 | - </ul> | |
111 | - </div><!--/.well --> | |
112 | - </div><!--/col-sm-3 col-md-3--> | |
113 | - <div class="col-sm-9 col-md-9"> | |
114 | - <div class="alert alert-info" id="loader"><i class="fa fa-spinner fa-spin fa-lg"></i> <%= t('instant_loading_page') %></div> | |
52 | + <div class="col-sm-12 col-md-12"> | |
53 | + <div class="alert alert-info" id="loader"><i class="fa fa-spinner fa-spin fa-lg"></i> <%= t('instant_loading_page') %></div> | |
115 | 54 | |
116 | 55 | <%= bootstrap_flash %> |
117 | 56 | <%= yield %> |
118 | 57 | </div> |
119 | 58 | </div><!--/row--> |
120 | - | |
121 | - <footer> | |
122 | - <div class="footer-left">© <%= link_to(t('mezuro_team'), '/humans.txt') %> 2013-2015</div> | |
123 | - <div class="footer-right"><%= link_to(image_tag('agplv3-88x31.png'), 'http://www.gnu.org/licenses/agpl-3.0-standalone.html') %> <%= link_to image_tag('fork-me.png'), 'https://github.com/mezuro/prezento' %> <%= image_tag 'usp-cloud-nuvem-logo.png' %> <%= link_to image_tag('banner-ccsl.png', height: '40', width: '190'), 'http://ccsl.ime.usp.br/' %></div> | |
124 | - </footer> | |
125 | - | |
126 | - <script type="text/javascript"> | |
127 | - $(function() { | |
128 | - $( "#languages-accordion > div" ).accordion({ | |
129 | - heightStyle: "content", | |
130 | - collapsible: true, | |
131 | - active: false | |
132 | - }); | |
133 | - }); | |
134 | - </script> | |
135 | - | |
136 | 59 | </div> <!-- /container --> |
137 | 60 | |
61 | + <%= render partial: 'shared/footer' %> | |
62 | + | |
63 | + <script type="text/javascript"> | |
64 | + $(function() { | |
65 | + $( "#languages-accordion > div" ).accordion({ | |
66 | + heightStyle: "content", | |
67 | + collapsible: true, | |
68 | + active: false | |
69 | + }); | |
70 | + }); | |
71 | + </script> | |
138 | 72 | </body> |
139 | 73 | </html> | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +<footer> | |
2 | + <div class="container-fluid"> | |
3 | + <div class="row"> | |
4 | + <div class="col-md-7">© <%= link_to(t('mezuro_team'), '/humans.txt') %> 2013-2016</div> | |
5 | + <div class="col-md-5"> | |
6 | + <div class="container-fluid"> | |
7 | + <div class="row"> | |
8 | + <div class="col-md-2"><%= link_to(image_tag('agplv3-88x31.png'), 'http://www.gnu.org/licenses/agpl-3.0-standalone.html') %></div> | |
9 | + <div class="col-md-2"><%= link_to image_tag('fork-me.png'), 'https://github.com/mezuro/prezento' %></div> | |
10 | + <div class="col-md-2"><%= image_tag 'usp-cloud-nuvem-logo.png' %></div> | |
11 | + <div class="col-md-6"><%= link_to image_tag('banner-ccsl.png', height: '40', width: '190'), 'http://ccsl.ime.usp.br/' %></div> | |
12 | + </div> | |
13 | + </div> | |
14 | + </div> | |
15 | + </div> | |
16 | + </div> | |
17 | +</footer> | ... | ... |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<div class="navbar navbar-default"> | |
2 | + <div class="navbar-inner"> | |
3 | + <div class="container-fluid"> | |
4 | + <div class="navbar-header"> | |
5 | + <button type="button" class="navbar-toggle collapsed" data-target="#nav-collapse" data-toggle="collapse"> | |
6 | + <span class="icon-bar"></span> | |
7 | + <span class="icon-bar"></span> | |
8 | + <span class="icon-bar"></span> | |
9 | + </button> | |
10 | + <a><%= link_to image_tag('logo.png'), root_path, class: 'navbar-brand' %></a> | |
11 | + </div> | |
12 | + <div class="collapse navbar-collapse" id="nav-collapse"> | |
13 | + <ul class="nav navbar-nav"> | |
14 | + <li><%= link_to t('home'), root_path %></li> | |
15 | + <li><%= link_to Project.model_name.human, projects_path %></li> | |
16 | + <li><%= link_to Repository.model_name.human, repositories_path %></li> | |
17 | + <li><%= link_to KalibroConfiguration.model_name.human, kalibro_configurations_path %></li> | |
18 | + <li><%= link_to ReadingGroup.model_name.human, reading_groups_path %></li> | |
19 | + </ul> | |
20 | + <ul class="nav navbar-nav navbar-right"> | |
21 | + <% if user_signed_in? %> | |
22 | + <li class="dropdown"> | |
23 | + <a class="dropdown-toggle" aria-expanded="true" role="button" data-toggle="dropdown" href="#"> | |
24 | + <%= current_user.name %> | |
25 | + <span class="caret"></span> | |
26 | + </a> | |
27 | + <ul class="dropdown-menu" role="menu"> | |
28 | + <li><%= link_to t('your_projects'), user_projects_path(current_user.id) %></li> | |
29 | + <li><%= link_to t('edit_account'), edit_user_registration_path %></li> | |
30 | + <li><%= link_to t('sign_out'), destroy_user_session_path, :method => :delete %></li> | |
31 | + </ul> | |
32 | + </li> | |
33 | + <% else %> | |
34 | + <li><%= link_to t('sign_in'), new_user_session_path %></li> | |
35 | + <li><%= link_to t('sign_up'), new_user_registration_path %></li> | |
36 | + <% end %> | |
37 | + <li class="dropdown"> | |
38 | + <a class="dropdown-toggle" aria-expanded="true" role="button" data-toggle="dropdown" href="#"> | |
39 | + <%= t('language') %> | |
40 | + <span class="caret"></span> | |
41 | + </a> | |
42 | + <ul class="dropdown-menu" role="menu"> | |
43 | + <% I18n.available_locales.each do |locale| %> | |
44 | + <li><%= link_to(locale.to_s, url_for(locale: locale), data: { no_turbolink: true }) %></li> | |
45 | + <% end %> | |
46 | + </ul> | |
47 | + </li> | |
48 | + </ul> | |
49 | + </div><!--/.nav-collapse --> | |
50 | + </div> | |
51 | + </div> | |
52 | +</div> | |
0 | 53 | \ No newline at end of file | ... | ... |
config/locales/views/home/en.yml
1 | 1 | en: |
2 | 2 | title_home_index: "Understanding Code Metrics" |
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> and <strong>Python</strong> source codes, but we are looking forward to supporting more languages in the future (PHP is coming soon).</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 | 4 | body_feedback_home_index_html: "Mezuro is continuously under development. Try it and give us your %{href}." |
5 | 5 | latest_projects: "Latest projects" |
6 | + latest_repositories: "Latest repositories" | |
7 | + latest_configurations: "Latest configurations" | ... | ... |
config/locales/views/home/pt.yml
1 | 1 | pt: |
2 | 2 | title_home_index: "Entendendo Métricas de Código" |
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> e <strong>Python<strong> mas nós pretendemos dar suporte a mais linguagens no futuro (PHP está muito próximo).</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 | 4 | body_feedback_home_index_html: "Mezuro está sob constante desenvolvimento. Experimente e nos dê o seu %{href}." |
5 | 5 | latest_projects: "Últimos projetos" |
6 | + latest_repositories: "Últimos repositórios" | |
7 | + latest_configurations: "Últimas configurações" | ... | ... |
config/locales/views/layouts/en.yml
config/locales/views/layouts/pt.yml
features/homepage.feature
... | ... | @@ -3,21 +3,29 @@ Feature: Homepage |
3 | 3 | As a regular user |
4 | 4 | I want to have in one page useful links to manage my account and session |
5 | 5 | |
6 | + @kalibro_processor_restart | |
6 | 7 | Scenario: Before signing in |
7 | - Given I am at the homepage | |
8 | - Then I should see "Sign In" | |
8 | + Given I have a project named "GCC" | |
9 | + Then I am at the homepage | |
10 | + And I should see "Home" | |
11 | + And I should see "Project" | |
12 | + And I should see "Repository" | |
13 | + And I should see "Configuration" | |
14 | + And I should see "Reading Group" | |
15 | + And I should see "Sign In" | |
9 | 16 | And I should see "Sign Up" |
17 | + And I should see "Language" | |
10 | 18 | And I should see "Latest projects" |
11 | - And I should see "Project" | |
19 | + And I should see "Latest repositories" | |
20 | + And I should see "Latest configurations" | |
21 | + Then I should see "GCC" only "1" times | |
12 | 22 | |
13 | 23 | Scenario: Signed in |
14 | 24 | Given I am a regular user |
15 | 25 | And I am signed in |
16 | 26 | And I am at the homepage |
17 | - Then I should see "Edit" | |
27 | + Then I should see "Edit Account" | |
18 | 28 | And I should see "Sign Out" |
19 | - And I should see "Latest projects" | |
20 | - And I should see "Project" | |
21 | 29 | And I should see "Your projects" |
22 | 30 | |
23 | 31 | Scenario: Language selection | ... | ... |
features/step_definitions/homepage_steps.rb
... | ... | @@ -12,4 +12,8 @@ end |
12 | 12 | |
13 | 13 | Then(/^I should see "(.+)"$/) do |text| |
14 | 14 | expect(page).to have_content(text) |
15 | -end | |
16 | 15 | \ No newline at end of file |
16 | +end | |
17 | + | |
18 | +Then(/^I should see "(.*?)" only "(.*?)" times$/) do |text, times| | |
19 | + expect(page).to have_content(text, count: times.to_i) | |
20 | +end | ... | ... |
features/users/user_update.feature
... | ... | @@ -8,7 +8,9 @@ Feature: User update |
8 | 8 | Given I am a regular user |
9 | 9 | And I am signed in |
10 | 10 | And I am at the homepage |
11 | - When I click the Edit link | |
11 | + And I take a picture of the page | |
12 | + When I click the Diego Martinez link | |
13 | + And I click the Edit Account link | |
12 | 14 | And I fill the Name field with "Rafael Manzo" |
13 | 15 | And I fill the Current password field with "password" |
14 | 16 | And I press the Update button | ... | ... |
spec/controllers/home_controller_spec.rb
... | ... | @@ -5,6 +5,8 @@ describe HomeController, :type => :controller do |
5 | 5 | context '#index' do |
6 | 6 | before :each do |
7 | 7 | Project.expects(:latest).with(5).returns([]) |
8 | + Repository.expects(:latest).with(5).returns([]) | |
9 | + KalibroConfiguration.expects(:latest).with(5).returns([]) | |
8 | 10 | end |
9 | 11 | |
10 | 12 | describe 'Rendering' do | ... | ... |
spec/models/kalibro_configuration_spec.rb
... | ... | @@ -70,6 +70,29 @@ describe KalibroConfiguration, :type => :model do |
70 | 70 | end |
71 | 71 | end |
72 | 72 | end |
73 | + | |
74 | + describe 'latest' do | |
75 | + let!(:kalibro_configuration) { FactoryGirl.build(:kalibro_configuration, id: 1) } | |
76 | + let!(:another_kalibro_configuration) { FactoryGirl.build(:another_kalibro_configuration, id: 2) } | |
77 | + let!(:kalibro_configuration_attributes) { FactoryGirl.build(:kalibro_configuration_attributes) } | |
78 | + | |
79 | + before :each do | |
80 | + kalibro_configuration.expects(:attributes).returns(kalibro_configuration_attributes) | |
81 | + another_kalibro_configuration.expects(:attributes).returns(kalibro_configuration_attributes) | |
82 | + | |
83 | + KalibroConfiguration.expects(:all).returns([kalibro_configuration, another_kalibro_configuration]) | |
84 | + end | |
85 | + | |
86 | + it 'should return the two kalibro_configurations ordered' do | |
87 | + expect(KalibroConfiguration.latest(2)).to eq([another_kalibro_configuration, kalibro_configuration]) | |
88 | + end | |
89 | + | |
90 | + context 'when no parameter is passed' do | |
91 | + it 'should return just the most recent kalibro_configuration' do | |
92 | + expect(KalibroConfiguration.latest).to eq([another_kalibro_configuration]) | |
93 | + end | |
94 | + end | |
95 | + end | |
73 | 96 | end |
74 | 97 | |
75 | 98 | describe 'destroy' do | ... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +require 'rails_helper' | |
2 | + | |
3 | +describe Repository do | |
4 | + describe 'class method' do | |
5 | + describe 'latest' do | |
6 | + let!(:repository) { FactoryGirl.build(:repository, id: 1) } | |
7 | + let!(:another_repository) { FactoryGirl.build(:another_repository, id: 2) } | |
8 | + | |
9 | + before do | |
10 | + Repository.expects(:all).returns([repository, another_repository]) | |
11 | + end | |
12 | + | |
13 | + it 'should return the two repositorys ordered' do | |
14 | + expect(Repository.latest(2)).to eq([another_repository, repository]) | |
15 | + end | |
16 | + | |
17 | + context 'when no parameter is passed' do | |
18 | + it 'should return just the most recent repository' do | |
19 | + expect(Repository.latest).to eq([another_repository]) | |
20 | + end | |
21 | + end | |
22 | + end | |
23 | + end | |
24 | +end | |
0 | 25 | \ No newline at end of file | ... | ... |