Commit d4fc661200af73fd446b570ffd48436c992b4fec
1 parent
1c08281c
Exists in
master
and in
28 other branches
[Mezuro] added project link on edit and new repository pages
Showing
4 changed files
with
23 additions
and
12 deletions
Show diff stats
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
... | ... | @@ -3,8 +3,11 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
3 | 3 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') |
4 | 4 | |
5 | 5 | def new |
6 | - @project_content = profile.articles.find(params[:id]) | |
7 | - | |
6 | + project_content = profile.articles.find(params[:id]) | |
7 | + @project_name = project_content.name | |
8 | + @data_profile = project_content.profile.identifier | |
9 | + @project_content_id = project_content.id | |
10 | + | |
8 | 11 | @repository_types = Kalibro::Repository.repository_types |
9 | 12 | |
10 | 13 | configurations = Kalibro::Configuration.all |
... | ... | @@ -16,7 +19,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
16 | 19 | |
17 | 20 | def create |
18 | 21 | project_content = profile.articles.find(params[:id]) |
19 | - | |
22 | + | |
20 | 23 | repository = Kalibro::Repository.new( params[:repository] ) |
21 | 24 | repository.save(project_content.project_id) |
22 | 25 | |
... | ... | @@ -29,8 +32,11 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
29 | 32 | end |
30 | 33 | |
31 | 34 | def edit |
32 | - @project_content = profile.articles.find(params[:id]) | |
33 | - | |
35 | + project_content = profile.articles.find(params[:id]) | |
36 | + @project_name = project_content.name | |
37 | + @data_profile = project_content.profile.identifier | |
38 | + @project_content_id = project_content.id | |
39 | + | |
34 | 40 | @repository_types = Kalibro::Repository.repository_types |
35 | 41 | |
36 | 42 | configurations = Kalibro::Configuration.all |
... | ... | @@ -39,7 +45,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
39 | 45 | [configuration.name,configuration.id] |
40 | 46 | end |
41 | 47 | |
42 | - @repository = @project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first | |
48 | + @repository = project_content.repositories.select{ |repository| repository.id.to_s == params[:repository_id] }.first | |
43 | 49 | end |
44 | 50 | |
45 | 51 | def update | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb
... | ... | @@ -31,8 +31,10 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase |
31 | 31 | |
32 | 32 | get :new, :profile => @profile.identifier, :id => @content.id |
33 | 33 | |
34 | - assert_equal @content, assigns(:project_content) | |
34 | + assert_equal @content.id, assigns(:project_content_id) | |
35 | + assert_equal @content.name, assigns(:project_name) | |
35 | 36 | assert_equal @repository_types, assigns(:repository_types) |
37 | + assert_equal @content.profile.identifier, assigns(:data_profile) | |
36 | 38 | assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first |
37 | 39 | assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last |
38 | 40 | end |
... | ... | @@ -63,8 +65,10 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase |
63 | 65 | |
64 | 66 | get :edit, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id |
65 | 67 | |
66 | - assert_equal @content, assigns(:project_content) | |
68 | + assert_equal @content.id, assigns(:project_content_id) | |
69 | + assert_equal @content.name, assigns(:project_name) | |
67 | 70 | assert_equal @repository_types, assigns(:repository_types) |
71 | + assert_equal @content.profile.identifier, assigns(:data_profile) | |
68 | 72 | assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first |
69 | 73 | assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last |
70 | 74 | assert_equal @repository, assigns(:repository) |
... | ... | @@ -92,6 +96,7 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase |
92 | 96 | Kalibro::Configuration.expects(:configuration_of).with(@repository.id).returns(@configuration) |
93 | 97 | |
94 | 98 | get :show, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id |
99 | + | |
95 | 100 | assert_equal @content.name, assigns(:project_name) |
96 | 101 | assert_equal @repository, assigns(:repository) |
97 | 102 | assert_equal @configuration.name, assigns(:configuration_name) | ... | ... |
plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb
1 | -<h2><%= @project_content.name %> Project</h2> | |
1 | +<h3> <%= link_to( @project_name, homepage_url(@data_profile, @project_name.downcase.gsub(/[^0-9A-Za-z]/, '')) ) %></h3> | |
2 | 2 | |
3 | 3 | <% form_for :repository, :url => {:action =>"update", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> |
4 | - <%= hidden_field_tag :id, @project_content.id %> | |
4 | + <%= hidden_field_tag :id, @project_content_id %> | |
5 | 5 | |
6 | 6 | <%= f.hidden_field :id%> |
7 | 7 | <%= required labelled_form_field _('Name:'), f.text_field(:name) %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_repository/new.html.erb
1 | -<h2><%= @project_content.name %> Project</h2> | |
1 | +<h3> <%= link_to( @project_name, homepage_url(@data_profile, @project_name.downcase.gsub(/[^0-9A-Za-z]/, '')) ) %></h3> | |
2 | 2 | |
3 | 3 | <% form_for :repository, :url => {:action =>"create", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> |
4 | - <%= hidden_field_tag :id, @project_content.id %> | |
4 | + <%= hidden_field_tag :id, @project_content_id %> | |
5 | 5 | |
6 | 6 | <%= required labelled_form_field _('Name:'), f.text_field(:name) %> |
7 | 7 | ... | ... |