Commit 00994564df2aa7a1627ae86b5eff91bf42efc035
Committed by
Alessandro Palmeira
1 parent
a26ae65f
Exists in
master
and in
28 other branches
[Mezuro] show a proper message to when a project exists in mezuro but
not in kalibro
Showing
3 changed files
with
17 additions
and
11 deletions
Show diff stats
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
| ... | ... | @@ -6,15 +6,11 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
| 6 | 6 | @project_content = profile.articles.find(params[:id]) |
| 7 | 7 | |
| 8 | 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 | 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 | 14 | end |
| 19 | 15 | end |
| 20 | 16 | ... | ... |
plugins/mezuro/lib/mezuro_plugin/project_content.rb
| ... | ... | @@ -41,7 +41,11 @@ class MezuroPlugin::ProjectContent < Article |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | def description |
| 44 | - @description ||= project.description | |
| 44 | + begin | |
| 45 | + @description ||= project.description | |
| 46 | + rescue | |
| 47 | + @description = "" | |
| 48 | + end | |
| 45 | 49 | @description |
| 46 | 50 | end |
| 47 | 51 | |
| ... | ... | @@ -79,6 +83,7 @@ class MezuroPlugin::ProjectContent < Article |
| 79 | 83 | |
| 80 | 84 | def create_kalibro_project |
| 81 | 85 | Kalibro::Project.create( |
| 86 | + :id => project_id, | |
| 82 | 87 | :name => name, |
| 83 | 88 | :description => description |
| 84 | 89 | ) | ... | ... |
plugins/mezuro/views/content_viewer/show_project.rhtml
| 1 | 1 | <% @project = @page.project %> |
| 2 | 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 | 4 | <h3>Warning:</h3> |
| 5 | 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 | 6 | <% else %> |
| ... | ... | @@ -28,11 +28,16 @@ |
| 28 | 28 | :action => "show", |
| 29 | 29 | :id => @page.id, |
| 30 | 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 | 37 | :profile => @page.profile.identifier, |
| 33 | 38 | :action => "destroy", |
| 34 | 39 | :id => @page.id, |
| 35 | - :repository_id => repository.id %></td> | |
| 40 | + :repository_id => repository.id}, :class=>"button with-text icon-delete" %></td> | |
| 36 | 41 | </tr> |
| 37 | 42 | <% end %> |
| 38 | 43 | </table> | ... | ... |