diff --git a/app/assets/javascripts/module/graphic.js.coffee b/app/assets/javascripts/module/graphic.js.coffee index b18b2df..c6c6b56 100644 --- a/app/assets/javascripts/module/graphic.js.coffee +++ b/app/assets/javascripts/module/graphic.js.coffee @@ -15,4 +15,4 @@ class Module.Graphic display(data,container) display: (data, container) -> - $('div#'+container).html('') \ No newline at end of file + $('div#'+container).html('') diff --git a/app/helpers/repository_helper.rb b/app/helpers/repository_helper.rb index 8423fcf..0bde7a5 100644 --- a/app/helpers/repository_helper.rb +++ b/app/helpers/repository_helper.rb @@ -14,4 +14,16 @@ module RepositoryHelper end return "Undefined" end -end \ No newline at end of file + + def day_options + (1..31).to_a.map {|day| [day, day]} + end + + def month_options + (1..12).to_a.map {|month| [month, month]} + end + + def year_options + (2013..2020).to_a.map {|year| [year, year]} + end +end diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 193dde2..3fcccfb 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -32,6 +32,14 @@ <%= @configuration.name %>

+

Retrieve a processing information from:

+ +

Day: <%= select_tag(:day, options_for_select(day_options), :style => "width:55px; margin-top:5px") %> +Month: <%= select_tag(:month, options_for_select(month_options), :style => "width:55px; margin-top:5px") %> +Year: <%= select_tag(:year, options_for_select(year_options), :style => "width:70px; margin-top:5px") %> +<%= link_to 'Search', "#", class: 'btn btn-info' , style: 'margin-bottom:5px' %>

+

+
diff --git a/config/routes.rb b/config/routes.rb index 6b3c742..511f243 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ Mezuro::Application.routes.draw do resources :projects do resources :repositories, except: [:update, :index] get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module + get '/repositories/:id/date' => 'repositories#date', as: :repository_date post '/repositories/:id/state' => 'repositories#state', as: :repository_state put '/repositories/:id' => 'repositories#update', as: :repository_update get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process diff --git a/spec/helpers/repository_helper_spec.rb b/spec/helpers/repository_helper_spec.rb index 6bd0916..21b2416 100644 --- a/spec/helpers/repository_helper_spec.rb +++ b/spec/helpers/repository_helper_spec.rb @@ -23,4 +23,22 @@ describe RepositoryHelper do helper.periodicity_option(nil).should eq "Undefined" end end -end \ No newline at end of file + + describe 'calendar' do + it 'should return an array with the number of days' do + days = (1..31).to_a.map {|day| [day, day]} + helper.day_options.should eq days + end + + it 'should return an array with the number of months' do + months = (1..12).to_a.map {|month| [month, month]} + helper.month_options.should eq months + end + + it 'should return a range of years' do + years = (2013..2020).to_a.map {|year| [year, year]} + helper.year_options.should eq years + end + end + +end diff --git a/spec/routing/repositories_routing_spec.rb b/spec/routing/repositories_routing_spec.rb index 4571914..e70eac5 100644 --- a/spec/routing/repositories_routing_spec.rb +++ b/spec/routing/repositories_routing_spec.rb @@ -22,5 +22,7 @@ describe RepositoriesController do to(controller: :repositories, action: :state, project_id: 1, id: 1) } it { should route(:get, '/projects/1/repositories/1/process'). to(controller: :repositories, action: :process_repository, project_id: 1, id: 1) } - end + it { should route(:get, '/projects/1/repositories/1/date'). + to(controller: :repositories, action: :date, project_id: 1, id: 1) } + end end -- libgit2 0.21.2