From 25336ff7a91e60d9a4f33d67d0936dd7ecd0bef4 Mon Sep 17 00:00:00 2001 From: Leonardo Cambraia Date: Mon, 31 Oct 2016 20:25:55 -0200 Subject: [PATCH 1/2] Counting configuration clones --- app/controllers/kalibro_configurations_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/kalibro_configurations_controller.rb b/app/controllers/kalibro_configurations_controller.rb index 251ff20b..6652bf1e 100644 --- a/app/controllers/kalibro_configurations_controller.rb +++ b/app/controllers/kalibro_configurations_controller.rb @@ -14,6 +14,11 @@ def new # GET /kalibro_configurations.json def index @kalibro_configurations = KalibroConfiguration.public_or_owned_by_user(current_user) + @number_of_repositories = {} + Repository.all.each do |r| + @number_of_repositories[r.kalibro_configuration_id.to_s] ||= 0 + @number_of_repositories[r.kalibro_configuration_id.to_s] += 1 + end end # POST /kalibro_configurations From e723e5f213f22d367f99e07c677ad129aa57c29c Mon Sep 17 00:00:00 2001 From: Leonardo Cambraia Date: Mon, 31 Oct 2016 20:28:42 -0200 Subject: [PATCH 2/2] Adding the count of configuration clones in the prezento interface --- CHANGELOG.md | 1 + .../kalibro_configurations/_kalibro_configuration.html.erb | 3 ++- app/views/kalibro_configurations/_list.html.erb | 4 ++-- config/locales/views/kalibro_configuration/en.yml | 3 ++- config/locales/views/kalibro_configuration/pt.yml | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b6f8b2e..30ac1869 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The version numbers below try to follow the conventions at http://semver.org/. ## Unreleased +- Add the count of configurations clones - Remove the repository's instance that has remained in the db - Adding translation of the periodicity options in repository helper - Fixing wrong configurations translation in portuguese navbar diff --git a/app/views/kalibro_configurations/_kalibro_configuration.html.erb b/app/views/kalibro_configurations/_kalibro_configuration.html.erb index b51d52b2..760e45a3 100644 --- a/app/views/kalibro_configurations/_kalibro_configuration.html.erb +++ b/app/views/kalibro_configurations/_kalibro_configuration.html.erb @@ -1,10 +1,11 @@ <%= kalibro_configuration.name %> <%= kalibro_configuration.description %> + <%= @number_of_repositories[kalibro_configuration.id.to_s] %> <%= link_to t('show'), kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %> <% if kalibro_configuration_owner?(kalibro_configuration.id) %> <%= link_to t('edit'), edit_kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %> <% end %> - \ No newline at end of file + diff --git a/app/views/kalibro_configurations/_list.html.erb b/app/views/kalibro_configurations/_list.html.erb index a6005353..4780e98b 100644 --- a/app/views/kalibro_configurations/_list.html.erb +++ b/app/views/kalibro_configurations/_list.html.erb @@ -3,11 +3,11 @@ <%= t('name') %> <%= t('description') %> + <%= t('number_of_repositories') %> - <%= render @kalibro_configurations %> - \ No newline at end of file + diff --git a/config/locales/views/kalibro_configuration/en.yml b/config/locales/views/kalibro_configuration/en.yml index 0474ce93..28c98fa5 100644 --- a/config/locales/views/kalibro_configuration/en.yml +++ b/config/locales/views/kalibro_configuration/en.yml @@ -7,4 +7,5 @@ en: attributes: kalibro_configuration: name: "Name" - description: "Description" \ No newline at end of file + description: "Description" + number_of_repositories: "Number of repositories used in" diff --git a/config/locales/views/kalibro_configuration/pt.yml b/config/locales/views/kalibro_configuration/pt.yml index 440209a5..8d5dc0cd 100644 --- a/config/locales/views/kalibro_configuration/pt.yml +++ b/config/locales/views/kalibro_configuration/pt.yml @@ -11,4 +11,5 @@ pt: helpers: submit: kalibro_configuration: - new: "Nova %{model}" \ No newline at end of file + new: "Nova %{model}" + number_of_repositories: "Número de repositórios em que é utilizada"