Commit 01df245825172d7af92ed183274f8f6d7918aa8d
1 parent
29c0d900
Exists in
master
and in
29 other branches
[Mezuro] show_project and new_repository views working
Showing
4 changed files
with
51 additions
and
18 deletions
Show diff stats
plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb
... | ... | @@ -24,6 +24,11 @@ class MezuroPluginProfileController < ProfileController |
24 | 24 | def project_content_has_errors? |
25 | 25 | not @content.errors[:base].nil? |
26 | 26 | end |
27 | + | |
28 | + def redirect_to_error_page(message) | |
29 | + message = URI.escape(CGI.escape(process_error_message(message)),'.') | |
30 | + redirect_to "/profile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" | |
31 | + end | |
27 | 32 | |
28 | 33 | end |
29 | 34 | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
... | ... | @@ -3,24 +3,33 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
3 | 3 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') |
4 | 4 | |
5 | 5 | def new_repository |
6 | - puts "\n\n\n\n\n\n\n\n\n\n\n\n\n" | |
7 | - puts "chegou aqui" | |
8 | 6 | @project_content = profile.articles.find(params[:id]) |
9 | - puts @project_content.inspect | |
7 | + | |
8 | + @repository_types = Kalibro::Repository.repository_types | |
9 | + #@repository_type_select = [] | |
10 | + #repository_types.each do |repository_type| | |
11 | + # @repository_type_select.push [repository_type,repository_type] | |
12 | + #end | |
13 | + | |
14 | + configurations = Kalibro::Configuration.all | |
15 | + @configuration_select = [] | |
16 | + configurations.each do |configuration| | |
17 | + @configuration_select.push [configuration.name,configuration.id] | |
18 | + end | |
10 | 19 | end |
11 | 20 | |
12 | 21 | 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 | |
22 | + project_content = profile.articles.find(params[:id]) | |
23 | + project_content_name = project_content.name | |
24 | + | |
25 | + repository = Kalibro::Repository.new( params[:repository] ) | |
26 | + repository.save(project_content.project_id) | |
27 | + | |
28 | + if( repository.errors.empty? ) | |
29 | + redirect_to "/#{profile.identifier}/#{project_content_name.downcase.gsub(/\s/, '-')}" | |
20 | 30 | else |
21 | - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/metric_configuration/edit_metric_configuration?id=#{id}&metric_name=#{metric_name.gsub(/\s/, '+')}" | |
31 | + redirect_to_error_page repository.errors[0].message | |
22 | 32 | end |
23 | -=end | |
24 | 33 | end |
25 | 34 | |
26 | 35 | def processing(repository_id) | ... | ... |
plugins/mezuro/views/content_viewer/show_project.rhtml
plugins/mezuro/views/mezuro_plugin_repository/new_repository.html.erb
1 | -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script> | |
2 | - | |
3 | 1 | <h2><%= @project_content.name %> Project</h2> |
4 | 2 | |
5 | 3 | <% form_for :repository, :url => {:action =>"create_repository", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> |
6 | - <%= hidden_field_tag :id, @configuration_content.id %> | |
4 | + <%= hidden_field_tag :id, @project_content.id %> | |
7 | 5 | |
8 | 6 | <p> |
9 | 7 | <%= f.label :name, "Name:" %> |
10 | 8 | <%= f.text_field :name %> |
11 | 9 | </p> |
12 | 10 | <p> |
11 | + <%= f.label :description, "Description:" %> | |
12 | + <%= f.text_field :description %> | |
13 | + </p> | |
14 | + | |
15 | + <%= required labelled_form_field _('License'), | |
16 | + f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options) %><br/> | |
17 | + <p> | |
18 | + | |
19 | + <p> | |
20 | + <%= f.label :process_period, "Process Period:" %> | |
21 | + <%= f.select(:process_period, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ) %> | |
22 | + </p> | |
13 | 23 | <%= f.label :type, "Type:" %> |
14 | - <%= f.select :type, [["GIT","GIT"], ["SVN", "SVN"]] %> | |
24 | + <%= f.select :type, @repository_types %> | |
25 | + </p> | |
26 | + | |
27 | + <p> | |
28 | + <%= f.label :address, "Address:" %> | |
29 | + <%= f.text_field :address %> | |
30 | + </p> | |
31 | + | |
32 | + </p> | |
33 | + <%= f.label :configuration_id, "Configuration:" %> | |
34 | + <%= f.select :configuration_id, @configuration_select %> | |
15 | 35 | </p> |
16 | 36 | |
17 | 37 | <p> |
... | ... | @@ -19,4 +39,3 @@ |
19 | 39 | </p> |
20 | 40 | |
21 | 41 | <% end %> |
22 | - | ... | ... |