Compare View

switch
from
...
to
 
Commits (219)
Showing 154 changed files   Show diff stats

Too many changes.

To preserve performance only 100 of 154 files displayed.

Rakefile
... ... @@ -41,7 +41,8 @@ if $SPB_ENV == 'lxc'
41 41 end
42 42  
43 43 File.open('config/lxc/iptables-filter-rules', 'w') do |f|
44   - lxc_host_bridge_ip = '192.168.122.1' # FIXME don't hardcode
  44 + lxc_host_bridge_name = `awk '{ if ($1 == "lxc.network.link") { print($3) } }' /etc/lxc/default.conf`.strip
  45 + lxc_host_bridge_ip = ` /sbin/ifconfig #{lxc_host_bridge_name} | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1 }' `.strip
45 46 f.puts "-A INPUT -s #{lxc_host_bridge_ip} -p tcp -m state --state NEW --dport 22 -j ACCEPT"
46 47 f.puts "-A INPUT -s #{lxc_host_bridge_ip} -p tcp -m state --state NEW --dport 5555 -j ACCEPT"
47 48 end
... ...
VERSION
1   -5.0a0
  1 +5.0a7
... ...
config/cdtc/config.yaml
... ... @@ -13,3 +13,5 @@ relay_hostname: relay.spb.cdtc.unb.br
13 13 relay_ip: 164.41.9.48
14 14 alt_ssh_port: 55555
15 15 from_address: noreply@spb.cdtc.unb.br
  16 +dev_backup_frequency: true
  17 +disable_send_emails: true
... ...
config/dev/config.yaml
... ... @@ -19,3 +19,5 @@ alt_ssh_port: 55555
19 19 external_outgoing_mail_domain: serpro.gov.br
20 20 raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19
21 21 google_analytics_id: 'UA-64206731-2'
  22 +dev_backup_frequency: true
  23 +disable_send_emails: true
... ...
config/homologa/config.yaml
... ... @@ -20,3 +20,5 @@ external_outgoing_mail_relay: 189.9.150.53
20 20 external_outgoing_mail_domain: serpro.gov.br
21 21 raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19
22 22 google_analytics_id: 'UA-64206731-3'
  23 +dev_backup_frequency: true
  24 +disable_send_emails: true
... ...
config/lappis/config.yaml
... ... @@ -3,14 +3,16 @@ admins:
3 3 site_url: https://softwarepublico.lappis
4 4 external_hostname: softwarepublico.lappis
5 5 sisp_external_hostname: sisp.lappis
6   -external_ip: 10.0.0.11
  6 +external_ip: 10.0.0.54
7 7 colab_from_address: '"Portal do Software Publico" <noreply@softwarepublico.lappis>'
8 8 server_email: '"Portal do Software Publico" <noreply@softwarepublico.lappis>'
9 9 email_subject_prefix: '[spb]'
10 10 lists_hostname: listas.softwarepublico.lappis
11 11 lists_admin: paulo@softwarelivre.org
12 12 relay_hostname: relay.softwarepublico.lappis
13   -relay_ip: 10.0.0.15
  13 +relay_ip: 10.0.0.51
14 14 alt_ssh_port: 5555
15 15 from_address: noreply@softwarepublico.lappis
16   -
  16 +# define less frequent backup for dev envs
  17 +dev_backup_frequency: true
  18 +disable_send_emails: true
... ...
config/lappis/ips.yaml
1   -reverseproxy: 10.0.0.11
2   -database: 10.0.0.13
3   -social: 10.0.0.14
4   -email: 10.0.0.15
5   -integration: 10.0.0.12
  1 +reverseproxy: 10.0.0.54
  2 +database: 10.0.0.55
  3 +social: 10.0.0.53
  4 +email: 10.0.0.51
  5 +integration: 10.0.0.52
... ...
config/lappis/ssh_config
... ... @@ -2,28 +2,28 @@ Host *
2 2 ForwardAgent yes
3 3  
4 4 Host reverseproxy.unconfigured
5   - Hostname 10.0.0.11
  5 + Hostname 10.0.0.54
6 6  
7 7 Host reverseproxy
8   - Hostname 10.0.0.11
  8 + Hostname 10.0.0.54
9 9 Port 5555
10   - ProxyCommand ssh 10.0.0.11 -p 22 nc %h %p
  10 + ProxyCommand ssh 10.0.0.54 -p 22 nc %h %p
11 11  
12 12 Host database
13   - Hostname 10.0.0.13
  13 + Hostname 10.0.0.55
14 14 # connect via reverseproxy host
15   - ProxyCommand ssh 10.0.0.11 nc %h %p
  15 + ProxyCommand ssh 10.0.0.54 nc %h %p
16 16  
17 17 Host social
18   - Hostname 10.0.0.14
  18 + Hostname 10.0.0.53
19 19 # connect via reverseproxy host
20   - ProxyCommand ssh 10.0.0.11 nc %h %p
  20 + ProxyCommand ssh 10.0.0.54 nc %h %p
21 21  
22 22 Host email
23   - Hostname 10.0.0.15
  23 + Hostname 10.0.0.51
24 24 # connect via reverseproxy host
25   - ProxyCommand ssh 10.0.0.11 nc %h %p
  25 + ProxyCommand ssh 10.0.0.54 nc %h %p
26 26  
27 27 Host integration
28   - Hostname 10.0.0.11
29   - # Porta 22 de 10.0.0.11 cai aqui entao nao precisa de ProxyCommand
  28 + Hostname 10.0.0.54
  29 + # Porta 22 de 10.0.0.54 cai aqui entao nao precisa de ProxyCommand
... ...
config/local/config.yaml
... ... @@ -19,3 +19,5 @@ alt_ssh_port: 5555
19 19 from_address: noreply@softwarepublico.dev
20 20 raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19
21 21 colab_http_workers: 1
  22 +dev_backup_frequency: true
  23 +disable_send_emails: true
... ...
cookbooks/backup/recipes/default.rb
... ... @@ -13,7 +13,7 @@ cookbook_file &#39;/usr/local/bin/backup_spb.sh&#39; do
13 13 mode 0755
14 14 end
15 15  
16   -cookbook_file '/etc/cron.d/rsnapshot-spb' do
  16 +template '/etc/cron.d/rsnapshot-spb' do
17 17 owner 'root'
18 18 group 'root'
19 19 mode 0644
... ...
cookbooks/backup/templates/rsnapshot-spb.erb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +<%if node['config']['dev_backup_frequency']%>
  2 +20 23 1 * * root rsnapshot monthly
  3 +<%else%>
  4 +0 */6 * * * root rsnapshot hourly
  5 +59 23 * * * root rsnapshot daily
  6 +40 23 * * 7 root rsnapshot weekly
  7 +20 23 1 * * root rsnapshot monthly
  8 +<%end%>
... ...
cookbooks/basics/recipes/default.rb
... ... @@ -65,6 +65,7 @@ package &#39;tmux&#39;
65 65 package 'less'
66 66 package 'htop'
67 67 package 'ntp'
  68 +package 'screen'
68 69  
69 70 cookbook_file '/usr/local/bin/is-a-container' do
70 71 owner 'root'
... ...
cookbooks/colab/files/default/dashboard.py 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +from colab.widgets.widget_manager import WidgetManager
  2 +
  3 +from colab.widgets.dashboard.dashboard_latest_collaborations import \
  4 + DashboardLatestCollaborationsWidget
  5 +from colab.widgets.dashboard.dashboard_collaboration_graph import \
  6 + DashboardCollaborationGraphWidget
  7 +from colab_superarchives.widgets.dashboard_most_relevant_threads import \
  8 + DashboardMostRelevantThreadsWidget
  9 +from colab_superarchives.widgets.dashboard_latest_threads import \
  10 + DashboardLatestThreadsWidget
  11 +
  12 +# Dashboard Widgets
  13 +WidgetManager.register_widget('dashboard',
  14 + DashboardLatestCollaborationsWidget())
  15 +WidgetManager.register_widget('dashboard',
  16 + DashboardCollaborationGraphWidget())
  17 +WidgetManager.register_widget('dashboard',
  18 + DashboardMostRelevantThreadsWidget())
  19 +WidgetManager.register_widget('dashboard',
  20 + DashboardLatestThreadsWidget())
  21 +
... ...
cookbooks/colab/files/default/gitlab_profile.py 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +from colab.widgets.widget_manager import WidgetManager
  2 +
  3 +from colab_gitlab.widgets.profile.profile import GitlabProfileWidget
  4 +
  5 +WidgetManager.register_widget('profile', GitlabProfileWidget())
... ...
cookbooks/colab/files/default/profile.py 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +from colab.widgets.widget_manager import WidgetManager
  2 +
  3 +from colab_superarchives.widgets.group import GroupWidget
  4 +from colab_superarchives.widgets.group_membership import GroupMembershipWidget
  5 +from colab_superarchives.widgets.latest_posted import LatestPostedWidget
  6 +from colab.accounts.widgets.latest_contributions import \
  7 + LatestContributionsWidget
  8 +
  9 +from colab.accounts.widgets.collaboration_chart import CollaborationChart
  10 +from colab_superarchives.widgets.participation_chart import ParticipationChart
  11 +
  12 +# Profile Widgets
  13 +WidgetManager.register_widget('group', GroupWidget())
  14 +WidgetManager.register_widget('button', GroupMembershipWidget())
  15 +WidgetManager.register_widget('list', LatestPostedWidget())
  16 +WidgetManager.register_widget('list', LatestContributionsWidget())
  17 +WidgetManager.register_widget('charts', CollaborationChart())
  18 +WidgetManager.register_widget('charts', ParticipationChart())
... ...
cookbooks/colab/recipes/default.rb
... ... @@ -26,7 +26,7 @@ package &#39;colab-spb-theme&#39; do
26 26 notifies :restart, 'service[colab]'
27 27 end
28 28  
29   -package 'colab-spb-theme' do
  29 +package 'colab-spb-plugin' do
30 30 action :upgrade
31 31 notifies :restart, 'service[colab]'
32 32 end
... ... @@ -161,6 +161,13 @@ template &#39;/etc/colab/plugins.d/noosfero.py&#39; do
161 161 variables(:get_private_token => get_private_token)
162 162 end
163 163  
  164 +template '/etc/colab/plugins.d/super_archives.py' do
  165 + owner 'root'
  166 + group 'colab'
  167 + mode 0640
  168 + notifies :restart, 'service[colab]'
  169 +end
  170 +
164 171 template '/etc/colab/plugins.d/spb.py' do
165 172 owner 'root'
166 173 group 'colab'
... ... @@ -177,6 +184,31 @@ end
177 184  
178 185 execute 'colab-admin migrate'
179 186  
  187 +# Adding widgets for colab
  188 +cookbook_file '/etc/colab/widgets.d/dashboard.py' do
  189 + owner 'root'
  190 + group 'colab'
  191 + mode 0640
  192 +
  193 + notifies :restart, 'service[colab]'
  194 +end
  195 +
  196 +cookbook_file '/etc/colab/widgets.d/profile.py' do
  197 + owner 'root'
  198 + group 'colab'
  199 + mode 0640
  200 +
  201 + notifies :restart, 'service[colab]'
  202 +end
  203 +
  204 +cookbook_file '/etc/colab/widgets.d/gitlab_profile.py' do
  205 + owner 'root'
  206 + group 'colab'
  207 + mode 0640
  208 +
  209 + notifies :restart, 'service[colab]'
  210 +end
  211 +
180 212 # Static files
181 213 directory '/var/lib/colab/assets/spb/' do
182 214 owner 'root'
... ...
cookbooks/colab/templates/gitlab.py.erb
... ... @@ -11,6 +11,11 @@ upstream = &#39;http://&lt;%= node[&#39;peers&#39;][&#39;integration&#39;] %&gt;:81/gitlab/&#39;
11 11 private_token = '<%= @get_private_token.call %>'
12 12 verify_ssl = False
13 13  
  14 +middlewares = [
  15 + 'colab.middlewares.cookie_middleware.CookiePreHandlerMiddleware',
  16 + 'colab.middlewares.cookie_middleware.CookiePostHandlerMiddleware'
  17 +]
  18 +
14 19 urls = {
15 20 'include': 'colab_gitlab.urls',
16 21 'namespace': 'gitlab', # TODO: do not allow to change namespace
... ... @@ -35,7 +40,7 @@ menu_urls = (
35 40 url(display=_('Issues'), viewname='gitlab',
36 41 kwargs={'path': 'dashboard/issues'}, auth=True),
37 42 url(display=_('Merge Requests'), viewname='gitlab',
38   - kwargs={'path': 'merge_requests'}, auth=True),
  43 + kwargs={'path': 'dashboard/merge_requests'}, auth=True),
39 44  
40 45 )
41 46  
... ...
cookbooks/colab/templates/noosfero.py.erb
... ... @@ -10,6 +10,11 @@ verbose_name = &#39;Noosfero Plugin&#39;
10 10  
11 11 upstream = 'http://<%= node['peers']['social'] %>:80/social/'
12 12  
  13 +middlewares = [
  14 + 'colab.middlewares.cookie_middleware.CookiePreHandlerMiddleware',
  15 + 'colab.middlewares.cookie_middleware.CookiePostHandlerMiddleware'
  16 +]
  17 +
