diff --git a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb index 939bc24..86cd6ac 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -17,20 +17,25 @@ class MezuroPluginProfileController < ProfileController def project_result - content = profile.articles.find(params[:id]) - project_result = content.project_result + content = profile.articles.find(params[:id]) + date = params[:date] + project_result = date.nil? ? content.project_result : content.get_date_project_result(date) project = content.project render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result} end def module_result content = profile.articles.find(params[:id]) +# date = params[:date] +# project_result = date.nil? ? content.project_result : content.get_date_module_results(date) module_result = content.module_result(params[:module_name]) render :partial => 'content_viewer/module_result', :locals => { :module_result => module_result} end def project_tree content = profile.articles.find(params[:id]) +# date = params[:date] +# project_result = date.nil? ? content.project_result : content.get_date_project_tree(date) project_result = content.project_result source_tree = project_result.node_of(params[:module_name]) render :partial =>'content_viewer/source_tree', :locals => { :source_tree => source_tree, :project_name => content.project.name} diff --git a/plugins/mezuro/lib/mezuro_plugin/project_content.rb b/plugins/mezuro/lib/mezuro_plugin/project_content.rb index 364bf3d..8ef7d66 100644 --- a/plugins/mezuro/lib/mezuro_plugin/project_content.rb +++ b/plugins/mezuro/lib/mezuro_plugin/project_content.rb @@ -20,10 +20,19 @@ class MezuroPlugin::ProjectContent < Article def project @project ||= Kalibro::Client::ProjectClient.project(name) end + + def project + @project ||= Kalibro::Client::ProjectClient.project(name) + end def project_result @project_result ||= Kalibro::Client::ProjectResultClient.last_result(name) end + + def get_date_result(date) + client = Kalibro::Client::ProjectResultClient.new + @project_result ||= client.has_results_before(name, date) ? client.last_result_before(name, date) : client.first_result_after(name, date) + end def module_result(module_name) @module_client ||= Kalibro::Client::ModuleResultClient.module_result(self, module_name) diff --git a/plugins/mezuro/public/javascripts/project_content.js b/plugins/mezuro/public/javascripts/project_content.js index ef5249e..63f7c36 100644 --- a/plugins/mezuro/public/javascripts/project_content.js +++ b/plugins/mezuro/public/javascripts/project_content.js @@ -11,11 +11,6 @@ function showProjectContent() { callAction('project_state', {}, showProjectContentFor); } -function reloadProjectWithDate(){ - reloadProject(); - return false; -} - function toggle_mezuro(){ var element = jQuery(this).attr('data-show'); jQuery(element).toggle(); @@ -31,12 +26,23 @@ function reloadModule(){ return false; } -function reloadProject(){ +function reloadProjectWithDate(){ + var day = jQuery("#project_date_day").val(); + var month = jQuery("#project_date_month").val(); + var year = jQuery("#project_date_year").val(); + + var date = year + "-" + month + "-" + day + "T00:00:00+00:00"; + + reloadProject(date); + return false; +} + +function reloadProject(date){ showLoadingProcess(true); - callAction('project_result', {}, showProjectResult); - callAction('project_tree', {}, showProjectTree); - callAction('module_result', {}, showModuleResult); + callAction('project_result', {date: date}, showProjectResult); + callAction('project_tree', {date: date}, showProjectTree); + callAction('module_result', {date: date}, showModuleResult); } function showProjectContentFor(state){ @@ -44,7 +50,7 @@ function showProjectContentFor(state){ callAction('project_error', {}, showProjectResult); else if (state == 'READY') { callAction('project_result', {}, showProjectResult); - //callAction('project_tree', {}, showProjectTree); + callAction('project_tree', {}, showProjectTree); var project_name = jQuery("#project-result").attr('data-project-name'); callAction('module_result', {module_name: project_name}, showModuleResult); } diff --git a/plugins/mezuro/views/content_viewer/_project_result.rhtml b/plugins/mezuro/views/content_viewer/_project_result.rhtml index 5eac569..28cfd54 100644 --- a/plugins/mezuro/views/content_viewer/_project_result.rhtml +++ b/plugins/mezuro/views/content_viewer/_project_result.rhtml @@ -1,12 +1,32 @@ -Project history <% form_for :project_date, :html=>{:id=>"project_history_date"} do |f| %> - <%= f.text_field :day, :size => 1, :maxlength => 2 %> - <%= f.text_field :month, :size => 1, :maxlength => 2 %> - <%= f.text_field :year, :size => 1, :maxlength => 4 %> -

- <%= f.submit "Save" %> -

+ <%= f.label :day, "Choose project date:" %> + + + + + + + + + + + + +
+ Day + + Month + + Year +
+ <%= f.text_field :day, :size => 1, :maxlength => 2, :placeholder =>"dd" %> + + <%= f.text_field :month, :size => 1, :maxlength => 2, :placeholder =>"mm" %> + + <%= f.text_field :year, :size => 1, :maxlength => 4, :placeholder =>"yyyy" %> +
+ <%= f.submit "Refresh" %> <% end %> -- libgit2 0.21.2