Commit 1c11f03321e6d5a3e792e0f9902fde856e7be97b
1 parent
d99a6c2b
Exists in
master
and in
5 other branches
Add software creation steps message and its test
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com> Signed-off-by: Parley Martins <parley@outlook.com>
Showing
8 changed files
with
70 additions
and
45 deletions
Show diff stats
controllers/mpog_software_plugin_myprofile_controller.rb
... | ... | @@ -47,26 +47,10 @@ class MpogSoftwarePluginMyprofileController < MyProfileController |
47 | 47 | redirect_to :controller => 'profile_editor', :action => 'edit', :profile => @community.identifier |
48 | 48 | end |
49 | 49 | else |
50 | - # @list_libraries.each do |lib| | |
51 | - # @errors |= lib.errors.full_messages | |
52 | - # end | |
53 | - # | |
54 | - # @list_languages.each do |lng| | |
55 | - # @errors |= lng.errors.full_messages | |
56 | - # end | |
57 | - # | |
58 | - # @list_databases.each do |db| | |
59 | - # @errors |= db.errors.full_messages | |
60 | - # end | |
61 | - | |
62 | - # @list_operating_systems.each do |os| | |
63 | - # @errors |= os.errors.full_messages | |
64 | - # end | |
65 | 50 | |
66 | 51 | @errors |= @community.errors.full_messages |
67 | 52 | @errors |= @software_info.errors.full_messages |
68 | 53 | @errors |= @license_info.errors.full_messages |
69 | - # @errors |= @software_categories.errors.full_messages | |
70 | 54 | end |
71 | 55 | end |
72 | 56 | ... | ... |
features/software_registration.feature
... | ... | @@ -19,7 +19,7 @@ Feature: edit public software information |
19 | 19 | @selenium |
20 | 20 | Scenario: Show SoftwareLangue fields when click in New Language |
21 | 21 | Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software |
22 | - When I follow "Public Software" | |
22 | + When I follow "Specifications" | |
23 | 23 | And I follow "New language" |
24 | 24 | And I should see "3" of this selector ".software-language-table" |
25 | 25 | And I follow "Delete" |
... | ... | @@ -29,7 +29,7 @@ Feature: edit public software information |
29 | 29 | @selenium |
30 | 30 | Scenario: Show databasefields when click in New database |
31 | 31 | Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software |
32 | - When I follow "Public Software" | |
32 | + When I follow "Specifications" | |
33 | 33 | And I follow "New Database" |
34 | 34 | And I should see "3" of this selector ".database-table" |
35 | 35 | And I follow "Delete" |
... | ... | @@ -39,7 +39,7 @@ Feature: edit public software information |
39 | 39 | @selenium |
40 | 40 | Scenario: Software database name should be an autocomplete |
41 | 41 | Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software |
42 | - When I follow "Public Software" | |
42 | + When I follow "Specifications" | |
43 | 43 | And I follow "New Database" |
44 | 44 | And I type in "my" into autocomplete list "database_autocomplete" and I choose "MySQL" |
45 | 45 | Then selector ".database_autocomplete" should have any "MySQL" |
... | ... | @@ -47,7 +47,7 @@ Feature: edit public software information |
47 | 47 | @selenium |
48 | 48 | Scenario: Software database name should be an autocomplete |
49 | 49 | Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software |
50 | - When I follow "Public Software" | |
50 | + When I follow "Specifications" | |
51 | 51 | And I follow "New language" |
52 | 52 | And I type in "py" into autocomplete list "language_autocomplete" and I choose "Python" |
53 | 53 | Then selector ".database_autocomplete" should have any "Python" |
... | ... | @@ -55,7 +55,7 @@ Feature: edit public software information |
55 | 55 | @selenium |
56 | 56 | Scenario: Create software with all dynamic table fields filled |
57 | 57 | Given I go to /myprofile/basic-software/plugin/mpog_software/edit_software |
58 | - When I follow "Public Software" | |
58 | + When I follow "Specifications" | |
59 | 59 | And I follow "New language" |
60 | 60 | And I type in "py" into autocomplete list "language_autocomplete" and I choose "Python" |
61 | 61 | And I fill in "language__version" with "1.2.3" |
... | ... | @@ -66,10 +66,20 @@ Feature: edit public software information |
66 | 66 | And I fill in "database__operating_system" with "Unix" |
67 | 67 | Then I press "Save" |
68 | 68 | And I follow "Software Info" |
69 | - And I follow "Public Software" | |
69 | + And I follow "Specifications" | |
70 | 70 | And selector ".language_autocomplete" should have any "Python" |
71 | 71 | And selector "#language__version" should have any "1.2.3" |
72 | 72 | And selector "#language__operating_system" should have any "Unix" |
73 | 73 | And selector ".database_autocomplete" should have any "MySQL" |
74 | 74 | And selector "#database__version" should have any "4.5.6" |
75 | 75 | And selector "#database__operating_system" should have any "Unix" |
76 | + | |
77 | + @selenium | |
78 | + Scenario: Message second step of creation in edit software community | |
79 | + Given the following softwares | |
80 | + | name | | |
81 | + | New Software | | |
82 | + And I go to /myprofile/new-software/profile_editor/edit | |
83 | + Then I should see "Step 2/2 - Software Community Configuration" | |
84 | + And I go to /myprofile/new-software/profile_editor/edit | |
85 | + Then I should not see "Step 2/2 - Software Community Configuration" | ... | ... |
lib/mpog_software_plugin.rb
... | ... | @@ -59,6 +59,12 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
59 | 59 | elsif context.profile.respond_to? :institution and !context.profile.institution.nil? |
60 | 60 | @show_sisp_field = show_sisp_field |
61 | 61 | expanded_template('institution_editor_extras.html.erb') |
62 | + elsif context.profile.respond_to? :software_info and !context.profile.software_info.nil? | |
63 | + if context.profile.software_info.first_edit? | |
64 | + context.profile.software_info.first_edit = false | |
65 | + context.profile.software_info.save! | |
66 | + expanded_template('first_edit_software_community_extras.html.erb') | |
67 | + end | |
62 | 68 | end |
63 | 69 | end |
64 | 70 | ... | ... |
lib/software_info.rb
1 | 1 | class SoftwareInfo < ActiveRecord::Base |
2 | - attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform, :demonstration_url, :acronym, :objectives, :features, :license_infos_id, :community_id, :finality, :repository_link, :public_software | |
3 | - | |
4 | - has_many :libraries, :dependent => :destroy | |
5 | - has_many :software_databases | |
6 | - has_many :database_descriptions, :through => :software_databases | |
7 | - has_many :software_languages | |
8 | - has_many :operating_systems | |
9 | - has_many :programming_languages, :through => :software_languages | |
10 | - has_many :operating_system_names, :through => :operating_systems | |
11 | - | |
12 | - belongs_to :community | |
13 | - belongs_to :license_info | |
14 | - | |
15 | - has_one :software_categories | |
16 | - | |
17 | - validates_length_of :finality, :maximum => 140 | |
18 | - validates_length_of :objectives, :maximum => 4000 | |
19 | - validates_length_of :features, :maximum => 4000 | |
20 | - | |
21 | - validate :validate_acronym | |
2 | + attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform, :demonstration_url, :acronym, :objectives, :features, :license_infos_id, :community_id, :finality, :repository_link, :public_software, :first_edit | |
3 | + | |
4 | + has_many :libraries, :dependent => :destroy | |
5 | + has_many :software_databases | |
6 | + has_many :database_descriptions, :through => :software_databases | |
7 | + has_many :software_languages | |
8 | + has_many :operating_systems | |
9 | + has_many :programming_languages, :through => :software_languages | |
10 | + has_many :operating_system_names, :through => :operating_systems | |
11 | + | |
12 | + belongs_to :community | |
13 | + belongs_to :license_info | |
14 | + | |
15 | + has_one :software_categories | |
16 | + | |
17 | + validates_length_of :finality, :maximum => 140 | |
18 | + validates_length_of :objectives, :maximum => 4000 | |
19 | + validates_length_of :features, :maximum => 4000 | |
20 | + | |
21 | + validate :validate_acronym | |
22 | 22 | |
23 | 23 | # used on find_by_contents |
24 | 24 | scope :like_search, lambda{ |name| | ... | ... |
public/mpog-software-validations.js
... | ... | @@ -105,9 +105,17 @@ |
105 | 105 | |
106 | 106 | function hide_show_public_software_fields() { |
107 | 107 | if (jQuery("#software_public_software").prop("checked")) |
108 | - jQuery(".public-software-fields").show(); | |
108 | + jQuery(".public-software-fields").show(); | |
109 | 109 | else |
110 | - jQuery(".public-software-fields").hide(); | |
110 | + jQuery(".public-software-fields").hide(); | |
111 | + } | |
112 | + | |
113 | + function replace_software_creations_step() { | |
114 | + var software_creation_step = jQuery("#software_creation_step").remove(); | |
115 | + | |
116 | + if( software_creation_step.size() > 0 ) { | |
117 | + jQuery("#profile-data").parent().prepend(software_creation_step); | |
118 | + } | |
111 | 119 | } |
112 | 120 | |
113 | 121 | jQuery(document).ready(function(){ |
... | ... | @@ -192,5 +200,7 @@ |
192 | 200 | }); |
193 | 201 | hide_show_public_software_fields(); |
194 | 202 | jQuery("#software_public_software").click(hide_show_public_software_fields); |
203 | + | |
204 | + replace_software_creations_step(); | |
195 | 205 | }); |
196 | 206 | })(); | ... | ... |
views/mpog_software_plugin_myprofile/new_software.html.erb
1 | - | |
2 | 1 | <%= javascript_include_tag "mpog-validations" %> |
3 | 2 | <%= stylesheet_link_tag('plugins/mpog_software/mpog-software') %> |
4 | 3 | |
4 | +<div id="software_creation_step"> | |
5 | + <h3><%= _("Step 1/2 - Software Creation")%></h3> | |
6 | +</div> | |
7 | + | |
5 | 8 | <h1><%= _('Creating new software') %></h1> |
6 | 9 | |
7 | 10 | <% if environment.enabled?('admin_must_approve_new_communities') %> | ... | ... |