13 18 private_token = '<%= @get_private_token.call %>'
14 19  
15 20 urls = {
... ...
cookbooks/colab/templates/super_archives.py.erb 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +
  2 +from django.utils.translation import ugettext_lazy as _
  3 +from colab.plugins.utils.menu import colab_url_factory
  4 +
  5 +name = 'colab_superarchives'
  6 +verbose_name = 'Super Archives'
  7 +
  8 +urls = {
  9 + 'include': 'colab_superarchives.urls',
  10 + 'prefix': '^archives/',
  11 +}
  12 +
  13 +menu_title = _('Groups')
  14 +
  15 +url = colab_url_factory('archives')
  16 +
  17 +menu_urls = (
  18 + url(display=_('Groups'), viewname='thread_list', auth=False),
  19 +)
  20 +
  21 +# Imported settings from colab
  22 +LOCALE_PATHS = ('colab_superarchives/locale',)
  23 +
  24 +# Super Archives
  25 +SUPER_ARCHIVES_PATH = '/var/lib/mailman/archives/private'
  26 +SUPER_ARCHIVES_EXCLUDE = []
  27 +SUPER_ARCHIVES_LOCK_FILE = '/var/lock/colab/import_emails.lock'
... ...
cookbooks/gitlab/recipes/default.rb
... ... @@ -110,6 +110,16 @@ execute &#39;change-cache-owner&#39; do
110 110 only_if 'ls -l /usr/lib/gitlab/tmp/cache | grep root'
111 111 end
112 112  
  113 +execute 'change-assets-owner' do
  114 + command 'chown -R git:git /usr/lib/gitlab/public/assets'
  115 + only_if 'ls -l /usr/lib/gitlab/public/assets | grep root'
  116 +end
  117 +
  118 +execute 'change-gitlab-assets-owner' do
  119 + command 'chown -R git:git /var/lib/gitlab-assets'
  120 + only_if 'ls -l /var/lib/gitlab-assets | grep root'
  121 +end
  122 +
113 123 execute 'precompile-assets' do
114 124 user 'git'
115 125 cwd '/usr/lib/gitlab'
... ...
cookbooks/mailman/files/centos/master.cf
... ... @@ -122,7 +122,12 @@ scache unix - - n - 1 scache
122 122 #scalemail-backend unix - n n - 2 pipe
123 123 # flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
124 124 # ${nexthop} ${user} ${extension}
125   -#
  125 +
126 126 mailman unix - n n - - pipe
127 127 flags=FR user=mailman:mailman argv=/usr/lib/mailman/bin/postfix-to-mailman.py
128 128 ${nexthop} ${user}
  129 +
  130 +fs_mail unix - n n - - pipe
  131 + flags=F user=spb argv=tee --append /var/tmp/fs_mail.dump
  132 +
  133 +
... ...
cookbooks/mailman/recipes/default.rb
... ... @@ -83,6 +83,16 @@ cookbook_file &#39;/etc/cron.d/mailman-spb&#39; do
83 83 mode 0644
84 84 end
85 85  
  86 +execute 'postfix:disable-send-emails' do
  87 + command "postconf 'default_transport = fs_mail'"
  88 + only_if { node['config']['disable_send_emails'] }
  89 +end
  90 +
  91 +execute 'postfix:enable-send-emails' do
  92 + command "postconf 'default_transport = smtp'"
  93 + not_if { node['config']['disable_send_emails'] }
  94 +end
  95 +
86 96 cookbook_file '/etc/postfix/master.cf' do
87 97 notifies :reload, 'service[postfix]'
88 98 end
... ...
cookbooks/noosfero/recipes/default.rb
... ... @@ -87,6 +87,12 @@ plugins_spb.each do |plugin|
87 87 end
88 88 end
89 89  
  90 +execute 'sisp:environment:prepare' do
  91 + command "RAILS_ENV=production bundle exec rake sisp:prepare ADMINUSER=#{node['config']['admins'].first[1]} DOMAIN=#{node['config']['sisp_external_hostname']}"
  92 + cwd '/usr/lib/noosfero'
  93 + user 'noosfero'
  94 +end
  95 +
90 96 execute 'plugins:activate' do
91 97 command "RAILS_ENV=production bundle exec rake noosfero:plugins:enable_all"
92 98 cwd '/usr/lib/noosfero'
... ...
cookbooks/reverse_proxy/templates/reverse_proxy.conf.erb
... ... @@ -67,6 +67,10 @@ server {
67 67 access_log /var/log/nginx/ssl-<%= node['config']['sisp_external_hostname'] %>.access.log;
68 68 error_log /var/log/nginx/ssl-<%= node['config']['sisp_external_hostname'] %>.error.log;
69 69  
  70 + location = / {
  71 + rewrite ^ /social/search/sisp?sort=asc;
  72 + }
  73 +
70 74 # TODO caching
71 75 location / {
72 76 proxy_pass http://colab;
... ...
local.rake.example
1 1 # copy this file to local.rake and adjust to your local environment
2 2 ENV['CHAKE_RSYNC_OPTIONS'] = '--exclude tmp/dump'
  3 +
  4 +# if you have vagrant lxc installed and want to use it, just copy the settings below to your local.rake
  5 +# and run vagrant up --provider lxc
  6 +#ENV['VAGRANT_BOX'] = 'frensjan/centos-7-64-lxc' #you can figure out a different lxc box if you want
  7 +#ENV['SPB_ENV'] = 'lxc'
... ...
src/colab-spb-plugin/VERSION
1   -5.0a0
  1 +5.0a7
... ...
src/colab-spb-plugin/setup.py
... ... @@ -15,7 +15,7 @@ version = open(&#39;VERSION&#39;).read().strip()
15 15  
16 16 setup(
17 17 name='colab-spb-plugin',
18   - version='0.2.5',
  18 + version=version,
19 19 author='Macartur Sousa',
20 20 author_email='macartur.sc@gmail.com',
21 21 url='https://portal.softwarepublico.gov.br/gitlab/softwarepublico/colab-spb-plugin/',
... ...
src/colab-spb-plugin/src/colab_spb/apps.py
1   -
2 1 from django.apps import AppConfig
  2 +from colab.signals.signals import connect_signal, register_signal
  3 +from celery.utils.log import get_task_logger
  4 +from colab_spb.tasks import list_group_and_repository_creation
  5 +
  6 +logger = get_task_logger(__name__)
3 7  
4 8  
5 9 class SpbAppConfig(AppConfig):
6 10 name = 'colab_spb'
7 11 verbose_name = 'SPB'
  12 + short_name = 'spb'
8 13 namespace = 'spb'
  14 +
  15 + signals_list = ['create_repo', 'create_mail_list']
  16 +
  17 + def register_signal(self):
  18 + logger.info('Signals from {0} registed '.format(self.short_name))
  19 + register_signal(self.short_name, self.signals_list)
  20 +
  21 + def connect_signal(self):
  22 + connect_signal('community_creation', 'noosfero',
  23 + list_group_and_repository_creation)
... ...
src/colab-spb-plugin/src/colab_spb/migrations/0001_initial.py
... ... @@ -9,7 +9,7 @@ class Migration(migrations.Migration):
9 9 dependencies = [
10 10 ('colab_gitlab', '0001_initial'),
11 11 ('colab_noosfero', '__first__'),
12   - ('super_archives', '0002_mailinglist_is_private'),
  12 + ('colab_superarchives', '0002_thread_user'),
13 13 ]
14 14  
15 15 operations = [
... ... @@ -19,7 +19,7 @@ class Migration(migrations.Migration):
19 19 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
20 20 ('community', models.ForeignKey(to='colab_noosfero.NoosferoCommunity', null=True)),
21 21 ('group', models.ForeignKey(to='colab_gitlab.GitlabGroup', null=True)),
22   - ('mail_list', models.ForeignKey(to='super_archives.MailingList', null=True)),
  22 + ('mail_list', models.ForeignKey(to='colab_superarchives.MailingList', null=True)),
23 23 ],
24 24 options={
25 25 },
... ...
src/colab-spb-plugin/src/colab_spb/models.py
1 1 from colab_gitlab import models as gitlab
2 2 from colab_noosfero import models as noosfero
3   -from colab.super_archives import models as mailman
  3 +from colab_superarchives import models as mailman
4 4 from django.db import models
5 5  
6 6  
... ...
src/colab-spb-plugin/src/colab_spb/tasks.py 0 → 100644
... ... @@ -0,0 +1,162 @@
  1 +import requests
  2 +from unicodedata import normalize, category
  3 +
  4 +from django.conf import settings
  5 +
  6 +from celery.utils.log import get_task_logger
  7 +from colab_superarchives.utils.mailman import create_list
  8 +from colab.celery import app
  9 +from colab_gitlab.models import GitlabGroup
  10 +
  11 +logger = get_task_logger(__name__)
  12 +
  13 +
  14 +def normalize_name(name):
  15 + """
  16 + Removes letters' accents, replaces whitespaces for dash (-), and lowercases
  17 + all letters
  18 + """
  19 + name = name.replace(' ', '-')
  20 +
  21 + if not isinstance(name, unicode):
  22 + name = unicode(name, 'utf-8')
  23 +
  24 + name = ''.join(c for c in normalize('NFD', name) if category(c) != 'Mn')
  25 +
  26 + return name.lower()
  27 +
  28 +
  29 +def create_group_from_community(noosfero_community):
  30 + """ Create a group into Gitlab from a Noosfero's Community"""
  31 +
  32 + group_name = normalize_name(noosfero_community.name)
  33 +
  34 + # If project already exist
  35 + group = GitlabGroup.objects.filter(name=group_name)
  36 + if group:
  37 + return group[0].id
  38 +
  39 + app_config = settings.COLAB_APPS.get('colab_gitlab', {})
  40 + private_token = app_config.get('private_token')
  41 + upstream = app_config.get('upstream', '').rstrip('/')
  42 + verify_ssl = app_config.get('verify_ssl', False)
  43 +
  44 + error_msg = u'Error trying to create group "%s" on Gitlab. Reason: %s'
  45 +
  46 + users_endpoint = '{}/api/v3/groups'.format(upstream)
  47 +
  48 + params = {
  49 + 'name': group_name,
  50 + 'path': noosfero_community.identifier,
  51 + 'private_token': private_token
  52 + }
  53 + group_id = None
  54 + try:
  55 + response = requests.post(users_endpoint, params=params,
  56 + verify=verify_ssl)
  57 + except Exception as excpt:
  58 + reason = 'Request to API failed ({})'.format(excpt)
  59 + logger.error(error_msg, group_name, reason)
  60 + return
  61 +
  62 + if response.status_code != 201:
  63 + if response.status_code is 404:
  64 + pass # TODO: should request the existing group id if error 404
  65 + reason = 'Unknown [{}].'.format(response.status_code)
  66 + logger.error(error_msg, group_name, reason)
  67 + return
  68 + else:
  69 + group_id = response.json().get('id')
  70 + logger.info('Group {0} created'.format(group_name))
  71 +
  72 + return group_id
  73 +
  74 +
  75 +def include_members_into_group(admins, group_id):
  76 + """ Include members from a Noosfero's Community into a Gitlab's group """
  77 +
  78 + app_config = settings.COLAB_APPS.get('colab_gitlab', {})
  79 + private_token = app_config.get('private_token')
  80 + upstream = app_config.get('upstream', '').rstrip('/')
  81 + verify_ssl = app_config.get('verify_ssl', False)
  82 + error_msg = u'Error to include "%s" to create group "%s" on Gitlab. \
  83 + Reason: %s'
  84 +
  85 + user_id = None
  86 + users_endpoint = '{}/api/v3/users'.format(upstream)
  87 + for admin in admins:
  88 + params = {'search': admin.username,
  89 + 'private_token': private_token}
  90 + response = requests.get(users_endpoint, params=params,
  91 + verify=verify_ssl)
  92 + users = response.json()
  93 + # Be sure to get only one
  94 + for user in users:
  95 + if user['username'] == admin.username:
  96 + user_id = user['id']
  97 + break
  98 +
  99 + users_endpoint = '{}/api/v3/groups/{}/members'.format(
  100 + upstream, group_id)
  101 + params = {
  102 + 'user_id': user_id,
  103 + 'access_level': 50, # OWNER = 50
  104 + 'private_token': private_token
  105 + }
  106 + try:
  107 + response = requests.post(users_endpoint, params=params,
  108 + verify=verify_ssl)
  109 + except Exception as excpt:
  110 + reason = 'Request to API failed ({})'.format(excpt)
  111 + logger.error(error_msg, admin.username, reason)
  112 + return
  113 + logger.info('Members included')
  114 +
  115 +
  116 +def create_project(project_name, group_id):
  117 + """ Create a project into Gitlab group """
  118 +
  119 + project_name = normalize_name(project_name)
  120 +
  121 + app_config = settings.COLAB_APPS.get('colab_gitlab', {})
  122 + private_token = app_config.get('private_token')
  123 + upstream = app_config.get('upstream', '').rstrip('/')
  124 + verify_ssl = app_config.get('verify_ssl', False)
  125 + error_msg = u'Error to create project "%s" into Gitlab. Reason: %s'
  126 +
  127 + users_endpoint = '{}/api/v3/projects'.format(upstream)
  128 + params = {
  129 + 'name': project_name,
  130 + 'public': True,
  131 + 'visibility_level': 20, # show to all
  132 + 'namespace_id': group_id,
  133 + 'private_token': private_token
  134 + }
  135 + try:
  136 + requests.post(users_endpoint, params=params,
  137 + verify=verify_ssl)
  138 + except Exception as excpt:
  139 + reason = 'Request to API failed ({})'.format(excpt)
  140 + logger.error(error_msg, project_name, reason)
  141 + return
  142 + logger.info('Project created')
  143 +
  144 +
  145 +@app.task(bind=True)
  146 +def list_group_and_repository_creation(self, **kwargs):
  147 + logger.info('Community created: {0}'.format(''.join(kwargs)))
  148 +
  149 + noosfero_community = kwargs['community']
  150 + admins = noosfero_community.admins.all()
  151 + if not len(admins):
  152 + logger.error('Failed to create list, the software does not '
  153 + 'have an admin.')
  154 + return -1
  155 +
  156 + group_id = create_group_from_community(noosfero_community)
  157 + include_members_into_group(admins, group_id)
  158 + create_project(noosfero_community.name, group_id)
  159 + listname = normalize_name(noosfero_community.name)
  160 + create_list(listname, admins[0])
  161 +
  162 + return 0
... ...
src/colab-spb-plugin/src/colab_spb/templatetags/__init__.py 0 → 100644
src/colab-spb-plugin/src/colab_spb/templatetags/spb_extra.py 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +from django import template
  2 +
  3 +from colab_spb.models import CommunityAssociations
  4 +
  5 +register = template.Library()
  6 +
  7 +@register.simple_tag
  8 +def get_community(mailinglist):
  9 + ml = mailinglist
  10 + community = ""
  11 +
  12 + try:
  13 + community_association = CommunityAssociations.objects.get(mail_list=ml)
  14 + community = community_association.community.name
  15 + except CommunityAssociations.DoesNotExist:
  16 + community = "software"
  17 +
  18 + return community
... ...
src/colab-spb-plugin/src/colab_spb/views.py
1 1 # -*- coding: utf-8 -*-
2 2 from django.shortcuts import render
3 3 from django.http import HttpResponse
4   -from colab.super_archives.models import MailingList, Thread
5   -from colab.accounts.utils import mailman
  4 +from colab_superarchives.models import MailingList, Thread
  5 +from colab_superarchives.utils import mailman
6 6 from colab.accounts.models import User
7 7 from colab_spb.models import CommunityAssociations
8 8  
... ...
src/colab-spb-theme-plugin/Makefile
1 1 PACKAGE = colab-spb-theme
2   -VERSION = 0.3.11
  2 +VERSION = $(shell cat VERSION)
3 3 DISTDIR = dist
4 4 PACKAGE_NAME = $(PACKAGE)-$(VERSION)
5 5 TARBALL = $(PACKAGE_NAME).tar.gz
... ...
src/colab-spb-theme-plugin/VERSION
1   -5.0a0
  1 +5.0a7
... ...
src/colab-spb-theme-plugin/colab_spb_theme/static/css/header.css
... ... @@ -428,7 +428,8 @@ header #sisp-header-quick-access a {
428 428 font-weight: bold;
429 429 }
430 430  
  431 +/*
431 432 header #spb-header-content,
432 433 header #sisp-header-content {
433 434 padding-top: 13px;
434   -}
  435 +} */
... ...
src/colab-spb-theme-plugin/colab_spb_theme/static/css/screen.css
... ... @@ -62,8 +62,10 @@ body {
62 62 bottom: 0;
63 63 }
64 64  
65   -#main-content {
  65 +body div#main-content {
66 66 margin-top: 0;
  67 + padding: 20px 0 60px 0;
  68 + color: #172738;
67 69 }
68 70  
69 71 li hr {
... ... @@ -508,11 +510,6 @@ span.highlighted {
508 510 margin: 0 2px;
509 511 }
510 512  
511   -#main-content {
512   - padding: 40px 0 60px 0;
513   - color: #172738;
514   -}
515   -
516 513 .colab-content {
517 514 max-width: 960px;
518 515 min-width: 960px;
... ... @@ -580,10 +577,22 @@ form.signup {
580 577  
581 578 .signup-help {
582 579 font-size: 16px;
583   - font-family: Arial;
  580 +}
  581 +
  582 +.mailinglist-help,
  583 +.signup-help {
584 584 padding-top: 7px;
  585 + font-family: Arial;
  586 + position: absolute;
  587 +}
585 588  
586   - }
  589 +.mailinglist-help {
  590 + font-size: 15px;
  591 +}
  592 +
  593 +.list-container {
  594 + padding-top: 30px;
  595 +}
587 596  
588 597 a.btn {
589 598 margin: 2px 0 2px 0;
... ...
src/colab-spb-theme-plugin/colab_spb_theme/static/css/search.css
... ... @@ -58,7 +58,7 @@
58 58 text-decoration: none;
59 59 }
60 60  
61   -.btn:hover {
  61 +colab-search-form .btn:hover {
62 62 color: white;
63 63 }
64 64  
... ...
src/colab-spb-theme-plugin/colab_spb_theme/static/js/scroll.js 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +var colab = (function( $ ){
  2 + var $window = $(window);
  3 +
  4 + var sidebar, offset, maxMarginTop, reference,
  5 +
  6 + sidebarScroll = function() {
  7 +
  8 + if($window.scrollTop() > offset.top) {
  9 + var marginTop = $window.scrollTop() - offset.top;
  10 + marginTop = marginTop > maxMarginTop ? maxMarginTop : marginTop;
  11 +
  12 + sidebar.stop().animate({
  13 + marginTop: marginTop
  14 + });
  15 + } else {
  16 + sidebar.stop().animate({
  17 + marginTop: 0
  18 + });
  19 + }
  20 + },
  21 +
  22 + init = function(sidebarSelector, referenceSelector) {
  23 + sidebar = $(sidebarSelector);
  24 + reference = $(referenceSelector);
  25 + offset = sidebar.offset();
  26 + maxMarginTop = reference.height() - sidebar.height();
  27 +
  28 + $window.scroll(function() {
  29 + sidebarScroll();
  30 + });
  31 + };
  32 +
  33 +
  34 + return {
  35 + init: init
  36 + };
  37 +})( jQuery );
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/accounts/user_create_form.html
1 1 {% extends "base.html" %}
2   -{% load i18n %}
  2 +{% load i18n staticfiles %}
  3 +
  4 +{% block head_js %}
  5 + <script src="{% static 'js/scroll.js' %}"></script>
  6 +{% endblock %}
  7 +
  8 +{% block title %}Cadastre-se - SPB{% endblock %}
3 9 {% block main-content %}
4 10 <div class="colab-content container">
5 11 <h2>Cadastre-se</h2>
... ... @@ -9,6 +15,7 @@
9 15 {% csrf_token %}
10 16 <div class="row">
11 17 <div class="col-md-6 col-lg-6 col-sm-6 col-xs-12">
  18 + <div class="signup-fields">
12 19 <fieldset>
13 20 {% for field in user_form %}
14 21 <div class="form-group{% if field.field.required %} required{% endif %}{% if field.errors %} alert alert-danger has-error{% endif %}">
... ... @@ -22,17 +29,22 @@
22 29 </fieldset>
23 30  
24 31 <input type="submit" value="Cadastrar" id="btn-cadastrar" class="btn btn-primary">
  32 + </div>
25 33 </div>
26 34 <div class="col-md-6 col-lg-6 col-sm-6 col-xs-12">
27 35 <div style="border-left: 1px solid #ccc; padding-left: 52px; min-height: 450px">
28 36 <div class="signup-help">
29   - <p>Em caso de dúvidas visite a seção de <a href="/social/spb/ajuda#faq">Ajuda</a></p>
  37 + <p>Em caso de dúvidas, visite a seção de <a href="/social/spb/ajuda#faq">Ajuda</a></p>
30 38 <hr>
31   - <p>Caso ainda permaneça com dúvidas, fique à vontade para entrar em contato conosco através do email <a href="mailto:admin@softwarepublico.gov.br">admin@softwarepublico.gov.br</a></p>
  39 + <p>Caso ainda permaneça com dúvidas, fique à vontade para entrar em contato conosco através do email: <a href="mailto:admin@softwarepublico.gov.br">admin@softwarepublico.gov.br</a></p>
32 40 </div>
33 41 </div>
34 42 </div>
35 43 </div>
36 44 </form>
37 45 </div>
  46 +
  47 + <script>
  48 + $(colab.init('.signup-help', '.signup-fields'));
  49 + </script>
38 50 {% endblock %}
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/footer_sisp.html
... ... @@ -10,65 +10,14 @@
10 10 <div id="footer" role="contentinfo">
11 11 <a name="afooter" id="afooter"></a>
12 12 <div id="doormat-container" class="columns-4">
13   - <div class="doormatColumn column-0">
14   - <dl class="doormatSection">
15   - <dt class="doormatSectionHeader">Assuntos</dt>
16   - <dd class="doormatSectionBody">
17   - <a href="/social/sisp/publique-seu-software" class="external-link">Publique seu software</a>
18   - </dd>
19   - <!--
20   - <dd class="doormatSectionBody">
21   - <a href="http://antigo.softwarepublico.gov.br/mpv/" class="external-link">Prestadores de serviço</a>
22   - </dd>
23   - -->
24   - </dl>
25   - </div>
26   - <div class="doormatColumn column-1">
27   - <dl class="doormatSection">
28   - <dt class="doormatSectionHeader">Portal do SISP</dt>
29   - <dd class="doormatSectionBody">
30   - <a href="/social/sisp/entenda-o-que-e" class="external-link">Entenda o que é</a>
31   - </dd>
32   - <!--
33   - <dd class="doormatSectionBody">
34   - <a href="/social/profile/sisp/events" class="external-link">Eventos</a>
35   - </dd>
36   - -->
37   - </dl>
38   - </div>
39   - <div class="doormatColumn column-2">
40   - <dl class="doormatSection">
41   - <dt class="doormatSectionHeader">Serviços</dt>
42   - <dd class="doormatSectionBody">
43   - <a href="/social/sisp/ajuda#faq" class="external-link">FAQ</a>
44   - </dd>
45   - <dd class="doormatSectionBody">
46   - <a href="/social/sisp/contato" class="external-link">Contato</a>
47   - </dd>
48   - <!--
49   - <dd class="doormatSectionBody">
50   - <a href="/archives/thread/sisp-usuarios/relatar-erros#msg-1635" class="external-link">Relatar erros</a>
51   - </dd>
52   - -->
53   - </dl>
54   - </div>
55   - <div class="doormatColumn column-3">
56   - <dl class="doormatSection">
57   - <dt class="doormatSectionHeader">RSS</dt>
58   - <dd class="doormatSectionBody">
59   - <a href="/social/sisp/rss/o-que-e" class="external-link">O que é?</a>
60   - </dd>
61   - <dd class="doormatSectionBody">
62   - <a href="/rss/colab/latest" class="external-link">Assine</a>
63   - </dd>
64   - </dl>
  13 + <div class ="doormatColumn column-0">
65 14 <dl class="doormatSection">
66 15 <dt class="doormatSectionHeader">Navegação</dt>
67 16 <dd class="doormatSectionBody">
68   - <a href="/social/sisp/acessibilidade" class="external-link">Acessibilidade</a>
  17 + <a href="" onclick="return false;" class="external-link">Acessibilidade</a>
69 18 </dd>
70 19 <dd class="doormatSectionBody">
71   - <a href="/social/sisp/mapa-do-site" class="external-link">Mapa do site</a>
  20 + <a href="" onclick="return false;" class="external-link">Mapa do site</a>
72 21 </dd>
73 22 </dl>
74 23 </div>
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/header_sisp.html
... ... @@ -8,9 +8,6 @@
8 8 </div>
9 9 <script src="//barra.brasil.gov.br/barra.js" type="text/javascript" defer async></script>
10 10 <div id="header" role="banner">
11   - <div id="sisp-header-quick-access">
12   - <p class='pull-right'>Acesso rápido: <a href="{{ SPB_PORTAL }}">Software Público Brasileiro</a></p>
13   - </div>
14 11 <div id="sisp-header-content">
15 12 <ul id="accessibility">
16 13 <li>
... ... @@ -49,7 +46,7 @@
49 46 <div id="second-nav">
50 47 <ul id="portal-siteactions">
51 48 <li id="siteaction-accessibility">
52   - <a href="/social/sisp/acessibilidade" title="Acessibilidade" accesskey="5">
  49 + <a href="" onclick="return false;" title="Acessibilidade" accesskey="5">
53 50 Acessibilidade
54 51 </a>
55 52 </li>
... ... @@ -59,7 +56,7 @@
59 56 </a>
60 57 </li>
61 58 <li id="siteaction-mapadosite">
62   - <a href="/social/sisp/mapa-do-site" title="Mapa do Site" accesskey="7">
  59 + <a href="" onclick="return false;" title="Mapa do Site" accesskey="7">
63 60 Mapa do Site
64 61 </a>
65 62 </li>
... ... @@ -67,8 +64,7 @@
67 64 </div>
68 65 <div id="logo">
69 66 <a id="portal-logo" title="" href="/">
70   - <span id="portal-title-1">Portal do</span>
71   - <h1 id="portal-title" class="corto">SISP</h1>
  67 + <h1 id="portal-title" class="corto">Catálogo do SISP</h1>
72 68 <span id="portal-description">MINISTÉRIO DO PLANEJAMENTO, ORÇAMENTO E GESTÃO</span>
73 69 </a>
74 70 </div>
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/header_spb.html
... ... @@ -8,9 +8,6 @@
8 8 </div>
9 9 <script src="//barra.brasil.gov.br/barra.js" type="text/javascript" defer async></script>
10 10 <div id="header" role="banner">
11   - <div id="spb-header-quick-access">
12   - <p class='pull-right'>Acesso rápido: <a href="{{ SISP_PORTAL }}">Portal do SISP</a></p>
13   - </div>
14 11 <div id="spb-header-content">
15 12 <ul id="accessibility">
16 13 <li>
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/mailinglist-summary.html
1 1 {% extends 'base.html' %}
2   -{% load i18n tz superarchives %}
  2 +{% load i18n tz superarchives staticfiles spb_extra %}
  3 +
  4 +{% block head_js %}
  5 + <script src="{% static 'js/scroll.js' %}"></script>
  6 +{% endblock %}
  7 +
  8 +{% block title %}{{ mailinglist.name|title }} - Listas de discussão - SPB{% endblock %}
  9 +
  10 +{% block title %}{{ mailinglist.name|title }}{% endblock %}
3 11  
4 12 {% block main-content %}
5 13 <div class="colab-content container">
... ... @@ -44,19 +52,37 @@
44 52 {% endblock %}
45 53  
46 54 {% block mailinglist_view_thread_list %}
47   - {% for thread in thread_list %}
48   - <div class="row colab-thread">
49   - <div class="col-md-12 colab-thread">
50   - <small class="colab-thread-modified-time">{{ thread.latest_message.received_time|date:"d F Y" }} {% trans "at" %} {{thread.latest_message.received_time|date:"h:m" }} - <a class="colab-thread-modified-author" href="{{thread.latest_message.author_url}}">{{thread.latest_message.author }}</a>
51   - </small><br>
52   - <h4><a class="colab-thread-subject" href="{{thread.get_absolute_url}}">{{ thread.latest_message.subject_clean }}</h4>
53   - {% with thread.latest_message.body|truncatechars:"85" as description %}
54   - <span class="colab-thread-latest-message">{{description | default_if_none:"a"}}</span></a><br>
55   - {% endwith %}
56   - <hr/>
  55 + <div class="row">
  56 + <div class="list-container">
  57 + <div class="col-md-8">
  58 + <div class="thread-list">
  59 + <div style="border-right: 1px solid #ccc; padding-right: 32px; min-height: 450px">
  60 + {% for thread in thread_list %}
  61 + <div class="row colab-thread">
  62 + <div class="col-md-12 colab-thread">
  63 + <small class="colab-thread-modified-time">{{ thread.latest_message.received_time|date:"d F Y" }} {% trans "at" %} {{thread.latest_message.received_time|date:"h:m" }} - <a class="colab-thread-modified-author" href="{{thread.latest_message.author_url}}">{{thread.latest_message.author }}</a>
  64 + </small><br>
  65 + <h4><a class="colab-thread-subject" href="{{thread.get_absolute_url}}">{{ thread.latest_message.subject_clean }}</h4>
  66 + {% with thread.latest_message.body|truncatechars:"85" as description %}
  67 + <span class="colab-thread-latest-message">{{description | default_if_none:"a"}}</span></a><br>
  68 + {% endwith %}
  69 + <hr/>
  70 + </div>
  71 + </div>
  72 + {% endfor %}
  73 + </div>
  74 + </div>
  75 + </div>
  76 +
  77 + <div class="col-md-4">
  78 + <div class="mailinglist-help">
  79 + <p>Em caso de dúvidas, visite o <a href="/social/{% get_community mailinglist %}/como-participar-da-lista-de-discussao">Guia de Uso</a></p>
  80 + <hr>
  81 + <p>Caso ainda permaneça com dúvidas, fique à vontade para entrar em contato conosco através do email: <a href="mailto:admin@softwarepublico.gov.br">admin@softwarepublico.gov.br</a></p>
  82 + </div>
57 83 </div>
58 84 </div>
59   - {% endfor %}
  85 + </div>
60 86 {% endblock %}
61 87  
62 88 {% block mailinglist_view_paginator %}
... ... @@ -109,4 +135,9 @@
109 135 {% endif %}
110 136 {% endblock %}
111 137 </div>
  138 +
  139 + <script>
  140 + $(colab.init('.mailinglist-help', '.thread-list'));
  141 + </script>
  142 +
112 143 {% endblock %}
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/registration/login.html 0 → 100644
... ... @@ -0,0 +1,61 @@
  1 +{% extends 'base.html' %}
  2 +{% load i18n tz superarchives %}
  3 +
  4 +{% block title %}Login - SPB{% endblock %}
  5 +
  6 +{% block main-content %}
  7 +<div class="row">
  8 + {% if form.errors %}
  9 + {% if form.errors.items|length == 1 %}
  10 + <div class="alert alert-danger">
  11 + <b>{% trans "Please correct the error below and try again." %}</b>
  12 + </div>
  13 + {% else %}
  14 + <div class="alert alert-danger">
  15 + <b>{% trans "Please correct the errors below and try again." %}</b>
  16 + </div>
  17 + {% endif %}
  18 + {% endif %}
  19 +
  20 + {% for error in form.non_field_errors %}
  21 + <div class="alert alert-danger">
  22 + {{ error }}
  23 + </div>
  24 + {% endfor %}
  25 +</div>
  26 +
  27 +
  28 +<br>
  29 +<form action="{% url 'login' %}" method="post" role="form" class="form-horizontal signup">
  30 + {% csrf_token %}
  31 +
  32 + <div class="row">
  33 + <div class="col-md-4 col-md-offset-4 col-lg-4 col-lg-4 col-sm-8 col-sm-offset-2 col-xs-12">
  34 + <div class="panel panel-default">
  35 + <div class="panel-heading"><h3 class="panel-title">{% trans 'Login' %}</h3></div>
  36 +
  37 + <div class="panel-body">
  38 + <div class="form-group{% if form.username.errors %} alert alert-danger has-error{% endif %}">
  39 + {{ form.username.label_tag }}
  40 + <input class="form-control" id="id_username" maxlength="254" name="username" type="text">
  41 + {{ form.username.errors }}
  42 + </div>
  43 + <div class="form-group{% if form.password.errors %} alert alert-danger has-error{% endif %}">
  44 + {{ form.password.label_tag }}
  45 + <input class="form-control" id="id_password" name="password" type="password">
  46 + {{ form.password.errors }}
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + </div>
  52 +
  53 + <div class="row">
  54 + <div class="submit">
  55 + <input type="submit" value="{% trans 'Login' %}" class="btn btn-primary btn-lg btn-block">
  56 + </div>
  57 + <p class="text-center"><a href="{% url 'password_reset' %}">{% trans 'Forgot Password?' %}</a></p>
  58 + </div>
  59 +
  60 +</form>
  61 +{% endblock %}
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/search/search.html
... ... @@ -2,7 +2,7 @@
2 2 {% load i18n tz highlight superarchives search_preview_templates %}
3 3 {% load static from staticfiles %}
4 4  
5   -{% block title %}{% trans 'search'|title %}{% endblock %}
  5 +{% block title %}{% trans 'search'|title %} - SPB{% endblock %}
6 6  
7 7 {% block head_js %}
8 8 <script type="text/javascript" src="{% static 'third-party/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js' %}"></script>
... ... @@ -107,7 +107,7 @@
107 107 {% if page.has_previous %}
108 108 {% if page.previous_page_number > 1 %}
109 109 <li>
110   - <a href="{% append_to_get page=page.previous_page_number|add:-2 %}">{{ page.number|add:-2 }}</a>
  110 + <a href="{% append_to_get page=page.previous_page_number|add:-1 %}">{{ page.number|add:-2 }}</a>
111 111 </li>
112 112 {% endif %}
113 113 <li>
... ...
src/colab-spb-theme-plugin/colab_spb_theme/templates/superarchives/thread-dashboard.html
1 1 {% extends 'base.html' %}
2 2 {% load i18n %}
3 3  
4   -{% block title %}Listas de discussão{% endblock %}
  4 +{% block title %}Listas de discussão - SPB{% endblock %}
5 5  
6 6 {% block main-content %}
7 7 <div class="colab-content container">
... ... @@ -25,7 +25,7 @@
25 25 {% endfor %}
26 26 </ul>
27 27 <div class="text-right">
28   - <a href="{% url 'haystack_search' %}?order=latest&list={{ mailinglist.name }}&type=thread">
  28 + <a href="{% url 'haystack_search' %}?order=latest&tag={{ mailinglist.name }}&type=thread">
29 29 {% trans "more..." %}
30 30 </a>
31 31 </div>
... ... @@ -39,7 +39,7 @@
39 39 {% endfor %}
40 40 </ul>
41 41 <div class="text-right">
42   - <a href="{% url 'haystack_search' %}?list={{ mailinglist.name }}&type=thread">
  42 + <a href="{% url 'haystack_search' %}?tag={{ mailinglist.name }}&type=thread">
43 43 {% trans "more..." %}
44 44 </a>
45 45 </div>
... ...
src/noosfero-spb/Makefile
1 1 PACKAGE = noosfero-spb
2   -VERSION = 4.2.12
  2 +VERSION = $(shell cat VERSION)
3 3 DISTDIR = $(PACKAGE)-$(VERSION)
4 4 TARBALL = $(DISTDIR).tar.gz
5 5  
... ... @@ -11,9 +11,10 @@ themes_dir=/usr/lib/noosfero/public/designs/themes
11 11 noosfero_dir=/usr/lib/noosfero
12 12  
13 13 dist: clean
14   - mkdir $(DISTDIR)
15   - tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd $(DISTDIR) && tar xaf -)
16   - tar --exclude=.git -czf $(TARBALL) $(DISTDIR)
  14 + mkdir -p dist/$(DISTDIR)
  15 + tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd dist/$(DISTDIR) && tar xaf -)
  16 + cd dist/ && tar --exclude=.git -czf $(TARBALL) $(DISTDIR)
  17 + $(RM) -r $(DISTDIR)
17 18  
18 19 clean:
19 20 $(RM) -r dist/
... ...
src/noosfero-spb/VERSION
1   -5.0a0
  1 +5.0a7
... ...
src/noosfero-spb/gov_user/controllers/gov_user_plugin_controller.rb
... ... @@ -5,6 +5,8 @@ class GovUserPluginController &lt; ApplicationController
5 5 :governmental_sphere, :governmental_power, :juridical_nature, :sisp
6 6 ]
7 7  
  8 + protect "create_institution_admin", :environment
  9 +
8 10 def hide_registration_incomplete_percentage
9 11 response = false
10 12  
... ... @@ -65,7 +67,10 @@ class GovUserPluginController &lt; ApplicationController
65 67 def get_institutions
66 68 redirect_to "/" if !request.xhr? || params[:query].blank?
67 69  
68   - institutions = Institution.search_institution(params[:query]).select([:id, :name])
  70 + selected_institutions = Institution.where(id: params[:selected_institutions]).select([:id, :name])
  71 + institutions = Institution.search_institution(params[:query], environment).select("institutions.id, institutions.name")
  72 + institutions -= selected_institutions
  73 +
69 74 institutions_list = institutions.map { |institution|
70 75 {:value=>institution.name, :id=>institution.id}
71 76 }
... ...
src/noosfero-spb/gov_user/controllers/gov_user_plugin_myprofile_controller.rb
1 1 class GovUserPluginMyprofileController < MyProfileController
2 2 append_view_path File.join(File.dirname(__FILE__) + '/../views')
3 3  
  4 + protect "edit_institution", :profile
  5 +
4 6 def index
5 7 end
6 8  
... ... @@ -19,7 +21,7 @@ class GovUserPluginMyprofileController &lt; MyProfileController
19 21  
20 22 def update_institution
21 23 @institution.community.update_attributes(params[:community])
22   - @institution.update_attributes(params[:institutions].except(:governmental_power, :governmental_sphere, :juridical_nature))
  24 + @institution.update_attributes(params[:institutions].except(:governmental_power, :governmental_sphere, :juridical_nature).merge({:name => params[:community][:name]}))
23 25 if @institution.type == "PublicInstitution"
24 26 begin
25 27 governmental_updates
... ...
src/noosfero-spb/gov_user/db/migrate/20160112174948_applies_accentuation_on_models_without_them.rb 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +#encoding: utf-8
  2 +
  3 +class AppliesAccentuationOnModelsWithoutThem < ActiveRecord::Migration
  4 + def up
  5 + execute "UPDATE governmental_powers SET name = 'Judiciário' WHERE name = 'Judiciario'"
  6 + execute "UPDATE governmental_powers SET name = 'Não se Aplica' WHERE name = 'Nao se Aplica'"
  7 +
  8 + execute "UPDATE juridical_natures SET name = 'Administração Direta' WHERE name = 'Administracao Direta'"
  9 + execute "UPDATE juridical_natures SET name = 'Empresa Pública' WHERE name = 'Empresa Publica'"
  10 + execute "UPDATE juridical_natures SET name = 'Fundação' WHERE name = 'Fundacao'"
  11 + execute "UPDATE juridical_natures SET name = 'Orgão Autônomo' WHERE name = 'Orgao Autonomo'"
  12 + end
  13 +
  14 + def down
  15 + say "This migration has no back state"
  16 + end
  17 +end
... ...
src/noosfero-spb/gov_user/db/migrate/20160113194207_fix_institutions_with_wrong_country.rb 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +class FixInstitutionsWithWrongCountry < ActiveRecord::Migration
  2 + def up
  3 + select_all("SELECT id, data FROM profiles WHERE type = 'Community'").each do |community|
  4 + settings = YAML.load(community['data'] || {}.to_yaml)
  5 + if !settings[:country].nil? && settings[:country].downcase == "brasil"
  6 + settings[:country] = 'BR'
  7 + assignments = ActiveRecord::Base.send(:sanitize_sql_for_assignment, {:data => settings.to_yaml})
  8 + update("UPDATE profiles SET %s WHERE id = %d" % [assignments, community['id']])
  9 + end
  10 + end
  11 + end
  12 +
  13 + def down
  14 + say "This migration can't be reverted."
  15 + end
  16 +end
... ...
src/noosfero-spb/gov_user/db/migrate/20160120185910_fix_communities_with_wrong_state.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +class FixCommunitiesWithWrongState < ActiveRecord::Migration
  2 + def up
  3 + select_all("SELECT id, data FROM profiles WHERE type = 'Community'").each do |community|
  4 + settings = YAML.load(community['data'] || {}.to_yaml)
  5 + new_state = Institution::VALID_STATES[settings[:state].upcase] if settings[:state].present?
  6 +
  7 + if new_state.present?
  8 + settings[:state] = new_state
  9 + assignments = ActiveRecord::Base.send(:sanitize_sql_for_assignment, {:data => settings.to_yaml})
  10 + update("UPDATE profiles SET %s WHERE id = %d" % [assignments, community['id']])
  11 + end
  12 + end
  13 + end
  14 +
  15 + def down
  16 + say "This migration can't be reverted."
  17 + end
  18 +end
... ...
src/noosfero-spb/gov_user/features/institution_registration.feature
... ... @@ -5,9 +5,12 @@ Feature: Institution Field
5 5  
6 6 Background:
7 7 Given "GovUserPlugin" plugin is enabled
  8 + And "SoftwareCommunitiesPlugin" plugin is enabled
8 9 And I am logged in as mpog_admin
  10 + And I go to /admin/environment_themes/set/noosfero-spb-theme
9 11 And I go to /admin/plugins
10 12 And I check "GovUserPlugin"
  13 + And I check "SoftwareCommunitiesPlugin"
11 14 And I press "Save changes"
12 15 And Institutions has initial default values on database
13 16 And I am logged in as mpog_admin
... ... @@ -27,6 +30,19 @@ Feature: Institution Field
27 30 And I should see "CNPJ"
28 31 And I should see "Acronym"
29 32 And I choose "Public Institution"
30   - Then I should see "Governmental Sphere:"
31   - And I should see "Governmental Power:"
32   - And I should see "Juridical Nature:"
  33 + Then I should see "Governmental Sphere"
  34 + And I should see "Governmental Power"
  35 + And I should see "Juridical Nature"
  36 +
  37 + @selenium
  38 + Scenario: Clean state and city values when country is diferent of Brazil
  39 + Given I follow "Edit Profile"
  40 + When I follow "Create new institution"
  41 + And I select "Brazil" from "community_country"
  42 + And I select "Distrito Federal" from "community_state"
  43 + And I fill in "community_city" with "Gama"
  44 + And I select "United States" from "community_country"
  45 + Then I should not see "community_state"
  46 + And I should not see "community_city"
  47 + And I select "Brazil" from "community_country"
  48 + Then I should not see "Gama"
... ...
src/noosfero-spb/gov_user/features/rate_community.feature
... ... @@ -27,8 +27,8 @@ Feature: rate_community
27 27 And Institutions has initial default values on database
28 28 And the following public institutions
29 29 | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name |
30   - | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades |
31   - | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
  30 + | Ministerio das Cidades | MC | BR | Distrito Federal | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades |
  31 + | Ministerio do Planejamento | MP | BR | Distrito Federal | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
32 32  
33 33 Scenario: display message on task when a rating with the same institution exists on the same software
34 34 Given the following organization ratings
... ... @@ -38,7 +38,7 @@ Feature: rate_community
38 38 And I go to mycommunity's control panel
39 39 And I follow "Process requests" within ".pending-tasks"
40 40 And I choose "Accept" within ".task_decisions"
41   - Then I should see "This instiution already has an accepted rating" in the page
  41 + Then I should see "This institution already has an accepted rating" in the page
42 42  
43 43 Scenario: do not display message on task when a rating with the same institution does not exist on the same software
44 44 Given the following organization ratings
... ...
src/noosfero-spb/gov_user/features/rating_institution_registration.feature
... ... @@ -8,6 +8,7 @@ Feature: Create institution on user report
8 8 And "SoftwareCommunitiesPlugin" plugin is enabled
9 9 And "OrganizationRatings" plugin is enabled
10 10 And I am logged in as mpog_admin
  11 + And I go to /admin/environment_themes/set/noosfero-spb-theme
11 12 And I go to /admin/plugins
12 13 And I check "GovUserPlugin"
13 14 And I check "SoftwareCommunitiesPlugin"
... ... @@ -23,20 +24,20 @@ Feature: Create institution on user report
23 24 And I should not see "Number of Beneficiaries"
24 25 And I should not see "Saved resources"
25 26 And I should not see "Organization name or Enterprise name"
26   - When I click on anything with selector "#comments-additional-information"
27   - Then I should see "Number of Beneficiaries"
28   - And I should see "Organization name or Enterprise name"
29   - And I should see "Saved resources"
  27 + When I click on anything with selector "comments-additional-information"
  28 + Then I should see "Número de beneficiados"
  29 + And I should see "Nome do órgão ou empresa"
  30 + And I should see "Recursos economizados"
30 31  
31 32 @selenium
32 33 Scenario: Show new institution fields when clicked in add new institution
33 34 Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
34   - And I click on anything with selector "#comments-additional-information"
  35 + And I sleep for 1 seconds
  36 + And I click on anything with selector "comments-additional-information"
35 37 And I fill in "input_institution" with "None institution"
36 38 And I sleep for 2 seconds
37 39 When I follow "Add"
38   - Then I should see "New Institution"
39   - And I should see "Public Institution"
  40 + Then I should see "Public Institution"
40 41 And I should see "Private Institution"
41 42 And I should see "Corporate Name"
42 43 And I should see "Name"
... ... @@ -46,33 +47,30 @@ Feature: Create institution on user report
46 47 And I should see "CNPJ"
47 48 And I should see "Acronym"
48 49 And I choose "Public Institution"
49   - And I should see "Governmental Sphere:"
50   - And I should see "Governmental Power:"
51   - And I should see "Juridical Nature:"
  50 + And I should see "Governmental Sphere"
  51 + And I should see "Governmental Power"
  52 + And I should see "Juridical Nature"
52 53  
53 54 @selenium
54 55 Scenario: Create new institution with name changed in the modal
55 56 Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
56   - And I click on anything with selector "#comments-additional-information"
  57 + And I sleep for 1 seconds
  58 + And I click on anything with selector "comments-additional-information"
57 59 And I fill in "input_institution" with "None institution"
58 60 And I sleep for 2 seconds
59   - When I click on anything with selector "#create_institution_link"
  61 + When I click on anything with selector "create_institution_link"
60 62 And I fill in "community_name" with "Noosfero Institution"
61   - And I select "United States" from "#community_country"
62   - And I follow "#save_institution_button"
  63 + And I select "United States" from "Country"
  64 + And I sleep for 1 seconds
  65 + And I follow "Save"
63 66 Then I should see "Noosfero Institution"
64 67  
65 68 @selenium
66 69 Scenario: Check new institution name in the modal
67 70 Given I go to /profile/noosfero/plugin/organization_ratings/new_rating
68   - And I click on anything with selector "#comments-additional-information"
  71 + And I sleep for 1 seconds
  72 + And I click on anything with selector "comments-additional-information"
69 73 And I fill in "input_institution" with "None institution"
70 74 And I sleep for 2 seconds
71   - When I click on anything with selector "#create_institution_link"
72   - Then I should see "None Institution" within "community_name"
73   -
74   -
75   -
76   -
77   -
78   -
  75 + When I click on anything with selector "create_institution_link"
  76 + Then I should see "None institution" in "Corporate Name" field
... ...
src/noosfero-spb/gov_user/features/user_profile_edition.feature
... ... @@ -5,12 +5,15 @@ Feature: Institution Field
5 5  
6 6 Background:
7 7 Given "GovUserPlugin" plugin is enabled
  8 + And "SoftwareCommunitiesPlugin" plugin is enabled
8 9 And the following users
9 10 | login | name |
10 11 | joao | Joao Silva |
11 12 And I am logged in as admin
  13 + And I go to /admin/environment_themes/set/noosfero-spb-theme
12 14 And I go to /admin/plugins
13 15 And I check "GovUserPlugin"
  16 + And I check "SoftwareCommunitiesPlugin"
14 17 And I press "Save changes"
15 18 And feature "skip_new_user_email_confirmation" is enabled on environment
16 19 And I go to /admin/features/manage_fields
... ... @@ -21,16 +24,16 @@ Feature: Institution Field
21 24 And Institutions has initial default values on database
22 25 And the following public institutions
23 26 | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name |
24   - | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades |
25   - | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF |
26   - | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
  27 + | Ministerio das Cidades | MC | BR | Distrito Federal | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | Ministerio das Cidades |
  28 + | Governo do DF | GDF | BR | Distrito Federal | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | Governo do DF |
  29 + | Ministerio do Planejamento | MP | BR | Distrito Federal | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
27 30  
  31 + @selenium
28 32 Scenario: Go to control panel when clicked on 'Complete your profile' link
29 33 Given I am logged in as "joao"
30 34 And I am on joao's control panel
31 35 When I follow "Complete your profile"
32 36 Then I should see "Profile settings for "
33   - And I should see "Personal information"
34 37  
35 38 @selenium
36 39 Scenario: Verify text information to use governmental e-mail
... ... @@ -44,13 +47,12 @@ Feature: Institution Field
44 47 Given I am logged in as "joao"
45 48 And I am on joao's control panel
46 49 When I follow "Edit Profile"
47   - And I follow "Add new institution"
48 50 And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento"
49   - And I follow "Add new institution"
  51 + And I follow "Add institution"
50 52 And I type in "Gover" in autocomplete list "#input_institution" and I choose "Governo do DF"
51   - And I follow "Add new institution"
52   - Then I should see "Ministerio do Planejamento" within ".institutions_added"
53   - And I should see "Governo do DF" within ".institutions_added"
  53 + And I follow "Add institution"
  54 + Then I should see "Ministerio do Planejamento"
  55 + And I should see "Governo do DF"
54 56  
55 57 @selenium
56 58 Scenario: Verify if field 'city' is shown when Brazil is selected
... ... @@ -75,3 +77,14 @@ Feature: Institution Field
75 77 And I fill in "input_institution" with "Some Nonexistent Institution"
76 78 And I sleep for 1 seconds
77 79 Then I should see "No institution found"
  80 +
  81 + @selenium
  82 + Scenario: Does not suggest institution that already exists
  83 + Given I am logged in as "joao"
  84 + And I am on joao's control panel
  85 + When I follow "Edit Profile"
  86 + And I type in "Minis" in autocomplete list "#input_institution" and I choose "Ministerio do Planejamento"
  87 + And I follow "Add institution"
  88 + And I fill in "input_institution" with "Minis"
  89 + And I sleep for 1 seconds
  90 + Then I should not see "Ministerio do Planejamento" within "ul.ui-autocomplete"
... ...
src/noosfero-spb/gov_user/lib/ext/organization_rating.rb
... ... @@ -6,7 +6,7 @@ OrganizationRating.class_eval do
6 6  
7 7 attr_accessible :institution, :institution_id
8 8  
9   - validate :verify_institution
  9 + validate :verify_institution, :verify_organization_rating_values
10 10  
11 11 private
12 12  
... ... @@ -18,4 +18,11 @@ OrganizationRating.class_eval do
18 18 end
19 19 end
20 20  
  21 + def verify_organization_rating_values
  22 + if self.institution.nil? && (self.people_benefited || self.saved_value)
  23 + self.errors.add :institution, _("Report values cannot be saved without an institution")
  24 + false
  25 + end
  26 + end
  27 +
21 28 end
... ...
src/noosfero-spb/gov_user/lib/ext/search_controller.rb
... ... @@ -3,6 +3,7 @@ require_dependency &#39;search_controller&#39;
3 3 class SearchController
4 4  
5 5 def communities
  6 + @titles[:communities] = _("Communities Search")
6 7 delete_communities = []
7 8 valid_communities_string = Community.get_valid_communities_string
8 9 Community.all.each{|community| delete_communities << community.id unless eval(valid_communities_string)}
... ... @@ -14,7 +15,7 @@ class SearchController
14 15 end
15 16  
16 17 def institutions
17   - @titles[:institutions] = _("Institution Catalog")
  18 + @titles[:institutions] = _("Institutions Search")
18 19 results = filter_communities_list{|community| community.institution?}
19 20 results = results.paginate(:per_page => 24, :page => params[:page])
20 21 @searches[@asset] = {:results => results}
... ...
src/noosfero-spb/gov_user/lib/institution.rb
  1 +#encoding: utf-8
  2 +
1 3 class Institution < ActiveRecord::Base
2 4 has_many :comments
3 5  
4 6 SEARCH_FILTERS = {
5   - :order => %w[],
  7 + :order => %w[more_recent more_popular more_active],
6 8 :display => %w[compact]
7 9 }
8 10  
9 11 CNPJ_FORMAT = /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
10 12  
  13 + VALID_STATES = { "AC"=>"Acre", "AL"=>"Alagoas", "AM"=>"Amazonas", "AP"=>"Amapá", "BA"=>"Bahia", "CE"=>"Ceará",
  14 + "DF"=>"Distrito Federal", "ES"=>"Espírito Santo", "GO"=>"Goiás", "MA"=>"Maranhão", "MT"=>"Mato Grosso",
  15 + "MS"=>"Mato Grosso do Sul", "MG"=>"Minas Gerais", "PA"=>"Pará", "PB"=>"Paraíba", "PR"=>"Paraná",
  16 + "PE"=>"Pernambuco", "PI"=>"Piauí", "RJ"=>"Rio de Janeiro", "RN"=>"Rio Grande do Norte", "RO"=>"Rondônia",
  17 + "RS"=>"Rio Grande do Sul", "RR"=>"Roraima", "SC"=>"Santa Catarina", "SE"=>"Sergipe", "SP"=>"São Paulo", "TO"=>"Tocantins" }
  18 +
11 19 def self.default_search_display
12 20 'compact'
13 21 end
... ... @@ -31,8 +39,8 @@ class Institution &lt; ActiveRecord::Base
31 39  
32 40 belongs_to :community
33 41  
34   - scope :search_institution, lambda{ |value|
35   - where("name ilike ? OR acronym ilike ?", "%#{value}%", "%#{value}%" )
  42 + scope :search_institution, lambda{ |value, env|
  43 + joins(:community).where("(profiles.name ilike ? OR institutions.acronym ilike ?) AND profiles.environment_id = ?", "%#{value}%", "%#{value}%", env.id)
36 44 }
37 45  
38 46 validate :validate_country, :validate_state, :validate_city,
... ... @@ -76,12 +84,12 @@ class Institution &lt; ActiveRecord::Base
76 84 end
77 85  
78 86 def validate_state
79   - unless self.community.blank?
80   - if self.community.country == "BR" &&
81   - (self.community.state.blank? || self.community.state == "-1") &&
82   - self.errors[:state].blank?
83   -
84   - self.errors.add(:state, _("can't be blank"))
  87 + if self.community.present? && self.community.country == "BR"
  88 + if self.community.state.blank?
  89 + self.errors.add(:state, _("can't be blank")) if self.errors[:state].blank?
  90 + return false
  91 + elsif !VALID_STATES.values.include?(self.community.state)
  92 + self.errors.add(:state, _("invalid state")) if self.errors[:state].blank?
85 93 return false
86 94 end
87 95 end
... ...
src/noosfero-spb/gov_user/lib/private_institution.rb
1 1 class PrivateInstitution < Institution
2 2 validates :cnpj,
3   - :presence=>true,
4 3 :format => {with: CNPJ_FORMAT},
5 4 :if => :is_a_brazilian_institution?
6 5  
7 6 validates :cnpj,
8   - :uniqueness=>true, :unless => 'cnpj.blank?'
  7 + :uniqueness => true, :unless => 'cnpj.blank?'
9 8  
10 9 private
11 10 def is_a_brazilian_institution?
... ...
src/noosfero-spb/gov_user/lib/public_institution.rb
1 1 class PublicInstitution < Institution
2 2 validates :governmental_power, :governmental_sphere, :juridical_nature,
3   - :presence=>true
  3 + :presence=>true, :unless=>lambda{self.community.country != "BR"}
4 4  
5 5 validates :cnpj,
6 6 :format => {with: CNPJ_FORMAT},
... ...
src/noosfero-spb/gov_user/po/gov_user.pot
... ... @@ -6,8 +6,8 @@
6 6 #, fuzzy
7 7 msgid ""
8 8 msgstr ""
9   -"Project-Id-Version: 1.3.1-61-g25bc299\n"
10   -"POT-Creation-Date: 2016-01-07 13:00-0000\n"
  9 +"Project-Id-Version: 1.3.1-64-g92ff843\n"
  10 +"POT-Creation-Date: 2016-01-22 17:58-0000\n"
11 11 "PO-Revision-Date: 2015-09-01 20:59-0000\n"
12 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 13 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -17,39 +17,77 @@ msgstr &quot;&quot;
17 17 "Content-Transfer-Encoding: 8bit\n"
18 18 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19 19  
20   -#: plugins/gov_user/test/unit/gov_user_person_test.rb:50
21   -#: plugins/gov_user/test/unit/gov_user_person_test.rb:56
22   -msgid "Name Should begin with a capital letter and no special characters"
23   -msgstr ""
24   -
25   -#: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:28
26   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:181
  20 +#: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:30
  21 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:183
27 22 msgid "Could not find Governmental Power or Governmental Sphere"
28 23 msgstr ""
29 24  
30   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:137
31   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:80
  25 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:139
  26 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:78
32 27 msgid "Select a Governmental Sphere"
33 28 msgstr ""
34 29  
35   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:142
36   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:87
  30 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:144
  31 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:85
37 32 msgid "Select a Governmental Power"
38 33 msgstr ""
39 34  
40   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:147
41   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:93
  35 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:149
  36 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:91
42 37 msgid "Select a Juridical Nature"
43 38 msgstr ""
44 39  
45   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:227
  40 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:229
46 41 msgid "Institution successful created!"
47 42 msgstr ""
48 43  
49   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:232
  44 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:234
50 45 msgid "Institution could not be created!"
51 46 msgstr ""
52 47  
  48 +#: plugins/gov_user/test/unit/gov_user_person_test.rb:49
  49 +#: plugins/gov_user/test/unit/gov_user_person_test.rb:55
  50 +msgid "Name Should begin with a capital letter and no special characters"
  51 +msgstr ""
  52 +
  53 +#: plugins/gov_user/lib/institution_modal_helper.rb:9
  54 +msgid "Create new institution"
  55 +msgstr ""
  56 +
  57 +#: plugins/gov_user/lib/institution_modal_helper.rb:55
  58 +msgid "New Institution"
  59 +msgstr ""
  60 +
  61 +#: plugins/gov_user/lib/institution.rb:58
  62 +msgid "invalid, only public and private institutions are allowed."
  63 +msgstr ""
  64 +
  65 +#: plugins/gov_user/lib/institution.rb:70
  66 +#: plugins/gov_user/lib/institution.rb:84
  67 +#: plugins/gov_user/lib/institution.rb:97
  68 +msgid "can't be blank"
  69 +msgstr ""
  70 +
  71 +#: plugins/gov_user/lib/institutions_block.rb:4
  72 +#: plugins/gov_user/views/person_editor_extras.html.erb:2
  73 +msgid "Institutions"
  74 +msgstr ""
  75 +
  76 +#: plugins/gov_user/lib/institutions_block.rb:12
  77 +msgid "{#} institution"
  78 +msgid_plural "{#} institutions"
  79 +msgstr[0] ""
  80 +msgstr[1] ""
  81 +
  82 +#: plugins/gov_user/lib/institutions_block.rb:16
  83 +msgid "This block displays the institutions in which the user is a member."
  84 +msgstr ""
  85 +
  86 +#: plugins/gov_user/lib/institutions_block.rb:24
  87 +#: plugins/gov_user/lib/institutions_block.rb:30
  88 +msgid "institutions|View all"
  89 +msgstr ""
  90 +
53 91 #: plugins/gov_user/lib/gov_user_plugin.rb:21
54 92 msgid "Add features related to Brazilian government."
55 93 msgstr ""
... ... @@ -64,67 +102,75 @@ msgid &quot;Institution Info&quot;
64 102 msgstr ""
65 103  
66 104 #: plugins/gov_user/lib/gov_user_plugin.rb:331
67   -#: plugins/gov_user/views/organization_ratings_container_extra_fields_show_institution.html.erb:4
68 105 #: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:4
  106 +#: plugins/gov_user/views/organization_ratings_container_extra_fields_show_institution.html.erb:4
69 107 msgid "Institution"
70 108 msgstr ""
71 109  
72   -#: plugins/gov_user/lib/institution.rb:58
73   -msgid "invalid, only public and private institutions are allowed."
  110 +#: plugins/gov_user/lib/ext/organization_rating.rb:16
  111 +msgid "institution not found"
74 112 msgstr ""
75 113  
76   -#: plugins/gov_user/lib/institution.rb:70
77   -#: plugins/gov_user/lib/institution.rb:84
78   -#: plugins/gov_user/lib/institution.rb:97
79   -msgid "can't be blank"
  114 +#: plugins/gov_user/lib/ext/search_controller.rb:6
  115 +msgid "Communities Search"
80 116 msgstr ""
81 117  
82   -#: plugins/gov_user/lib/ext/user.rb:19
83   -msgid "Email must be different from secondary email."
  118 +#: plugins/gov_user/lib/ext/search_controller.rb:18
  119 +msgid "Institutions Search"
84 120 msgstr ""
85 121  
86   -#: plugins/gov_user/lib/ext/user.rb:40
87   -msgid "E-mail or secondary e-mail already taken."
  122 +#: plugins/gov_user/views/incomplete_registration.html.erb:3
  123 +msgid "Complete Profile"
88 124 msgstr ""
89 125  
90   -#: plugins/gov_user/lib/ext/user.rb:50
91   -msgid "Invalid secondary email format."
  126 +#: plugins/gov_user/views/incomplete_registration.html.erb:6
  127 +msgid "Complete your profile"
92 128 msgstr ""
93 129  
94   -#: plugins/gov_user/lib/ext/search_controller.rb:17
95   -msgid "Institution Catalog"
  130 +#: plugins/gov_user/views/incomplete_registration.html.erb:7
  131 +msgid "Hide"
96 132 msgstr ""
97 133  
98   -#: plugins/gov_user/lib/ext/organization_rating.rb:16
99   -msgid "institution not found"
  134 +#: plugins/gov_user/views/person_editor_extras.html.erb:6
  135 +msgid "Add institution"
100 136 msgstr ""
101 137  
102   -#: plugins/gov_user/lib/institution_modal_helper.rb:9
103   -msgid "Create new institution"
  138 +#: plugins/gov_user/views/person_editor_extras.html.erb:13
  139 +msgid "No institution found"
104 140 msgstr ""
105 141  
106   -#: plugins/gov_user/lib/institution_modal_helper.rb:55
107   -msgid "New Institution"
  142 +#: plugins/gov_user/views/person_editor_extras.html.erb:30
  143 +msgid "Should begin with a capital letter and no special characters"
108 144 msgstr ""
109 145  
110   -#: plugins/gov_user/lib/institutions_block.rb:4
111   -#: plugins/gov_user/views/person_editor_extras.html.erb:11
112   -msgid "Institutions"
  146 +#: plugins/gov_user/views/person_editor_extras.html.erb:31
  147 +msgid "Email should have the following format: name@host.br"
113 148 msgstr ""
114 149  
115   -#: plugins/gov_user/lib/institutions_block.rb:12
116   -msgid "{#} institution"
117   -msgid_plural "{#} institutions"
118   -msgstr[0] ""
119   -msgstr[1] ""
  150 +#: plugins/gov_user/views/person_editor_extras.html.erb:32
  151 +msgid "Site should have a valid format: http://name.hosts"
  152 +msgstr ""
120 153  
121   -#: plugins/gov_user/lib/institutions_block.rb:16
122   -msgid "This block displays the institutions in which the user is a member."
  154 +#: plugins/gov_user/views/person_editor_extras.html.erb:33
  155 +msgid "If you work in a public agency use your government e-Mail"
123 156 msgstr ""
124 157  
125   -#: plugins/gov_user/lib/institutions_block.rb:24
126   -#: plugins/gov_user/lib/institutions_block.rb:30
127   -msgid "institutions|View all"
  158 +#: plugins/gov_user/views/ratings_extra_field.html.erb:2
  159 +msgid "Organization name or Enterprise name"
  160 +msgstr ""
  161 +
  162 +#: plugins/gov_user/views/ratings_extra_field.html.erb:7
  163 +msgid "No organization or company found"
  164 +msgstr ""
  165 +
  166 +#: plugins/gov_user/views/ratings_extra_field.html.erb:8
  167 +msgid "Add"
  168 +msgstr ""
  169 +
  170 +#: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:9
  171 +msgid ""
  172 +"This institution already has an accepted rating. Accepting it will "
  173 +"automatically update the saved value."
128 174 msgstr ""
129 175  
130 176 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:1
... ... @@ -144,175 +190,94 @@ msgstr &quot;&quot;
144 190 msgid "\"Can`t create new Institution: #{flash[:errors].length} errors\""
145 191 msgstr ""
146 192  
147   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:28
  193 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:23
  194 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11
  195 +msgid "The highlighted fields are mandatory"
  196 +msgstr ""
  197 +
  198 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:32
148 199 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:51
149 200 msgid "Public Institution"
150 201 msgstr ""
151 202  
152   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:33
  203 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:37
153 204 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:44
154 205 msgid "Private Institution"
155 206 msgstr ""
156 207  
157   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:40
158   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:67
159   -msgid "Institution name already exists"
160   -msgstr ""
161   -
162   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:44
  208 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:43
163 209 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:62
164 210 msgid "Corporate Name"
165 211 msgstr ""
166 212  
167   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:49
  213 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:45
  214 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:69
  215 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:71
  216 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:119
  217 +msgid "Fantasy name"
  218 +msgstr ""
  219 +
  220 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:47
168 221 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:79
169 222 msgid "Country"
170 223 msgstr ""
171 224  
172   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:53
  225 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:51
173 226 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:88
174 227 msgid "State"
175 228 msgstr ""
176 229  
177   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:63
  230 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:61
178 231 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:109
179 232 msgid "CNPJ"
180 233 msgstr ""
181 234  
  235 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:68
182 236 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:70
183   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:72
184 237 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:118
185 238 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:120
186 239 msgid "Acronym"
187 240 msgstr ""
188 241  
189   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:71
190   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:71
191   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:119
192   -msgid "Fantasy name"
193   -msgstr ""
194   -
195   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:79
  242 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:77
196 243 #: plugins/gov_user/views/profile/_institution_tab.html.erb:17
197 244 msgid "Governmental Sphere:"
198 245 msgstr ""
199 246  
200   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:86
  247 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:84
201 248 #: plugins/gov_user/views/profile/_institution_tab.html.erb:16
202 249 msgid "Governmental Power:"
203 250 msgstr ""
204 251  
205   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:92
  252 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:90
206 253 #: plugins/gov_user/views/profile/_institution_tab.html.erb:18
207 254 msgid "Juridical Nature:"
208 255 msgstr ""
209 256  
210   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99
  257 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:97
211 258 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:164
212 259 msgid "SISP?"
213 260 msgstr ""
214 261  
215   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101
216   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
  262 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99
217 263 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:169
  264 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
218 265 msgid "Yes"
219 266 msgstr ""
220 267  
221   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:103
222   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:106
223   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
  268 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101
  269 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:104
224 270 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:174
  271 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
225 272 msgid "No"
226 273 msgstr ""
227 274  
228   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:111
  275 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:109
229 276 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:184
230 277 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:187
231 278 msgid "Save"
232 279 msgstr ""
233 280  
234   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:3
235   -msgid "Institution Information"
236   -msgstr ""
237   -
238   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:6
239   -msgid "Type:"
240   -msgstr ""
241   -
242   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:7
243   -msgid "CNPJ:"
244   -msgstr ""
245   -
246   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:8
247   -msgid "Last modification:"
248   -msgstr ""
249   -
250   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:9
251   -msgid "Country:"
252   -msgstr ""
253   -
254   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:10
255   -msgid "State:"
256   -msgstr ""
257   -
258   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:11
259   -msgid "City:"
260   -msgstr ""
261   -
262   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:13
263   -msgid "Fantasy Name:"
264   -msgstr ""
265   -
266   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:15
267   -msgid "Acronym:"
268   -msgstr ""
269   -
270   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
271   -msgid "SISP:"
272   -msgstr ""
273   -
274   -#: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:9
275   -msgid ""
276   -"This institution already has an accepted rating. Accepting it will "
277   -"automatically update the saved value."
278   -msgstr ""
279   -
280   -#: plugins/gov_user/views/ratings_extra_field.html.erb:2
281   -msgid "Organization name or Enterprise name"
282   -msgstr ""
283   -
284   -#: plugins/gov_user/views/ratings_extra_field.html.erb:7
285   -msgid "No organization or company found"
286   -msgstr ""
287   -
288   -#: plugins/gov_user/views/ratings_extra_field.html.erb:8
289   -msgid "Add"
290   -msgstr ""
291   -
292   -#: plugins/gov_user/views/person_editor_extras.html.erb:2
293   -msgid "Secondary e-mail"
294   -msgstr ""
295   -
296   -#: plugins/gov_user/views/person_editor_extras.html.erb:21
297   -msgid "No institution found"
298   -msgstr ""
299   -
300   -#: plugins/gov_user/views/person_editor_extras.html.erb:38
301   -msgid "Should begin with a capital letter and no special characters"
302   -msgstr ""
303   -
304   -#: plugins/gov_user/views/person_editor_extras.html.erb:39
305   -msgid "Email should have the following format: name@host.br"
306   -msgstr ""
307   -
308   -#: plugins/gov_user/views/person_editor_extras.html.erb:40
309   -msgid "Site should have a valid format: http://name.hosts"
310   -msgstr ""
311   -
312   -#: plugins/gov_user/views/person_editor_extras.html.erb:41
313   -msgid "If you work in a public agency use your government e-Mail"
314   -msgstr ""
315   -
316 281 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:5
317 282 msgid ""
318 283 "Note that the creation of institutions in this environment is restricted. "
... ... @@ -321,14 +286,14 @@ msgid &quot;&quot;
321 286 "and criteria."
322 287 msgstr ""
323 288  
324   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11
325   -msgid "The highlighted fields are mandatory"
326   -msgstr ""
327   -
328 289 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:23
329 290 msgid "\"<b>#{key_name.capitalize}</b> #{value.join()}\""
330 291 msgstr ""
331 292  
  293 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:67
  294 +msgid "Institution name already exists"
  295 +msgstr ""
  296 +
332 297 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:83
333 298 msgid "Select a country"
334 299 msgstr ""
... ... @@ -366,14 +331,42 @@ msgstr &quot;&quot;
366 331 msgid "Type words about the %s you're looking for"
367 332 msgstr ""
368 333  
369   -#: plugins/gov_user/views/incomplete_registration.html.erb:3
370   -msgid "Complete Profile"
  334 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:3
  335 +msgid "Institution Information"
371 336 msgstr ""
372 337  
373   -#: plugins/gov_user/views/incomplete_registration.html.erb:6
374   -msgid "Complete your profile"
  338 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:6
  339 +msgid "Type:"
375 340 msgstr ""
376 341  
377   -#: plugins/gov_user/views/incomplete_registration.html.erb:7
378   -msgid "Hide"
  342 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:7
  343 +msgid "CNPJ:"
  344 +msgstr ""
  345 +
  346 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:8
  347 +msgid "Last modification:"
  348 +msgstr ""
  349 +
  350 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:9
  351 +msgid "Country:"
  352 +msgstr ""
  353 +
  354 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:10
  355 +msgid "State:"
  356 +msgstr ""
  357 +
  358 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:11
  359 +msgid "City:"
  360 +msgstr ""
  361 +
  362 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:13
  363 +msgid "Fantasy Name:"
  364 +msgstr ""
  365 +
  366 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:15
  367 +msgid "Acronym:"
  368 +msgstr ""
  369 +
  370 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
  371 +msgid "SISP:"
379 372 msgstr ""
... ...
src/noosfero-spb/gov_user/po/pt/gov_user.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.3.1-61-g25bc299\n"
9   -"POT-Creation-Date: 2016-01-07 13:00-0000\n"
  8 +"Project-Id-Version: 1.3.1-64-g92ff843\n"
  9 +"POT-Creation-Date: 2016-01-22 17:58-0000\n"
10 10 "PO-Revision-Date: 2015-09-01 19:55-0000\n"
11 11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 12 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -16,58 +16,47 @@ msgstr &quot;&quot;
16 16 "Content-Transfer-Encoding: 8bit\n"
17 17 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18 18  
19   -#: plugins/gov_user/test/unit/gov_user_person_test.rb:50
20   -#: plugins/gov_user/test/unit/gov_user_person_test.rb:56
21   -msgid "Name Should begin with a capital letter and no special characters"
22   -msgstr ""
23   -"Nome deve iniciar com letrar maiúscula e não deve conter carateres especiais"
24   -
25   -#: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:28
26   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:181
  19 +#: plugins/gov_user/controllers/gov_user_plugin_myprofile_controller.rb:30
  20 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:183
27 21 msgid "Could not find Governmental Power or Governmental Sphere"
28 22 msgstr "Não foi possível encontrar o Poder ou Esfera Governamental"
29 23  
30   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:137
31   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:80
  24 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:139
  25 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:78
32 26 msgid "Select a Governmental Sphere"
33 27 msgstr "Selecione uma Esfera Governamental"
34 28  
35   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:142
36   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:87
  29 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:144
  30 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:85
37 31 msgid "Select a Governmental Power"
38 32 msgstr "Selecione um Poder Governamental"
39 33  
40   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:147
41   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:93
  34 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:149
  35 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:91
42 36 msgid "Select a Juridical Nature"
43 37 msgstr "Seleciona uma Natureza Jurídica"
44 38  
45   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:227
  39 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:229
46 40 msgid "Institution successful created!"
47 41 msgstr "Instituição criada com sucesso!"
48 42  
49   -#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:232
  43 +#: plugins/gov_user/controllers/gov_user_plugin_controller.rb:234
50 44 msgid "Institution could not be created!"
51 45 msgstr "Instituição não pode ser criada!"
52 46  
53   -#: plugins/gov_user/lib/gov_user_plugin.rb:21
54   -msgid "Add features related to Brazilian government."
55   -msgstr "Adicionar funcionlidade relacionada com o governo brasileiro."
56   -
57   -#: plugins/gov_user/lib/gov_user_plugin.rb:134
58   -#: plugins/gov_user/lib/gov_user_plugin.rb:166
59   -msgid "Create Institution"
60   -msgstr "Criar Instituição"
  47 +#: plugins/gov_user/test/unit/gov_user_person_test.rb:49
  48 +#: plugins/gov_user/test/unit/gov_user_person_test.rb:55
  49 +msgid "Name Should begin with a capital letter and no special characters"
  50 +msgstr ""
  51 +"Nome deve iniciar com letra maiúscula e não deve conter carateres especiais"
61 52  
62   -#: plugins/gov_user/lib/gov_user_plugin.rb:306
63   -msgid "Institution Info"
64   -msgstr "Informações da Instituição"
  53 +#: plugins/gov_user/lib/institution_modal_helper.rb:9
  54 +msgid "Create new institution"
  55 +msgstr "Criar nova instituição"
65 56  
66   -#: plugins/gov_user/lib/gov_user_plugin.rb:331
67   -#: plugins/gov_user/views/organization_ratings_container_extra_fields_show_institution.html.erb:4
68   -#: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:4
69   -msgid "Institution"
70   -msgstr "Instituição"
  57 +#: plugins/gov_user/lib/institution_modal_helper.rb:55
  58 +msgid "New Institution"
  59 +msgstr "Nova Instituição"
71 60  
72 61 #: plugins/gov_user/lib/institution.rb:58
73 62 msgid "invalid, only public and private institutions are allowed."
... ... @@ -79,36 +68,8 @@ msgstr &quot;Inválido, somente instituições públicas e privadas são permitidas.&quot;
79 68 msgid "can't be blank"
80 69 msgstr "não pode ficar em branco"
81 70  
82   -#: plugins/gov_user/lib/ext/user.rb:19
83   -msgid "Email must be different from secondary email."
84   -msgstr "Email deve ser diferente do email secundário"
85   -
86   -#: plugins/gov_user/lib/ext/user.rb:40
87   -msgid "E-mail or secondary e-mail already taken."
88   -msgstr "Email ou email secundário já estão sendo utilizados."
89   -
90   -#: plugins/gov_user/lib/ext/user.rb:50
91   -msgid "Invalid secondary email format."
92   -msgstr "Formato inválido do email sencundário"
93   -
94   -#: plugins/gov_user/lib/ext/search_controller.rb:17
95   -msgid "Institution Catalog"
96   -msgstr "Catálogo de Instituições"
97   -
98   -#: plugins/gov_user/lib/ext/organization_rating.rb:16
99   -msgid "institution not found"
100   -msgstr "Nenhuma instituição encontrada"
101   -
102   -#: plugins/gov_user/lib/institution_modal_helper.rb:9
103   -msgid "Create new institution"
104   -msgstr "Criar nova instituição"
105   -
106   -#: plugins/gov_user/lib/institution_modal_helper.rb:55
107   -msgid "New Institution"
108   -msgstr "Nova Instituição"
109   -
110 71 #: plugins/gov_user/lib/institutions_block.rb:4
111   -#: plugins/gov_user/views/person_editor_extras.html.erb:11
  72 +#: plugins/gov_user/views/person_editor_extras.html.erb:2
112 73 msgid "Institutions"
113 74 msgstr "Instituições"
114 75  
... ... @@ -127,6 +88,93 @@ msgstr &quot;Esse bloco mostra as instituições em que o usuário faz parte.&quot;
127 88 msgid "institutions|View all"
128 89 msgstr "instituições|Ver todas"
129 90  
  91 +#: plugins/gov_user/lib/gov_user_plugin.rb:21
  92 +msgid "Add features related to Brazilian government."
  93 +msgstr "Adicionar funcionalidade relacionada com o governo brasileiro."
  94 +
  95 +#: plugins/gov_user/lib/gov_user_plugin.rb:134
  96 +#: plugins/gov_user/lib/gov_user_plugin.rb:166
  97 +msgid "Create Institution"
  98 +msgstr "Criar Instituição"
  99 +
  100 +#: plugins/gov_user/lib/gov_user_plugin.rb:306
  101 +msgid "Institution Info"
  102 +msgstr "Informações da Instituição"
  103 +
  104 +#: plugins/gov_user/lib/gov_user_plugin.rb:331
  105 +#: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:4
  106 +#: plugins/gov_user/views/organization_ratings_container_extra_fields_show_institution.html.erb:4
  107 +msgid "Institution"
  108 +msgstr "Instituição"
  109 +
  110 +#: plugins/gov_user/lib/ext/organization_rating.rb:16
  111 +msgid "institution not found"
  112 +msgstr "Nenhuma instituição encontrada"
  113 +
  114 +#: plugins/gov_user/lib/ext/search_controller.rb:6
  115 +msgid "Communities Search"
  116 +msgstr "Buscar Comunidades"
  117 +
  118 +#: plugins/gov_user/lib/ext/search_controller.rb:18
  119 +msgid "Institutions Search"
  120 +msgstr "Buscar Instituições"
  121 +
  122 +#: plugins/gov_user/views/incomplete_registration.html.erb:3
  123 +msgid "Complete Profile"
  124 +msgstr "Complete o Perfil"
  125 +
  126 +#: plugins/gov_user/views/incomplete_registration.html.erb:6
  127 +msgid "Complete your profile"
  128 +msgstr "Complete seu perfil"
  129 +
  130 +#: plugins/gov_user/views/incomplete_registration.html.erb:7
  131 +msgid "Hide"
  132 +msgstr "Ocultar"
  133 +
  134 +#: plugins/gov_user/views/person_editor_extras.html.erb:6
  135 +msgid "Add institution"
  136 +msgstr "Adicionar instituição"
  137 +
  138 +#: plugins/gov_user/views/person_editor_extras.html.erb:13
  139 +msgid "No institution found"
  140 +msgstr "Nenhuma instituição encontrada"
  141 +
  142 +#: plugins/gov_user/views/person_editor_extras.html.erb:30
  143 +msgid "Should begin with a capital letter and no special characters"
  144 +msgstr "Deve começar com letra maíscula e não conter caracteres especiais"
  145 +
  146 +#: plugins/gov_user/views/person_editor_extras.html.erb:31
  147 +msgid "Email should have the following format: name@host.br"
  148 +msgstr "Email deve ter o seguinte formato: name@host.br"
  149 +
  150 +#: plugins/gov_user/views/person_editor_extras.html.erb:32
  151 +msgid "Site should have a valid format: http://name.hosts"
  152 +msgstr "Site deve ter um formato válido: http://name.hosts"
  153 +
  154 +#: plugins/gov_user/views/person_editor_extras.html.erb:33
  155 +msgid "If you work in a public agency use your government e-Mail"
  156 +msgstr "Se você trabalha em uma agência pública use seu email governamental"
  157 +
  158 +#: plugins/gov_user/views/ratings_extra_field.html.erb:2
  159 +msgid "Organization name or Enterprise name"
  160 +msgstr "Nome da organização ou empresa"
  161 +
  162 +#: plugins/gov_user/views/ratings_extra_field.html.erb:7
  163 +msgid "No organization or company found"
  164 +msgstr "Nenhum orgão ou empresa encontrados"
  165 +
  166 +#: plugins/gov_user/views/ratings_extra_field.html.erb:8
  167 +msgid "Add"
  168 +msgstr "Adicionar"
  169 +
  170 +#: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:9
  171 +msgid ""
  172 +"This institution already has an accepted rating. Accepting it will "
  173 +"automatically update the saved value."
  174 +msgstr ""
  175 +"* Você já aprovou uma avaliação desse órgão/empresa. Ao aceitar este relato, "
  176 +"o novo valor será adicionado."
  177 +
130 178 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:1
131 179 msgid "Edit Institution"
132 180 msgstr "Editar Instituição"
... ... @@ -149,177 +197,94 @@ msgid &quot;\&quot;Can`t create new Institution: #{flash[:errors].length} errors\&quot;&quot;
149 197 msgstr ""
150 198 "\"Não foi possível criar nova Instituição: #{flash[:errors].length} erros\""
151 199  
152   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:28
  200 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:23
  201 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11
  202 +msgid "The highlighted fields are mandatory"
  203 +msgstr "Todos os campos com (*) são obrigatórios"
  204 +
  205 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:32
153 206 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:51
154 207 msgid "Public Institution"
155 208 msgstr "Instituição Pública"
156 209  
157   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:33
  210 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:37
158 211 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:44
159 212 msgid "Private Institution"
160 213 msgstr "Instituição Privada"
161 214  
162   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:40
163   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:67
164   -msgid "Institution name already exists"
165   -msgstr "Nome de Instituição já existe"
166   -
167   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:44
  215 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:43
168 216 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:62
169 217 msgid "Corporate Name"
170 218 msgstr "Razão Social"
171 219  
172   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:49
  220 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:45
  221 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:69
  222 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:71
  223 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:119
  224 +msgid "Fantasy name"
  225 +msgstr "Nome Fantasia"
  226 +
  227 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:47
173 228 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:79
174 229 msgid "Country"
175 230 msgstr "País"
176 231  
177   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:53
  232 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:51
178 233 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:88
179 234 msgid "State"
180 235 msgstr "Estado"
181 236  
182   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:63
  237 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:61
183 238 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:109
184 239 msgid "CNPJ"
185 240 msgstr "CNPJ"
186 241  
  242 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:68
187 243 #: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:70
188   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:72
189 244 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:118
190 245 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:120
191 246 msgid "Acronym"
192 247 msgstr "Sigla"
193 248  
194   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:71
195   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:71
196   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:119
197   -msgid "Fantasy name"
198   -msgstr "Nome Fantasia"
199   -
200   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:79
  249 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:77
201 250 #: plugins/gov_user/views/profile/_institution_tab.html.erb:17
202 251 msgid "Governmental Sphere:"
203 252 msgstr "Esfera Governamental:"
204 253  
205   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:86
  254 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:84
206 255 #: plugins/gov_user/views/profile/_institution_tab.html.erb:16
207 256 msgid "Governmental Power:"
208 257 msgstr "Poder Governamental:"
209 258  
210   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:92
  259 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:90
211 260 #: plugins/gov_user/views/profile/_institution_tab.html.erb:18
212 261 msgid "Juridical Nature:"
213 262 msgstr "Natureza Jurídica:"
214 263  
215   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99
  264 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:97
216 265 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:164
217 266 msgid "SISP?"
218 267 msgstr "SISP?"
219 268  
220   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101
221   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
  269 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:99
222 270 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:169
  271 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
223 272 msgid "Yes"
224 273 msgstr "Sim"
225 274  
226   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:103
227   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:106
228   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
  275 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:101
  276 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:104
229 277 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:174
  278 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
230 279 msgid "No"
231 280 msgstr "Não"
232 281  
233   -#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:111
  282 +#: plugins/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb:109
234 283 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:184
235 284 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:187
236 285 msgid "Save"
237 286 msgstr "Salvar"
238 287  
239   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:3
240   -msgid "Institution Information"
241   -msgstr "Informação da Instituição"
242   -
243   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:6
244   -msgid "Type:"
245   -msgstr "Tipo:"
246   -
247   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:7
248   -msgid "CNPJ:"
249   -msgstr "CNPJ:"
250   -
251   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:8
252   -msgid "Last modification:"
253   -msgstr "Última modificação:"
254   -
255   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:9
256   -msgid "Country:"
257   -msgstr "País:"
258   -
259   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:10
260   -msgid "State:"
261   -msgstr "Estado:"
262   -
263   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:11
264   -msgid "City:"
265   -msgstr "Cidade:"
266   -
267   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:13
268   -msgid "Fantasy Name:"
269   -msgstr "Nome Fantasia:"
270   -
271   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:15
272   -msgid "Acronym:"
273   -msgstr "Sigla:"
274   -
275   -#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
276   -msgid "SISP:"
277   -msgstr "SISP:"
278   -
279   -#: plugins/gov_user/views/organization_ratings_task_extra_fields_show_institution.html.erb:9
280   -msgid ""
281   -"This institution already has an accepted rating. Accepting it will "
282   -"automatically update the saved value."
283   -msgstr ""
284   -"* Você já aprovou uma avaliação desse órgão/empresa. Ao aceitar este relato, "
285   -"o novo valor será adicionado."
286   -
287   -#: plugins/gov_user/views/ratings_extra_field.html.erb:2
288   -msgid "Organization name or Enterprise name"
289   -msgstr "Nome da organização ou empresa"
290   -
291   -#: plugins/gov_user/views/ratings_extra_field.html.erb:7
292   -msgid "No organization or company found"
293   -msgstr "Nenhum orgão ou empresa encontrados"
294   -
295   -#: plugins/gov_user/views/ratings_extra_field.html.erb:8
296   -msgid "Add"
297   -msgstr "Adicionar"
298   -
299   -#: plugins/gov_user/views/person_editor_extras.html.erb:2
300   -msgid "Secondary e-mail"
301   -msgstr "Email secundário"
302   -
303   -#: plugins/gov_user/views/person_editor_extras.html.erb:21
304   -msgid "No institution found"
305   -msgstr "Nenhuma instituição encontrada"
306   -
307   -#: plugins/gov_user/views/person_editor_extras.html.erb:38
308   -msgid "Should begin with a capital letter and no special characters"
309   -msgstr "Deve começar com letra maíscula e não conter caracteres especiais"
310   -
311   -#: plugins/gov_user/views/person_editor_extras.html.erb:39
312   -msgid "Email should have the following format: name@host.br"
313   -msgstr "Email deve ter o seguinte formato: name@host.br"
314   -
315   -#: plugins/gov_user/views/person_editor_extras.html.erb:40
316   -msgid "Site should have a valid format: http://name.hosts"
317   -msgstr "Site deve ter um formato válido: http://name.hosts"
318   -
319   -#: plugins/gov_user/views/person_editor_extras.html.erb:41
320   -msgid "If you work in a public agency use your government e-Mail"
321   -msgstr "Se você trabalha em uma agência pública use seu email governamental"
322   -
323 288 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:5
324 289 msgid ""
325 290 "Note that the creation of institutions in this environment is restricted. "
... ... @@ -332,14 +297,14 @@ msgstr &quot;&quot;
332 297 "%{environment} e será aprovada ou rejeitada de acordo com seus métodos e "
333 298 "critérios."
334 299  
335   -#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:11
336   -msgid "The highlighted fields are mandatory"
337   -msgstr "Todos os campos com (*) são obrigatórios"
338   -
339 300 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:23
340 301 msgid "\"<b>#{key_name.capitalize}</b> #{value.join()}\""
341 302 msgstr "\"<b>#{key_name.capitalize}</b> #{value.join()}\""
342 303  
  304 +#: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:67
  305 +msgid "Institution name already exists"
  306 +msgstr "Nome de Instituição já existe"
  307 +
343 308 #: plugins/gov_user/views/gov_user_plugin/_institution.html.erb:83
344 309 msgid "Select a country"
345 310 msgstr "Selecione um Estado"
... ... @@ -377,17 +342,60 @@ msgstr &quot;Criar instituição&quot;
377 342 msgid "Type words about the %s you're looking for"
378 343 msgstr "Escreve palavras sobre o %s que você está procurando"
379 344  
380   -#: plugins/gov_user/views/incomplete_registration.html.erb:3
381   -msgid "Complete Profile"
382   -msgstr "Complete o Perfil"
  345 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:3
  346 +msgid "Institution Information"
  347 +msgstr "Informação da Instituição"
383 348  
384   -#: plugins/gov_user/views/incomplete_registration.html.erb:6
385   -msgid "Complete your profile"
386   -msgstr "Complete seu perfil"
  349 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:6
  350 +msgid "Type:"
  351 +msgstr "Tipo:"
387 352  
388   -#: plugins/gov_user/views/incomplete_registration.html.erb:7
389   -msgid "Hide"
390   -msgstr "Ocultar"
  353 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:7
  354 +msgid "CNPJ:"
  355 +msgstr "CNPJ:"
  356 +
  357 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:8
  358 +msgid "Last modification:"
  359 +msgstr "Última modificação:"
  360 +
  361 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:9
  362 +msgid "Country:"
  363 +msgstr "País:"
  364 +
  365 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:10
  366 +msgid "State:"
  367 +msgstr "Estado:"
  368 +
  369 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:11
  370 +msgid "City:"
  371 +msgstr "Cidade:"
  372 +
  373 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:13
  374 +msgid "Fantasy Name:"
  375 +msgstr "Nome Fantasia:"
  376 +
  377 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:15
  378 +msgid "Acronym:"
  379 +msgstr "Sigla:"
  380 +
  381 +#: plugins/gov_user/views/profile/_institution_tab.html.erb:19
  382 +msgid "SISP:"
  383 +msgstr "SISP:"
  384 +
  385 +#~ msgid "Email must be different from secondary email."
  386 +#~ msgstr "Email deve ser diferente do email secundário"
  387 +
  388 +#~ msgid "E-mail or secondary e-mail already taken."
  389 +#~ msgstr "Email ou email secundário já estão sendo utilizados."
  390 +
  391 +#~ msgid "Invalid secondary email format."
  392 +#~ msgstr "Formato inválido do email sencundário"
  393 +
  394 +#~ msgid "Institution Catalog"
  395 +#~ msgstr "Catálogo de Instituições"
  396 +
  397 +#~ msgid "Secondary e-mail"
  398 +#~ msgstr "Email secundário"
391 399  
392 400 #~ msgid "SISP ?"
393 401 #~ msgstr "SISP ?"
... ... @@ -401,9 +409,6 @@ msgstr &quot;Ocultar&quot;
401 409 #~ msgid "not found"
402 410 #~ msgstr "não encontrada"
403 411  
404   -#~ msgid "Add new institution"
405   -#~ msgstr "Adicionar nova instituição"
406   -
407 412 #~ msgid "A plugin that does this and that."
408 413 #~ msgstr "Um plugin que faz isso e aquilo"
409 414  
... ...
src/noosfero-spb/gov_user/public/style.css
... ... @@ -33,3 +33,7 @@
33 33 #create_institution_link {
34 34 margin-left: 8px;
35 35 }
  36 +
  37 +#add_institution_link {
  38 + display: none;
  39 +}
... ...
src/noosfero-spb/gov_user/public/views/create-institution.js
... ... @@ -29,6 +29,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
29 29 $(".public-institutions-fields").hide();
30 30 $("#institutions_governmental_power option").selected(0);
31 31 $("#institutions_governmental_sphere option").selected(0);
  32 + $("#institutions_juridical_nature option").selected(0);
32 33 $("#cnpj_required_field_mark").html("(*)");
33 34 }
34 35  
... ... @@ -201,12 +202,13 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
201 202 $.ajax({
202 203 type: "GET",
203 204 url: AJAX_URL.get_institutions,
204   - data: {query: request.term},
  205 + data: {query: request.term, selected_institutions: get_selected_institutions()},
205 206 success: function(result){
206 207 response(result);
207 208  
208 209 if( result.length === 0 ) {
209 210 $('#institution_empty_ajax_message').switchClass("hide-field", "show-field");
  211 + $('#add_institution_link').hide();
210 212 toggle_extra_fields_style_status(true);
211 213 $("#institution_modal").css({display: "none"});
212 214 }
... ... @@ -221,12 +223,22 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
221 223  
222 224 select : function (event, selected) {
223 225 $('#institution_empty_ajax_message').switchClass("show-field", "hide-field");
224   - //$("#create_institution_link").remove();
  226 + $('#add_institution_link').show();
225 227 toggle_extra_fields_style_status(false);
226 228 $("#institution_selected").val(selected.item.id).attr("data-name", selected.item.label);
227 229 }
228 230 });
229 231 }
  232 +
  233 + function get_selected_institutions() {
  234 + var selected_institutions = []
  235 + $('.institutions_added').find('li').each(function() {
  236 + selected_institutions.push($(this).attr('data-institution'));
  237 + });
  238 +
  239 + return selected_institutions;
  240 + }
  241 +
230 242 function add_selected_institution_to_list(id, name) {
231 243 var selected_institution = "<li data-institution='"+id+"'>"+name;
232 244 selected_institution += "<a href='#' class='button without-text icon-remove remove-institution'></a></li>";
... ... @@ -245,6 +257,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
245 257  
246 258 // Visualy add the selected institution to the list
247 259 add_selected_institution_to_list(selected.val(), selected.attr("data-name"));
  260 + $(this).hide();
248 261  
249 262 // clean the institution flag
250 263 selected.val("").attr("data-name", "");
... ... @@ -270,25 +283,33 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
270 283  
271 284  
272 285 function show_hide_cnpj_city(country) {
273   - var cnpj = $("#institutions_cnpj").parent();
274   - var city = $("#community_city").parent();
275   - var state = $("#community_state").parent();
  286 + var cnpj = $("#institutions_cnpj").parent().parent();
  287 + var city = $("#community_city");
  288 + var city_label = $('label[for="community_city"]');
  289 + var state = $("#community_state");
  290 + var state_label = $('label[for="community_state"]');
276 291 var inst_type = $("input[name='institutions[type]']:checked").val();
277 292  
278   - institution_type_actions(inst_type);
279   -
280 293 if ( country === "-1" ) {
281 294 $("#community_country").val("BR");
282 295 country = "BR";
283 296 }
284 297  
  298 + institution_type_actions(inst_type);
  299 +
285 300 if ( country !== "BR" ) {
286 301 cnpj.hide();
  302 + city.val('');
287 303 city.hide();
  304 + city_label.hide();
  305 + state.val("");
288 306 state.hide();
  307 + state_label.hide();
289 308 } else {
290 309 cnpj.show();
291 310 city.show();
  311 + city_label.show();
  312 + state_label.show();
292 313 state.show();
293 314 }
294 315 }
... ... @@ -302,30 +323,6 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
302 323 }
303 324 }
304 325  
305   -
306   - function set_form_count_custom_data() {
307   - var divisor_option = SelectElement.generateOption("-1", "--------------------------------");
308   - var default_option = SelectElement.generateOption("BR", "Brazil");
309   -
310   -
311   - var inst_type = $("input[name='institutions[type]']:checked").val();
312   - var country = $("#community_country").val();
313   -
314   - institution_type_actions(inst_type);
315   - show_hide_cnpj_city(country);
316   -
317   - if( $('#community_country').find("option[value='']").length === 1 ) {
318   - $('#community_country').find("option[value='']").remove();
319   - $('#community_country').prepend(divisor_option);
320   - $('#community_country').prepend(default_option);
321   -
322   - if($("#edit_institution_page").val() === "false") {
323   - $('#community_country').val("BR");
324   - show_hide_cnpj_city($('#community_country').val());
325   - }
326   - }
327   - }
328   -
329 326 function autoCompleteCity() {
330 327 var country_selected = $('#community_country').val();
331 328  
... ... @@ -368,14 +365,14 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
368 365 function set_events() {
369 366 $("input[name='institutions[type]']").click(function(){
370 367 institution_type_actions(this.value);
371   - }).trigger("click");
  368 + });
372 369  
373 370 $('#save_institution_button').click(save_institution);
374 371 $('#cancel_institution_button').click(cancel_institution);
375 372  
376 373 $("#community_name").keyup(institution_already_exists);
377 374  
378   - $("#add_new_institution").click(add_new_institution);
  375 + $("#add_institution_link").click(add_new_institution);
379 376  
380 377 $(".remove-institution").click(remove_institution);
381 378  
... ... @@ -397,7 +394,7 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
397 394  
398 395  
399 396 function init_module() {
400   - set_form_count_custom_data();
  397 + show_hide_cnpj_city($('#community_country').val());
401 398 set_events();
402 399 }
403 400  
... ...
src/noosfero-spb/gov_user/public/views/new-community.js
... ... @@ -2,11 +2,6 @@
2 2  
3 3 modulejs.define("NewCommunity", ['jquery'], function($) {
4 4  
5   - function replace_mandatory_message() {
6   - $(".required-field").first()
7   - .replaceWith("<span class='required-field'> Os campos em destaque<label class='pseudoformlabel'> (*)</label> são obrigatórios. </span>");
8   - }
9   -
10 5 function remove_image_builder_text() {
11 6 $("label:contains('Image builder')").hide();
12 7 }
... ... @@ -22,7 +17,6 @@ modulejs.define(&quot;NewCommunity&quot;, [&#39;jquery&#39;], function($) {
22 17 },
23 18  
24 19 init: function() {
25   - replace_mandatory_message();
26 20 remove_image_builder_text();
27 21 hide_organization_template_fields();
28 22 }
... ...
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_controller_test.rb
... ... @@ -9,7 +9,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
9 9 def setup
10 10 @admin = create_user("adminuser").person
11 11 @admin.stubs(:has_permission?).returns("true")
12   - @controller.stubs(:current_user).returns(@admin.user)
  12 + login_as(@admin.user_login)
13 13  
14 14 @environment = Environment.default
15 15 @environment.enabled_plugins = ['SoftwareCommunitiesPlugin']
... ... @@ -26,7 +26,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
26 26 "Ministerio Publico da Uniao",
27 27 "MPU",
28 28 "BR",
29   - "DF",
  29 + "Distrito Federal",
30 30 "Gama",
31 31 @juridical_nature,
32 32 @gov_power,
... ... @@ -37,7 +37,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
37 37 "Tribunal Regional da Uniao",
38 38 "TRU",
39 39 "BR",
40   - "DF",
  40 + "Distrito Federal",
41 41 "Brasilia",
42 42 @juridical_nature,
43 43 @gov_power,
... ... @@ -68,8 +68,8 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
68 68  
69 69 json_response = ActiveSupport::JSON.decode(@response.body)
70 70  
71   - assert_equal "Ministerio Publico da Uniao", json_response[0]["value"]
72   - assert_equal "Tribunal Regional da Uniao", json_response[1]["value"]
  71 + assert json_response.any?{|r| r["value"] == "Ministerio Publico da Uniao"}
  72 + assert json_response.any?{|r| r["value"] == "Tribunal Regional da Uniao"}
73 73 end
74 74  
75 75 should "method create_institution return the html for modal" do
... ... @@ -84,7 +84,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
84 84 fields = InstitutionTestHelper.generate_form_fields(
85 85 "foo bar",
86 86 "BR",
87   - "DF",
  87 + "Distrito Federal",
88 88 "Brasilia",
89 89 "12.234.567/8900-10",
90 90 "PublicInstitution"
... ... @@ -100,13 +100,13 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
100 100 assert json_response["success"]
101 101 end
102 102  
103   - should "create a institution without cnpj" do
  103 + should "not create a private institution without cnpj" do
104 104 @controller.stubs(:verify_recaptcha).returns(true)
105 105  
106 106 fields = InstitutionTestHelper.generate_form_fields(
107 107 "Some Private Institution",
108 108 "BR",
109   - "DF",
  109 + "Distrito Federal",
110 110 "Brasilia",
111 111 "",
112 112 "PrivateInstitution"
... ... @@ -114,6 +114,28 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
114 114 fields[:institutions][:acronym] = "SPI"
115 115  
116 116 xhr :get, :new_institution, fields
  117 + json_response = ActiveSupport::JSON.decode(@response.body)
  118 +
  119 + assert_equal false, json_response["success"]
  120 + assert_equal false, json_response["errors"].blank?
  121 + end
  122 +
  123 + should "create public institution without cnpj" do
  124 + @controller.stubs(:verify_recaptcha).returns(true)
  125 +
  126 + fields = InstitutionTestHelper.generate_form_fields(
  127 + "Some Private Institution",
  128 + "BR",
  129 + "Distrito Federal",
  130 + "Brasilia",
  131 + "56.366.790/0001-88",
  132 + "PublicInstitution"
  133 + )
  134 + fields[:institutions][:governmental_power] = @gov_power.id
  135 + fields[:institutions][:governmental_sphere] = @gov_sphere.id
  136 + fields[:institutions][:juridical_nature] = @juridical_nature.id
  137 +
  138 + xhr :get, :new_institution, fields
117 139  
118 140 json_response = ActiveSupport::JSON.decode(@response.body)
119 141  
... ... @@ -144,7 +166,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
144 166 fields = InstitutionTestHelper.generate_form_fields(
145 167 "Some Private Institution",
146 168 "BR",
147   - "DF",
  169 + "Distrito Federal",
148 170 "Brasilia",
149 171 "12.345.567/8900-10",
150 172 "PrivateInstitution"
... ... @@ -162,7 +184,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
162 184 fields = InstitutionTestHelper.generate_form_fields(
163 185 "Some Private Institution",
164 186 "BR",
165   - "DF",
  187 + "Distrito Federal",
166 188 "Brasilia",
167 189 "56.366.790/0001-88",
168 190 "PrivateInstitution"
... ... @@ -221,7 +243,7 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
221 243 fields = InstitutionTestHelper.generate_form_fields(
222 244 "Private Institution",
223 245 "BR",
224   - "DF",
  246 + "Distrito Federal",
225 247 "Brasilia",
226 248 "12.323.557/8900-10",
227 249 "PrivateInstitution"
... ... @@ -233,4 +255,28 @@ class GovUserPluginControllerTest &lt; ActionController::TestCase
233 255 assert(Institution.last.community.is_admin?(admin2) )
234 256 end
235 257  
  258 + should "admin user can access action create_institution_admin" do
  259 + login_as(@admin.user_login)
  260 +
  261 + post :create_institution_admin
  262 +
  263 + assert_response 200
  264 + end
  265 +
  266 + should "disconnected user can not access action create_institution_admin" do
  267 + logout
  268 +
  269 + post :create_institution_admin
  270 +
  271 + assert_response 403
  272 + end
  273 +
  274 + should "regular user can not access action create_institution_admin" do
  275 + disconnected_user = create_user("another_admin").person
  276 + login_as(disconnected_user.user_login)
  277 +
  278 + post :create_institution_admin
  279 +
  280 + assert_response 403
  281 + end
236 282 end
... ...
src/noosfero-spb/gov_user/test/functional/gov_user_plugin_myprofile_controller.rb
... ... @@ -18,34 +18,35 @@ class GovUserPluginMyprofileControllerTest &lt; ActionController::TestCase
18 18 @offer_1 = create_user('Ana de Souza')
19 19 @offer_2 = create_user('Angelo Roberto')
20 20  
21   - login_as(@person.user_login)
22   - @environment = Environment.default
23   - @environment.enable_plugin('GovUserPlugin')
24   - @environment.save!
25   - end
26   - should "user edit its community institution" do
27   - govPower = GovernmentalPower.create(:name=>"Some Gov Power")
28   - govSphere = GovernmentalSphere.create(:name=>"Some Gov Sphere")
  21 + gov_power = GovernmentalPower.create(:name=>"Some Gov Power")
  22 + gov_sphere = GovernmentalSphere.create(:name=>"Some Gov Sphere")
29 23 juridical_nature = JuridicalNature.create(:name => "Autarquia")
30   -
31   - institution = InstitutionTestHelper.create_public_institution(
  24 + @institution = InstitutionTestHelper.create_public_institution(
32 25 "Ministerio Publico da Uniao",
33 26 "MPU",
34 27 "BR",
35   - "DF",
  28 + "Distrito Federal",
36 29 "Gama",
37 30 juridical_nature,
38   - govPower,
39   - govSphere,
  31 + gov_power,
  32 + gov_sphere,
40 33 "12.345.678/9012-45"
41 34 )
42 35  
43   - identifier = institution.community.identifier
  36 + login_as(@person.user_login)
  37 + @environment = Environment.default
  38 + @environment.enable_plugin('GovUserPlugin')
  39 + @environment.save!
  40 + end
  41 +
  42 + should "admin user edit an institution" do
  43 + @institution.community.add_admin @person
  44 + identifier = @institution.community.identifier
44 45  
45 46 fields = InstitutionTestHelper.generate_form_fields(
46 47 "institution new name",
47 48 "BR",
48   - "DF",
  49 + "Distrito Federal",
49 50 "Gama",
50 51 "12.345.678/9012-45",
51 52 "PrivateInstitution"
... ... @@ -53,7 +54,7 @@ class GovUserPluginMyprofileControllerTest &lt; ActionController::TestCase
53 54  
54 55 post(
55 56 :edit_institution,
56   - :profile=>institution.community.identifier,
  57 + :profile=>@institution.community.identifier,
57 58 :community=>fields[:community],
58 59 :institutions=>fields[:institutions]
59 60 )
... ... @@ -62,29 +63,35 @@ class GovUserPluginMyprofileControllerTest &lt; ActionController::TestCase
62 63 assert_not_equal "Ministerio Publico da Uniao", institution.community.name
63 64 end
64 65  
65   - should "not user edit its community institution with wrong values" do
66   - govPower = GovernmentalPower.create(:name=>"Some Gov Power")
67   - govSphere = GovernmentalSphere.create(:name=>"Some Gov Sphere")
68   - juridical_nature = JuridicalNature.create(:name => "Autarquia")
69   -
70   - institution = InstitutionTestHelper.create_public_institution(
71   - "Ministerio Publico da Uniao",
72   - "MPU",
  66 + should "regular user should not edit an institution" do
  67 + identifier = @institution.community.identifier
  68 + fields = InstitutionTestHelper.generate_form_fields(
  69 + "institution new name",
73 70 "BR",
74   - "DF",
  71 + "Distrito Federal",
75 72 "Gama",
76   - juridical_nature,
77   - govPower,
78   - govSphere,
79   - "12.345.678/9012-45"
  73 + "12.345.678/9012-45",
  74 + "PrivateInstitution"
  75 + )
  76 +
  77 + post(
  78 + :edit_institution,
  79 + :profile=>@institution.community.identifier,
  80 + :community=>fields[:community],
  81 + :institutions=>fields[:institutions]
80 82 )
81 83  
82   - identifier = institution.community.identifier
  84 + institution = Community[identifier].institution
  85 + assert_equal "Ministerio Publico da Uniao", institution.community.name
  86 + assert_response 403
  87 + end
83 88  
  89 + should "not user edit its community institution with wrong values" do
  90 + identifier = @institution.community.identifier
84 91 fields = InstitutionTestHelper.generate_form_fields(
85 92 "",
86 93 "BR",
87   - "DF",
  94 + "Distrito Federal",
88 95 "Gama",
89 96 "6465465465",
90 97 "PrivateInstitution"
... ... @@ -92,7 +99,7 @@ class GovUserPluginMyprofileControllerTest &lt; ActionController::TestCase
92 99  
93 100 post(
94 101 :edit_institution,
95   - :profile=>institution.community.identifier,
  102 + :profile=>@institution.community.identifier,
96 103 :community=>fields[:community],
97 104 :institutions=>fields[:institutions]
98 105 )
... ...
src/noosfero-spb/gov_user/test/functional/profile_editor_controller_test.rb
... ... @@ -38,7 +38,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
38 38 "Ministerio Publico da Uniao",
39 39 "MPU",
40 40 "BR",
41   - "DF",
  41 + "Distrito Federal",
42 42 "Gama",
43 43 @juridical_nature,
44 44 @govPower,
... ... @@ -50,7 +50,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
50 50 "Tribunal Regional da Uniao",
51 51 "TRU",
52 52 "BR",
53   - "DF",
  53 + "Distrito Federal",
54 54 "Brasilia",
55 55 @juridical_nature,
56 56 @govPower,
... ...
src/noosfero-spb/gov_user/test/unit/gov_user_person_test.rb
... ... @@ -14,7 +14,6 @@ class SoftwareCommunitiesPluginPersonTest &lt; ActiveSupport::TestCase
14 14 "My Name",
15 15 "user@email.com",
16 16 "123456",
17   - "123456",
18 17 "user2@email.com",
19 18 "Any State",
20 19 "Some City"
... ...
src/noosfero-spb/gov_user/test/unit/gov_user_plugin_api_test.rb 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +require File.dirname(__FILE__) + '/../../../../test/unit/api/test_helper'
  2 +require File.dirname(__FILE__) + '/../helpers/plugin_test_helper'
  3 +
  4 +class GovUserPlugin::ApiTest < ActiveSupport::TestCase
  5 +
  6 + include PluginTestHelper
  7 +
  8 + def setup
  9 + login_api
  10 + environment = Environment.default
  11 + environment.enable_plugin(GovUserPlugin)
  12 + @gov_power = GovernmentalPower.create(:name=>"Some Gov Power")
  13 + @gov_sphere = GovernmentalSphere.create(:name=>"Some Gov Sphere")
  14 + @juridical_nature = JuridicalNature.create(:name => "Autarquia")
  15 + @institution = create_public_institution(
  16 + "Ministerio Publico da Uniao",
  17 + "MPU",
  18 + "BR",
  19 + "Distrito Federal",
  20 + "Gama",
  21 + @juridical_nature,
  22 + @gov_power,
  23 + @gov_sphere,
  24 + "11.222.333/4444-55")
  25 + end
  26 +
  27 + should 'list all institutions' do
  28 + @institution1 = create_public_institution(
  29 + "Instituicao bacana",
  30 + "IB",
  31 + "BR",
  32 + "Distrito Federal",
  33 + "Gama",
  34 + @juridical_nature,
  35 + @gov_power,
  36 + @gov_sphere,
  37 + "11.222.333/4444-56"
  38 + )
  39 +
  40 + get "/api/v1/gov_user/institutions?#{params.to_query}"
  41 + json = JSON.parse(last_response.body)
  42 + assert_equivalent [@institution.id, @institution1.id], json['institutions'].map {|c| c['id']}
  43 + end
  44 +
  45 + should 'get institution by id' do
  46 + get "/api/v1/gov_user/institutions/#{@institution.id}?#{params.to_query}"
  47 + json = JSON.parse(last_response.body)
  48 + assert_equal @institution.id, json["institution"]["id"]
  49 + end
  50 +
  51 +end
... ...
src/noosfero-spb/gov_user/test/unit/institution_test.rb
... ... @@ -12,7 +12,7 @@ class InstitutionTest &lt; ActiveSupport::TestCase
12 12 "Ministerio Publico da Uniao",
13 13 "MPU",
14 14 "BR",
15   - "DF",
  15 + "Distrito Federal",
16 16 "Gama",
17 17 @juridical_nature,
18 18 @gov_power,
... ... @@ -27,30 +27,31 @@ class InstitutionTest &lt; ActiveSupport::TestCase
27 27 JuridicalNature.destroy_all
28 28 @institution = nil
29 29 end
  30 +
30 31 should "not save institutions without name" do
31 32 @institution.name = nil
32 33 assert_equal false, @institution.save
33   - assert_equal true, @institution.errors.full_messages.include?("Name can't be blank")
  34 + assert_equal true, @institution.errors.messages.keys.include?(:name)
34 35 end
35 36  
36 37 should "not save if institution has invalid type" do
37 38 invalid_msg = "Type invalid, only public and private institutions are allowed."
38 39 @institution.type = "Other type"
39 40 assert_equal false, @institution.save
40   - assert_equal true, @institution.errors.full_messages.include?(invalid_msg)
  41 + assert_equal true, @institution.errors.messages.keys.include?(:type)
41 42 end
42 43  
43 44 should "not save without country" do
44 45 @institution.community.country = nil
45 46 assert_equal false, @institution.save
46   - assert_equal true, @institution.errors.full_messages.include?("Country can't be blank")
  47 + assert_equal true, @institution.errors.messages.keys.include?(:country)
47 48 end
48 49  
49 50 should "not save without state" do
50 51 @institution.community.state = nil
51 52  
52 53 assert_equal false, @institution.save
53   - assert_equal true, @institution.errors.full_messages.include?("State can't be blank")
  54 + assert_equal true, @institution.errors.messages.keys.include?(:state)
54 55 end
55 56  
56 57 should "not save without city" do
... ... @@ -58,6 +59,18 @@ class InstitutionTest &lt; ActiveSupport::TestCase
58 59 @institution.community.state = "DF"
59 60  
60 61 assert_equal false, @institution.save
61   - assert_equal true, @institution.errors.full_messages.include?("City can't be blank")
  62 + assert_equal true, @institution.errors.messages.keys.include?(:city)
  63 + end
  64 +
  65 + should "only return institutions of a specific environment" do
  66 + env1 = Environment.create(:name => "Environment One")
  67 + env2 = Environment.create(:name => "Environment Two")
  68 +
  69 + env1.communities << @institution.community
  70 + search_result_env1 = Institution.search_institution("Ministerio", env1).collect{ |i| i.id }
  71 + search_result_env2 = Institution.search_institution("Ministerio", env2).collect{ |i| i.id }
  72 +
  73 + assert_includes search_result_env1, @institution.id
  74 + assert_not_includes search_result_env2, @institution.id
62 75 end
63 76 end
... ...
src/noosfero-spb/gov_user/test/unit/organization_rating_test.rb
... ... @@ -10,21 +10,49 @@ class OrganizationRatingTest &lt; ActiveSupport::TestCase
10 10 @environment.save
11 11 end
12 12  
13   - should "validate institution if there is an institution_id" do
  13 + should "not validate organization rating if the institution is not saved" do
14 14 person = fast_create(Person)
15 15 community = fast_create(Community)
16   - private_institution = build_private_institution "huehue", "hue", "11.222.333/4444-55"
17 16  
  17 + private_institution = build_private_institution "Some Institution", "Some Inst Incorporated", "11.222.333/4444-55"
18 18 community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => private_institution)
  19 +
19 20 assert_equal false, community_rating.valid?
  21 + assert_equal true, community_rating.errors.messages.keys.include?(:institution)
  22 + end
20 23  
21   - assert_equal true, community_rating.errors[:institution].include?("not found")
  24 + should "validate organization rating if the institution is saved" do
  25 + person = fast_create(Person)
  26 + community = fast_create(Community)
22 27  
  28 + private_institution = build_private_institution "Some Institution", "Some Inst Incorporated", "11.222.333/4444-55"
  29 + community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => private_institution)
23 30 private_institution.save
24   - community_rating.institution = private_institution
25 31  
26 32 assert_equal true, community_rating.valid?
27   - assert_equal false, community_rating.errors[:institution].include?("not found")
  33 + assert_equal false, community_rating.errors.messages.keys.include?(:institution)
  34 + end
  35 +
  36 + should "not create organization rating with saved value and no institution" do
  37 + person = fast_create(Person)
  38 + community = fast_create(Community)
  39 +
  40 + community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => nil)
  41 + community_rating.saved_value = "2000"
  42 +
  43 + assert_equal false, community_rating.save
  44 + assert_equal true, community_rating.errors.messages.keys.include?(:institution)
  45 + end
  46 +
  47 + should "not create organization rating with benefited people value and no institution" do
  48 + person = fast_create(Person)
  49 + community = fast_create(Community)
  50 +
  51 + community_rating = OrganizationRating.new(:person => person, :value => 3, :organization => community, :institution => nil)
  52 + community_rating.people_benefited = "100"
  53 +
  54 + assert_equal false, community_rating.save
  55 + assert_equal true, community_rating.errors.messages.keys.include?(:institution)
28 56 end
29 57  
30 58 private
... ...
src/noosfero-spb/gov_user/test/unit/private_institution_test.rb
... ... @@ -8,7 +8,7 @@ class PrivateInstitutionTest &lt; ActiveSupport::TestCase
8 8 "Simple Private Institution",
9 9 "SPI",
10 10 "BR",
11   - "DF",
  11 + "Distrito Federal",
12 12 "Gama",
13 13 "00.000.000/0001-00"
14 14 )
... ...
src/noosfero-spb/gov_user/test/unit/public_institution_test.rb
... ... @@ -12,7 +12,7 @@ class PublicInstitutionTest &lt; ActiveSupport::TestCase
12 12 "Ministerio Publico da Uniao",
13 13 "MPU",
14 14 "BR",
15   - "DF",
  15 + "Distrito Federal",
16 16 "Gama",
17 17 @juridical_nature,
18 18 @gov_power,
... ...
src/noosfero-spb/gov_user/views/gov_user_plugin/_institution.html.erb
... ... @@ -13,43 +13,29 @@
13 13 </div>
14 14  
15 15 <div class="spb-row spb-col spb-col-12">
16   - <% unless flash[:errors].nil? %>
17   - <div class="errorExplanation" id="errorExplanation">
18   - <h2> <%= _("Can`t create new Institution: #{flash[:errors].length} errors") %> </h2>
19   - <ul>
20   - <% flash[:errors].each do |key, value| %>
21   - <% key_name = key.to_s.gsub("_", " ") %>
22   - <% if value.length > 0 %>
23   - <li> <%= _("<b>#{key_name.capitalize}</b> #{value.join()}") %> </li>
  16 + <div class="errorExplanation" id="create_institution_errors">
  17 + <% unless flash[:errors].blank? %>
  18 + <h2><%= _("Can`t create new Institution: #{flash[:errors].length} errors") %></h2>
  19 + <ul>
  20 + <% flash[:errors].each do |error| %>
  21 + <li><%= error %></li>
24 22 <% end %>
  23 + </ul>
25 24 <% end %>
26   - </ul>
27 25 </div>
28   - <% end %>
29   -</div>
30   -
31   -<div class="spb-row">
32   - <div id='create_institution_errors' class='spb-col spb-col-12 errorExplanation hide-field'></div>
33 26 </div>
34 27  
35   -
36 28 <%= form_for :community, :url => {:action=>"new_institution"}, :html => { :multipart => true, :id=>"institution_form" } do |f| %>
37 29  
38 30 <%= hidden_field_tag "edit_institution_page", false %>
39 31 <%= fields_for :institutions do |inst| %>
40 32 <div class="spb-row no-margin-top">
41 33 <div class='spb-col spb-col-3'>
42   - <label class="formlabel">
43   - <%= radio_button_tag("institutions[type]" ,"PrivateInstitution", true)%>
44   - <%= _("Private Institution") %>
45   - </label>
  34 + <%= labelled_radio_button _('Public Institution'), 'institutions[type]', 'PublicInstitution', true %>
46 35 </div>
47 36  
48 37 <div class="spb-col spb-col-3">
49   - <label class="formlabel">
50   - <%= radio_button_tag("institutions[type]", "PublicInstitution") %>
51   - <%= _("Public Institution") %>
52   - </label>
  38 + <%= labelled_radio_button _('Private Institution'), 'institutions[type]', 'PrivateInstitution' %>
53 39 </div>
54 40  
55 41 <div class="spb-col spb-col-3"></div>
... ... @@ -80,7 +66,7 @@
80 66 <span class="required-field">(*)</span>
81 67 </label>
82 68  
83   - <%= select("community", "country", [[_('Select a country'), nil]] + country_helper.countries, {:class => "type-select #{flash[:error_community_country]}"}) %>
  69 + <%= select("community", "country", [[_('Select a country'), -1]] + country_helper.countries, {:class => "type-select #{flash[:error_community_country]}"}) %>
84 70 </div>
85 71  
86 72 <div class="spb-col spb-col-2">
... ... @@ -89,7 +75,7 @@
89 75 <span class="required-field">(*)</span>
90 76 </label>
91 77  
92   - <%= f.select(:state, @state_options, {:selected => params[:community][:state]}, {:class => flash[:error_community_state]}) %>
  78 + <%= select("community", "state", [[_('Select a state'), '']] + @state_options, {:class => "type-select #{flash[:error_community_state]}"}) %>
93 79 </div>
94 80  
95 81 <div class="spb-col spb-col-5">
... ...
src/noosfero-spb/gov_user/views/gov_user_plugin_myprofile/edit_institution.html.erb
... ... @@ -19,6 +19,10 @@
19 19  
20 20 <div id = 'create_institution_errors' class='errorExplanation hide-field'></div>
21 21  
  22 +<div class="spb-row spb-col spb-col-12 required-field">
  23 + <%= _("The highlighted fields are mandatory") %>
  24 +</div>
  25 +
22 26 <div>
23 27 <%= labelled_form_for :community,:html => { :multipart => true, :id=>"institution_form" } do |f| %>
24 28 <%= hidden_field_tag "edit_institution_page", true %>
... ... @@ -26,34 +30,25 @@
26 30 <span class=''>
27 31 <div class='formfield type-radio'>
28 32 <label> <%= _("Public Institution") %>
29   - <%= radio_button_tag("institutions[type]", "PublicInstitution", (@institution.type == "PublicInstitution" ? true : false)) %>
  33 + <%= radio_button_tag("institutions[type]", "PublicInstitution", (@institution.type == "PublicInstitution")) %>
30 34 </label>
31 35  
32 36 <label>
33 37 <%= _("Private Institution") %>
34   - <%= radio_button_tag("institutions[type]" ,"PrivateInstitution", (@institution.type == "PrivateInstitution" ? true : false))%>
  38 + <%= radio_button_tag("institutions[type]" ,"PrivateInstitution", (@institution.type == "PrivateInstitution"))%>
35 39 </label>
36 40 </div>
37 41 </span>
38 42  
39   - <%= required f.text_field(:name, :value => @institution.community.name) %>
40   - <%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %>
  43 + <%= required labelled_form_field(_('Corporate Name'), text_field_tag('community[name]', @institution.community.name)) %>
41 44  
42   - <span class='required-field'>
43   - <div class="formfield type-text">
44   - <%= inst.label "corporate_name", _("Corporate Name"), :class=>"formlabel" %>
45   - <%= required inst.text_field(:corporate_name, :value => @institution.corporate_name) %>
46   - </div>
47   - </span>
  45 + <%= labelled_form_field(_('Fantasy name'), inst.text_field(:corporate_name, :value => @institution.corporate_name)) %>
48 46  
49   - <%= required select_country(_('Country'), 'community', 'country', {:class => 'type-select', :id => "community_country"}, :selected => @institution.community.country) %>
  47 + <%= required labelled_form_field(_('Country'), select("community", "country", [[_('Select a country'), -1]] + country_helper.countries,
  48 + {:selected => @institution.community.country, :class => "type-select #{flash[:error_community_country]}"})) %>
50 49  
51   - <span class='required-field'>
52   - <div class="formfield">
53   - <label for="community_state" class="formlabel"><%= _("State") %></label>
54   - <%= f.select(:state, @state_list.collect {|state| [state.name, state.name]}, :selected => @institution.community.state) %>
55   - </div>
56   - </span>
  50 + <%= required labelled_form_field(_('State'), select("community", "state", [[_('Select a state'), '']] + @state_list.collect {|state| [state.name, state.name]},
  51 + {:selected => @institution.community.state, :class => "type-select #{flash[:error_community_state]}"})) %>
57 52  
58 53 <%= required f.text_field(:city, :value => @institution.community.city) %>
59 54  
... ...
src/noosfero-spb/gov_user/views/person_editor_extras.html.erb
... ... @@ -3,6 +3,7 @@
3 3  
4 4 <div class="institution_container">
5 5 <%= text_field_tag(:institution, "", :id=>"input_institution") %>
  6 + <%= link_to(_("Add institution"), "#", :class=>'button with-text icon-add', :id => 'add_institution_link') %>
6 7  
7 8 <% context.profile.user.institutions.each do |institution| %>
8 9 <%= hidden_field_tag("user[institution_ids][]", institution.id, :class => 'user_institutions') %>
... ...
src/noosfero-spb/noosfero-spb-theme/css/administration-panel.css
... ... @@ -114,7 +114,7 @@
114 114 padding: 8px 8px 0;
115 115 }
116 116  
117   -/*** Features Settings ***/
  117 +/* Features Settings */
118 118  
119 119 .controller-features #content form *{
120 120 font-size: 15px;
... ... @@ -233,6 +233,105 @@
233 233 padding: 8px 8px 0;
234 234 }
235 235  
  236 +/* Create Instituition */
  237 +
  238 +/*Temporary - Best fix html structure*/
  239 +.action-gov_user_plugin-create_institution_admin #institution_form{
  240 + font-size: 12px;
  241 + font-family: Arial;
  242 +}
  243 +
  244 +.action-gov_user_plugin-create_institution_admin input[type="text"],
  245 +.action-gov_user_plugin-create_institution_admin select {
  246 + height: 30px;
  247 + border-radius: 5px;
  248 + border: solid 1px #ccc;
  249 + background-color: #fff;
  250 + padding: 0px 5px;
  251 +}
  252 +
  253 +.action-gov_user_plugin-create_institution_admin select{
  254 + height: 32px;
  255 + font-size: 12px;
  256 + font-family: Arial;
  257 +}
  258 +
  259 +.action-gov_user_plugin-create_institution_admin input[type="radio"] {
  260 + vertical-align: middle;
  261 + margin-right: 5px;
  262 +}
  263 +
  264 +.action-gov_user_plugin-create_institution_admin label.formlabel {
  265 + margin: 10px 0px 3px 0px;
  266 +}
  267 +
  268 +.action-gov_user_plugin-create_institution_admin .explanation {
  269 + color: #3F60C6;
  270 + font-size: 12px;
  271 + font-style: italic;
  272 + font-family: Arial, Helvetica, sans-serif;
  273 + margin-bottom: 25px;
  274 +}
  275 +
  276 +.action-gov_user_plugin-create_institution_admin .required-field,
  277 +.action-gov_user_plugin-create_institution_admin .errorExplanation {
  278 + color: #EA1C00;
  279 + font-size:12px;
  280 + margin-bottom: 20px;
  281 + font-family: Arial;
  282 +}
  283 +
  284 +.action-gov_user_plugin-create_institution_admin .errorExplanation:empty {
  285 + margin-bottom: 10px;
  286 +}
  287 +
  288 +.action-gov_user_plugin-create_institution_admin #community_name {
  289 + width: 200px;
  290 +}
  291 +
  292 +.action-gov_user_plugin-create_institution_admin #institutions_corporate_name {
  293 + width: 310px;
  294 +}
  295 +
  296 +.action-gov_user_plugin-create_institution_admin #community_country {
  297 + width: 213px;
  298 +}
  299 +
  300 +.action-gov_user_plugin-create_institution_admin #community_state {
  301 + width: 81px;
  302 +}
  303 +
  304 +.action-gov_user_plugin-create_institution_admin #community_city {
  305 + width: 222px;
  306 +}
  307 +
  308 +.action-gov_user_plugin-create_institution_admin #institutions_cnpj,
  309 +.action-gov_user_plugin-create_institution_admin #institutions_acronym {
  310 + text-indent: 5px;
  311 + width: 530px;
  312 +}
  313 +
  314 +.action-gov_user_plugin-create_institution_admin .modal-form-actions {
  315 + margin-top: 20px;
  316 +}
  317 +
  318 +.action-gov_user_plugin-create_institution_admin .sisp-fields {
  319 + margin-top: 15px;
  320 +}
  321 +
  322 +.action-gov_user_plugin-create_institution_admin #content form input.button.with-text {
  323 + background-color: #3E67B1;
  324 + color: #fff;
  325 + font-size: 14px;
  326 + font-family: "open_sansregular", Arial;
  327 + height: 32px;
  328 + line-height: 17px;
  329 +}
  330 +
  331 +.action-gov_user_plugin-create_institution_admin #content form a.button.with-text{
  332 + padding: 7px 15px;
  333 +}
  334 +
