Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count configuration clones #389

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions app/controllers/kalibro_configurations_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<tr>
<td><%= kalibro_configuration.name %></td>
<td><%= kalibro_configuration.description %></td>
<td><%= @number_of_repositories[kalibro_configuration.id.to_s] %></td>
<td><%= link_to t('show'), kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %></td>
<td>
<% if kalibro_configuration_owner?(kalibro_configuration.id) %>
<%= link_to t('edit'), edit_kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %>
<% end %>
</td>
</tr>
</tr>
4 changes: 2 additions & 2 deletions app/views/kalibro_configurations/_list.html.erb
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@
<tr>
<th><%= t('name') %></th>
<th><%= t('description') %></th>
<th><%= t('number_of_repositories') %></th>
<th colspan="2"></th>
</tr>
</thead>

<tbody>
<%= render @kalibro_configurations %>
</tbody>
</table>
</table>
3 changes: 2 additions & 1 deletion config/locales/views/kalibro_configuration/en.yml
Original file line number Diff line number Diff line change
@@ -7,4 +7,5 @@ en:
attributes:
kalibro_configuration:
name: "Name"
description: "Description"
description: "Description"
number_of_repositories: "Number of repositories used in"
3 changes: 2 additions & 1 deletion config/locales/views/kalibro_configuration/pt.yml
Original file line number Diff line number Diff line change
@@ -11,4 +11,5 @@ pt:
helpers:
submit:
kalibro_configuration:
new: "Nova %{model}"
new: "Nova %{model}"
number_of_repositories: "Número de repositórios em que é utilizada"