Commit ade78acd11cb7ef07a0ac93f5ced4a0ac61f200b
Committed by
David Silva
1 parent
378f4396
Exists in
master
and in
5 other branches
Remove trailing whitespace
Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com> Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
3 changed files
with
56 additions
and
25 deletions
Show diff stats
lib/create_software.rb
@@ -4,7 +4,8 @@ class CreateSoftware < Task | @@ -4,7 +4,8 @@ class CreateSoftware < Task | ||
4 | validates_presence_of :requestor_id, :target_id | 4 | validates_presence_of :requestor_id, :target_id |
5 | validates_presence_of :name | 5 | validates_presence_of :name |
6 | 6 | ||
7 | - attr_accessible :name, :finality, :repository_link, :requestor, :environment, :reject_explanation, :license_info | 7 | + attr_accessible :name, :finality, :repository_link, :requestor, :environment, |
8 | + :reject_explanation, :license_info | ||
8 | 9 | ||
9 | alias :environment :target | 10 | alias :environment :target |
10 | alias :environment= :target= | 11 | alias :environment= :target= |
@@ -20,7 +21,8 @@ class CreateSoftware < Task | @@ -20,7 +21,8 @@ class CreateSoftware < Task | ||
20 | template_id = software_template.id | 21 | template_id = software_template.id |
21 | end | 22 | end |
22 | 23 | ||
23 | - community = Community.create!(:name => self.name, :template_id => template_id) | 24 | + community = Community.create!(:name => self.name, |
25 | + :template_id => template_id) | ||
24 | 26 | ||
25 | community.environment = self.environment | 27 | community.environment = self.environment |
26 | community.add_admin(self.requestor) | 28 | community.add_admin(self.requestor) |
@@ -34,20 +36,16 @@ class CreateSoftware < Task | @@ -34,20 +36,16 @@ class CreateSoftware < Task | ||
34 | _("New software") | 36 | _("New software") |
35 | end | 37 | end |
36 | 38 | ||
37 | - # def icon | ||
38 | - # src = image ? image.public_filename(:minor) : '/images/icons-app/community-minor.png' | ||
39 | - # {:type => :defined_image, :src => src, :name => name} | ||
40 | - # end | ||
41 | - | ||
42 | def subject | 39 | def subject |
43 | name | 40 | name |
44 | end | 41 | end |
45 | 42 | ||
46 | def information | 43 | def information |
44 | + message = _('%{requestor} wants to create software %{subject} with') | ||
47 | if finality.blank? | 45 | if finality.blank? |
48 | - { :message => _('%{requestor} wants to create software %{subject} with no finality.') } | 46 | + { :message => message + _(' no finality.') } |
49 | else | 47 | else |
50 | - { :message => _('%{requestor} wants to create software %{subject} with this finality:<p><em>%{finality}</em></p>'), | 48 | + { :message => message + _(' this finality:<p><em>%{finality}</em></p>'), |
51 | :variables => {:finality => finality} } | 49 | :variables => {:finality => finality} } |
52 | end | 50 | end |
53 | end | 51 | end |
@@ -67,32 +65,48 @@ class CreateSoftware < Task | @@ -67,32 +65,48 @@ class CreateSoftware < Task | ||
67 | end | 65 | end |
68 | 66 | ||
69 | def target_notification_description | 67 | def target_notification_description |
70 | - _('%{requestor} wants to create software %{subject}') % {:requestor => requestor.name, :subject => subject} | 68 | + _('%{requestor} wants to create software %{subject}') % |
69 | + {:requestor => requestor.name, :subject => subject} | ||
71 | end | 70 | end |
72 | 71 | ||
73 | def target_notification_message | 72 | def target_notification_message |
74 | - _("User \"%{user}\" just requested to create software %{software}. You have to approve or reject it through the \"Pending Validations\" section in your control panel.\n") % { :user => self.requestor.name, :software => self.name } | 73 | + _("User \"%{user}\" just requested to create software %{software}. |
74 | + You have to approve or reject it through the \"Pending Validations\" | ||
75 | + section in your control panel.\n") % | ||
76 | + { :user => self.requestor.name, :software => self.name } | ||
75 | end | 77 | end |
76 | 78 | ||
77 | def task_created_message | 79 | def task_created_message |
78 | - _("Your request for registering software %{software} at %{environment} was just sent. Environment administrator will receive it and will approve or reject your request according to his methods and creteria. | 80 | + _("Your request for registering software %{software} at %{environment} was |
81 | + just sent. Environment administrator will receive it and will approve or | ||
82 | + reject your request according to his methods and creteria. | ||
79 | 83 | ||
80 | - You will be notified as soon as environment administrator has a position about your request.") % { :software => self.name, :environment => self.target } | 84 | + You will be notified as soon as environment administrator has a position |
85 | + about your request.") % | ||
86 | + { :software => self.name, :environment => self.target } | ||
81 | end | 87 | end |
82 | 88 | ||
83 | def task_cancelled_message | 89 | def task_cancelled_message |
84 | - _("Your request for registering software %{software} at %{environment} was not approved by the environment administrator. The following explanation was given: \n\n%{explanation}") % { :software => self.name, :environment => self.environment, :explanation => self.reject_explanation } | 90 | + _("Your request for registering software %{software} at %{environment} was |
91 | + not approved by the environment administrator. The following explanation | ||
92 | + was given: \n\n%{explanation}") % | ||
93 | + { :software => self.name, | ||
94 | + :environment => self.environment, | ||
95 | + :explanation => self.reject_explanation } | ||
85 | end | 96 | end |
86 | 97 | ||
87 | def task_finished_message | 98 | def task_finished_message |
88 | - _('Your request for registering the software "%{software}" was approved. You can access %{url} and finish the registration of your software.') % { :software => self.name, :url => mount_url } | 99 | + _('Your request for registering the software "%{software}" was approved. |
100 | + You can access %{url} and finish the registration of your software.') % | ||
101 | + { :software => self.name, :url => mount_url } | ||
89 | end | 102 | end |
90 | 103 | ||
91 | private | 104 | private |
92 | 105 | ||
93 | def mount_url | 106 | def mount_url |
94 | identifier = Community.where(:name => self.name).first.identifier | 107 | identifier = Community.where(:name => self.name).first.identifier |
95 | - # The use of url_for doesn't allow the /social within the Public Software portal. That's why the url is mounted so 'hard coded' | 108 | + # The use of url_for doesn't allow the /social within the Public Software |
109 | + # portal. That's why the url is mounted so 'hard coded' | ||
96 | url = "#{environment.top_url}/myprofile/#{identifier}/profile_editor/edit" | 110 | url = "#{environment.top_url}/myprofile/#{identifier}/profile_editor/edit" |
97 | end | 111 | end |
98 | 112 |
lib/institution.rb
@@ -15,8 +15,9 @@ class Institution < ActiveRecord::Base | @@ -15,8 +15,9 @@ class Institution < ActiveRecord::Base | ||
15 | 15 | ||
16 | attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type, | 16 | attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type, |
17 | :sub_juridical_nature, :normalization_level, | 17 | :sub_juridical_nature, :normalization_level, |
18 | - :version, :cnpj, :type, :governmental_power, :governmental_sphere, | ||
19 | - :sisp, :juridical_nature, :corporate_name | 18 | + :version, :cnpj, :type, :governmental_power, |
19 | + :governmental_sphere, :sisp, :juridical_nature, | ||
20 | + :corporate_name | ||
20 | 21 | ||
21 | validates :name, :presence=>true, :uniqueness=>true | 22 | validates :name, :presence=>true, :uniqueness=>true |
22 | 23 | ||
@@ -30,7 +31,8 @@ class Institution < ActiveRecord::Base | @@ -30,7 +31,8 @@ class Institution < ActiveRecord::Base | ||
30 | where("name ilike ? OR acronym ilike ?", "%#{value}%", "%#{value}%" ) | 31 | where("name ilike ? OR acronym ilike ?", "%#{value}%", "%#{value}%" ) |
31 | } | 32 | } |
32 | 33 | ||
33 | - validate :validate_country, :validate_state, :validate_city, :verify_institution_type, :validate_cnpj, :validate_format_cnpj | 34 | + validate :validate_country, :validate_state, :validate_city, |
35 | + :verify_institution_type, :validate_cnpj, :validate_format_cnpj | ||
34 | 36 | ||
35 | 37 | ||
36 | protected | 38 | protected |
@@ -39,7 +41,10 @@ class Institution < ActiveRecord::Base | @@ -39,7 +41,10 @@ class Institution < ActiveRecord::Base | ||
39 | valid_institutions_type = ["PublicInstitution", "PrivateInstitution"] | 41 | valid_institutions_type = ["PublicInstitution", "PrivateInstitution"] |
40 | 42 | ||
41 | unless valid_institutions_type.include? self.type | 43 | unless valid_institutions_type.include? self.type |
42 | - self.errors.add(:type, _("invalid, only public and private institutions are allowed.")) | 44 | + self.errors.add( |
45 | + :type, | ||
46 | + _("invalid, only public and private institutions are allowed.") | ||
47 | + ) | ||
43 | 48 | ||
44 | return false | 49 | return false |
45 | end | 50 | end |
@@ -47,7 +52,10 @@ class Institution < ActiveRecord::Base | @@ -47,7 +52,10 @@ class Institution < ActiveRecord::Base | ||
47 | end | 52 | end |
48 | 53 | ||
49 | def validate_country | 54 | def validate_country |
50 | - if (self.community.blank?) || self.community.country.blank? && self.errors[:country].blank? | 55 | + if(self.community.blank? || |
56 | + self.community.country.blank? && | ||
57 | + self.errors[:country].blank?) | ||
58 | + | ||
51 | self.errors.add(:country, _("can't be blank")) | 59 | self.errors.add(:country, _("can't be blank")) |
52 | return false | 60 | return false |
53 | end | 61 | end |
@@ -55,7 +63,10 @@ class Institution < ActiveRecord::Base | @@ -55,7 +63,10 @@ class Institution < ActiveRecord::Base | ||
55 | end | 63 | end |
56 | 64 | ||
57 | def validate_state | 65 | def validate_state |
58 | - if (self.community.blank?) || self.errors[:state].blank? && self.community.state.blank? | 66 | + if(self.community.blank? || |
67 | + self.errors[:state].blank? && | ||
68 | + self.community.state.blank?) | ||
69 | + | ||
59 | if self.community.country == "BR" | 70 | if self.community.country == "BR" |
60 | self.errors.add(:state, _("can't be blank")) | 71 | self.errors.add(:state, _("can't be blank")) |
61 | return false | 72 | return false |
@@ -67,7 +78,10 @@ class Institution < ActiveRecord::Base | @@ -67,7 +78,10 @@ class Institution < ActiveRecord::Base | ||
67 | end | 78 | end |
68 | 79 | ||
69 | def validate_city | 80 | def validate_city |
70 | - if (self.community.blank?) || self.errors[:city].blank? && self.community.city.blank? | 81 | + if(self.community.blank? || |
82 | + self.errors[:city].blank? && | ||
83 | + self.community.city.blank?) | ||
84 | + | ||
71 | if self.community.country == "BR" | 85 | if self.community.country == "BR" |
72 | self.errors.add(:city, _("can't be blank")) | 86 | self.errors.add(:city, _("can't be blank")) |
73 | return false | 87 | return false |
lib/software_helper.rb
1 | module SoftwareHelper | 1 | module SoftwareHelper |
2 | - def self.select_options programming_languages, selected=0 | 2 | + def self.select_options programming_languages, selected = 0 |
3 | value = "" | 3 | value = "" |
4 | 4 | ||
5 | programming_languages.each do |language| | 5 | programming_languages.each do |language| |
6 | - value += "<option value=#{language.id} #{'selected' if selected == language.id}>#{language.name}</option>" | 6 | + selected = selected == language.id ? 'selected' : '' |
7 | + value += "<option value=#{language.id} #{selected}> | ||
8 | + #{language.name} | ||
9 | + </option>" | ||
7 | end | 10 | end |
8 | 11 | ||
9 | value | 12 | value |