236 335  
237 336 /*** Community Admin pages ***/
238 337 /* Homepage */
... ... @@ -290,12 +389,288 @@
290 389 vertical-align: bottom;
291 390 }
292 391  
  392 +/* Categories */
  393 +
  394 +.action-categories-index #content .main-content > div{
  395 + padding: 0px 0px 20px;
  396 + border-bottom: 1px solid #EEE;
  397 + height: 30px;
  398 +}
  399 +
  400 +.action-categories-index #content .main-content > div a{
  401 + border: 1px solid #3E67B1;
  402 + display: block;
  403 + padding: 7px;
  404 + width: 85px;
  405 + border-radius: 5px;
  406 + color: #3E67B1;
  407 +}
  408 +
  409 +.action-categories-index .tree{
  410 + margin-top: 20px;
  411 +}
  412 +
  413 +.action-categories-index .tree li{
  414 + margin-bottom: 20px;
  415 +}
  416 +
  417 +.action-categories-index .tree li li{
  418 + margin-left: 30px;
  419 +}
  420 +
  421 +.action-categories-index .tree li *{
  422 + border-bottom: none;
  423 + list-style-type: disc;
  424 +}
  425 +
  426 +.action-categories-index .treeitem{
  427 + margin-bottom: 20px;
  428 +}
  429 +
  430 +.action-categories-index .treeitem .color_marker{
  431 + border-bottom: 1px solid;
  432 +}
  433 +
  434 +.action-categories-index .treeitem span{
  435 + font-weight: 600;
  436 + font-size: 14px;
  437 +}
  438 +
  439 +.action-categories-index .treeitem div{
  440 + margin-top: 6px;
  441 +}
  442 +
  443 +.action-categories-index .treeitem ul{
  444 + margin-left: 10px;
  445 +}
  446 +
  447 +.action-categories-index .treeitem .button{
  448 + margin-left: 10px;
  449 +}
  450 +
  451 +.action-categories-index #content .treeitem a,
  452 +.action-categories-index #content .treeitem a:focus,
  453 +.action-categories-index #content .treeitem a:visited,
  454 +.action-categories-index #content .treeitem a:link{
  455 + margin-right: 10px;
  456 + color: #3E67B1;
  457 +}
  458 +
