Commit 29fdbbad042161ffe5d75aae0fca21b165c4f5ab

Authored by Alessandro Palmeira
1 parent 1b5608f8

[Mezuro] Draft to new_repository view

plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
  1 +class MezuroPluginRepositoryController < MezuroPluginProfileController
  2 +
  3 + append_view_path File.join(File.dirname(__FILE__) + '/../../views')
  4 +
  5 + def new_repository
  6 + puts "\n\n\n\n\n\n\n\n\n\n\n\n\n"
  7 + puts "chegou aqui"
  8 + @project_content = profile.articles.find(params[:id])
  9 + puts @project_content.inspect
  10 + end
  11 +
  12 + def create_repository
  13 + id = params[:id]
  14 +=begin
  15 + metric_name = params[:metric_configuration][:metric][:name]
  16 + metric_configuration = Kalibro::MetricConfiguration.new(params[:metric_configuration])
  17 + metric_configuration.save
  18 + if metric_configuration_has_errors? metric_configuration
  19 + redirect_to_error_page metric_configuration.errors[0].message
  20 + else
  21 + redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}"
  22 + end
  23 +=end
  24 + end
  25 +
1 def processing(repository_id) 26 def processing(repository_id)
2 begin 27 begin
3 if Kalibro::Processing.has_ready_processing(repository_id) 28 if Kalibro::Processing.has_ready_processing(repository_id)
@@ -41,3 +66,5 @@ @@ -41,3 +66,5 @@
41 errors.add_to_base(error.message) 66 errors.add_to_base(error.message)
42 end 67 end
43 end 68 end
  69 +
  70 +end
plugins/mezuro/views/content_viewer/show_project.rhtml
@@ -23,5 +23,11 @@ @@ -23,5 +23,11 @@
23 <% @page.repositories.each do |repository| %> 23 <% @page.repositories.each do |repository| %>
24 <% repository.name %> 24 <% repository.name %>
25 <% end %> 25 <% end %>
  26 +
  27 + <br>
  28 + <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Repository", :controller => "mezuro_plugin_repository",
  29 + :profile => @page.profile.identifier,
  30 + :action => "new_repository",
  31 + :id => @page.id %><br/>
26 32
27 <% end %> 33 <% end %>
plugins/mezuro/views/mezuro_plugin_repository/_error_page.html.erb 0 → 100644
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +<h2> An error occured: </h2>
  2 +<%= @message %>
plugins/mezuro/views/mezuro_plugin_repository/new_repository.html.erb 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>
  2 +
  3 +<h2><%= @project_content.name %> Project</h2>
  4 +
  5 +<% form_for :repository, :url => {:action =>"create_repository", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %>
  6 + <%= hidden_field_tag :id, @configuration_content.id %>
  7 +
  8 + <p>
  9 + <%= f.label :name, "Name:" %>
  10 + <%= f.text_field :name %>
  11 + </p>
  12 + <p>
  13 + <%= f.label :type, "Type:" %>
  14 + <%= f.select :type, [["GIT","GIT"], ["SVN", "SVN"]] %>
  15 + </p>
  16 +
  17 + <p>
  18 + <%= f.submit "Add" %>
  19 + </p>
  20 +
  21 +<% end %>
  22 +