Commit 253ca723bb857784e33d2f6d899887e534dc4cca
Committed by
Alessandro Palmeira
1 parent
01df2458
Exists in
master
and in
29 other branches
[Mezuro] Draft to show_repository view
Showing
3 changed files
with
36 additions
and
124 deletions
Show diff stats
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
... | ... | @@ -32,6 +32,13 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController |
32 | 32 | end |
33 | 33 | end |
34 | 34 | |
35 | + def show_repository | |
36 | + project_content = profile.articles.find(params[:id]) | |
37 | + @project_name = project_content.name | |
38 | + @repository = project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_s }.first | |
39 | + @configuration_name = Kalibro::Configuration.find(@repository.configuration_id).name | |
40 | + end | |
41 | + | |
35 | 42 | def processing(repository_id) |
36 | 43 | begin |
37 | 44 | if Kalibro::Processing.has_ready_processing(repository_id) | ... | ... |
plugins/mezuro/views/content_viewer/show_project.rhtml
... | ... | @@ -22,6 +22,11 @@ |
22 | 22 | <%= _('Repositories') %> |
23 | 23 | <% @page.repositories.each do |repository| %> |
24 | 24 | <%= repository.name %> |
25 | + <%= link_to repository.name, :controller => "mezuro_plugin_repository", | |
26 | + :profile => @page.profile.identifier, | |
27 | + :action => "show_repository", | |
28 | + :id => @page.id, | |
29 | + :repository_id => repository.id %><br/> | |
25 | 30 | <% end %> |
26 | 31 | |
27 | 32 | <br> | ... | ... |
plugins/mezuro/views/mezuro_plugin_repository/show_repository.html.erb
1 | -<h1> <%= _(MezuroPlugin::ProjectContent.short_description) %> </h1> | |
2 | - | |
3 | -<% | |
4 | - @project = @article.title.nil? ? nil : @article.project | |
5 | - begin | |
6 | - @repository_types = Kalibro::Repository.repository_types.sort | |
7 | - @configuration_names = Kalibro::Configuration.all_names.sort | |
8 | - rescue Exception => exception | |
9 | - @article.errors.add_to_base(exception.message) | |
10 | - @repository_types = [] | |
11 | - @configuration_names = [] | |
12 | - end | |
13 | -%> | |
14 | - | |
15 | -<%= error_messages_for 'project_content' %> | |
16 | - | |
17 | -<%= hidden_field_tag 'project_content[profile_id]', profile.id %> | |
18 | -<%= hidden_field_tag 'id', @article.id %> | |
19 | - | |
20 | -<%= required_fields_message %> | |
21 | -<% if !@project.nil? && !@article.id.nil? %> | |
22 | - <%= required f.text_field(:name, :disabled => 'true') %> | |
23 | -<% else %> | |
24 | - <%= required f.text_field(:name) %> | |
25 | -<% end %> | |
26 | - | |
27 | -<% selected = (@project.nil? ? "" : @project.license) %> | |
28 | -<%= required labelled_form_field _('License'), | |
29 | - f.select(:project_license, MezuroPlugin::Helpers::ContentViewerHelper.create_license_options ,{:selected => selected}) %><br/> | |
30 | - | |
31 | -<%= f.text_field :description %><br/> | |
32 | - | |
33 | -<% @selected = (@project.nil? ? @repository_types : @project.repository.type) %> | |
34 | -<%= required labelled_form_field _('Repository type'), | |
35 | - f.select(:repository_type, @repository_types, {:selected => @selected}) %><br/> | |
36 | - | |
37 | -<%= required f.text_field(:repository_url) %><br/> | |
38 | - | |
39 | -<% @selected = (@project.nil? ? @configuration_names[0] : @project.configuration_name) %> | |
40 | - | |
41 | -<% if !@project.nil? && !@article.id.nil? %> | |
42 | - <%= required labelled_form_field _('Configuration') + " (Changing the configuration will erase your saved periodic avaliations)", | |
43 | - f.select(:configuration_name, @configuration_names, {:selected => @selected}) %> | |
44 | -<% else %> | |
45 | - <%= required labelled_form_field _('Configuration'), | |
46 | - f.select(:configuration_name, @configuration_names, {:selected => @selected}) %><br/> | |
47 | -<% end %> | |
48 | - | |
49 | -<% selected = (@project.nil? ? 0 : @project.process_period.to_i) %> | |
50 | -<%= required labelled_form_field _('Periodic Avaliation'), | |
51 | - f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => selected}) %><br/> | |
52 | - | |
53 | - | |
54 | - | |
55 | - | |
56 | - | |
57 | - | |
58 | - | |
59 | - | |
60 | - ************************************* | |
61 | - | |
62 | - | |
63 | - | |
64 | - | |
65 | - <script src="/plugins/mezuro/javascripts/project_content.js" type="text/javascript"></script> | |
66 | - | |
67 | -<% @project = @page.project %> | |
68 | -<% unless @page.errors[:base].nil? %> | |
69 | - <% if @page.errors[:base] =~ /There is no project named/ %> | |
70 | - <h3>Warning:</h3> | |
71 | - <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> | |
72 | - <% else %> | |
73 | - <%= @page.errors[:base] %> | |
74 | - <% end %> | |
75 | -<% else %> | |
76 | - | |
77 | - <table> | |
78 | - <tr> | |
79 | - <td><%= _('Name') %></td> | |
80 | - <td><%= @project.name %></td> | |
81 | - </tr> | |
82 | - <tr> | |
83 | - <td><%= _('License') %></td> | |
84 | - <td><%= @project.license %></td> | |
85 | - </tr> | |
86 | - <tr> | |
87 | - <td><%= _('Description') %></td> | |
88 | - <td><%= @project.description %></td> | |
89 | - </tr> | |
90 | - <tr> | |
91 | - <td><%= _('Repository type') %></td> | |
92 | - <td><%= @project.repository.type %></td> | |
93 | - </tr> | |
94 | - <tr> | |
95 | - <td><%= _('Repository address') %></td> | |
96 | - <td><%= @project.repository.address %></td> | |
97 | - </tr> | |
98 | - <tr> | |
99 | - <td><%= _('Configuration') %></td> | |
100 | - <td><%= @project.configuration_name %></td> | |
101 | - </tr> | |
102 | - <tr> | |
103 | - <td><%= _('Periodicity') %></td> | |
104 | - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.get_periodicity_option(@page.periodicity_in_days) %></td> | |
105 | - </tr> | |
106 | - <tr> | |
107 | - <td><%= _('Status')%></td> | |
108 | - <td> | |
109 | - <div id="project-state" style="color:DarkGoldenRod"><%= @project.state %></div> | |
110 | - <div id="msg-time"></div> | |
111 | - </td> | |
112 | - </tr> | |
113 | - </table> | |
114 | - | |
115 | - <br /> | |
116 | - | |
117 | - <div id="project-result" data-profile="<%= @page.profile.identifier %>" data-content="<%= @page.id %>" | |
118 | - data-project-name="<%= @project.name %>"> | |
119 | - </div> | |
120 | - <div id="project-tree"></div> | |
121 | - <div id="module-result"> | |
122 | - </div> | |
123 | -<% end %> | |
124 | - | |
1 | + <p> | |
2 | + <%= "Project Name: " + @project_name %> | |
3 | + </p> | |
4 | + <p> | |
5 | + <%= "Name: " + @repository.name %> | |
6 | + </p> | |
7 | + <p> | |
8 | + <%= "Description: " + @repository.description %> | |
9 | + </p> | |
10 | + <p> | |
11 | + <%= "License: " + @repository.license %> | |
12 | + </p> | |
13 | + <p> | |
14 | + <%= "Process Period: " + @repository.process_period %> | |
15 | + </p> | |
16 | + <p> | |
17 | + <%= "Type: " + @repository.type %> | |
18 | + </p> | |
19 | + <p> | |
20 | + <%= "Address: " + @repository.address %> | |
21 | + </p> | |
22 | + <p> | |
23 | + <%= "Configuration: " + @configuration_name %> | |
24 | + </p> | ... | ... |