293 459 /*Edition configuration profile */
294 460  
  461 +.action-profile_editor-edit #content .main-content #profile-data #profile-is-template{
  462 + background-color: #F0F1F1;
  463 + padding: 6px;
  464 + font-size: 14px;
  465 + font-family: 'open_sansregular';
  466 + margin-bottom: 10px;
  467 + max-width: 405px;
  468 +}
  469 +
  470 +.action-profile_editor-edit div#errorExplanation{
  471 + margin-left: 0px;
  472 + color: #FF0366;
  473 +}
  474 +
  475 +.action-profile_editor-edit div#errorExplanation ul li{
  476 + list-style-type: disc;
  477 + list-style-position: inside;
  478 + margin-bottom: 5px;
  479 + font-size: 13px;
  480 +}
  481 +
  482 +.action-profile_editor-edit #content .main-content #profile-data #profile-is-template input[type="checkbox"]{
  483 + margin: 0 10px 0 10px;
  484 +}
  485 +
  486 +.action-profile_editor-edit #content .main-content #profile-data div{
  487 + margin: 5px 0 5px 0;
  488 +}
  489 +
  490 +.action-profile_editor-edit #content .main-content #profile-data #profile_change_picture div{
  491 + margin-bottom: 0px;
  492 +}
  493 +
  494 +.action-profile_editor-edit #content .main-content #profile-data #institution_modal_container{
  495 + margin: 15px 0 11px 0;
  496 +}
  497 +
  498 +.action-profile_editor-edit #content .main-content #profile-data #institution_modal_container a{
  499 + margin-left: 0px;
  500 +}
  501 +
  502 +.action-profile_editor-edit #content .main-content #profile-data .formlabel,
  503 +.action-profile_editor-edit #content .main-content #profile-data .formfieldline label{
  504 + color: #231F20;
  505 + font-size: 14px;
  506 + font-weight: 300;
  507 + margin-bottom: 5px;
  508 +}
  509 +
  510 +.action-profile_editor-edit #content .main-content #profile-data div span div div #email_public_message{
  511 + color: #888;
  512 + font-size: 12px;
  513 + font-weight: 300;
  514 + font-style: italic;
  515 + margin-bottom: 5px;
  516 +}
  517 +
  518 +
  519 +.action-profile_editor-edit #content .main-content #profile-data .formlabel::after{
  520 + color:#F00;
  521 +}
  522 +
  523 +.action-profile_editor-edit #content .main-content #profile-data p .required-field{
  524 + max-width: 374px;
  525 + padding: 15px 20px;
  526 + margin: 20px 0px 25px;
  527 + border-width: 1px 1px 1px 5px;
  528 + border-style: dotted dotted dotted solid;
  529 + border-color: #CCC #CCC #CCC #FF0366;
  530 + -moz-border-top-colors: none;
  531 + -moz-border-right-colors: none;
  532 + -moz-border-bottom-colors: none;
  533 + -moz-border-left-colors: none;
  534 + border-image: none;
  535 + border-radius: 3px;
  536 + display: block;
  537 + background: #FFF none repeat scroll 0% 0%;
  538 + line-height: 20px;
  539 + font-size: 13px;
  540 +}
  541 +
  542 +.action-profile_editor-edit #content .main-content #profile-data input[type="text"]{
  543 + background: none;
  544 + display: block;
  545 + height: 19px;
  546 + padding: 6px;
  547 + border: 1px solid #ccc;
  548 + border-radius: 4px;
  549 + width: 405px;
  550 + font-size: 15px;
  551 + font-family: Arial, helvetica;
  552 + color: #585858;
  553 +}
  554 +
  555 +.action-profile_editor-edit #content #profile_change_picture div div div div div div input[type="file"]{
  556 + background: none;
  557 + color: #999;
  558 + padding: 0px;
  559 + text-indent: 0px;
  560 + border: 1px solid #bbb;
  561 + font-size: 14px;
  562 + border-radius: 4px;
  563 +}
  564 +
  565 +.action-profile_editor-edit #content #profile_change_picture{
  566 + margin-top: 0px;
  567 +}
  568 +
  569 +.action-profile_editor-edit #content .main-content form div input[type="radio"],
  570 +.action-profile_editor-edit #content .main-content form input[type="checkbox"]{
  571 + margin-right: 5px;
  572 + vertical-align: middle;
  573 +}
  574 +
  575 +.action-profile_editor-edit #content .main-content #profile-data .field-with-privacy-selector:hover{
  576 + background-color: #FFF;
  577 +}
  578 +
  579 +.action-profile_editor-edit #content .main-content #profile-data .field-with-privacy-selector .field-privacy-selector{
  580 + position: relative;
  581 + top: 6px;
  582 + text-align: right;
  583 +}
  584 +
  585 +.action-profile_editor-edit #content .main-content #profile-data .field-with-privacy-selector .field-privacy-selector div{
  586 + text-align: right;
  587 + top: 0px;
  588 +}
  589 +
  590 +.action-profile_editor-edit #content .main-content #profile-data .field-with-privacy-selector .field-privacy-selector label,
  591 +.action-profile_editor-edit #content .main-content #profile-data #profile_change_picture_title span label{
  592 + font-size: 12px;
  593 + font-family: 'open_sansregular';
  594 +}
  595 +
  596 +.action-profile_editor-edit #content .main-content #category-ajax-selector{
  597 + border-radius: 4px;
  598 + background: #F0F1F1;
  599 + border-color: #ccc;
  600 + margin-bottom: 10px;
  601 + max-width: 405px;
  602 +}
  603 +
  604 +.action-profile_editor-edit #content .main-content #category-ajax-selector #select-categories .toplevel-categories hr{
  605 + border-color: #ccc;
  606 +}
  607 +
  608 +.action-profile_editor-edit #content .main-content #category-ajax-selector #selected-categories .label,
  609 +.action-profile_editor-edit #content .main-content #category-ajax-selector #select-categories div .category-helper-label{
  610 + font-size: 14px;
  611 +}
  612 +
  613 +.action-profile_editor-edit #content .main-content #category-ajax-selector #select-categories div .category-helper-label{
  614 + color: #888;
  615 +}
  616 +
  617 +.action-profile_editor-edit #content .main-content #category-ajax-selector #select-categories div a:hover{
  618 + cursor: move;
  619 + border: 1px solid #3E67B1;
  620 +}
  621 +
  622 +.action-profile_editor-edit #content .main-content #category-ajax-selector #select-categories div a{
  623 + padding: 2px 5px;
  624 + margin: 2px 0;
  625 + background: #fff;
  626 + display: inline-block;
  627 +}
  628 +
  629 +.action-profile_editor-edit #content .main-content #profile-data #image-builder-remove-checkbox{
  630 + float: left;
  631 + width: 100%;
  632 + position: relative;
  633 + margin-top: 0px;
  634 +}
  635 +
  636 +.action-profile_editor-edit #content .main-content #profile-data #image-builder-remove-checkbox div label{
  637 + position: absolute;
  638 + left: 20px;
  639 + padding-top: 0px;
  640 +}
  641 +
  642 +.action-profile_editor-edit #content .main-content #profile-data #image-builder-remove-checkbox div div {
  643 + margin-top: 0px;
  644 +}
  645 +
  646 +.action-profile_editor-edit #content .main-content #profile-data .button-bar{
  647 + margin: 15px 0 30px 0;
  648 +}
  649 +
  650 +.action-profile_editor-edit #content .main-content #profile-data .button-bar .submit{
  651 + background-color: #3E67B1;
  652 + color: #FFF;
  653 + margin-right: 10px;
  654 +}
  655 +
