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 | 4 | validates_presence_of :requestor_id, :target_id |
5 | 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 | 10 | alias :environment :target |
10 | 11 | alias :environment= :target= |
... | ... | @@ -20,7 +21,8 @@ class CreateSoftware < Task |
20 | 21 | template_id = software_template.id |
21 | 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 | 27 | community.environment = self.environment |
26 | 28 | community.add_admin(self.requestor) |
... | ... | @@ -34,20 +36,16 @@ class CreateSoftware < Task |
34 | 36 | _("New software") |
35 | 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 | 39 | def subject |
43 | 40 | name |
44 | 41 | end |
45 | 42 | |
46 | 43 | def information |
44 | + message = _('%{requestor} wants to create software %{subject} with') | |
47 | 45 | if finality.blank? |
48 | - { :message => _('%{requestor} wants to create software %{subject} with no finality.') } | |
46 | + { :message => message + _(' no finality.') } | |
49 | 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 | 49 | :variables => {:finality => finality} } |
52 | 50 | end |
53 | 51 | end |
... | ... | @@ -67,32 +65,48 @@ class CreateSoftware < Task |
67 | 65 | end |
68 | 66 | |
69 | 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 | 70 | end |
72 | 71 | |
73 | 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 | 77 | end |
76 | 78 | |
77 | 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 | 87 | end |
82 | 88 | |
83 | 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 | 96 | end |
86 | 97 | |
87 | 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 | 102 | end |
90 | 103 | |
91 | 104 | private |
92 | 105 | |
93 | 106 | def mount_url |
94 | 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 | 110 | url = "#{environment.top_url}/myprofile/#{identifier}/profile_editor/edit" |
97 | 111 | end |
98 | 112 | ... | ... |
lib/institution.rb
... | ... | @@ -15,8 +15,9 @@ class Institution < ActiveRecord::Base |
15 | 15 | |
16 | 16 | attr_accessible :name, :acronym, :unit_code, :parent_code, :unit_type, |
17 | 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 | 22 | validates :name, :presence=>true, :uniqueness=>true |
22 | 23 | |
... | ... | @@ -30,7 +31,8 @@ class Institution < ActiveRecord::Base |
30 | 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 | 38 | protected |
... | ... | @@ -39,7 +41,10 @@ class Institution < ActiveRecord::Base |
39 | 41 | valid_institutions_type = ["PublicInstitution", "PrivateInstitution"] |
40 | 42 | |
41 | 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 | 49 | return false |
45 | 50 | end |
... | ... | @@ -47,7 +52,10 @@ class Institution < ActiveRecord::Base |
47 | 52 | end |
48 | 53 | |
49 | 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 | 59 | self.errors.add(:country, _("can't be blank")) |
52 | 60 | return false |
53 | 61 | end |
... | ... | @@ -55,7 +63,10 @@ class Institution < ActiveRecord::Base |
55 | 63 | end |
56 | 64 | |
57 | 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 | 70 | if self.community.country == "BR" |
60 | 71 | self.errors.add(:state, _("can't be blank")) |
61 | 72 | return false |
... | ... | @@ -67,7 +78,10 @@ class Institution < ActiveRecord::Base |
67 | 78 | end |
68 | 79 | |
69 | 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 | 85 | if self.community.country == "BR" |
72 | 86 | self.errors.add(:city, _("can't be blank")) |
73 | 87 | return false | ... | ... |
lib/software_helper.rb
1 | 1 | module SoftwareHelper |
2 | - def self.select_options programming_languages, selected=0 | |
2 | + def self.select_options programming_languages, selected = 0 | |
3 | 3 | value = "" |
4 | 4 | |
5 | 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 | 10 | end |
8 | 11 | |
9 | 12 | value | ... | ... |