Commit 1cdaecd5fe5079e874e4a177501946b548fd5bf4

Authored by Alessandro Palmeira + Diego Araújo + João M. M. da Silva
Committed by João M. M. da Silva
1 parent ad7f5933

[Mezuro] refactoring show_repository view

plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb
  1 +#TODO Ver quais metodos precisam estar aqui e fazer os testes
1 2 class MezuroPluginProfileController < ProfileController
2 3  
3 4 append_view_path File.join(File.dirname(__FILE__) + '/../../views')
4 5  
  6 +=begin
5 7 rescue_from Exception do |exception|
6 8 @message = process_error_message exception.message
7 9 render :partial => "error_page"
... ... @@ -10,7 +12,7 @@ class MezuroPluginProfileController &lt; ProfileController
10 12 def error_page
11 13 @message = params[:message]
12 14 end
13   -
  15 +=end
14 16 protected
15 17  
16 18 def process_error_message message
... ...
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... ... @@ -10,7 +10,11 @@ class MezuroPlugin::Helpers::ContentViewerHelper
10 10 [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]]
11 11 end
12 12  
13   - def self.create_license_options
  13 + def self.periodicity_option(periodicity)
  14 + periodicity_options.select {|x| x.last == periodicity}.first.first
  15 + end
  16 +
  17 + def self.license_options
14 18 options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml")
15 19 options = options.split(";")
16 20 formated_options = []
... ... @@ -44,12 +48,6 @@ class MezuroPlugin::Helpers::ContentViewerHelper
44 48 metric_configuration_snapshot.metric.name.delete("() ")
45 49 end
46 50  
47   - def self.get_license_option(selected)
48   - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml")
49   - options.split(";")
50   - selected_option = options.find { |license| license == selected }
51   - end
52   -
53 51 private
54 52  
55 53 def self.discretize_array(array)
... ...
plugins/mezuro/views/mezuro_plugin_repository/show.html.erb
... ... @@ -16,7 +16,7 @@
16 16 </tr>
17 17 <tr>
18 18 <td><%= _('Process Period') %></td>
19   - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.get_periodicity_option(@repository.process_period) %></td>
  19 + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.periodicity_option(@repository.process_period.to_i) %></td>
20 20 </tr>
21 21 <tr>
22 22 <td><%= _('Type') %></td>
... ... @@ -33,16 +33,14 @@
33 33 <tr>
34 34 <td><%= _('Status')%></td>
35 35 <td>
36   - <div id="processing-state" style="color:DarkGoldenRod"><%= @processing.state %></div>
  36 + <div id="processing-state" style="color:DarkGoldenRod">Retrieving</div>
37 37 <div id="msg-time"></div>
38 38 </td>
39 39 </tr>
40 40 </table>
41   -
42   -
43 41 <br />
44 42  
45   -<div id="processing" data-profile="<%= @page.profile.identifier %>" data-content="<%= @page.id %>"
  43 +<div id="processing" data-profile="<%= @data_profile %>" data-content="<%= @data_content %>"
46 44 data-repository-id="<%= @repository.id %>"></div>
47 45 <div id="project-tree"></div>
48 46 <div id="module-result"></div>
... ...