295 656 .action-profile_editor-edit #delete-profile{
296 657 margin-top:0px;
297 658 }
298 659  
  660 +.action-profile_editor-edit #content .main-content #profile-data #delete-profile a{
  661 + border-color: #df3e3e;
  662 + color: #df3e3e;
  663 +}
  664 +
  665 +.action-profile_editor-edit #content .main-content #profile-data #delete-profile a:hover{
  666 + color: #FFF;
  667 + background: #df3e3e;
  668 +}
  669 +
  670 +.action-profile_editor-edit .controller-profile_editor #profile-data{
  671 + display: block;
  672 +}
  673 +
299 674 /*form Change Password */
300 675 .action-account-change_password #content form input.button.with-text.icon-ok.submit{
301 676 height: 32px;
... ... @@ -303,13 +678,13 @@
303 678 }
304 679  
305 680 .action-account-change_password input{
306   -padding: 6px;
307   -color: #585858;
308   -background: #FFF;
309   -border: 1px solid #ccc;
310   -border-radius: 4px;
311   -font-size: 15px;
312   -font-family: Arial, helvetica;
  681 + padding: 6px;
  682 + color: #585858;
  683 + background: #FFF;
  684 + border: 1px solid #ccc;
  685 + border-radius: 4px;
  686 + font-size: 15px;
  687 + font-family: Arial, helvetica;
313 688 }
314 689  
315 690 /* Members management */
... ...
src/noosfero-spb/noosfero-spb-theme/css/article-page.css
... ... @@ -256,26 +256,28 @@
256 256 /*** end of help page ***/
257 257  
258 258 /*** article lists ***/
259   -
260   -.article-body ul,
261   -.article-body ol{
262   - margin-bottom: 20px;
  259 +.article-body ul {
  260 + list-style-type: disc;
  261 + list-style-position: inside;
263 262 }
264 263  
265   -.article-body li ul,
266   -.article-body li ol{
267   - margin-bottom: 0px;
268   - margin-left: 20px;
  264 +.article-body ol {
  265 + list-style-type: decimal;
  266 + list-style-position: inside;
269 267 }
270 268  
271   -.article-body ul li{
272   - list-style-type: disc;
273   - list-style-position: inside;
  269 +.article-body ul ul,
  270 +.article-body ol ul {
  271 + list-style-type: circle;
  272 + list-style-position: inside;
  273 + margin-left: 15px;
274 274 }
275 275  
276   -.article-body ol li{
277   - list-style-type: decimal;
278   - list-style-position: inside;
  276 +.article-body ol ol,
  277 +.article-body ul ol {
  278 + list-style-type: lower-latin;
  279 + list-style-position: inside;
  280 + margin-left: 15px;
279 281 }
280 282  
281 283 /*** end of article numbered lists ***/
... ...
src/noosfero-spb/noosfero-spb-theme/css/community-pages.css
... ... @@ -179,6 +179,7 @@
179 179 margin:0px 45%;
180 180 color:#FF0366;
181 181 }
  182 +
182 183 #block-community-tabs .ui-tabs .ui-tabs-nav li.ui-tabs-active a{
183 184 color: #FF0366;
184 185 font-weight: 300;
... ... @@ -485,12 +486,12 @@
485 486 }
486 487  
487 488 #content #blog-tab .blog .blog-post.position-1 .post-pic {
488   -margin: 0 20px 5px 0px;
489   -border-radius: 4px;
490   -height: 210px;
491   -width: 100%;
492   -background: center/cover no-repeat;
493   -float: left;
  489 + margin: 0 20px 5px 0px;
  490 + border-radius: 4px;
  491 + height: 210px;
  492 + width: 100%;
  493 + background: center/cover no-repeat;
  494 + float: left;
494 495 }
495 496  
496 497 /* Read more button*/
... ... @@ -541,17 +542,17 @@ float: left;
541 542  
542 543 /* SISP Tab Data - about tab */
543 544 #block-community-tabs .software-sisp {
544   - margin-top: 46px;
  545 + margin-top: 40px;
545 546 }
546 547  
547 548 #block-community-tabs .software-sisp p,
548 549 #block-community-tabs .software-sisp h2 {
549   - font-family: 'open_sansregular', Arial, Helvetica, sans-serif;
  550 + font-family: Arial, Helvetica, sans-serif;
