Commit d8f78c1653323a05b731ca3df596c051c229fa65
1 parent
d02c2ee7
Exists in
master
and in
5 other branches
Move name and image fields from community to software edit page
Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com> Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
17 changed files
with
86 additions
and
45 deletions
Show diff stats
controllers/software_communities_plugin_myprofile_controller.rb
... | ... | @@ -40,6 +40,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
40 | 40 | update_software_atributes |
41 | 41 | |
42 | 42 | return unless request.post? |
43 | + | |
43 | 44 | @software_info = constroy_software |
44 | 45 | software_info_insert_models.call(@list_libraries, 'libraries') |
45 | 46 | software_info_insert_models.call(@list_languages, 'software_languages') |
... | ... | @@ -48,6 +49,10 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
48 | 49 | |
49 | 50 | begin |
50 | 51 | @software_info.save! |
52 | + | |
53 | + @community = @software_info.community | |
54 | + @community.update_attributes!(params[:community]) | |
55 | + | |
51 | 56 | if params[:commit] == _('Save and Configure Community') |
52 | 57 | redirect_to :controller => 'profile_editor', :action => 'edit' |
53 | 58 | else |
... | ... | @@ -155,6 +160,8 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
155 | 160 | params[:software_info].merge({ |
156 | 161 | :environment => environment, |
157 | 162 | :name => params[:community][:name], |
163 | + :identifier => params[:community][:identifier], | |
164 | + :image_builder => params[:community][:image_builder], | |
158 | 165 | :license_info => @license_info, |
159 | 166 | :another_license_version => another_license_version, |
160 | 167 | :another_license_link => another_license_link })) | ... | ... |
features/public_software_validation.feature
... | ... | @@ -16,7 +16,7 @@ Feature: edit adherent fields |
16 | 16 | And I press "Save changes" |
17 | 17 | And I go to /myprofile/mpog-admin |
18 | 18 | And I follow "Create a new software" |
19 | - And I fill in "community_name" with "basic software" | |
19 | + And I fill in "community_name_id" with "basic software" | |
20 | 20 | And I fill in "software_info_finality" with "basic software finality" |
21 | 21 | And I press "Create" |
22 | 22 | ... | ... |
features/software_registration.feature
... | ... | @@ -12,7 +12,7 @@ Feature: edit public software information |
12 | 12 | And I press "Save changes" |
13 | 13 | And I go to /myprofile/mpog-admin |
14 | 14 | And I follow "Create a new software" |
15 | - And I fill in "community_name" with "basic software" | |
15 | + And I fill in "community_name_id" with "basic software" | |
16 | 16 | And I fill in "software_info_finality" with "basic software finality" |
17 | 17 | And I type in "gp" in autocomplete list "#license_info_version" and I choose "GPL-2" |
18 | 18 | And I press "Create" | ... | ... |
features/step_definitions/software_communities_steps.rb
... | ... | @@ -131,6 +131,8 @@ Given /^the following softwares$/ do |table| |
131 | 131 | software_info.community = Community.create(:name=>item[:name]) |
132 | 132 | |
133 | 133 | software_info.acronym = item[:acronym] if item[:acronym] |
134 | + software_info.finality = item[:finality] if item[:finality] | |
135 | + software_info.finality ||= "something" | |
134 | 136 | software_info.operating_platform = item[:operating_platform] if item[:operating_platform] |
135 | 137 | software_info.objectives = item[:objectives] if item[:objectives] |
136 | 138 | software_info.features = item[:features] if item[:features] | ... | ... |
lib/software_info.rb
... | ... | @@ -159,6 +159,8 @@ class SoftwareInfo < ActiveRecord::Base |
159 | 159 | def self.create_after_moderation(requestor, attributes = {}) |
160 | 160 | environment = attributes.delete(:environment) |
161 | 161 | name = attributes.delete(:name) |
162 | + identifier = attributes.delete(:identifier) | |
163 | + image_builder = attributes.delete(:image_builder) | |
162 | 164 | license_info = attributes.delete(:license_info) |
163 | 165 | another_license_version = attributes.delete(:another_license_version) |
164 | 166 | another_license_link = attributes.delete(:another_license_link) |
... | ... | @@ -175,7 +177,12 @@ class SoftwareInfo < ActiveRecord::Base |
175 | 177 | ) |
176 | 178 | else |
177 | 179 | software_template = Community["software"] |
178 | - community = Community.new(:name => name) | |
180 | + | |
181 | + community_hash = {:name => name} | |
182 | + community_hash[:identifier] = identifier | |
183 | + community_hash[:image_builder] = image_builder if image_builder | |
184 | + | |
185 | + community = Community.new(community_hash) | |
179 | 186 | community.environment = environment |
180 | 187 | |
181 | 188 | if (!software_template.blank? && software_template.is_template) | ... | ... |
public/style.css
test/functional/profile_editor_controller_test.rb
... | ... | @@ -119,7 +119,7 @@ class ProfileEditorControllerTest < ActionController::TestCase |
119 | 119 | community |
120 | 120 | end |
121 | 121 | |
122 | - def create_software_info name, finality = "", acronym = "" | |
122 | + def create_software_info name, finality = "something", acronym = "" | |
123 | 123 | community = create_community(name) |
124 | 124 | software_info = SoftwareInfo.new |
125 | 125 | software_info.community = community | ... | ... |
test/functional/software_communities_plugin_myprofile_controller_test.rb
... | ... | @@ -225,8 +225,8 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC |
225 | 225 | |
226 | 226 | post( |
227 | 227 | :new_software, |
228 | - :community => {:name =>"New Software"}, | |
229 | - :software_info => {:finality => "", :repository_link => ""}, | |
228 | + :community => {:name =>"New Software", :identifier => "new-software"}, | |
229 | + :software_info => {:finality => "something", :repository_link => ""}, | |
230 | 230 | :license =>{:license_infos_id => LicenseInfo.last.id}, |
231 | 231 | :profile => @person.identifier |
232 | 232 | ) |
... | ... | @@ -243,8 +243,8 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC |
243 | 243 | |
244 | 244 | post( |
245 | 245 | :new_software, |
246 | - :community => { :name =>"New Software" }, | |
247 | - :software_info => { :finality => "", :repository_link => "" }, | |
246 | + :community => { :name => "New Software", :identifier => "new-software" }, | |
247 | + :software_info => { :finality => "something", :repository_link => "" }, | |
248 | 248 | :license => { :license_infos_id => license_another.id, |
249 | 249 | :version => another_license_version, |
250 | 250 | :link=> another_license_link | ... | ... |
test/helpers/plugin_test_helper.rb
... | ... | @@ -13,14 +13,15 @@ module PluginTestHelper |
13 | 13 | community |
14 | 14 | end |
15 | 15 | |
16 | - def create_software_info name, finality = "", acronym = "" | |
16 | + def create_software_info name, finality = "something", acronym = "" | |
17 | 17 | community = create_community(name) |
18 | 18 | software_info = SoftwareInfo.new |
19 | 19 | software_info.community = community |
20 | 20 | software_info.finality = finality |
21 | 21 | software_info.acronym = acronym |
22 | 22 | software_info.public_software = true |
23 | - software_info.save | |
23 | + software_info.save! | |
24 | + | |
24 | 25 | software_info |
25 | 26 | end |
26 | 27 | ... | ... |
test/unit/software_info_validation_test.rb
... | ... | @@ -40,7 +40,8 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase |
40 | 40 | :e_arq => true, |
41 | 41 | :operating_platform => true, |
42 | 42 | :objectives => "", |
43 | - :features => "" | |
43 | + :features => "", | |
44 | + :finality => "something" | |
44 | 45 | ) |
45 | 46 | @software_info.software_languages << @software_language |
46 | 47 | @software_info.software_databases << @software_database | ... | ... |
test/unit/software_registration_test.rb
... | ... | @@ -30,7 +30,8 @@ class SoftwareRegistrationTest < ActiveSupport::TestCase |
30 | 30 | task = CreateSoftware.create!( |
31 | 31 | :name => "Teste Two", |
32 | 32 | :requestor => person, |
33 | - :environment => @environment | |
33 | + :environment => @environment, | |
34 | + :finality => "something" | |
34 | 35 | ) |
35 | 36 | |
36 | 37 | software_count = SoftwareInfo.count | ... | ... |
views/profile_editor/_software_community.html.erb
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | <%= required_fields_message %> |
4 | 4 | |
5 | - <%= required f.text_field(:name) %> | |
6 | - | |
7 | 5 | <%= @plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }.join("") %> |
8 | 6 | |
9 | 7 | <% if @environment.enabled?('enable_organization_url_change') %> | ... | ... |
views/profile_editor/edit_software_community.html.erb
... | ... | @@ -21,16 +21,6 @@ |
21 | 21 | |
22 | 22 | <%= render :partial => 'software_community', :locals => { :f => f } %> |
23 | 23 | |
24 | - <div id="profile_change_picture_title"> | |
25 | - <h2><%= _('Change picture') %></h2> | |
26 | - <span><%= unchangeable_privacy_field @profile %></span> | |
27 | - </div> | |
28 | - <div id="profile_change_picture"> | |
29 | - <%= f.fields_for :image_builder, @profile.image do |i| %> | |
30 | - <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> | |
31 | - <% end %> | |
32 | - </div> | |
33 | - | |
34 | 24 | <h2><%= _('Privacy options') %></h2> |
35 | 25 | |
36 | 26 | <% if profile.person? %> | ... | ... |
views/software_communities_plugin_myprofile/_license_info_fields.html.erb
... | ... | @@ -2,7 +2,6 @@ |
2 | 2 | <input type="hidden" id = "version_<%=license.id %>" value = "<%=license.link%>"> |
3 | 3 | <% end %> |
4 | 4 | |
5 | -<h3><%= _("License Version: ") %></h3> | |
6 | 5 | <%= text_field_tag "license_info[version]", license_version, :id=>"license_info_version", :class=>"license_info_version", :placeholder=>_('Autocomplete field, type some license') %> |
7 | 6 | <%= hidden_field_tag "license[license_infos_id]", license_id, :id=>"license_info_id", :class=>"license_info_id", :data => {:label=>license_version} %> |
8 | 7 | ... | ... |
views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb
1 | 1 | <h1><%= @profile.software_info.name + _(' Information') %></h1> |
2 | 2 | |
3 | +<h3> <%= _("Name") %> </h3> | |
4 | +<div id="name"> | |
5 | + <%= text_field_tag("community[name]", @profile.name) %> | |
6 | +</div> | |
7 | + | |
3 | 8 | <h3> <%= _("Acronym") %> </h3> |
4 | 9 | <div id="acronym"> |
5 | 10 | <%= text_field_tag("software[acronym]", @profile.software_info.acronym, :maxlength=>"10") %> |
... | ... | @@ -7,9 +12,19 @@ |
7 | 12 | |
8 | 13 | <h3> <%= _("Finality") %> </h3> |
9 | 14 | <div id="finality"> |
10 | - <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("It is a software of..."), :cols => 40, :rows => 5, :maxlength => 140%> | |
15 | + <%= text_area_tag "software[finality]", @profile.software_info.finality, :placeholder => _("What is the software for?"), :maxlength => 120 %> | |
16 | +</div> | |
17 | + | |
18 | +<div id="profile_change_picture_title"> | |
19 | + <h3><%= _('Software Logo') %></h3> | |
20 | +</div> | |
21 | +<div id="profile_change_picture"> | |
22 | + <%= f.fields_for :image_builder, @profile.image do |i| %> | |
23 | + <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> | |
24 | + <% end %> | |
11 | 25 | </div> |
12 | 26 | |
27 | +<h3><%= _("License Version: ") %></h3> | |
13 | 28 | <div id='licenses'> |
14 | 29 | <%= render :partial => "license_info_fields", :locals => { |
15 | 30 | :license_version => @license_version, |
... | ... | @@ -25,3 +40,4 @@ |
25 | 40 | <%= text_field_tag("software[repository_link]", @profile.software_info.repository_link, :class => "improve_input_size") %> |
26 | 41 | </div> |
27 | 42 | |
43 | + | ... | ... |
views/software_communities_plugin_myprofile/edit_software.html.erb
1 | 1 | <% tabs = [] %> |
2 | 2 | |
3 | -<%= error_messages_for :software_info %> | |
3 | +<%= error_messages_for :software_info, :community %> | |
4 | 4 | |
5 | -<%= labelled_form_for :software_communities_plugin_myprofile, :html => { :multipart => true, :id => 'edit-form' } do |f| %> | |
5 | +<%= labelled_form_for :community, :html => { :multipart => true, :id => 'edit-form' } do |f| %> | |
6 | 6 | |
7 | -<% tabs << {:title => _("Software"), :id => 'basic-info', | |
8 | - :content => (render :partial => 'main_software_editor_extras')} %> | |
7 | + <% tabs << {:title => _("Software"), :id => 'basic-info', | |
8 | + :content => (render :partial => 'main_software_editor_extras', :locals => {:f => f})} %> | |
9 | 9 | |
10 | -<% tabs << {:title => _("Specifications"), :id => 'especific-info', | |
11 | - :content => (render :partial => 'public_software_info')} %> | |
10 | + <% tabs << {:title => _("Specifications"), :id => 'especific-info', | |
11 | + :content => (render :partial => 'public_software_info')} %> | |
12 | 12 | |
13 | -<%= render_tabs(tabs) %> | |
13 | + <%= render_tabs(tabs) %> | |
14 | 14 | |
15 | -<% button_bar do %> | |
15 | + <% button_bar do %> | |
16 | 16 | <%= submit_button(:save, _('Save')) %> |
17 | 17 | <%= submit_button(:save, _('Save and Configure Community')) %> |
18 | 18 | <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> |
19 | -<% end %> | |
19 | + <% end %> | |
20 | 20 | <% end %> | ... | ... |
views/software_communities_plugin_myprofile/new_software.html.erb
... | ... | @@ -43,23 +43,37 @@ |
43 | 43 | <div id='software-name-field' class='formfield'> |
44 | 44 | |
45 | 45 | <span id='software-hostname'><%= environment.default_hostname %>/</span> |
46 | - <%= required text_field(:community, :name, :size => 30, :maxlength => 100) %> | |
46 | + <%= required text_field(:community, :identifier, :size => 30, :maxlength => 100) %> | |
47 | 47 | </div> |
48 | 48 | |
49 | 49 | <%= fields_for @software_info do |swf| %> |
50 | - <div class="formfield type-text"> | |
50 | + <div id="finality" class="formfield type-text"> | |
51 | 51 | <%= swf.label("finality" ,_("Finality"), :class=>"formlabel") %> |
52 | - <%= required swf.text_area(:finality, :placeholder => _("What is the software?"), :cols => 40, :rows => 5, :maxlength => 140) %> | |
52 | + <%= required swf.text_area(:finality, :placeholder => _("What is the software for?"), :maxlength => 120) %> | |
53 | 53 | </div> |
54 | 54 | <% end %> |
55 | 55 | |
56 | - <div class="formfieldline"> | |
57 | - <%= render :partial => "license_info_fields", :locals => { | |
58 | - :license_version => "", | |
59 | - :license_id => "", | |
60 | - :another_version=>"", | |
61 | - :another_link=>"" | |
62 | - } %> | |
56 | + <div id="profile_change_picture_title" class="formlabel"> | |
57 | + <label> | |
58 | + <%= _('Software Logo') %> | |
59 | + </label> | |
60 | + </div> | |
61 | + <div id="profile_change_picture"> | |
62 | + <%= f.fields_for :image_builder, @community.image do |i| %> | |
63 | + <%= file_field_or_thumbnail(_('Image:'), @community.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> | |
64 | + <% end %> | |
65 | + </div> | |
66 | + | |
67 | + <div id="profile_change_picture_title" class="formlabel formfieldline"> | |
68 | + <label> | |
69 | + <%= _("License Version: ") %> | |
70 | + </label> | |
71 | + <%= render :partial => "license_info_fields", :locals => { | |
72 | + :license_version => "", | |
73 | + :license_id => "", | |
74 | + :another_version=>"", | |
75 | + :another_link=>"" | |
76 | + } %> | |
63 | 77 | </div> |
64 | 78 | |
65 | 79 | <%= fields_for @software_info do |swf| %> | ... | ... |