Commit 1bf2c6617b801c2fd55a36e270aa8393fe5387f1

Authored by João M. M. da Silva
Committed by Alessandro Palmeira
1 parent 958f621c

[Mezuro] show a proper message to when a project exists in mezuro but

not in kalibro
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
@@ -6,15 +6,11 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController @@ -6,15 +6,11 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController
6 @project_content = profile.articles.find(params[:id]) 6 @project_content = profile.articles.find(params[:id])
7 7
8 @repository_types = Kalibro::Repository.repository_types 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 9
14 configurations = Kalibro::Configuration.all 10 configurations = Kalibro::Configuration.all
15 - @configuration_select = []  
16 - configurations.each do |configuration|  
17 - @configuration_select.push [configuration.name,configuration.id] 11 + configurations = [] if (configurations.nil?)
  12 + @configuration_select = configurations.map do |configuration|
  13 + [configuration.name,configuration.id]
18 end 14 end
19 end 15 end
20 16
plugins/mezuro/lib/mezuro_plugin/project_content.rb
@@ -41,7 +41,11 @@ class MezuroPlugin::ProjectContent < Article @@ -41,7 +41,11 @@ class MezuroPlugin::ProjectContent < Article
41 end 41 end
42 42
43 def description 43 def description
44 - @description ||= project.description 44 + begin
  45 + @description ||= project.description
  46 + rescue
  47 + @description = ""
  48 + end
45 @description 49 @description
46 end 50 end
47 51
@@ -79,6 +83,7 @@ class MezuroPlugin::ProjectContent < Article @@ -79,6 +83,7 @@ class MezuroPlugin::ProjectContent < Article
79 83
80 def create_kalibro_project 84 def create_kalibro_project
81 Kalibro::Project.create( 85 Kalibro::Project.create(
  86 + :id => project_id,
82 :name => name, 87 :name => name,
83 :description => description 88 :description => description
84 ) 89 )
plugins/mezuro/views/content_viewer/show_project.rhtml
1 <% @project = @page.project %> 1 <% @project = @page.project %>
2 <% unless @page.errors[:base].nil? %> 2 <% unless @page.errors[:base].nil? %>
3 - <% if @page.errors[:base] =~ /There is no project named/ %> 3 + <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %>
4 <h3>Warning:</h3> 4 <h3>Warning:</h3>
5 <p>This project doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p> 5 <p>This project doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p>
6 <% else %> 6 <% else %>
@@ -28,11 +28,16 @@ @@ -28,11 +28,16 @@
28 :action => "show", 28 :action => "show",
29 :id => @page.id, 29 :id => @page.id,
30 :repository_id => repository.id %></td> 30 :repository_id => repository.id %></td>
31 - <td><%= link_to "#{image_tag ('/plugins/mezuro/images/minus.png')}", :controller => "mezuro_plugin_repository", 31 + <td ><%= link_to _('Edit'), {:controller => "mezuro_plugin_repository",
  32 + :profile => @page.profile.identifier,
  33 + :action => "edit",
  34 + :id => @page.id,
  35 + :repository_id => repository.id}, :class=>"button with-text icon-edit" %></td>
  36 + <td ><%= link_to _('Remove'), {:controller => "mezuro_plugin_repository",
32 :profile => @page.profile.identifier, 37 :profile => @page.profile.identifier,
33 :action => "destroy", 38 :action => "destroy",
34 :id => @page.id, 39 :id => @page.id,
35 - :repository_id => repository.id %></td> 40 + :repository_id => repository.id}, :class=>"button with-text icon-delete" %></td>
36 </tr> 41 </tr>
37 <% end %> 42 <% end %>
38 </table> 43 </table>