550 551 }
551 552  
552 553 #block-community-tabs .software-sisp h2 {
553 554 border-bottom: solid 2px #f7f8f9;
554   - margin-bottom: 26px;
  555 + margin-bottom: 20px;
555 556 padding-bottom: 8px;
556 557 color: #172938;
557 558 font-size: 18px;
... ... @@ -563,9 +564,14 @@ float: left;
563 564 }
564 565  
565 566 #block-community-tabs .software-sisp p {
  567 + margin-bottom: 10px;
566 568 color: #172938;
567 569 }
568 570  
  571 +#block-community-tabs .software-about p {
  572 + margin-bottom: 20px;
  573 +}
  574 +
569 575 #block-community-tabs .software-sisp p span {
570 576 color: #797979;
571 577 }
... ...
src/noosfero-spb/noosfero-spb-theme/css/edition-pages.css
... ... @@ -275,15 +275,17 @@
275 275 color: #585858;
276 276 }
277 277  
  278 +.action-software_communities_plugin_myprofile-new_software #content .main-block form textarea{
  279 + border-radius: 4px;
  280 + font-size: 15px;
  281 + font-family: arial, helvetica;
  282 + padding: 10px;
  283 +}
  284 +
278 285 .action-software_communities_plugin_myprofile-new_software #content .formfield input{
279 286 background: none #FFFFFF;
280   - border: 1px solid #DDDDDD;
281   - color: #585858;
282   - font-size: 16px;
283   - width: 76%;
284   - word-wrap: break-word;
285   - border-radius: 4px;
286 287 }
  288 +
287 289 .action-software_communities_plugin_myprofile-new_software #content .main-content form label.formlabel.mandatory{
288 290 font-size: 14px;
289 291 margin-bottom: 5px;
... ... @@ -317,20 +319,16 @@
317 319 }
318 320  
319 321 .action-software_communities_plugin_myprofile-new_software #software-name-field span #community-identifier{
320   - width: auto;
  322 + width: 500px;
321 323 }
322 324  
323 325 .action-software_communities_plugin_myprofile-new_software #content #software-hostname {
324   - line-height: 22px;
325   - padding: 0px;
326   - color: #4A4A4A;
327   - font-size: 20px;
328   - text-transform: lowercase;
329   - border-spacing: 20px;
  326 + position: absolute;
  327 + font-size: 15px;
  328 + padding: 5px 10px;
330 329 }
331 330  
332 331 .action-software_communities_plugin_myprofile-new_software #content .main-block form #profile_change_picture {
333   - padding: 0 15px 15px 15px;
334 332 border: 1px dotted #ddd;
335 333 margin-top: 10px;
336 334 }
... ... @@ -464,7 +462,6 @@ font-size: 10px;
464 462 font-weight: 500;
465 463 }
466 464  
467   -
468 465 .action-contact-new .formfield textarea{
469 466 background: none #FFFFFF;
470 467 border: 1px solid #DDDDDD;
... ... @@ -503,7 +500,6 @@ font-size: 10px;
503 500 display: none;
504 501 }
505 502  
506   -
507 503 .action-tasks-index select{
508 504 background: none;
509 505 border: 1px solid #D3D6DE;
... ... @@ -512,6 +508,7 @@ font-size: 10px;
512 508 margin: 0px 0px 0px 10px;
513 509 font-size: 14px;
514 510 }
  511 +
515 512 .action-tasks-index #content .main-block form input[type="text"] {
516 513 display: block;
517 514 height: 19px;
... ... @@ -544,7 +541,18 @@ font-size: 10px;
544 541 line-height: 20px;
545 542 position: absolute;
546 543 }
  544 +
547 545 .action-tasks-index .task_decisions label{
548 546 margin: 2px 0px 2px 30px;
549 547 line-height: 22px;
550 548 }
  549 +
  550 +#content .new-software-form .button-bar .button.with-text.icon-save.submit{
  551 + background: #3E67B1;
  552 + color: #FFF;
  553 +}
  554 +
  555 +#content .new-software-form .button-bar .button.with-text.icon-save.submit:hover{
  556 + background: #FFF;
  557 + color: #3E67B1;
  558 +}
... ...
src/noosfero-spb/noosfero-spb-theme/css/home-page.css
... ... @@ -66,8 +66,8 @@
66 66 border-radius: 4px;
67 67 }
68 68  
69   -.controller-environment_design #content #catalogo-software-search h1,
70   -.action-home-index #content #catalogo-software-search h1{
  69 +.controller-environment_design #content #catalogo-software-search h2,
  70 +.action-home-index #content #catalogo-software-search h2 {
71 71 margin: 0px 15px 10px 15px;
72 72 border-bottom: none;
73 73 padding: 10px 0px 0px 0px;
... ... @@ -444,7 +444,6 @@
444 444 border-radius: 0px 0px 8px 8px;
445 445 height: 250px !important;
446 446 background-color: #fff;
447   - opacity: 1.0 !important;
448 447 }
449 448  
450 449 .controller-environment_design #content .highlights-image-link img,
... ...
src/noosfero-spb/noosfero-spb-theme/css/news-page.css
... ... @@ -97,7 +97,7 @@
97 97 border-radius: 4px;
98 98 height: 80px;
99 99 width: 20%;
100   - background: center/cover no-repeat;
  100 + background: center/contain no-repeat;
101 101 float: left;
102 102 }
103 103  
... ...
src/noosfero-spb/noosfero-spb-theme/css/search-pages.css
... ... @@ -18,6 +18,14 @@
18 18 margin: 0 0 15px 0;
19 19 }
20 20  
  21 +.action-search-people #content form #search-header #search-filters,
  22 +.action-search-communities #content form #search-header #search-filters,
  23 +.action-search-institutions #content form #search-header #search-filters {
  24 + position: absolute;
  25 + top: 40px;
  26 + right: 18px;
  27 +}
  28 +
21 29 .action-search-people #content form #search-header #search-filters .sod_select,
22 30 .action-search-communities #content form #search-header #search-filters .sod_select,
23 31 .action-search-institutions #content form #search-header #search-filters .sod_select {
... ... @@ -160,3 +168,6 @@
160 168 text-align: center;
161 169 }
162 170  
  171 +#search-subheader{
  172 + display: none;
  173 +}
... ...
src/noosfero-spb/noosfero-spb-theme/css/software-catalog-page.css
... ... @@ -7,13 +7,13 @@
7 7 }
8 8  
9 9 .action-search-software_infos .main-content,
10   -.action-search-sisp .main-content{
  10 +.action-search-sisp .main-content {
  11 + padding: 10px 0;
11 12 border: none;
12 13 box-shadow: none;
13 14 }
14 15  
15   -.action-search-software_infos #content .main-content h2,
16   -.action-search-sisp #content .main-content h2{
  16 +.action-search-software_infos #content .main-content h2 {
17 17 color: #FF0366;
18 18 font-size: 16px;
19 19 font-family: "open_sansregular",Arial, Helvetica,sans-serif;
... ... @@ -21,14 +21,21 @@
21 21 text-transform: uppercase;
22 22 }
23 23  
24   -.action-search-software_infos #content .main-content h1,
25   -.action-search-sisp #content .main-content h1{
  24 +.action-search-sisp #content .main-content h2 {
  25 + display: none;
  26 +}
  27 +
  28 +.action-search-software_infos #content .main-content h1 {
26 29 padding: 5px 0 10px 0;
27 30 border-bottom: 1px solid #D3D6DE;
28 31 font-family: Arial, Helvetica, sans-serif;
29 32 font-size: 35px;
30 33 font-variant: normal;
31 34 }
  35 +
  36 +.action-search-sisp #content .main-content h1 {
  37 + display: none;
  38 +}
32 39 /*** end of title and subtitle ***/
33 40  
34 41 /*** Search Box ***/
... ... @@ -176,7 +183,7 @@
176 183 .controller-search #filter-catalog-software #filter-categories-option {
177 184 border: none;
178 185 height: 0;
179   - max-height: 620px;
  186 + max-height: 100%;
180 187 position: relative;
181 188 overflow: hidden;
182 189 padding: 0 15px;
... ...
src/noosfero-spb/noosfero-spb-theme/css/software-pages.css
... ... @@ -64,7 +64,7 @@
64 64 }
65 65  
66 66 #content #software-information-block-table #col-software-name b {
67   - font: normal normal normal 15px/21px arial, 'open_sansregular', helvetica, sans-serif;
  67 + font: normal normal normal 16px/21px arial, 'open_sansregular', helvetica, sans-serif;
68 68 }
69 69  
70 70 /*** end of Software Header ***/
... ... @@ -143,6 +143,10 @@
143 143 font-size: 14px;
144 144 }
145 145  
  146 +#content .download-block label {
  147 + padding-right: 2px;
  148 +}
  149 +
146 150 #content .download-block .download-info .min-requirements {
147 151 font-size: 12px;
148 152 }
... ... @@ -205,25 +209,16 @@
205 209 font-size: 15px;
206 210 }
207 211  
208   -.profile-homepage #article .article-body ul {
209   - background-repeat: no-repeat;
210   - list-style-position: inside;
211   - list-style-type: disc;
212   -}
213   -
214   -.profile-homepage #article .article-body ul li {
215   - line-height: 21px;
216   - text-align: left;
217   - font-size: 15px;
218   - list-style: inherit;
219   -}
220   -
221 212 /*** end of Software Homepage ***/
222 213  
223 214 /*** Categories and Tags block ***/
224 215  
225 216 #content .box-1 .categories-and-tags-block{
226 217 border-top: 4px solid #2C4B6B;
  218 + margin-top: 26px;
  219 + padding-bottom: 15px;
  220 + border-bottom: 1px solid #D3D6DE;
  221 + margin-bottom: 60px;
227 222 }
228 223  
229 224 #content .box-1 .categories-and-tags-block .block-title{
... ... @@ -232,7 +227,7 @@
232 227 padding: 3px 0px;
233 228 background: none;
234 229 color: #5E82C6;
235   - font-family: Arial;
  230 + font-family: Arial, verdana;
236 231 font-size: 12px;
237 232 font-weight: 300;
238 233 }
... ... @@ -240,18 +235,19 @@
240 235 #content .box-1 .categories-and-tags-block .category_cloud{
241 236 margin: 0px;
242 237 position: relative;
243   - top: 7px;
  238 + top: 9px;
244 239 }
245 240  
246 241 #content .box-1 .categories-and-tags-block .category_cloud a{
247 242 display: inline-block;
248   - padding: 3px 10px;
  243 + padding: 1px 10px;
249 244 margin: 5px;
250 245 color: #3E67B1;
251 246 background-color: #ECEDF1;
252 247 border: 1px solid #D3D6DE;
253 248 border-radius: 3px;
254 249 font-size: 12px;
  250 + font-family: Arial, verdana;
255 251 }
256 252  
257 253 #content .box-1 .categories-and-tags-block .category_cloud a:hover{
... ... @@ -764,3 +760,125 @@
764 760 font-weight: 800;
765 761 padding-top: 30px;
766 762 }
  763 +
  764 +/* software_communites new software page refactor */
  765 +.new-software-form .optional-box{
  766 + margin-bottom: 20px;
  767 +}
  768 +
  769 +.new-software-form div#errorExplanation{
  770 + margin-left: 0px;
  771 + color: #FF0366;
  772 +}
  773 +
  774 +.new-software-form div#errorExplanation ul li{
  775 + list-style-type: disc;
  776 + list-style-position: inside;
  777 + margin-bottom: 5px;
  778 + font-size: 13px;
  779 +}
  780 +
  781 +.new-software-form div#errorExplanation h2{
  782 + color: #000;
  783 + padding: 0px;
  784 + font-size: 16px;
  785 + background: none;
  786 + text-align: left;
  787 +}
  788 +
  789 +.action-profile_editor-edit_software_community #content .main-block .step-explanation span {
  790 + font-size: 14px;
  791 +}
  792 +
  793 +.action-software_communities_plugin_myprofile-new_software #content .main-block form .highlight-error[type="text"],
  794 +.action-software_communities_plugin_myprofile-new_software #content .main-block form .highlight-error{
  795 + border: 1px solid #FF0366;
  796 + box-shadow: none;
  797 +}
  798 +
  799 +.action-software_communities_plugin_myprofile-new_software #content .main-block form #software_info_finality{
  800 + width: 490px;
  801 +}
  802 +
  803 +.action-software_communities_plugin_myprofile-new_software #content .main-block form .obrigatory-field .highlight-error[type="text"],
  804 +.action-software_communities_plugin_myprofile-new_software #content .main-block form .optional-field input[type="text"],
  805 +.action-software_communities_plugin_myprofile-new_software #content .main-block form .obrigatory-field input[type="text"]{
  806 + width: 500px;
  807 +}
  808 +
  809 +.action-software_communities_plugin_myprofile-new_software .new-software-form #software-name-field #community-identifier{
  810 + width: 277px;
  811 + padding-left: 228px;
  812 +}
  813 +
  814 +.new-software-form .optional-field label.formlabel,
  815 +.new-software-form .optional-box label {
  816 + font-family: "open_sansregular", Arial, Helvetica, sans-serif;
  817 + font-size: 14px;
  818 + color: #231f20;
  819 +}
  820 +
  821 +.new-software-form #content .main-block form .optional-box #profile_change_picture.software-label-box{
  822 + width: 470px;
  823 + border-radius: 4px;
  824 +}
  825 +
  826 +.action-software_communities_plugin_myprofile-new_software #content .main-block form #profile_change_picture{
  827 + border: none;
  828 +}
  829 +
  830 +.new-software-form .formfieldline{
  831 + padding: 0px;
  832 +}
  833 +
  834 +.new-software-form #community_image_builder_uploaded_data{
  835 + border: none;
  836 +}
  837 +
  838 +.new-software-form #community_image_builder_label{
  839 + display: none !important;
  840 +}
  841 +
  842 +.new-software-form .formfield input{
  843 + text-indent: 0px;
  844 + padding: 0px;
  845 + font-size: 14px;
  846 +}
  847 +
  848 +/* end of software_communites new software page refactor */
  849 +
  850 +/* software_steps */
  851 +.software-step-info{
  852 + padding-bottom: 30px;
  853 + display: block;
  854 +}
  855 +
  856 +.software-step-info ul li{
  857 + float: left;
  858 + margin-right: 30px;
  859 + border-right: 1px solid #eee;
  860 + padding-right: 30px;
  861 + font-size: 14px;
  862 +}
  863 +
  864 +.software-step-info ul li:last-child{
  865 + border: none;
  866 +}
  867 +
  868 +.software-step-info ul li .current-step{
  869 + background: #FF0366;
  870 +}
  871 +
  872 +.software-step-info ul li span{
  873 + display: inline-block;
  874 + height: 24px;
  875 + width: 24px;
  876 + border-radius: 50%;
  877 + color: #fff;
  878 + text-align: center;
  879 + margin-right: 6px;
  880 + background: #333;
  881 + padding: 1px 0 0 0;
  882 + font-weight: 700;
  883 +}
  884 +/* end of software_steps */
... ...
src/noosfero-spb/noosfero-spb-theme/css/use-report.css
... ... @@ -454,9 +454,8 @@
454 454 border-bottom: 1px solid #D3D6DE;
455 455 border-top: none;
456 456 color: #172738;
457   - font-size: 20px;
  457 + font-size: 22px;
458 458 font-weight: 700;
459   - letter-spacing: 1.8px;
460 459 margin-bottom: 0px;
461 460 padding: 0px 0px 12px 4px;
462 461 }
... ...
src/noosfero-spb/noosfero-spb-theme/style.css
... ... @@ -90,7 +90,6 @@
90 90 * {
91 91 margin: 0;
92 92 padding: 0;
93   - list-style: none;
94 93 vertical-align: baseline;
95 94 }
96 95  
... ...
src/noosfero-spb/noosfero-spb-theme/theme.js
1   -function alignBlocks(containerIndex){
2   - //Needed to save the original reference to jQuery(this)
3   - jt = jQuery(this);
4   - longerBlock = 0;
5   - jt.find(".block-outer").each(function () {
6   - if(jQuery(this).height() > longerBlock)
7   - longerBlock = jQuery(this).height();
8   - });
  1 +/* globals jQuery */
9 2  
10   - jt.find("#block-48504 .block-inner-2").height(492);
11   - jt.find("#block-55304 .block-inner-2").height(378);
12   -
13   - //Aligns the blocks in the most common situations
14   - jt.find(".block-outer").height(longerBlock);
15   - //Only used for blocks with video, since it uses the size of the iframe
16   - if(jt.find("iframe").length > 0){
17   - jt.find(".block-inner-1 .block-inner-2").each(function (idx) {
18   - if(idx==2){
19   - jQuery(this).height(jt.find("iframe").height());
20   - }
21   - });
22   - }
23   -}
  3 +// Theme namespace
  4 +var SPBNoosferoTheme = {};
24 5  
25   -(function($) {
26   - // Run code
27   - if($.cookie("high_contrast") === 'true'){
28   - $( "body" ).toggleClass( "contraste" );
29   - }
30   - $( "#siteaction-contraste a" ).click(function() {
31   - $( "body" ).toggleClass( "contraste" );
32   - if($('body').hasClass('contraste')){
33   - $.cookie('high_contrast', 'true', {path: '/'});
34   - } else {
35   - $.cookie('high_contrast', null, { path: '/' });
36   - }
37   - });
38   -
39   - $( ".profile-image" ).prepend( "<span class='helper'></span>" );
40   - //insere a mensagem no bloco de trilhas na página inicial//
41   - $( ".action-home-index #content .community-track-plugin_track-card-list-block .track_list" ).prepend( "<span class='msg_block'>Construa seu caminho de participação na elaboração de políticas públicas...</span>" );
42   - //insere a mensagem no bloco de comunidades na página inicial//
43   - $( ".action-home-index #content .communities-block .block-inner-2>div" ).prepend( "<span class='msg_block'>Participe dos dialogos entre governo e sociedade em comunidades temáticas...</span>" );
44   - $( ".action-home-index #content .communities-block .block-inner-2>div.block-footer-content .msg_block" ).remove();
45   - $('.container-block-plugin_container-block').each(alignBlocks);
46   -
47   - $('#block-48500 > .block-inner-1 > .block-inner-2').append('<div class="more_button" style="position: absolute; top: 5px; left: 519px;"><div class="view_all"><a href="/portal/blog">Ler todas</a></div></div>');
  6 +// Add in jQuery a method that executes a given function only if there is a filled query result
  7 +jQuery.fn.doOnce = function( func ) {
  8 + this.length && func.apply( this );
  9 + return this;
  10 +}
48 11  
  12 +// Animate Organization Ratings additional informations form
  13 +SPBNoosferoTheme.OrganizationRatings = (function($) {
  14 + 'use strict';
49 15  
  16 + // Add a question mark next to each form field, so when user mouse over it,
  17 + // it displays some userfull information about the field
  18 + function setTooltipContent() {
  19 + $('span.star-tooltip').html('?');
  20 + }
50 21  
51   -// Foco no botao de busca
  22 + // Given the current state of the form(hidden or in display)
  23 + // change the arrow image and animte its state change
  24 + function animateExtraFields(additionalFields, arrow) {
  25 + var innerHeight = additionalFields[0].offsetHeight;
  26 +
  27 + // If in display, puts the down arrow and hide the form
  28 + if(additionalFields.height() !== 0) {
  29 + arrow.attr('class', 'comments-arrow-down');
  30 + additionalFields.animate({height: 0});
  31 + } else { // if the form is hidden, puts the up arrow and display the form
  32 + arrow.attr('class', 'comments-arrow-up');
  33 + additionalFields.animate({
  34 + height: additionalFields.get(0).scrollHeight
  35 + }, 1000 );
  36 + }
52 37  
53   -$('#link-buscar').click(function(e) {
54   - e.defaultPrevented();
55   - window.location.hash = '#portal-searchbox';
56   - $('.searchField').focus()
57   -})
  38 + // Fix for the arrow change on the additional informations, it prevents the institution modal
  39 + // from killing the entire page. When the form had their status changed, the institution modal
  40 + // tended to cover the page even if it was not in display
  41 + document.getElementById('institution_modal').style.display = 'none';
  42 + }
58 43  
59   -})(jQuery);
  44 + // Set additional informations form up and down arrows click event
  45 + function setArrowDirection() {
  46 + var reportForm = $('div.star-comment-container');
  47 + var parent = reportForm.parent();
  48 + reportForm.detach(); // Remove form from the page DOM
  49 +
  50 + // Apply arrows click event
  51 + var additionalDataBar = reportForm.find('div.comments-display-fields');
  52 + additionalDataBar.on('click', function() {
  53 + var arrow = additionalDataBar.find('span[class*="comments-arrow"]');
  54 + var additionalFields = reportForm.find('.comments-software-extra-fields');
  55 + animateExtraFields(additionalFields, arrow);
  56 + });
60 57  
  58 + // Add the form back to the page
  59 + parent.append(reportForm);
  60 + }
61 61  
62   -// Efeito Fade nos box de softwares
63 62  
64   -(function($){
65   - "use strict";// Make javascript less intolerant to errors
  63 + function initialize() {
  64 + $('div.star-rate-form').doOnce(function() {
  65 + setTooltipContent();
  66 + setArrowDirection();
  67 + });
  68 + }
66 69  
67   - var TRANSITION_TIME = 250;// milliseconds
  70 + return {
  71 + init: initialize
  72 + };
68 73  
  74 +}) (jQuery);
69 75  
70   - function show_finality() {
71   - var finality = $(this).children(".software-block-finality");
  76 +// Fade effect on software blocks of portal homepage
  77 +SPBNoosferoTheme.HighlightedSoftwaresBlock = (function($) {
  78 + 'use strict';
72 79  
73   - //finality.stop().fadeTo(TRANSITION_TIME,1);
  80 + function showFinality() {
  81 + var finality = $(this).children('div.software-block-finality');
74 82 finality.stop().fadeTo('fast', 1);
75   - //finality.stop().animate({"top" : "0%"}, TRANSITION_TIME);
76 83 }
77 84  
78   - function hide_finality() {
79   - var finality = $(this).children(".software-block-finality");
80   -
81   - //finality.stop().fadeTo(TRANSITION_TIME,0);
  85 + function hideFinality() {
  86 + var finality = $(this).children('div.software-block-finality');
82 87 finality.stop().fadeTo('fast', 0);
83   - //finality.stop().animate({"top" : "100%"}, TRANSITION_TIME);
84 88 }
85 89  
86   - function move_article_buttons(){
87   - var article_actions = $('#article-actions').clone();
88   - var report = $('.report-abuse-action').remove();
89   - var suggest = $('.icon-suggest').remove();
90   -
  90 + // Set the mouse over and out event in each of the finality blocks in the page
  91 + function setFadeInOutFinality(){
  92 + $('#boxes div.software-block-finality').css({'opacity':0, 'top':0});
  93 + var softwaresBlocks = $('#boxes div.software-block');
91 94  
92   - $(article_actions).find('.icon-edit, .icon-new, .icon-delete, .icon-locale').remove();
93   - $('.article-body').append(article_actions);
  95 + softwaresBlocks.mouseover(showFinality);
  96 + softwaresBlocks.mouseout(hideFinality);
94 97 }
95 98  
96   - function add_link_to_article_div(){
97   - var list = $('.display-content-block').find('li');
  99 + function initialize() {
  100 + $('#boxes .box-1 div.softwares-block').doOnce(function() {
  101 + setFadeInOutFinality();
  102 + });
  103 + }
98 104  
99   - list.each(function(){
100   - var link = $(this).find('.title').find('a').attr('href');
101   - var text = $(this).find('.lead').find('p').text();
  105 + return {
  106 + init: initialize
  107 + };
  108 +}) (jQuery);
  109 +
  110 +
  111 +SPBNoosferoTheme.NoosferoHTMLAdjusts = (function($) {
  112 + 'use strict';
  113 +
  114 + // Take each list item from the block and apply to its lead the same link as its title
  115 + // then wraps the list item inside a new div with class notice-item
  116 + function insertLinksAndWrapsOnHomeNews(){
  117 + var news = $('div.display-content-block').find('li');
  118 + var parent = news.parent();
  119 + news.detach();
  120 + news.each(function(){
  121 + //add link on lead
  122 + var link = $(this).find('div.title a').attr('href');
  123 + var lead = $(this).find('div.lead');
102 124 var leadLink = $('<a></a>');
103 125  
104 126 leadLink.attr('href', link);
105   - leadLink.text(text);
  127 + leadLink.text(lead.find('p').text());
  128 + lead.html(leadLink);
106 129  
107   - $(this).find('.lead').html(leadLink);
  130 + //add wraps to improve styling
  131 + $(this).find('div:gt(0)').wrapAll('<div class="notice-item"/>');
  132 + $(this).find('.notice-item div:gt(0)').wrapAll('<div class="notice-info"/>');
108 133 });
  134 +
  135 + parent.append(news);
109 136 }
110 137  
111   - function insert_notice_div(){
112   - var notice = $('.display-content-block').find('li');
113   - notice.each(function(){
114   - var $set = $(this).children();
115   - for(var i=1, len = $set.length; i < len; i+=5){
116   - $set.slice(i, i+5).wrapAll('<div class="notice-item"/>');
117   - }
118   - for(var i=2, len = $set.length; i < len; i+=3){
119   - $set.slice(i, i+3).wrapAll('<div class="notice-info"/>');
  138 + // Add a toggle tooltip to all span with title attribute
  139 + function addTooltips(){
  140 + $('#content span[title]').doOnce(function(){
  141 + this.attr('data-toggle', 'tooltip');
  142 + this.tooltip();
  143 + });
  144 + }
  145 +
  146 + // Make the link next to a popover span show the popover when it is clicked
  147 + function addPopovers() {
  148 + var span = $('span[data-toggle="popover"]');
  149 + var place = span.attr('data-placement');
  150 + var elementClass = span.attr('data-class');
  151 +
  152 + span.doOnce(function(){
  153 + var popover = this.popover({
  154 + html:true,
  155 + placement: place,
  156 + content: function() {
  157 + return $(this).next().html();
120 158 }
121   - //$('<div class="notice-item"></div>').wrap($(this).find( '.image', '.title', '.lead', '.read_more'));
  159 + })
  160 + .data('bs.popover');
  161 +
  162 + if(popover) {
  163 + popover.tip()
  164 + .addClass(elementClass);
  165 +
  166 + // Make the link show the span popover when it is clicked
  167 + $('a.toggle-popover').on('click',function() {
  168 + span.trigger('click');
  169 + });
  170 + }
122 171 });
  172 + }
123 173  
  174 + function moveBreadcrumbs() {
  175 + $('div.breadcrumbs-plugin_content-breadcrumbs-block').doOnce(function() {
  176 + this.insertBefore('#content-inner');
  177 + $('<span id="breadcrumbs-you-are-here">Você está aqui:</span>').insertBefore(this.find('div.block-inner-2').children().first());
  178 + });
124 179 }
125 180  
126   - //toggle filter options in catalog page
127   - function setFilterCategoriesOptionClass() {
128   - var filterOptions = $("#filter-categories-option");
129   - filterOptions.addClass("animated slideInDown");
  181 + function removeButtons(){
  182 + $('#article-actions').doOnce(function() {
  183 + $(this).children('.icon-spread, .icon-locale, .report-abuse-action, .icon-clone').remove();
  184 + });
  185 +
  186 + $('div.page-members-header').doOnce(function() {
  187 + $(this).find('.report-abuse-action').remove();
  188 + });
130 189 }
131 190  
  191 + // Put the focus on the search form when user click on the "go to search link"
  192 + function searchLinkApplyFocusToItsForm() {
  193 + $('#link-buscar').click(function(e) {
  194 + e.defaultPrevented();
  195 + $('.searchField').focus();
  196 + });
  197 + }
  198 +
  199 + function initialize() {
  200 + insertLinksAndWrapsOnHomeNews();
  201 + addTooltips();
  202 + addPopovers();
  203 + moveBreadcrumbs();
  204 + searchLinkApplyFocusToItsForm();
  205 + removeButtons();
  206 + }
  207 +
  208 + return {
  209 + init: initialize
  210 + };
  211 +
  212 +}) (jQuery);
  213 +
  214 +// Software catalog category filter toggle functionality
  215 +SPBNoosferoTheme.SoftwareCatalog = (function($) {
  216 + 'use strict';
  217 +
  218 + // Apply the toggle animation on the category filter based on its current status
132 219 function toggleFilterOptions(){
133   - var filterOptions = $("#filter-categories-option");
134   - var filterHeight = filterOptions[0].scrollHeight;
135   - var showOptions = $("#filter-option-catalog-software");
136   - var hideOptions = $("#filter-option-catalog-close");
137   - if(hideOptions.is(":visible")){
138   - //filterOptions.slideUp(function() {
139   - showOptions.show();
140   - hideOptions.hide();
141   - //});
  220 + var filter = document.getElementById('filter-catalog-software');
  221 + var filterOptions = $(filter.children[0]); // filter categories
  222 + var filterHeight = filterOptions[0].scrollHeight; // filter categories height to be used when displaying it
  223 + var showOptions = $(filter.children[1]); // Show categories div, has a click event
  224 + var hideOptions = $(filter.children[2]); // Hide categories div, has a click event
  225 +
  226 + // If the hide categories div is visible and it is clicked,
  227 + // hide the categories and display the show categories div
  228 + if(hideOptions.is(':visible')){
  229 + showOptions.show();
  230 + hideOptions.hide();
  231 +
142 232 filterOptions.animate({
143 233 height: 0
144 234 },500);
145   - }
146   - else {
  235 + } else { // The user clicked on the show categories div, then show the categories and the "hide categories div"
147 236 showOptions.hide();
148 237 hideOptions.show();
  238 +
149 239 filterOptions.animate({
150 240 height: filterHeight
151 241 },500);
152 242 }
153 243 }
154 244  
155   - function setEvents(){
156   - // Fade css
157   - $('.software-block-finality').css('opacity', 0);
158   - $('.software-block-finality').css('top', 0);
159   - // End Fade CSS
160   - $(".software-block").mouseover(show_finality);
161   - $(".software-block").mouseout(hide_finality);
162   -
163   - var showOptions = $("#filter-option-catalog-software");
164   - var hideOptions = $("#filter-option-catalog-close");
165   - showOptions.click(toggleFilterOptions);
166   - hideOptions.click(toggleFilterOptions);
  245 +// If there is a software catalog on the page, add its category filter toggle animation
  246 + function initialize() {
  247 + var filter = document.getElementById('filter-catalog-software');
  248 + if (filter) {
  249 + //toggle filter options in catalog page
  250 + filter.children[0].setAttribute('class', 'animated slideInDown');
  251 + $(filter.children[1]).click(toggleFilterOptions);
  252 + $(filter.children[2]).click(toggleFilterOptions);
  253 + }
  254 + }
  255 +
  256 + return {
  257 + init: initialize
  258 + };
  259 +}) (jQuery);
  260 +
  261 +SPBNoosferoTheme.NoosferoFoldersContent = (function($) {
  262 + 'use strict';
  263 +
  264 + /* Splits a file name from its extension. Example: example.pdf becomes example - PDF */
  265 + function split_file_extension(element) {
  266 + var tokens = element.innerHTML.split('.');
  267 +
  268 + if(tokens.length > 1) {
  269 + var fileExtension = tokens.pop().toUpperCase();
  270 + var fileName = tokens.join('.');
  271 + element.innerHTML = fileName + ' - ' + fileExtension;
  272 + }
167 273 }
168 274  
169 275 /* Finds all uploaded files from manuals page and sets its names on the right format */
... ... @@ -173,7 +279,7 @@ $(&#39;#link-buscar&#39;).click(function(e) {
173 279 var folderList = article.getElementsByClassName('folder-content')[0];
174 280 var folderItens = folderList.getElementsByClassName('item-description');
175 281  
176   - for(var i = 0; i < folderItens.length; i++) {
  282 + for(var i = 0, loop_length = folderItens.length; i < loop_length; i++) {
177 283 split_file_extension(folderItens[i].getElementsByTagName('a')[0]);
178 284 }
179 285 } catch(e) {
... ... @@ -181,110 +287,26 @@ $(&#39;#link-buscar&#39;).click(function(e) {
181 287 }
182 288 }
183 289  
184   - /* Splits a file name from its extension. Example: example.pdf becomes example - PDF */
185   - function split_file_extension(element) {
186   - var tokens = element.innerHTML.split('.');
187   - if(tokens.length == 2) {
188   - var fileName = tokens[0];
189   - var fileExtension = tokens[1].toUpperCase();
190   - element.innerHTML = fileName + " - " + fileExtension;
191   - }
192   - }
193   -
194   - function set_tooltip_content() {
195   - $('.star-tooltip').html("?");
196   - }
197   -
198   -
199   - function set_arrow_direction() {
200   - var additional_data_bar = $('.comments-display-fields');
201   -
202   - additional_data_bar.on('click', function() {
203   - var arrow = additional_data_bar.find('span[class*="comments-arrow"]');
204   - var additional_fields = $('.comments-software-extra-fields');
205   -
206   - if (additional_fields) {
207   - animateExtraFields(additional_fields, arrow);
208   - }
209   - });
210   - }
211   -
212   -
213   - function animateExtraFields(additional_fields, arrow) {
214   - var innerHeight = additional_fields[0].offsetHeight;
215   -
216   - if(additional_fields.height() !== 0) {
217   - arrow.attr('class', "comments-arrow-down");
218   - additional_fields.animate({height: 0});
219   - } else {
220   - arrow.attr('class', "comments-arrow-up");
221   - additional_fields.animate({height: additional_fields.get(0).scrollHeight}, 1000 );
222   - }
223   -
224   - // Fix for the arrow change on modal display to block, killing the entire page
225   - $("#institution_modal").css({'display':'none'});
226   - }
227   -
228   -
229   - function set_use_report_content() {
230   - $('.profile-homepage .organization-average-rating-container .rate-this-organization a').html('Avalie este software');
231   - $('.make-report-block .make-report-container .button-bar a span').html('Avalie este software');
232   - $('.star-rate-data .star-rate-form.rating-cooldown .button-bar a span').html('Avalie este software');
233   - $('.make-report-block .make-report-container .make-report-message').html('Relate sua experiência ou do órgão/empresa com relação ao software.');
234   - $('.ratings-list .see-more a.icon-arrow-right-p').html('veja todos os relatos');
235   - $('.main-content .star-rate-data .star-rate-form .star-comment-container .button-bar input').attr('value', 'Enviar');
236   - $('.main-content .star-rate-data .star-rate-form .star-rate-text').html('Avalie este software');
237   - $('.main-content .star-rate-data .star-rate-form .star-comment-container .formlabel').html('Depoimento sobre o software');
238   - $('.star-rate-form .star-comment-container .comments-display-fields span#comments-additional-information').html('Dados adicionais (órgãos e empresas)');
239   - $('.star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments label').html('Nome do órgão ou empresa');
240   - $('.star-rate-form .star-comment-container .comments-software-extra-fields .comments-software-people-benefited label').html('Número de beneficiados');
241   - $('.star-rate-form .star-comment-container .comments-software-extra-fields .comments-software-saved-values label').html('Recursos economizados');
242   - }
243   -
244   - function add_tooltips(){
245   - $('#content span[title]').attr("data-toggle","tooltip");
246   -
247   - $('[data-toggle="tooltip"]').tooltip();
248   - }
249   -
250   - function add_popovers() {
251   - var span = $('span[data-toggle="popover"]');
252   - var place = span.attr("data-placement");
253   - var elementClass = span.attr("data-class");
254   - if(span){
255   - var popover = span.popover({
256   - html:true,
257   - placement: place,
258   - content: function() {
259   - return $(this).next().html();
260   - }
261   - })
262   - .data('bs.popover');
263   - }
264   - if(popover) {
265   - popover.tip()
266   - .addClass(elementClass);
267   - $('a.toggle-popover').on("click",function() {
268   - span.trigger("click");
269   - });
270   - }
271   - }
272   -
273   - function move_breadcrumbs() {
274   - $('.breadcrumbs-plugin_content-breadcrumbs-block').prependTo('#wrap-2');
275   - $('<span id="breadcrumbs-you-are-here">Você está aqui:</span>').insertBefore($('.breadcrumbs-plugin_content-breadcrumbs-block .block-inner-2').children().first());
  290 + function initialize() {
  291 + set_uploaded_files_names();
276 292 }
277 293  
278   - $(document).ready(function(){
279   - add_tooltips();
280   - add_popovers();
281   - move_article_buttons();
282   - move_breadcrumbs();
283   - insert_notice_div();
284   - set_uploaded_files_names();
285   - set_tooltip_content();
286   - set_arrow_direction();
287   - set_use_report_content();
288   - setEvents();
289   - });
290   -})(jQuery);
  294 + return {
  295 + init: initialize
  296 + };
  297 +
  298 +}) (jQuery);
  299 +
  300 +// Theme javascript bootstrap
  301 +(function(jQuery) {
  302 + 'use strict';
  303 +
  304 + // Initialize everything
  305 + $(document).ready(function() {
  306 + SPBNoosferoTheme.OrganizationRatings.init();
  307 + SPBNoosferoTheme.HighlightedSoftwaresBlock.init();
  308 + SPBNoosferoTheme.NoosferoHTMLAdjusts.init();
  309 + SPBNoosferoTheme.SoftwareCatalog.init();
  310 + SPBNoosferoTheme.NoosferoFoldersContent.init();
  311 + });
  312 +}) (jQuery);
... ...
src/noosfero-spb/software_communities/controllers/software_communities_plugin_controller.rb
... ... @@ -5,8 +5,8 @@ class SoftwareCommunitiesPluginController &lt; ApplicationController
5 5 def get_license_data
6 6 return render :json=>{} if !request.xhr? || params[:query].nil?
7 7  
8   - data = LicenseHelper.find_licenses(params[:query]) if params[:query]
9   - data ||= LicenseInfo.all
  8 + data = LicenseHelper.find_licenses(params[:query]) unless params[:query].blank?
  9 + data ||= LicenseHelper.all
10 10  
11 11 render :json=> data.collect { |license|
12 12 {:id=>license.id, :label=>license.version}
... ...
src/noosfero-spb/software_communities/db/migrate/20160112191716_add_license_to_softwares_with_none.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class AddLicenseToSoftwaresWithNone < ActiveRecord::Migration
  2 + def up
  3 + execute("UPDATE software_infos SET license_info_id=(SELECT id FROM license_infos WHERE version='Another') WHERE license_info_id IS NULL;")
  4 + end
  5 +
  6 + def down
  7 + say "This migration can't be reverted"
  8 + end
  9 +end
... ...
src/noosfero-spb/software_communities/db/migrate/20160114190943_add_timestamps_to_software_info.rb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +class AddTimestampsToSoftwareInfo < ActiveRecord::Migration
  2 + def up
  3 + change_table :software_infos do |t|
  4 + t.datetime :created_at, :null => false, :default => Time.zone.now
  5 + t.datetime :updated_at, :null => false, :default => Time.zone.now
  6 + end
  7 + end
  8 +
  9 + def down
  10 + remove_column :software_infos, :created_at
  11 + remove_column :software_infos, :updated_at
  12 + end
  13 +end
... ...
src/noosfero-spb/software_communities/features/categories_softwares_block.feature 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +Feature: go to software search when click on category
  2 + As a user
  3 + I want to select a category
  4 + to see the softwares with the selected category
  5 +
  6 + Background:
  7 + Given "SoftwareCommunitiesPlugin" plugin is enabled
  8 + And I am logged in as mpog_admin
  9 + And I go to /admin/plugins
  10 + And I check "SoftwareCommunitiesPlugin"
  11 + And I press "Save changes"
  12 + And the following categories
  13 + | name | display_in_menu |
  14 + | Software | true |
  15 + And the following categories
  16 + | parent | name | display_in_menu |
  17 + | Software | Health | true |
  18 + | Software | Education | true |
  19 + And the following softwares
  20 + | name | public_software | categories | finality |
  21 + | Software One | true | Health | some finality |
  22 + | Software Two | true | Health, Education | some finality |
  23 + | Software Three | false | Education | some finality |
  24 + And the following blocks
  25 + | owner | type |
  26 + | environment | CategoriesSoftwareBlock |
  27 +
  28 + Scenario: Search softwares by education category
  29 + Given I go to /
  30 + When I follow "Education"
  31 + Then I should see "Software Two"
  32 + And I should see "Software Three"
  33 + And I should not see "Software One"
  34 +
... ...