Commit f77c83ab00c7ac8f9cfa37bbffc372147b81c0a7
Exists in
master
and in
51 other branches
Fix css/html in institution modal
Showing
88 changed files
with
1470 additions
and
382 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,96 @@ |
| 1 | +# Software Público - configuration management | |
| 2 | + | |
| 3 | +## Requirements | |
| 4 | + | |
| 5 | +* [chake](https://rubygems.org/gems/chake) | |
| 6 | +* rake | |
| 7 | + | |
| 8 | +For development | |
| 9 | + | |
| 10 | +* vagrant | |
| 11 | +* shunit2 | |
| 12 | +* moreutils | |
| 13 | +* redir | |
| 14 | + | |
| 15 | +## Configuration parameters | |
| 16 | + | |
| 17 | +All configuration parameters are defined in `nodes.yaml`, with exception of IP | |
| 18 | +addresses, which are defined in different files: | |
| 19 | + | |
| 20 | +- for local development, the IP addresses of the Vagrant VMs are defined in | |
| 21 | + config/local/ips.yaml. | |
| 22 | + | |
| 23 | +- for production, you need to create a new file called | |
| 24 | + `config/production/ips.yaml` | |
| 25 | + | |
| 26 | +You will probably not need to change nodes.yaml unless you are developing the | |
| 27 | +deployment process. | |
| 28 | + | |
| 29 | +## Deploy | |
| 30 | + | |
| 31 | +### Development | |
| 32 | + | |
| 33 | +First you have to bring up the development virtual machines: | |
| 34 | + | |
| 35 | +```bash | |
| 36 | +$ vagrant up | |
| 37 | +$ rake preconfig | |
| 38 | +$ rake bootstrap_common | |
| 39 | +``` | |
| 40 | + | |
| 41 | +Right now there are 5 VM's, so this might take a while. The basic commands for | |
| 42 | +deployment: | |
| 43 | + | |
| 44 | +```bash | |
| 45 | +$ rake # deploys all servers | |
| 46 | +$ rake nodes # lists all servers | |
| 47 | +$ rake converge:$server # deploys only $server | |
| 48 | +``` | |
| 49 | + | |
| 50 | +### Production | |
| 51 | + | |
| 52 | +* TODO: document adding the SSL key and certificate | |
| 53 | +* TODO: document creation of `prod.yaml`. | |
| 54 | +* TODO: document SSH configuration | |
| 55 | + | |
| 56 | +The very first step is | |
| 57 | + | |
| 58 | +``` | |
| 59 | +$ rake preconfig SPB_ENV=production | |
| 60 | +``` | |
| 61 | + | |
| 62 | +This will perform some initial configuration to the system that is required | |
| 63 | +before doing the actual deployment. | |
| 64 | + | |
| 65 | +After that: | |
| 66 | + | |
| 67 | +```bash | |
| 68 | +$ rake SPB_ENV=production # deploys all servers | |
| 69 | +$ rake nodes SPB_ENV=production # lists all servers | |
| 70 | +$ rake converge:$server SPB_ENV=production # deploys only $server | |
| 71 | +``` | |
| 72 | + | |
| 73 | +You can also do `export SPB_ENV=production` in your shell and omit it in the | |
| 74 | +`rake` calls. | |
| 75 | + | |
| 76 | +See the output of `rake -T` for other tasks. | |
| 77 | + | |
| 78 | +## Viewing the running site when developping locally | |
| 79 | + | |
| 80 | +Run: | |
| 81 | + | |
| 82 | +```bash | |
| 83 | +./server | |
| 84 | +``` | |
| 85 | + | |
| 86 | +Follow the on-screen instructions an browse to | |
| 87 | +[http://softwarepublico.dev/](http://softwarepublico.dev/). | |
| 88 | + | |
| 89 | +Note: this requires that your system will resolve `\*.dev` to `localhost`. | |
| 90 | +Google DNS servers will do that automatically, otherwise you might add the following entries to `/etc/hosts`: | |
| 91 | + | |
| 92 | +``` | |
| 93 | +127.0.53.53 softwarepublico.dev | |
| 94 | +127.0.53.53 listas.softwarepublico.dev | |
| 95 | +``` | |
| 96 | + | ... | ... |
README.md
| 1 | -# Software Público - configuration management | |
| 1 | +# Software Público Brasileiro - desenvolvimento | |
| 2 | 2 | |
| 3 | -## Requirements | |
| 3 | +## Organização | |
| 4 | 4 | |
| 5 | -* [chake](https://rubygems.org/gems/chake) | |
| 6 | -* rake | |
| 5 | +Este repositório contém tanto o código fonte desenvolvimento especificamente | |
| 6 | +para o SPB, quando o código de gestão de configuração necessário para implantar | |
| 7 | +o ambiente do SPB. | |
| 7 | 8 | |
| 8 | -For development | |
| 9 | +O código fonte dos componentes e pacotes desenvolvidos está no diretório | |
| 10 | +`src/`. Os demais diretórios contém código de gestão de configuração, | |
| 11 | +documentação, utilitários etc. | |
| 9 | 12 | |
| 10 | -* vagrant | |
| 11 | -* shunit2 | |
| 12 | -* moreutils | |
| 13 | -* redir | |
| 13 | +## Fazendo um release | |
| 14 | 14 | |
| 15 | -## Configuration parameters | |
| 15 | +* Atualize o número de versão no arquivo VERSION | |
| 16 | +* Execute `make release`. | |
| 16 | 17 | |
| 17 | -All configuration parameters are defined in `nodes.yaml`, with exception of IP | |
| 18 | -addresses, which are defined in different files: | |
| 19 | - | |
| 20 | -- for local development, the IP addresses of the Vagrant VMs are defined in | |
| 21 | - config/local/ips.yaml. | |
| 22 | - | |
| 23 | -- for production, you need to create a new file called | |
| 24 | - `config/production/ips.yaml` | |
| 25 | - | |
| 26 | -You will probably not need to change nodes.yaml unless you are developing the | |
| 27 | -deployment process. | |
| 28 | - | |
| 29 | -## Deploy | |
| 30 | - | |
| 31 | -### Development | |
| 32 | - | |
| 33 | -First you have to bring up the development virtual machines: | |
| 34 | - | |
| 35 | -```bash | |
| 36 | -$ vagrant up | |
| 37 | -$ rake preconfig | |
| 38 | -$ rake bootstrap_common | |
| 39 | -``` | |
| 40 | - | |
| 41 | -Right now there are 5 VM's, so this might take a while. The basic commands for | |
| 42 | -deployment: | |
| 43 | - | |
| 44 | -```bash | |
| 45 | -$ rake # deploys all servers | |
| 46 | -$ rake nodes # lists all servers | |
| 47 | -$ rake converge:$server # deploys only $server | |
| 48 | -``` | |
| 49 | - | |
| 50 | -### Production | |
| 51 | - | |
| 52 | -* TODO: document adding the SSL key and certificate | |
| 53 | -* TODO: document creation of `prod.yaml`. | |
| 54 | -* TODO: document SSH configuration | |
| 55 | - | |
| 56 | -The very first step is | |
| 57 | - | |
| 58 | -``` | |
| 59 | -$ rake preconfig SPB_ENV=production | |
| 60 | -``` | |
| 61 | - | |
| 62 | -This will perform some initial configuration to the system that is required | |
| 63 | -before doing the actual deployment. | |
| 64 | - | |
| 65 | -After that: | |
| 66 | - | |
| 67 | -```bash | |
| 68 | -$ rake SPB_ENV=production # deploys all servers | |
| 69 | -$ rake nodes SPB_ENV=production # lists all servers | |
| 70 | -$ rake converge:$server SPB_ENV=production # deploys only $server | |
| 71 | -``` | |
| 72 | - | |
| 73 | -You can also do `export SPB_ENV=production` in your shell and omit it in the | |
| 74 | -`rake` calls. | |
| 75 | - | |
| 76 | -See the output of `rake -T` for other tasks. | |
| 77 | - | |
| 78 | -## Viewing the running site when developping locally | |
| 79 | - | |
| 80 | -Run: | |
| 81 | - | |
| 82 | -```bash | |
| 83 | -./server | |
| 84 | -``` | |
| 85 | - | |
| 86 | -Follow the on-screen instructions an browse to | |
| 87 | -[http://softwarepublico.dev/](http://softwarepublico.dev/). | |
| 88 | - | |
| 89 | -Note: this requires that your system will resolve `\*.dev` to `localhost`. | |
| 90 | -Google DNS servers will do that automatically, otherwise you might add the following entries to `/etc/hosts`: | |
| 91 | - | |
| 92 | -``` | |
| 93 | -127.0.53.53 softwarepublico.dev | |
| 94 | -127.0.53.53 listas.softwarepublico.dev | |
| 95 | -``` | |
| 18 | +## Implantação | |
| 96 | 19 | |
| 20 | +Veja as instruções em README.chef.md. | ... | ... |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +5.0a0 | ... | ... |
cookbooks/colab/recipes/default.rb
| ... | ... | @@ -21,6 +21,11 @@ package 'colab-spb-theme' do |
| 21 | 21 | notifies :restart, 'service[colab]' |
| 22 | 22 | end |
| 23 | 23 | |
| 24 | +package 'colab-spb-theme' do | |
| 25 | + action :upgrade | |
| 26 | + notifies :restart, 'service[colab]' | |
| 27 | +end | |
| 28 | + | |
| 24 | 29 | directory '/etc/colab' do |
| 25 | 30 | owner 'root' |
| 26 | 31 | group 'root' | ... | ... |
cookbooks/colab/templates/gitlab.py.erb
cookbooks/colab/templates/noosfero.py.erb
| ... | ... | @@ -27,6 +27,8 @@ menu_urls = ( |
| 27 | 27 | kwargs={'path': 'search/people'}, auth=False), |
| 28 | 28 | url(display=_('Communities'), viewname='noosfero', |
| 29 | 29 | kwargs={'path': 'search/communities'}, auth=False), |
| 30 | + url(display=_('Institutions'), viewname='noosfero', | |
| 31 | + kwargs={'path': 'search/institutions'}, auth=False), | |
| 30 | 32 | url(display=_('Profile'), viewname='noosfero', |
| 31 | 33 | kwargs={'path': 'profile/~/'}, auth=True), |
| 32 | 34 | url(display=_('Control Panel'), viewname='noosfero', | ... | ... |
cookbooks/noosfero/files/noosfero-create-api-user
| ... | ... | @@ -5,13 +5,19 @@ email = ARGV[1] |
| 5 | 5 | password = SecureRandom.random_number.to_s |
| 6 | 6 | |
| 7 | 7 | user = User.find_by_login(login) |
| 8 | -exit(0) if user | |
| 9 | - | |
| 10 | -user = User.create!( | |
| 11 | - login: login, | |
| 12 | - email: email, | |
| 13 | - password: password, | |
| 14 | - password_confirmation: password | |
| 15 | -) | |
| 16 | -user.activate | |
| 17 | -user.generate_private_token! | |
| 8 | +if user | |
| 9 | + if user.private_token_expired? | |
| 10 | + user.generate_private_token! | |
| 11 | + else | |
| 12 | + exit(0) | |
| 13 | + end | |
| 14 | +else | |
| 15 | + user = User.create!( | |
| 16 | + login: login, | |
| 17 | + email: email, | |
| 18 | + password: password, | |
| 19 | + password_confirmation: password | |
| 20 | + ) | |
| 21 | + user.activate | |
| 22 | + user.generate_private_token! | |
| 23 | +end | ... | ... |
cookbooks/reverse_proxy/templates/reverse_proxy.conf.erb
docs/apoio.rst.in
| ... | ... | @@ -65,6 +65,42 @@ Caso os ambientes já tenham sido convergidos anteriormente, não será possíve |
| 65 | 65 | |
| 66 | 66 | O output do comando acima é a sua chave pública, ela deverá ser copiada e colada, manualmente, em ``~/.ssh/authorized_keys`` do usuário desejado. Esse procedimento deve ser repetido em todas as máquinas listadas em ``config/@@SPB_ENV@@/ips.yaml``. |
| 67 | 67 | |
| 68 | +Git push com HTTPS | |
| 69 | +----------------- | |
| 70 | + | |
| 71 | +Para a utilização do git com protocolo HTTPS é necessário configurar a senha do perfil do seu usuário na ferramenta Gitlab, pois a senha do seu usuário do portal não é configurada no Gitlab já que a autenticação é feita via REMOTE_USER (cabeçalho HTTP). Para configurar a sua senha no Gitlab é necessário que já exista um usuário válido no portal e o mesmo esteja logado, em seguida, siga os passos a seguir: | |
| 72 | + | |
| 73 | +1- No menu, clique no botão "Desenvolvimento" para que apareça novas opções | |
| 74 | +2- Nas opções apresentadas, clique em "Perfil" para ser direcionado para o seu perfil do Gitlab | |
| 75 | +3- No seu perfil será apresentado um novo menu abaixo do menu do portal, nesse menu clique na aba "Password" | |
| 76 | +4- Na aba "Password", indique que você esqueceu a sua senha clicando no link "Forgot your password?" | |
| 77 | +5- Um email será enviado para o seu endereço de email configurado no seu usuário do portal | |
| 78 | +6- Abra o email recebido e clique no link "Change my password", que irá redirecionar para uma página de configuração de uma nova senha | |
| 79 | +7- Na página de configuração de uma nova senha digite a sua senha e a confirme (sugere-se que use a mesma senha do portal), finalizando a operação de configuração da senha do seu perfil no Gitlab | |
| 80 | + | |
| 81 | +Com a senha do seu perfil do Gitlab configurada pode-se utlizar normalmente o git com protocolo HTTPS, onde será solcitado o seu usuário e senha durante as operações. Lembrando que o usuário será o seu usuário do portal e a senha será a que foi configurada com o processo descrito anteriormente. | |
| 82 | + | |
| 83 | +No Portal do Software Público Brasileiro, assim como em outros portais do governo, temos problemas com o certificado digital. Para o git conseguir realizar as operções usando HTTPS é necessário ignorar o certificado, para isso, abra o terminal (com o git instalado) e execute o seguinte comando:: | |
| 84 | + | |
| 85 | + $ cd <caminho-do-diretório-do-projeto> | |
| 86 | + $ git config http.sslVerify "false" | |
| 87 | + | |
| 88 | + | |
| 89 | +Integração manual entre repositórios | |
| 90 | +--------------------------------- | |
| 91 | + | |
| 92 | +Para empurrar modificações para mais de um repositório, por exemplo os repositórios do Portal do Software Público Brasileiro e Github, é necessário fazer algumas modificações nas configurações no git localmente (lado do cliente). Para isso, vamos configurar um apelido (alias) que aponte para as URLs dos nossos repositórios, e quando o comando ``git push <alias> <branch>`` for executado, as modificações serão empurradas para todos os nossos repositórios previamente configurados. Ou seja, apenas um comando será executado e todos os repositórios serão atualizados. | |
| 93 | + | |
| 94 | +Para realizar essa configuração é necessário que tenha o git instalado com um bash(terminal) e o repositório do seu projeto clonado localmente. Tendo isso, abra o bash e execute os comandos a seguir:: | |
| 95 | + | |
| 96 | + $ cd <caminho-do-diretório-do-projeto> | |
| 97 | + $ git remote set-url --add --push <apelido> <URL-repo1> | |
| 98 | + $ git remote set-url --add --push <apelido> <URL-repo2> | |
| 99 | + $ git remote set-url --add --push <apelido> <URL-repo3> | |
| 100 | + | |
| 101 | +Lembrando que o <apelido> de todos deve ser o mesmo, usualmente é usado o apelido "origin". Com isso, ao empurrar as suas modificações todos os repositórios configurados serão atualizados. | |
| 102 | + | |
| 103 | + | |
| 68 | 104 | Gerenciando listas de email |
| 69 | 105 | --------------------------- |
| 70 | 106 | O Mailman fornece alguns scripts para administração das listas de email, tais programas podem ser encontrados na máquina ``integration`` em ``/usr/lib/mailman/bin``. | ... | ... |
| ... | ... | @@ -0,0 +1,49 @@ |
| 1 | +VERSION = $(shell cat ../VERSION) | |
| 2 | +subdirs = colab-spb-plugin colab-spb-theme-plugin noosfero-spb | |
| 3 | + | |
| 4 | +dist_all = $(patsubst %, %-dist, $(subdirs)) | |
| 5 | +dist: $(dist_all) | |
| 6 | +$(dist_all): %-dist : % | |
| 7 | + if [ -f $*/Makefile ]; then make -C $* dist; fi | |
| 8 | + if [ -f $*/setup.py ]; then (cd $* && python setup.py sdist); fi | |
| 9 | + | |
| 10 | +clean_all = $(patsubst %, %-clean, $(subdirs)) | |
| 11 | +clean: $(clean_all) | |
| 12 | + $(MAKE) -C pkg-rpm/ clean | |
| 13 | + | |
| 14 | +$(clean_all): %-clean : % | |
| 15 | + if [ -f $*/Makefile ]; then make -C $* clean; fi | |
| 16 | + if [ -f $*/setup.py ]; then rm -rf $*/dist; fi | |
| 17 | + | |
| 18 | +release: | |
| 19 | + @if git tag | grep -q '^v$(VERSION)$$'; then \ | |
| 20 | + echo "E: version $(VERSION) already tagged. You need a new version number"; \ | |
| 21 | + false; \ | |
| 22 | + fi | |
| 23 | + echo '$(VERSION)' > colab-spb-plugin/VERSION | |
| 24 | + echo '$(VERSION)' > colab-spb-theme-plugin/VERSION | |
| 25 | + echo '$(VERSION)' > noosfero-spb/VERSION | |
| 26 | + $(MAKE) dist | |
| 27 | + cp noosfero-spb/dist/*.tar.* pkg-rpm/noosfero-spb/ | |
| 28 | + cp colab-spb-theme-plugin/dist/*.tar.* pkg-rpm/colab-spb-theme/ | |
| 29 | + cp colab-spb-plugin/dist/*.tar.* pkg-rpm/colab-spb-plugin/ | |
| 30 | + sed -i -e 's/^\(Version:\s*\).*/\1$(VERSION)/' \ | |
| 31 | + pkg-rpm/colab-spb-theme/colab-spb-theme.spec \ | |
| 32 | + pkg-rpm/colab-spb-plugin/colab-spb-plugin.spec \ | |
| 33 | + pkg-rpm/noosfero-spb/noosfero-spb.spec | |
| 34 | + git diff | |
| 35 | + @printf "Confirm release? [y/N]"; \ | |
| 36 | + read confirm; \ | |
| 37 | + if [ "$$confirm" = 'y' -o "$$confirm" = 'Y' ]; then \ | |
| 38 | + echo "SPB release $(VERSION)" > .commit_template; \ | |
| 39 | + git commit * --file .commit_template; \ | |
| 40 | + rm -f .commit_template; \ | |
| 41 | + else \ | |
| 42 | + echo 'Aborting at your request!'; \ | |
| 43 | + git checkout -- colab-spb-theme-plugin/VERSION noosfero-spb/VERSION colab-spb-plugin/VERSION ; \ | |
| 44 | + git checkout -- pkg-rpm/colab-spb-theme/ pkg-rpm/noosfero-spb/ pkg-rpm/colab-spb-plugin/ ; \ | |
| 45 | + false; \ | |
| 46 | + fi | |
| 47 | + # TODO add pkg-rpm/colab-spb-plugin to the git checkout all above | |
| 48 | + $(MAKE) -C pkg-rpm/ noosfero-spb-upload colab-spb-theme-upload colab-spb-plugin-upload | |
| 49 | + git tag $(VERSION) -s -m 'SPB Release $(VERSION)' | ... | ... |
src/colab-spb-plugin/.gitignore
src/colab-spb-plugin/MANIFEST.in
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +5.0a0 | ... | ... |
src/colab-spb-plugin/setup.py
| ... | ... | @@ -11,9 +11,11 @@ install_requires = ['colab', 'colab_noosfero', 'colab_gitlab'] |
| 11 | 11 | |
| 12 | 12 | tests_require = [ ] |
| 13 | 13 | |
| 14 | +version = open('VERSION').read().strip() | |
| 15 | + | |
| 14 | 16 | setup( |
| 15 | - name='colab-spb', | |
| 16 | - version='0.1.0', | |
| 17 | + name='colab-spb-plugin', | |
| 18 | + version=version, | |
| 17 | 19 | author='Macartur Sousa', |
| 18 | 20 | author_email='macartur.sc@gmail.com', |
| 19 | 21 | url='https://portal.softwarepublico.gov.br/gitlab/softwarepublico/colab-spb-plugin/', | ... | ... |
src/colab-spb-plugin/src/colab_spb/apps.py
src/colab-spb-plugin/tests/plugins.d/gitlab.py
src/colab-spb-plugin/tests/plugins.d/noosfero.py
src/colab-spb-plugin/tests/plugins.d/spb.py
| ... | ... | @@ -6,7 +6,6 @@ verbose_name = "SPB Plugin" |
| 6 | 6 | middlewares = ['colab_spb.middleware.ForceLangMiddleware'] |
| 7 | 7 | |
| 8 | 8 | urls = {"include": "colab_spb.urls", |
| 9 | - "prefix": '^spb/', | |
| 10 | - "namespace": "colab_spb"} | |
| 9 | + "prefix": '^spb/',} | |
| 11 | 10 | |
| 12 | 11 | url = colab_url_factory('colab_spb') | ... | ... |
src/colab-spb-theme-plugin/Makefile
| 1 | 1 | PACKAGE = colab-spb-theme |
| 2 | -VERSION = 0.2.0 | |
| 2 | +VERSION = $(shell cat VERSION) | |
| 3 | 3 | DISTDIR = dist |
| 4 | 4 | PACKAGE_NAME = $(PACKAGE)-$(VERSION) |
| 5 | 5 | TARBALL = $(PACKAGE_NAME).tar.gz |
| ... | ... | @@ -10,10 +10,10 @@ all: |
| 10 | 10 | colab_dir=/usr/lib/colab |
| 11 | 11 | |
| 12 | 12 | dist: clean |
| 13 | - mkdir -p $(DISTDIR)/$(PACKAGE_NAME) | |
| 14 | - tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd $(DISTDIR)/$(PACKAGE_NAME) && tar xzf -) | |
| 13 | + mkdir -p $(DISTDIR)/$(PACKAGE_NAME) | |
| 14 | + tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd $(DISTDIR)/$(PACKAGE_NAME) && tar xf -) | |
| 15 | 15 | cd $(DISTDIR) && tar -czf $(TARBALL) $(PACKAGE_NAME) |
| 16 | - rm -r $(DISTDIR)/$(PACKAGE_NAME) | |
| 16 | + rm -r $(DISTDIR)/$(PACKAGE_NAME) | |
| 17 | 17 | clean: |
| 18 | 18 | $(RM) $(TARBALL) |
| 19 | 19 | $(RM) -r $(DISTDIR) | ... | ... |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +5.0a0 | ... | ... |
src/noosfero-spb/.gitignore
src/noosfero-spb/Makefile
| 1 | 1 | PACKAGE = noosfero-spb |
| 2 | -VERSION = 4.2.1 | |
| 2 | +VERSION = $(shell cat VERSION) | |
| 3 | 3 | DISTDIR = $(PACKAGE)-$(VERSION) |
| 4 | 4 | TARBALL = $(DISTDIR).tar.gz |
| 5 | 5 | |
| ... | ... | @@ -11,13 +11,13 @@ 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 dist/$(DISTDIR) | |
| 17 | 18 | |
| 18 | 19 | clean: |
| 19 | - $(RM) $(TARBALL) | |
| 20 | - $(RM) -r $(DISTDIR) | |
| 20 | + $(RM) -r dist/ | |
| 21 | 21 | |
| 22 | 22 | install: |
| 23 | 23 | install -d -m 0755 $(DESTDIR)/$(plugins_dir)/software_communities | ... | ... |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +5.0a0 | ... | ... |
src/noosfero-spb/gov_user/lib/gov_user_plugin.rb
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +require File.dirname(__FILE__) + '/../../../../../lib/noosfero/api/helpers' | |
| 2 | +require_relative 'api_entities' | |
| 3 | + | |
| 4 | +class GovUserPlugin::API < Grape::API | |
| 5 | + | |
| 6 | + include Noosfero::API::APIHelpers | |
| 7 | + | |
| 8 | + resource :gov_user do | |
| 9 | + get 'institutions' do | |
| 10 | + authenticate! | |
| 11 | + institutions = select_filtered_collection_of(environment,'communities',params).joins(:institution) | |
| 12 | + present institutions.map{|o|o.institution}, :with => Entities::Institution | |
| 13 | + end | |
| 14 | + | |
| 15 | + get 'institutions/:id' do | |
| 16 | + authenticate! | |
| 17 | + institution = Institution.find_by_id(params[:id]) | |
| 18 | + present institution, :with => Entities::Institution | |
| 19 | + end | |
| 20 | + | |
| 21 | + end | |
| 22 | +end | |
| 23 | + | ... | ... |
src/noosfero-spb/gov_user/lib/gov_user_plugin/api_entities.rb
0 → 100644
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +module Entities | |
| 2 | + class Institution < Noosfero::API::Entity | |
| 3 | + root 'institutions', 'institution' | |
| 4 | + expose :name, :acronym, :unit_code, :parent_code, :unit_type, | |
| 5 | + :sub_juridical_nature, :normalization_level, | |
| 6 | + :version, :cnpj, :type, :governmental_power, | |
| 7 | + :governmental_sphere, :sisp, :juridical_nature, | |
| 8 | + :corporate_name, :siorg_code, :id | |
| 9 | + expose :community_id do |institution,options| | |
| 10 | + institution.community.id | |
| 11 | + end | |
| 12 | + end | |
| 13 | +end | ... | ... |
| ... | ... | @@ -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 GovUserApiTest < 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 | + "DF", | |
| 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 | + "DF", | |
| 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/noosfero-spb-theme/README.md
| ... | ... | @@ -3,4 +3,154 @@ PSB Theme for Noosfero |
| 3 | 3 | |
| 4 | 4 | Noosfero theme for the _Portal do Software Público_ project. |
| 5 | 5 | |
| 6 | -Install on /public/designs/themes/noosfero-spb-theme | |
| 7 | 6 | \ No newline at end of file |
| 7 | +Install on /public/designs/themes/noosfero-spb-theme | |
| 8 | + | |
| 9 | +================================ | |
| 10 | + | |
| 11 | +# Passos para configurar o tema a partir do spb/spb | |
| 12 | + | |
| 13 | +## Considerando que o clone do noosfero está na pasta home | |
| 14 | + | |
| 15 | +```bash | |
| 16 | +rm -r ~/noosfero/public/design/theme/noosfero-spb-theme | |
| 17 | +cd ~ | |
| 18 | +git clone git@softwarepublico.gov.br:softwarepublico/softwarepublico.git | |
| 19 | +cd softwarepublico/src/noosfero-spb/ | |
| 20 | +ln -sr noosfero-spb-theme/ ~/noosfero/public/designs/themes/ | |
| 21 | +ln -sr software_communities ~/noosfero/plugins/ | |
| 22 | +ln -sr gov_user ~/noosfero/plugins/ | |
| 23 | +git remote add theme git@softwarepublico.gov.br:softwarepublico/noosfero-spb-theme.git | |
| 24 | +``` | |
| 25 | + | |
| 26 | +# Para instalar o Colab | |
| 27 | + | |
| 28 | +```bash | |
| 29 | +cd ~ | |
| 30 | +git clone https://github.com/colab/colab | |
| 31 | +``` | |
| 32 | + | |
| 33 | +## Configuração | |
| 34 | + | |
| 35 | +Seguir [tutorial](https://github.com/colab/colab/blob/master/README.rst) do próprio Colab | |
| 36 | + | |
| 37 | +## Arquivos de configuração Colab | |
| 38 | + | |
| 39 | +Estando com o ambiente do vagrant levantado `(vagrant up && vagrant ssh)`, | |
| 40 | +e "trabalhando" com o colab `(workon colab)`: | |
| 41 | + | |
| 42 | +## Clone os repositórios: | |
| 43 | + | |
| 44 | +```bash | |
| 45 | +cd ~ | |
| 46 | +git clone git@softwarepublico.gov.br:softwarepublico/softwarepublico.git | |
| 47 | +git clone https://github.com/colab/colab-gitlab-plugin | |
| 48 | +git clone https://github.com/colab/colab-noosfero-plugin | |
| 49 | +``` | |
| 50 | + | |
| 51 | +## Criando diretórios - Plugins do Colab | |
| 52 | + | |
| 53 | +```bash | |
| 54 | +mkdir /etc/colab/plugins.d/ | |
| 55 | +cd plugins.d | |
| 56 | +``` | |
| 57 | + | |
| 58 | +## Crie os arquivos | |
| 59 | + | |
| 60 | +### gitlab.py | |
| 61 | + | |
| 62 | +```bash | |
| 63 | +vim gitlab.py | |
| 64 | +``` | |
| 65 | + | |
| 66 | +#### Conteúdo do gitlab.py | |
| 67 | + | |
| 68 | +```python | |
| 69 | +from django.utils.translation import ugettext_lazy as _ | |
| 70 | +from colab.plugins.utils.menu import colab_url_factory | |
| 71 | + | |
| 72 | +name = "colab_gitlab" | |
| 73 | +verbose_name = "Gitlab" | |
| 74 | + | |
| 75 | +upstream = '' | |
| 76 | +private_token = '' | |
| 77 | + | |
| 78 | +urls = { | |
| 79 | + "include":"colab_gitlab.urls", | |
| 80 | + "prefix": 'gitlab/', | |
| 81 | + "namespace":"gitlab" | |
| 82 | + } | |
| 83 | + | |
| 84 | +url = colab_url_factory('gitlab') | |
| 85 | +``` | |
| 86 | + | |
| 87 | +### noosfero.py | |
| 88 | + | |
| 89 | +```bash | |
| 90 | +vim noosfero.py | |
| 91 | +``` | |
| 92 | + | |
| 93 | +#### Conteúdo do noosfero.py | |
| 94 | + | |
| 95 | +```python | |
| 96 | +from django.utils.translation import ugettext_lazy as _ | |
| 97 | +from colab.plugins.utils.menu import colab_url_factory | |
| 98 | + | |
| 99 | +name = "colab_noosfero" | |
| 100 | +verbose_name = "Noosfero" | |
| 101 | +private_token = "" | |
| 102 | + | |
| 103 | +upstream = 'http://<IP DA SUA MÁQUINA AQUI>:8080/social' | |
| 104 | + | |
| 105 | +urls = { | |
| 106 | + "include":"colab_noosfero.urls", | |
| 107 | + "prefix": '^social/', | |
| 108 | + "namespace":"social" | |
| 109 | + } | |
| 110 | + | |
| 111 | +url = colab_url_factory('social') | |
| 112 | +``` | |
| 113 | + | |
| 114 | +### spb.py | |
| 115 | + | |
| 116 | +```bash | |
| 117 | +vim spb.py | |
| 118 | +``` | |
| 119 | + | |
| 120 | +#### Conteúdo do spb.py | |
| 121 | + | |
| 122 | +```python | |
| 123 | +from django.utils.translation import ugettext_lazy as _ | |
| 124 | +from colab.plugins.utils.menu import colab_url_factory | |
| 125 | + | |
| 126 | +name = "colab_spb" | |
| 127 | +verbose_name = "SPB Plugin" | |
| 128 | +urls = { | |
| 129 | + "include":"colab_spb.urls", | |
| 130 | + "prefix": '^spb/', | |
| 131 | + "namespace":"colab_spb" | |
| 132 | + } | |
| 133 | + | |
| 134 | +url = colab_url_factory('colab_spb') | |
| 135 | +``` | |
| 136 | +### Execuntando scripts de instalação | |
| 137 | + | |
| 138 | +```bash | |
| 139 | +cd ~/softwarepublico/config/ | |
| 140 | +pip install -e . | |
| 141 | +cd ~/softwarepublico/src/colab-spb-plugin/ | |
| 142 | +pip install -e . | |
| 143 | +colab-admin migrate | |
| 144 | +colab-admin migrate colab_spb | |
| 145 | +cd ~/colab-gitlab-plugin/ | |
| 146 | +pip install -e . | |
| 147 | +cd ~/softwarepublico/src/colab-spb-plugin/ | |
| 148 | +pip install -e . | |
| 149 | +colab-admin migrate | |
| 150 | +``` | |
| 151 | + | |
| 152 | +## Finalizando | |
| 153 | + | |
| 154 | +Execute o noosfero seja no ambiente local, ou schroot, | |
| 155 | +com o comando `RAILS_RELATIVE_URL_ROOT=/social unicorn` | |
| 156 | + | |
| 157 | +No vagrant, execute `colab-admin runserver 0.0.0.0:8000` | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/community-pages.css
| ... | ... | @@ -409,18 +409,19 @@ |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | #content #blog-tab .blog .blog-post h1{ |
| 412 | - margin: 0px 0px 10px 0px; | |
| 412 | + margin: 0px 0px 4px 0px; | |
| 413 | 413 | padding: 0px 0px 0px 0px; |
| 414 | - max-width: 555px; | |
| 414 | + max-width: 100%; | |
| 415 | 415 | max-height: 40px; |
| 416 | 416 | border: none; |
| 417 | 417 | font: normal normal bold 16px/20px Arial; |
| 418 | 418 | overflow: hidden; |
| 419 | - display: inline-block; | |
| 419 | + display: block; | |
| 420 | + text-align: left; | |
| 420 | 421 | } |
| 421 | 422 | |
| 422 | 423 | #content #blog-tab .blog .blog-post .post-pic{ |
| 423 | - margin:0 20px 5px 0px; | |
| 424 | + margin:0 20px 25px 0px; | |
| 424 | 425 | border-radius: 4px; |
| 425 | 426 | height: 62px; |
| 426 | 427 | width: 19%; |
| ... | ... | @@ -477,6 +478,7 @@ |
| 477 | 478 | color: #172738; |
| 478 | 479 | padding-left:0px; |
| 479 | 480 | text-align: left; |
| 481 | + display: inline-block; | |
| 480 | 482 | } |
| 481 | 483 | #content #blog-tab .blog .blog-post.position-1 .date{ |
| 482 | 484 | padding-left:0px; |
| ... | ... | @@ -492,6 +494,10 @@ float: left; |
| 492 | 494 | } |
| 493 | 495 | |
| 494 | 496 | /* Read more button*/ |
| 497 | +#content #blog-tab .blog .blog-post .read-more{ | |
| 498 | + display: none; | |
| 499 | +} | |
| 500 | + | |
| 495 | 501 | #content #blog-tab .blog .read-more{ |
| 496 | 502 | text-align: right; |
| 497 | 503 | display: block; |
| ... | ... | @@ -541,6 +547,31 @@ float: left; |
| 541 | 547 | } |
| 542 | 548 | |
| 543 | 549 | /*Block with Community information - Need to develop solution - Only display on profile page */ |
| 550 | +#agenda-toolbar a.button{ | |
| 551 | + opacity: 1.0; | |
| 552 | +} | |
| 553 | + | |
| 554 | +#content .software-events-block{ | |
| 555 | + display: none; | |
| 556 | +} | |
| 557 | + | |
| 558 | +.action-profile_design-index #content .software-events-block, | |
| 559 | +.profile-type-is-community .action-profile-index #content .software-events-block{ | |
| 560 | + display: block; | |
| 561 | +} | |
| 562 | + | |
| 563 | +/*** Right bar ***/ | |
| 564 | + | |
| 565 | +.template-default.profile-type-is-community .action-profile-index #content .box-3 .software-events-block, | |
| 566 | +.template-lefttopright.profile-type-is-community .action-profile-index #content .box-2 .software-events-block{ | |
| 567 | + display: none; | |
| 568 | +} | |
| 569 | + | |
| 570 | +.template-lefttopright.profile-type-is-community .action-content_viewer-view_page #content .box-2 .software-events-block{ | |
| 571 | + display: block; | |
| 572 | +} | |
| 573 | + | |
| 574 | +/*Block with Community information - Need to develop solution - Only display on profile page */ | |
| 544 | 575 | |
| 545 | 576 | .profile-type-is-community .block.community-block{ |
| 546 | 577 | display: none; |
| ... | ... | @@ -1151,7 +1182,7 @@ float: left; |
| 1151 | 1182 | overflow: hidden; |
| 1152 | 1183 | } |
| 1153 | 1184 | |
| 1154 | -/*** Events ***/ | |
| 1185 | +/*** Events internal page ***/ | |
| 1155 | 1186 | |
| 1156 | 1187 | #content .article-body-event .event-card{ |
| 1157 | 1188 | border-top: 1px dotted #D3D6D3; |
| ... | ... | @@ -1189,7 +1220,7 @@ float: left; |
| 1189 | 1220 | letter-spacing: 0.48px; |
| 1190 | 1221 | } |
| 1191 | 1222 | |
| 1192 | -#content .article-body-event .event-link a{ | |
| 1223 | +#content .box-1 .article-body-event .event-link a{ | |
| 1193 | 1224 | text-decoration: underline; |
| 1194 | 1225 | } |
| 1195 | 1226 | |
| ... | ... | @@ -1206,3 +1237,77 @@ float: left; |
| 1206 | 1237 | font-family: Arial; |
| 1207 | 1238 | line-height: 22px; |
| 1208 | 1239 | } |
| 1240 | + | |
| 1241 | +/*software-events-block box-1*/ | |
| 1242 | + | |
| 1243 | +.box-1 .software-events-block ul.software-community-events-list { | |
| 1244 | + border: 1px solid #D3D6DE; | |
| 1245 | + border-radius: 8px; | |
| 1246 | + width: 100%; | |
| 1247 | +} | |
| 1248 | + | |
| 1249 | +.box-1 .software-events-block li.software-events-list-item { | |
| 1250 | + border-bottom: 1px dotted #D3D6DE; | |
| 1251 | + font-size: 14px; | |
| 1252 | + padding: 7px 0px; | |
| 1253 | + padding-left: 16px; | |
| 1254 | +} | |
| 1255 | + | |
| 1256 | +.box-1 .software-events-block li.software-events-list-item:last-child{ | |
| 1257 | + border:none; | |
| 1258 | +} | |
| 1259 | + | |
| 1260 | +.box-1 .software-events-block .software-events-list-item-calendar { | |
| 1261 | + background-image: url("../images/calendar-icon.png"); | |
| 1262 | + background-repeat: no-repeat; | |
| 1263 | + width: 14px; | |
| 1264 | + height: 14px; | |
| 1265 | + float: left; | |
| 1266 | + margin-top: 2px; | |
| 1267 | +} | |
| 1268 | + | |
| 1269 | +.box-1 .software-events-block .software-events-list-item-date { | |
| 1270 | + padding-left: 5px; | |
| 1271 | + font-weight: 700; | |
| 1272 | +} | |
| 1273 | + | |
| 1274 | +.box-1 .software-events-block .software-events-list-item-title { | |
| 1275 | + padding-left: 1px; | |
| 1276 | +} | |
| 1277 | + | |
| 1278 | +/*software-events-block - sidebar - box2*/ | |
| 1279 | + | |
| 1280 | +#content .box-2 .software-events-block .software-community-events-block{ | |
| 1281 | + border:1px solid #C0C1C1; | |
| 1282 | + border-radius:4px; | |
| 1283 | + background-color:#ECEDF1; | |
| 1284 | +} | |
| 1285 | + | |
| 1286 | +#content .box-2 .software-events-block .software-events-list-item{ | |
| 1287 | + padding:10px 15px; | |
| 1288 | + border-bottom:1px dotted #C0C1C1; | |
| 1289 | + color:#2C4B6B; | |
| 1290 | + font-size: 15px; | |
| 1291 | + font-weight: 500; | |
| 1292 | +} | |
| 1293 | + | |
| 1294 | +#content .box-2 .software-events-block .software-events-list-item-date{ | |
| 1295 | + font-weight: 800; | |
| 1296 | +} | |
| 1297 | + | |
| 1298 | +#content .box-2 .software-events-block .software-events-list-item-title a, | |
| 1299 | +#content .box-2 .software-events-block .software-events-list-item-title a:visited{ | |
| 1300 | + color:#2C4B6B; | |
| 1301 | +} | |
| 1302 | + | |
| 1303 | +#content .box-2 .software-events-block .software-events-list-item:first-child{ | |
| 1304 | + color:#172738; | |
| 1305 | + font-weight: 800; | |
| 1306 | + text-transform: uppercase; | |
| 1307 | + border-bottom: 1px solid #C0C1C1; | |
| 1308 | + padding:10px 15px; | |
| 1309 | +} | |
| 1310 | + | |
| 1311 | +#content .box-2 .software-events-block .software-events-list-item:last-child{ | |
| 1312 | + border:none; | |
| 1313 | +} | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/home-page.css
| ... | ... | @@ -283,9 +283,9 @@ |
| 283 | 283 | .action-home-index #content .display-content-block .image{ |
| 284 | 284 | padding-right: 25px; |
| 285 | 285 | padding: 0px 25px 0px 0px; |
| 286 | - border: 0px solid #c0c1c1; | |
| 287 | - width: 150px; | |
| 286 | + max-width: 150px; | |
| 288 | 287 | display: table-cell; |
| 288 | + vertical-align: top; | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | .controller-environment_design #content .display-content-block .image a, |
| ... | ... | @@ -298,7 +298,6 @@ |
| 298 | 298 | |
| 299 | 299 | .controller-environment_design #content .display-content-block .image img, |
| 300 | 300 | .action-home-index #content .display-content-block .image img{ |
| 301 | - border: 0px solid #c0c1c1; | |
| 302 | 301 | max-width: 150px; |
| 303 | 302 | } |
| 304 | 303 | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/news-page.css
| ... | ... | @@ -57,13 +57,14 @@ |
| 57 | 57 | |
| 58 | 58 | #content .blog .blog-post h1.title { |
| 59 | 59 | margin: 0px 0px 10px 0px; |
| 60 | - padding: 0px 0px 0px 0px; | |
| 61 | - max-width: 555px; | |
| 60 | + padding: 0px; | |
| 61 | + max-width: 100%; | |
| 62 | 62 | max-height: 40px; |
| 63 | 63 | border: none; |
| 64 | 64 | font: normal normal bold 16px/20px arial; |
| 65 | 65 | overflow: hidden; |
| 66 | - display: inline-block; | |
| 66 | + display: block; | |
| 67 | + white-space: normal; | |
| 67 | 68 | } |
| 68 | 69 | |
| 69 | 70 | #content .blog .blog-post h1.title a { |
| ... | ... | @@ -148,15 +149,24 @@ |
| 148 | 149 | |
| 149 | 150 | |
| 150 | 151 | /** Secondary News' Block **/ |
| 152 | + | |
| 153 | +#content .blog .page-1 .position-1 .title, | |
| 154 | +#content .blog .page-1 .position-2 .title, | |
| 155 | +#content .blog .page-1 .position-3 .title, | |
| 156 | +#content .blog .page-1 .position-4 .title { | |
| 157 | + display: inline-block; | |
| 158 | +} | |
| 159 | + | |
| 151 | 160 | #content .blog .page-1 .position-2, |
| 152 | 161 | #content .blog .page-1 .position-3, |
| 153 | 162 | #content .blog .page-1 .position-4 { |
| 154 | - margin: 0px 0px 0px 0px; | |
| 155 | - padding: 20px 21px 45px 0px; | |
| 156 | - height: 235px; | |
| 163 | + margin: 0px; | |
| 164 | + padding: 20px 4.2% 5px 0px; | |
| 165 | + height: auto; | |
| 157 | 166 | width: 30.5%; |
| 158 | 167 | display: block; |
| 159 | 168 | float: left; |
| 169 | + border-bottom: none; | |
| 160 | 170 | } |
| 161 | 171 | |
| 162 | 172 | #content .blog .page-1 .position-2 p, |
| ... | ... | @@ -173,7 +183,7 @@ |
| 173 | 183 | #content .blog .page-1 .position-2 .post-pic, |
| 174 | 184 | #content .blog .page-1 .position-3 .post-pic, |
| 175 | 185 | #content .blog .page-1 .position-4 .post-pic { |
| 176 | - margin-top: 12px; | |
| 186 | + margin-bottom: 12px; | |
| 177 | 187 | top: 10px; |
| 178 | 188 | height: 120px; |
| 179 | 189 | width: 100%; |
| ... | ... | @@ -200,6 +210,10 @@ |
| 200 | 210 | /* This rule serves to maintain the element in position-5 clear the |
| 201 | 211 | * configurations of float. |
| 202 | 212 | */ |
| 213 | +#content .blog .page-1 .blog-post.position-5{ | |
| 214 | + border-top:1px solid #ccc; | |
| 215 | +} | |
| 216 | + | |
| 203 | 217 | #content .blog .blog-post.position-5 { |
| 204 | 218 | clear: both; |
| 205 | 219 | } | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/notifications.css
| ... | ... | @@ -51,13 +51,14 @@ |
| 51 | 51 | color: #8a6d3b; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -.environment-notification-plugin-notification-bar .warningnotification p a, | |
| 55 | -.environment-notification-plugin-notification-notification-modal .warningnotification p a{ | |
| 54 | +#content .environment-notification-plugin-notification-bar .warningnotification p a, | |
| 55 | +#content .environment-notification-plugin-notification-bar .warningnotification p a:visited, | |
| 56 | +#content .environment-notification-plugin-notification-notification-modal .warningnotification p a | |
| 57 | +#content .environment-notification-plugin-notification-notification-modal .warningnotification p a:visited{ | |
| 56 | 58 | font-weight: bold; |
| 57 | 59 | color: #8a6d3b; |
| 58 | 60 | } |
| 59 | 61 | |
| 60 | - | |
| 61 | 62 | .environment-notification-plugin-notification-bar .informationnotification, |
| 62 | 63 | .environment-notification-plugin-notification-notification-modal .informationnotification{ |
| 63 | 64 | background: #d9edf7; | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/search-pages.css
| ... | ... | @@ -2,7 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | .action-search-index #content form #search-header, |
| 4 | 4 | .action-search-people #content form #search-header, |
| 5 | -.action-search-communities #content form #search-header { | |
| 5 | +.action-search-communities #content form #search-header, | |
| 6 | +.action-search-institutions #content form #search-header { | |
| 6 | 7 | float: right; |
| 7 | 8 | border: none; |
| 8 | 9 | } |
| ... | ... | @@ -12,12 +13,14 @@ |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | .action-search-people #content form #search-header, |
| 15 | -.action-search-communities #content form #search-header { | |
| 16 | - margin: 0 0 15px 0 ; | |
| 16 | +.action-search-communities #content form #search-header, | |
| 17 | +.action-search-institutions #content form #search-header { | |
| 18 | + margin: 0 0 15px 0; | |
| 17 | 19 | } |
| 18 | 20 | |
| 19 | 21 | .action-search-people #content form #search-header #search-filters .sod_select, |
| 20 | -.action-search-communities #content form #search-header #search-filters .sod_select { | |
| 22 | +.action-search-communities #content form #search-header #search-filters .sod_select, | |
| 23 | +.action-search-institutions #content form #search-header #search-filters .sod_select { | |
| 21 | 24 | color: #3E67B1; |
| 22 | 25 | border: 1px solid #3E67B1; |
| 23 | 26 | border-radius: 4px; |
| ... | ... | @@ -28,7 +31,8 @@ |
| 28 | 31 | } |
| 29 | 32 | |
| 30 | 33 | .action-search-people #content form #search-header #search-filters .sod_select .sod_list, |
| 31 | -.action-search-communities #content form #search-header #search-filters .sod_select .sod_list { | |
| 34 | +.action-search-communities #content form #search-header #search-filters .sod_select .sod_list, | |
| 35 | +.action-search-institutions #content form #search-header #search-filters .sod_select .sod_list { | |
| 32 | 36 | margin: -2px 0 0 -1px; |
| 33 | 37 | color: #3E67B1; |
| 34 | 38 | border: 1px solid #3E67B1; |
| ... | ... | @@ -40,34 +44,41 @@ |
| 40 | 44 | } |
| 41 | 45 | |
| 42 | 46 | .action-search-people #content form #search-header #search-filters .sod_select .sod_list .active, |
| 43 | -.action-search-communities #content form #search-header #search-filters .sod_select .sod_list .active { | |
| 47 | +.action-search-communities #content form #search-header #search-filters .sod_select .sod_list .active, | |
| 48 | +.action-search-institutions #content form #search-header #search-filters .sod_select .sod_list .active { | |
| 44 | 49 | border-radius: 0px 0px 4px 4px; |
| 45 | 50 | } |
| 46 | 51 | |
| 47 | 52 | .action-search-people #content form #search-header #search-filters .sod_select .sod_list .selected, |
| 48 | -.action-search-communities #content form #search-header #search-filters .sod_select .sod_list .selected { | |
| 53 | +.action-search-communities #content form #search-header #search-filters .sod_select .sod_list .selected, | |
| 54 | +.action-search-institutions #content form #search-header #search-filters .sod_select .sod_list .selected { | |
| 49 | 55 | padding-right: 21px; |
| 50 | 56 | } |
| 51 | 57 | |
| 52 | 58 | .action-search-people #content form #search-subheader .sod_select, |
| 53 | -.action-search-communities #content form #search-subheader .sod_select { | |
| 59 | +.action-search-communities #content form #search-subheader .sod_select, | |
| 60 | +.action-search-institutions #content form #search-subheader .sod_select { | |
| 54 | 61 | line-height: 15px; |
| 55 | 62 | } |
| 56 | 63 | |
| 57 | 64 | .action-search-index #content form .search-field, |
| 58 | 65 | .action-search-people #content form .search-field, |
| 59 | -.action-search-communities #content form .search-field{ | |
| 66 | +.action-search-communities #content form .search-field, | |
| 67 | +.action-search-institutions #content form .search-field { | |
| 60 | 68 | margin-bottom: 30px; |
| 61 | 69 | } |
| 62 | 70 | |
| 63 | 71 | .action-search-index #content form .search-field .formfield, |
| 64 | 72 | .action-search-people #content form .search-field .formfield, |
| 65 | -.action-search-communities #content form .search-field .formfield{ | |
| 73 | +.action-search-communities #content form .search-field .formfield, | |
| 74 | +.action-search-institutions #content form .search-field .formfield { | |
| 66 | 75 | width: 99%; |
| 67 | 76 | } |
| 77 | + | |
| 68 | 78 | .action-search-index #content form .search-field .formfield input, |
| 69 | 79 | .action-search-people #content form .search-field .formfield input, |
| 70 | -.action-search-communities #content form .search-field .formfield input { | |
| 80 | +.action-search-communities #content form .search-field .formfield input, | |
| 81 | +.action-search-institutions #content form .search-field .formfield input { | |
| 71 | 82 | margin-top: 0px; |
| 72 | 83 | padding: 6px; |
| 73 | 84 | height: 19px; |
| ... | ... | @@ -81,7 +92,8 @@ |
| 81 | 92 | |
| 82 | 93 | .action-search-index #content form input.button.submit, |
| 83 | 94 | .action-search-people #content form input.button.submit, |
| 84 | -.action-search-communities #content form input.button.submit { | |
| 95 | +.action-search-communities #content form input.button.submit, | |
| 96 | +.action-search-institutions #content form input.button.submit { | |
| 85 | 97 | background: #3E67B1; |
| 86 | 98 | color: #FFF; |
| 87 | 99 | border-radius: 4px; |
| ... | ... | @@ -94,12 +106,14 @@ |
| 94 | 106 | |
| 95 | 107 | .action-search-index #content form input.button.submit:hover, |
| 96 | 108 | .action-search-people #content form input.button.submit:hover, |
| 97 | -.action-search-communities #content form input.button.submit:hover { | |
| 109 | +.action-search-communities #content form input.button.submit:hover, | |
| 110 | +.action-search-institutions #content form input.button.submit:hover { | |
| 98 | 111 | background: #5E82C6; |
| 99 | 112 | } |
| 100 | 113 | |
| 101 | 114 | .action-search-people #search-results .search-results-type-people, |
| 102 | -.action-search-communities #search-results .search-results-type-community { | |
| 115 | +.action-search-communities #search-results .search-results-type-community, | |
| 116 | +.action-search-institutions #search-results .search-results-type-institution { | |
| 103 | 117 | background: none; |
| 104 | 118 | border: 1px solid #ccc; |
| 105 | 119 | border-radius: 10px; |
| ... | ... | @@ -119,3 +133,31 @@ |
| 119 | 133 | background: none; |
| 120 | 134 | border: 1px solid #ccc; |
| 121 | 135 | } |
| 136 | + | |
| 137 | +.search-software-item .search-software-content-block .search-content-result a { | |
| 138 | + color: #172738 !important; | |
| 139 | +} | |
| 140 | + | |
| 141 | +.action-search-institutions .common-profile-list-block .vcard a.profile_link, .comment-actions .vcard a.profile_link{ | |
| 142 | + height: 108px; | |
| 143 | + max-height: 108px; | |
| 144 | +} | |
| 145 | + | |
| 146 | +.action-search-institutions #content .search-results-box .vcard{ | |
| 147 | + margin: 8.5px | |
| 148 | +} | |
| 149 | + | |
| 150 | +.action-search-institutions .menu-submenu-content{ | |
| 151 | + height: auto; | |
| 152 | +} | |
| 153 | + | |
| 154 | +.action-search-institutions #content .menu-submenu h4{ | |
| 155 | + text-align: center; | |
| 156 | +} | |
| 157 | + | |
| 158 | +.action-search-institutions #content .menu-submenu-content ul a{ | |
| 159 | + padding-left: 0; | |
| 160 | + text-align: center; | |
| 161 | +} | |
| 162 | + | |
| 163 | + | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/software-catalog-page.css
| ... | ... | @@ -53,7 +53,7 @@ |
| 53 | 53 | margin: 0 0 0 15px; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - It's TEMPORARY | |
| 56 | + It's TEMPORARY | |
| 57 | 57 | .action-search-software_infos #content .search-form .doubts-catalog-software { |
| 58 | 58 | display: none; |
| 59 | 59 | }*/ |
| ... | ... | @@ -65,7 +65,7 @@ |
| 65 | 65 | line-height: 20px; |
| 66 | 66 | position:absolute; |
| 67 | 67 | } |
| 68 | -.action-search-software_infos .search-form label, | |
| 68 | +.action-search-software_infos .search-form label, | |
| 69 | 69 | .action-search-software_infos .search-form label{ |
| 70 | 70 | margin:0px 3px 4px 32px; |
| 71 | 71 | line-height: 22px; |
| ... | ... | @@ -310,9 +310,9 @@ |
| 310 | 310 | |
| 311 | 311 | /* Column left */ |
| 312 | 312 | |
| 313 | -.action-search-software_infos #search-results .search-software-item-column-left{ | |
| 314 | - width: 130px; | |
| 315 | - height: 130px; | |
| 313 | +.action-search-software_infos #search-results .search-software-item-column-left { | |
| 314 | + width: 140px; | |
| 315 | + height: 140px; | |
| 316 | 316 | float: left; |
| 317 | 317 | border-right: 1px dotted #ccc; |
| 318 | 318 | } |
| ... | ... | @@ -359,7 +359,7 @@ |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | .action-search-software_infos #search-results .search-software-item-column-left .extra_info { |
| 362 | - width: 130px; | |
| 362 | + width: 140px; | |
| 363 | 363 | padding-right: 20px; |
| 364 | 364 | top: 0px; |
| 365 | 365 | position: absolute; |
| ... | ... | @@ -370,18 +370,32 @@ |
| 370 | 370 | opacity: inherit; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | -.action-search-software_infos #search-results .search-software-item-column-left .extra_info::before{ | |
| 373 | +.action-search-software_infos #search-results .search-software-item-column-left .software-date { | |
| 374 | + margin-top: 20px; | |
| 375 | + width: 130px; | |
| 376 | +} | |
| 377 | + | |
| 378 | +.action-search-software_infos #search-results .search-software-item-column-left .software-date::before{ | |
| 374 | 379 | content: url("../images/ic-calendar.png"); |
| 375 | - margin: 6px 10px 20px 0; | |
| 380 | + margin: 0px 7px 20px 0; | |
| 376 | 381 | float: left; |
| 377 | 382 | } |
| 378 | 383 | |
| 384 | +.action-search-software_infos #search-results .search-software-item-column-left .star-container.catalog_rating_block { | |
| 385 | + width: 140px; | |
| 386 | + margin-left: 0px; | |
| 387 | +} | |
| 388 | + | |
| 389 | +.action-search-software_infos #search-results .search-software-item-column-left .software-date-value { | |
| 390 | + margin-left: 23px; | |
| 391 | +} | |
| 392 | + | |
| 379 | 393 | /* Column Right */ |
| 380 | 394 | |
| 381 | 395 | .action-search-software_infos #search-results .search-software-item-column-right { |
| 382 | - width: 70%; | |
| 396 | + width: 65%; | |
| 383 | 397 | float: left; |
| 384 | - margin-left: 130px; | |
| 398 | + margin-left: 140px; | |
| 385 | 399 | padding: 0 0 0 8px; |
| 386 | 400 | font-size: 15px; |
| 387 | 401 | font-family: Arial; |
| ... | ... | @@ -439,3 +453,5 @@ |
| 439 | 453 | font-size: 13px; |
| 440 | 454 | text-decoration: underline; |
| 441 | 455 | } |
| 456 | + | |
| 457 | + | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/software-pages.css
| ... | ... | @@ -89,14 +89,15 @@ |
| 89 | 89 | display: block; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -#content .download-block .download-button #download-size { | |
| 93 | - border: 1px solid #1a397d; | |
| 94 | - border-radius: 0px 0px 8px 8px; | |
| 95 | - background-color: #1a397d; | |
| 96 | - color: #ffffff; | |
| 97 | - font-size: 12px; | |
| 92 | +#content .download-block .download-button .download-size { | |
| 98 | 93 | text-align: center; |
| 99 | - display: none; | |
| 94 | + display: block; | |
| 95 | + background: rgb(0, 40, 140) none repeat scroll 0% 0%; | |
| 96 | + color: rgb(255, 255, 255); | |
| 97 | + border-bottom-left-radius: 5px; | |
| 98 | + border-bottom-right-radius: 5px; | |
| 99 | + margin-top: -15px; | |
| 100 | + line-height: 20px; | |
| 100 | 101 | } |
| 101 | 102 | |
| 102 | 103 | #content .download-block .download-info { |
| ... | ... | @@ -208,9 +209,7 @@ |
| 208 | 209 | } |
| 209 | 210 | |
| 210 | 211 | #content .box-1 .categories-and-tags-block .category_cloud{ |
| 211 | - display: inline-flex; | |
| 212 | 212 | margin: 13px 0 10px 0; |
| 213 | - max-width: 87%; | |
| 214 | 213 | } |
| 215 | 214 | |
| 216 | 215 | #content .box-1 .categories-and-tags-block .category_cloud a{ |
| ... | ... | @@ -590,7 +589,7 @@ |
| 590 | 589 | padding: 45px 40px 4px 10px; |
| 591 | 590 | border: 1px solid #2C66CE; |
| 592 | 591 | border-radius: 4px; |
| 593 | - background: #2C66CE url("../images/download-mini_icon.png") center center no-repeat; | |
| 592 | + background: #2C66CE url("../images/history-mini_icon.png") center center no-repeat; | |
| 594 | 593 | display: block; |
| 595 | 594 | float: left; |
| 596 | 595 | } | ... | ... |
src/noosfero-spb/noosfero-spb-theme/css/use-report.css
| ... | ... | @@ -322,8 +322,12 @@ |
| 322 | 322 | padding-right: 6px; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | +/*FIX_ME - tmp css solution for development tmp solution, remove when fixed on plugin*/ | |
| 326 | + | |
| 325 | 327 | #content .star-rate-form .star-comment-container .comments-software-extra-fields #organization_rating_people_benefited, |
| 326 | -#content .star-rate-form .star-comment-container .comments-software-extra-fields #organization_rating_saved_value { | |
| 328 | +#content .star-rate-form .star-comment-container .comments-software-extra-fields #organization_rating_saved_value, | |
| 329 | +#content .star-rate-form .star-comment-container .comments-software-extra-fields #people_benefited_tmp, | |
| 330 | +#content .star-rate-form .star-comment-container .comments-software-extra-fields #saved_value_tmp { | |
| 327 | 331 | display: block; |
| 328 | 332 | height: 19px; |
| 329 | 333 | width: 155px; |
| ... | ... | @@ -344,13 +348,17 @@ |
| 344 | 348 | #content .star-rate-form .star-comment-container .star-tooltip { |
| 345 | 349 | cursor: default; |
| 346 | 350 | content: '?'; |
| 347 | - border-radius: 90%; | |
| 348 | - font-size: 12px; | |
| 349 | - font-weight: 700; | |
| 350 | - background: #3867b7; | |
| 351 | - color: #fff; | |
| 352 | - margin-left: 4px; | |
| 353 | - padding: 0px 6px; | |
| 351 | + padding-top: 2px; | |
| 352 | + background-color: #3867b7; | |
| 353 | + color: #ffffff; | |
| 354 | + font-weight: bold; | |
| 355 | + cursor: pointer; | |
| 356 | + height: 15px; | |
| 357 | + font-family: arial; | |
| 358 | + width: 17px; | |
| 359 | + display: inline-block; | |
| 360 | + text-align: center; | |
| 361 | + border-radius: 50% | |
| 354 | 362 | } |
| 355 | 363 | |
| 356 | 364 | .ratings-list { | ... | ... |
476 Bytes
268 Bytes
src/noosfero-spb/noosfero-spb-theme/theme.js
| ... | ... | @@ -268,10 +268,15 @@ $('#link-buscar').click(function(e) { |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | + function move_breadcrumbs() { | |
| 272 | + $('.breadcrumbs-plugin_content-breadcrumbs-block').prependTo('#wrap-2'); | |
| 273 | + } | |
| 274 | + | |
| 271 | 275 | $(document).ready(function(){ |
| 272 | 276 | add_tooltips(); |
| 273 | 277 | add_popovers(); |
| 274 | 278 | move_article_buttons(); |
| 279 | + move_breadcrumbs(); | |
| 275 | 280 | insert_notice_div(); |
| 276 | 281 | set_uploaded_files_names(); |
| 277 | 282 | set_tooltip_content(); | ... | ... |
src/noosfero-spb/software_communities/controllers/software_communities_plugin_controller.rb
| ... | ... | @@ -5,11 +5,9 @@ class SoftwareCommunitiesPluginController < ApplicationController |
| 5 | 5 | def get_license_data |
| 6 | 6 | return render :json=>{} if !request.xhr? || params[:query].nil? |
| 7 | 7 | |
| 8 | - data = if params[:query].empty? | |
| 9 | - LicenseInfo.all | |
| 10 | - else | |
| 11 | - LicenseInfo.where("version ILIKE ?", "%#{params[:query]}%").select("id, version") | |
| 12 | - end | |
| 8 | + data = LicenseHelper.find_licenses(params[:query]) if params[:query] | |
| 9 | + data ||= LicenseInfo.all | |
| 10 | + | |
| 13 | 11 | render :json=> data.collect { |license| |
| 14 | 12 | {:id=>license.id, :label=>license.version} |
| 15 | 13 | } |
| ... | ... | @@ -44,11 +42,7 @@ class SoftwareCommunitiesPluginController < ApplicationController |
| 44 | 42 | protected |
| 45 | 43 | |
| 46 | 44 | def get_model_by_params_field |
| 47 | - case params[:field] | |
| 48 | - when "software_language" | |
| 49 | - return ProgrammingLanguage | |
| 50 | - else | |
| 51 | - return DatabaseDescription | |
| 52 | - end | |
| 45 | + return DatabaseDescription unless params[:field] == "software_language" | |
| 46 | + return ProgrammingLanguage | |
| 53 | 47 | end |
| 54 | 48 | end | ... | ... |
src/noosfero-spb/software_communities/controllers/software_communities_plugin_myprofile_controller.rb
| ... | ... | @@ -9,13 +9,13 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 9 | 9 | |
| 10 | 10 | @community = Community.new(params[:community]) |
| 11 | 11 | @community.environment = environment |
| 12 | - @software_info = SoftwareInfo.new(params[:software_info]) | |
| 13 | 12 | |
| 14 | - @license_info = if params[:license].blank? or params[:license][:license_infos_id].blank? | |
| 15 | - LicenseInfo.new | |
| 16 | - else | |
| 17 | - LicenseInfo.find(params[:license][:license_infos_id]) | |
| 18 | - end | |
| 13 | + @license_info = LicenseInfo.find_by_id(params[:license][:license_infos_id]) if params[:license] | |
| 14 | + @license_info ||= LicenseInfo.new | |
| 15 | + | |
| 16 | + @software_info = SoftwareInfo.new(params[:software_info]) | |
| 17 | + @software_info.community = @community | |
| 18 | + @software_info.license_info = @license_info | |
| 19 | 19 | |
| 20 | 20 | control_software_creation |
| 21 | 21 | update_new_software_errors |
| ... | ... | @@ -26,14 +26,15 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 26 | 26 | |
| 27 | 27 | return unless request.post? |
| 28 | 28 | |
| 29 | - @software_info = constroy_software | |
| 29 | + @software_info = create_software | |
| 30 | 30 | software_info_insert_models.call(@list_libraries, 'libraries') |
| 31 | 31 | software_info_insert_models.call(@list_languages, 'software_languages') |
| 32 | 32 | software_info_insert_models.call(@list_databases, 'software_databases') |
| 33 | 33 | software_info_insert_models.call(@list_operating_systems, 'operating_systems') |
| 34 | 34 | |
| 35 | 35 | begin |
| 36 | - @software_info.save! | |
| 36 | + raise NotAdminException unless can_change_public_software? | |
| 37 | + @software_info.update_attributes!(params[:software]) | |
| 37 | 38 | |
| 38 | 39 | @community = @software_info.community |
| 39 | 40 | @community.update_attributes!(params[:community]) |
| ... | ... | @@ -44,31 +45,50 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 44 | 45 | redirect_to :controller => 'profile_editor', :action => 'index' |
| 45 | 46 | session[:notice] = _('Software updated successfully') |
| 46 | 47 | end |
| 47 | - rescue ActiveRecord::RecordInvalid => invalid | |
| 48 | + rescue NotAdminException, ActiveRecord::RecordInvalid => invalid | |
| 48 | 49 | update_new_software_errors |
| 49 | 50 | session[:notice] = _('Could not update software') |
| 50 | 51 | end |
| 51 | 52 | end |
| 52 | 53 | |
| 53 | - def disabled_public_software_field | |
| 54 | - !environment.admins.include?(current_user.person) | |
| 55 | - end | |
| 56 | - | |
| 57 | 54 | private |
| 58 | 55 | |
| 56 | + def can_change_public_software? | |
| 57 | + if !user.is_admin?(environment) | |
| 58 | + if params[:software][:public_software] | |
| 59 | + @software_info.errors.add(:public_software, _("You don't have permission to change public software status")) | |
| 60 | + return false | |
| 61 | + end | |
| 62 | + | |
| 63 | + if params[:software].keys.any?{|key| ["e_ping","e_mag","icp_brasil","e_arq","intern"].include?(key)} | |
| 64 | + @software_info.errors.add(:base, _("You don't have permission to change public software attributes")) | |
| 65 | + return false | |
| 66 | + end | |
| 67 | + end | |
| 68 | + return true | |
| 69 | + end | |
| 70 | + | |
| 59 | 71 | def add_software_erros |
| 60 | 72 | @errors = [] |
| 61 | - @errors |= @community.errors.full_messages if @community | |
| 73 | + if @community | |
| 74 | + error = @community.errors.delete(:identifier) | |
| 75 | + @errors |= [_("Domain %s") % error.first ] if error | |
| 76 | + @errors |= @community.errors.full_messages | |
| 77 | + end | |
| 62 | 78 | @errors |= @software_info.errors.full_messages if @software_info |
| 63 | 79 | @errors |= @license_info.errors.full_messages if @license_info |
| 64 | 80 | end |
| 65 | 81 | |
| 66 | 82 | def control_software_creation |
| 67 | - valid_models = request.post? && (@community.valid? && @software_info.valid? && @license_info.valid?) | |
| 68 | - if valid_models | |
| 69 | - send_software_to_moderation | |
| 70 | - else | |
| 71 | - add_software_erros | |
| 83 | + if request.post? | |
| 84 | + valid_models = @community.valid? | |
| 85 | + valid_models &= @software_info.valid? | |
| 86 | + valid_models &= @license_info.valid? | |
| 87 | + if valid_models | |
| 88 | + send_software_to_moderation | |
| 89 | + else | |
| 90 | + add_software_erros | |
| 91 | + end | |
| 72 | 92 | end |
| 73 | 93 | end |
| 74 | 94 | |
| ... | ... | @@ -79,16 +99,14 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 79 | 99 | } |
| 80 | 100 | end |
| 81 | 101 | |
| 82 | - def constroy_software | |
| 102 | + def create_software | |
| 83 | 103 | @software_info = @profile.software_info |
| 84 | - params[:software][:public_software] ||= false unless @software_info.public_software? | |
| 85 | - @license = LicenseInfo.find(params[:license][:license_infos_id]) | |
| 86 | - @software_info.license_info = @license | |
| 87 | - @software_info.update_attributes(params[:software]) | |
| 88 | - | |
| 89 | 104 | another_license_version = nil |
| 90 | 105 | another_license_link = nil |
| 91 | 106 | if params[:license] |
| 107 | + @license = LicenseInfo.find(params[:license][:license_infos_id]) | |
| 108 | + @software_info.license_info = @license | |
| 109 | + | |
| 92 | 110 | another_license_version = params[:license][:version] |
| 93 | 111 | another_license_link = params[:license][:link] |
| 94 | 112 | end |
| ... | ... | @@ -126,7 +144,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 126 | 144 | |
| 127 | 145 | add_admin_to_community |
| 128 | 146 | |
| 129 | - if !environment.admins.include?(current_user.person) | |
| 147 | + if !environment.admins.include?(current_user.person) | |
| 130 | 148 | session[:notice] = _('Your new software request will be evaluated by an'\ |
| 131 | 149 | 'administrator. You will be notified.') |
| 132 | 150 | redirect_to user.admin_url |
| ... | ... | @@ -143,7 +161,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 143 | 161 | @list_databases = @software_info.software_databases |
| 144 | 162 | @list_languages = @software_info.software_languages |
| 145 | 163 | @list_operating_systems = @software_info.operating_systems |
| 146 | - @disabled_public_software_field = disabled_public_software_field | |
| 164 | + @non_admin_status = 'disabled' unless user.is_admin?(environment) | |
| 147 | 165 | |
| 148 | 166 | @license_version = @software_info.license_info.version |
| 149 | 167 | @license_id = @software_info.license_info.id |
| ... | ... | @@ -184,7 +202,6 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 184 | 202 | add_software_erros |
| 185 | 203 | end |
| 186 | 204 | |
| 187 | - | |
| 188 | 205 | @error_community_name = @community.errors.include?(:name) ? "highlight-error" : "" if @community |
| 189 | 206 | @error_software_acronym = @software_info.errors.include?(:acronym) ? "highlight-error" : "" if @software_info |
| 190 | 207 | @error_software_domain = @community.errors.include?(:identifier) ? "highlight-error" : "" if @community |
| ... | ... | @@ -192,3 +209,5 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
| 192 | 209 | @error_software_license = @license_info.errors.include?(:version) ? "highlight-error" : "" if @license_info |
| 193 | 210 | end |
| 194 | 211 | end |
| 212 | + | |
| 213 | +class NotAdminException < Exception; end | ... | ... |
src/noosfero-spb/software_communities/features/software_catalog.feature
| ... | ... | @@ -80,3 +80,33 @@ Feature: Search software |
| 80 | 80 | Then I should see "Software One" |
| 81 | 81 | And I should see "Software Two" |
| 82 | 82 | And I should see "Software Three" |
| 83 | + | |
| 84 | + @selenium | |
| 85 | + Scenario: See software rating on catalog | |
| 86 | + Given plugin "OrganizationRatings" is enabled on environment | |
| 87 | + And I am logged in as mpog_admin | |
| 88 | + And I go to /admin/plugins | |
| 89 | + And I check "Organization Ratings" | |
| 90 | + And I press "Save changes" | |
| 91 | + And I go to /admin/admin_panel/site_info | |
| 92 | + And I select "Software Público" from "environment_theme" | |
| 93 | + And I press "Save" | |
| 94 | + And I go to /account/logout | |
| 95 | + Given the following user | |
| 96 | + | login | name | | |
| 97 | + | joaosilva | Joao Silva | | |
| 98 | + And the following blocks | |
| 99 | + | owner | type | | |
| 100 | + | software-two | AverageRatingBlock | | |
| 101 | + | software-two | OrganizationRatingsBlock | | |
| 102 | + And the environment domain is "localhost" | |
| 103 | + And I am logged in as "joaosilva" | |
| 104 | + And I go to /profile/software-two/plugin/organization_ratings/new_rating | |
| 105 | + And I press "Enviar" | |
| 106 | + And I go to /search/software_infos | |
| 107 | + When I select "Favorites" from "sort" | |
| 108 | + And I sleep for 3 seconds | |
| 109 | + Then I should see "Software Two" before "Software One" | |
| 110 | + And there should be 1 div with class "small-star-positive" | |
| 111 | + And there should be 4 divs with class "small-star-negative" | |
| 112 | + | ... | ... |
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
| ... | ... | @@ -194,7 +194,7 @@ Given /^the user "([^"]*)" has "([^"]*)" as secondary e\-mail$/ do |login, email |
| 194 | 194 | end |
| 195 | 195 | |
| 196 | 196 | Given /^I click on anything with selector "([^"]*)"$/ do |selector| |
| 197 | - evaluate_script "jQuery('#{selector}').trigger('click') && true" | |
| 197 | + page.evaluate_script("jQuery('##{selector}').click();") | |
| 198 | 198 | end |
| 199 | 199 | |
| 200 | 200 | Given /^I should see "([^"]*)" of this selector "([^"]*)"$/ do |quantity, selector| |
| ... | ... | @@ -243,3 +243,7 @@ Given /^I keyup on selector "([^"]*)"$/ do |selector| |
| 243 | 243 | selector_founded = evaluate_script("jQuery('#{selector}').trigger('keyup').length != 0") |
| 244 | 244 | selector_founded.should be_true |
| 245 | 245 | end |
| 246 | + | |
| 247 | +Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| | |
| 248 | + should have_selector("div.#{klass}", :count => count) | |
| 249 | +end | ... | ... |
src/noosfero-spb/software_communities/features/use_report.feature
0 → 100644
| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | +Feature: Use report | |
| 2 | + As a user | |
| 3 | + I want to make a use report of a software | |
| 4 | + to give my feedback about a software. | |
| 5 | + | |
| 6 | + Background: | |
| 7 | + Given "SoftwareCommunitiesPlugin" plugin is enabled | |
| 8 | + Given "OrganizationRatings" plugin is enabled | |
| 9 | + And I am logged in as mpog_admin | |
| 10 | + And I go to /admin/plugins | |
| 11 | + And I check "SoftwareCommunitiesPlugin" | |
| 12 | + And I press "Save changes" | |
| 13 | + And the following softwares | |
| 14 | + | name | public_software | finality | | |
| 15 | + | Noosfero | true | some finality | | |
| 16 | + | |
| 17 | + Scenario: Add Organization Ratings Block | |
| 18 | + Given I go to Noosfero's control panel | |
| 19 | + And I follow "Edit sideboxes" | |
| 20 | + When I follow "Add a block" | |
| 21 | + And I choose "Organization Ratings" | |
| 22 | + And I press "Add" | |
| 23 | + Then I should see "Report your experiences" | |
| 24 | + | |
| 25 | + Scenario: Add Average Rating Block | |
| 26 | + Given I go to Noosfero's control panel | |
| 27 | + And I follow "Edit sideboxes" | |
| 28 | + When I follow "Add a block" | |
| 29 | + And I choose "Organization Average Rating" | |
| 30 | + And I press "Add" | |
| 31 | + Then I should see "Be the first to rate!" | |
| 32 | + | |
| 33 | + @selenium | |
| 34 | + Scenario: Test Additional Fields JavaScript | |
| 35 | + Given I go to /profile/noosfero/plugin/organization_ratings/new_rating | |
| 36 | + Then I should not see "Number of Beneficiaries" | |
| 37 | + And I should not see "Saved Resources" | |
| 38 | + When I click on anything with selector "comments-additional-information" | |
| 39 | + Then I should see "Number of Beneficiaries" | |
| 40 | + And I should see "Saved Resources" | |
| 41 | + | |
| 42 | + @selenium | |
| 43 | + Scenario: Validate Use Report fields format | |
| 44 | + Given I go to Noosfero's control panel | |
| 45 | + Given I follow "Edit sideboxes" | |
| 46 | + When I follow "Add a block" | |
| 47 | + And I choose "Organization Ratings" | |
| 48 | + And I press "Add" | |
| 49 | + And I am on Noosfero's homepage | |
| 50 | + And I follow "Rate Community" | |
| 51 | + When I click on anything with selector "comments-additional-information" | |
| 52 | + And I fill in "organization_rating_people_benefited" with "123123" | |
| 53 | + And I fill in "organization_rating_saved_value" with "7654321" | |
| 54 | + And I press "Save" | |
| 55 | + Then I should see "Benefited People: 123.123" | |
| 56 | + And I should see "Saved Resources: $ 76,543.21" | ... | ... |
src/noosfero-spb/software_communities/lib/create_software.rb
| ... | ... | @@ -5,12 +5,14 @@ class CreateSoftware < Task |
| 5 | 5 | validates_presence_of :name |
| 6 | 6 | |
| 7 | 7 | attr_accessible :name, :finality, :repository_link, :requestor, :environment, |
| 8 | - :reject_explanation, :license_info | |
| 8 | + :reject_explanation, :license_info, :identifier, :another_license_version, | |
| 9 | + :another_license_link | |
| 9 | 10 | |
| 10 | 11 | alias :environment :target |
| 11 | 12 | alias :environment= :target= |
| 12 | 13 | |
| 13 | - DATA_FIELDS = ['name', 'finality', 'license_info', 'repository_link'] | |
| 14 | + DATA_FIELDS = ['name', 'identifier', 'finality', 'license_info', 'repository_link', | |
| 15 | + 'another_license_version', 'another_license_link'] | |
| 14 | 16 | DATA_FIELDS.each do |field| |
| 15 | 17 | settings_items field.to_sym |
| 16 | 18 | end |
| ... | ... | @@ -21,15 +23,21 @@ class CreateSoftware < Task |
| 21 | 23 | template_id = software_template.id |
| 22 | 24 | end |
| 23 | 25 | |
| 26 | + identifier = self.identifier | |
| 27 | + identifier ||= self.name.to_slug | |
| 28 | + | |
| 24 | 29 | community = Community.create!(:name => self.name, |
| 30 | + :identifier => identifier, | |
| 25 | 31 | :template_id => template_id) |
| 26 | 32 | |
| 27 | 33 | community.environment = self.environment |
| 28 | 34 | community.add_admin(self.requestor) |
| 29 | 35 | |
| 30 | - software = SoftwareInfo.create!(:finality => self.finality, | |
| 36 | + software = SoftwareInfo.new(:finality => self.finality, | |
| 31 | 37 | :repository_link => self.repository_link, :community_id => community.id, |
| 32 | 38 | :license_info => self.license_info) |
| 39 | + software.verify_license_info(self.another_license_version, self.another_license_link) | |
| 40 | + software.save! | |
| 33 | 41 | end |
| 34 | 42 | |
| 35 | 43 | def title | ... | ... |
src/noosfero-spb/software_communities/lib/database_helper.rb
| ... | ... | @@ -34,12 +34,7 @@ class DatabaseHelper < DynamicTableHelper |
| 34 | 34 | |
| 35 | 35 | def self.valid_list_database? list_databases |
| 36 | 36 | return false if list_databases.nil? or list_databases.length == 0 |
| 37 | - | |
| 38 | - list_databases.each do |database| | |
| 39 | - return false unless database.valid? | |
| 40 | - end | |
| 41 | - | |
| 42 | - true | |
| 37 | + return !list_databases.any?{|database| !database.valid?} | |
| 43 | 38 | end |
| 44 | 39 | |
| 45 | 40 | def self.database_as_tables(list_databases, disabled=false) |
| ... | ... | @@ -51,14 +46,10 @@ class DatabaseHelper < DynamicTableHelper |
| 51 | 46 | |
| 52 | 47 | def self.database_html_structure(database_data, disabled) |
| 53 | 48 | database_id = database_data[:database_description_id] |
| 54 | - database_name = if database_data[:database_description_id].blank? | |
| 55 | - "" | |
| 56 | - else | |
| 57 | - DatabaseDescription.find( | |
| 49 | + database_name = database_id.blank? ? "" : DatabaseDescription.find( | |
| 58 | 50 | database_data[:database_description_id], |
| 59 | 51 | :select=>"name" |
| 60 | 52 | ).name |
| 61 | - end | |
| 62 | 53 | |
| 63 | 54 | data = { |
| 64 | 55 | model_name: MODEL_NAME, |
| ... | ... | @@ -83,4 +74,4 @@ class DatabaseHelper < DynamicTableHelper |
| 83 | 74 | def self.add_dynamic_table |
| 84 | 75 | database_as_tables(nil).first.call |
| 85 | 76 | end |
| 86 | -end | |
| 87 | 77 | \ No newline at end of file |
| 78 | +end | ... | ... |
src/noosfero-spb/software_communities/lib/ext/search_controller.rb
| ... | ... | @@ -105,6 +105,8 @@ class SearchController |
| 105 | 105 | communities_list.reverse! |
| 106 | 106 | elsif params[:sort] && params[:sort] == "relevance" |
| 107 | 107 | communities_list = sort_by_relevance(communities_list, params[:query]){ |community| [community.software_info.finality, community.name] } |
| 108 | + elsif params[:sort] && params[:sort] == "rating" | |
| 109 | + communities_list = sort_by_average_rating(communities_list) | |
| 108 | 110 | end |
| 109 | 111 | communities_list |
| 110 | 112 | end | ... | ... |
src/noosfero-spb/software_communities/lib/ext/search_helper.rb
| ... | ... | @@ -30,4 +30,16 @@ module SearchHelper |
| 30 | 30 | list |
| 31 | 31 | end |
| 32 | 32 | |
| 33 | + def sort_by_average_rating list | |
| 34 | + list.sort! do |a, b| | |
| 35 | + rating_a = OrganizationRating.average_rating(a.id) | |
| 36 | + rating_a = 0 if rating_a.nil? | |
| 37 | + rating_b = OrganizationRating.average_rating(b.id) | |
| 38 | + rating_b = 0 if rating_b.nil? | |
| 39 | + rating_a - rating_b | |
| 40 | + end | |
| 41 | + | |
| 42 | + list.reverse! | |
| 43 | + end | |
| 44 | + | |
| 33 | 45 | end | ... | ... |
src/noosfero-spb/software_communities/lib/library_helper.rb
| ... | ... | @@ -20,12 +20,7 @@ class LibraryHelper < DynamicTableHelper |
| 20 | 20 | |
| 21 | 21 | def self.valid_list_library? list_libraries |
| 22 | 22 | return true if list_libraries.nil? or list_libraries.length == 0 |
| 23 | - | |
| 24 | - list_libraries.each do |library| | |
| 25 | - return false unless library.valid? | |
| 26 | - end | |
| 27 | - | |
| 28 | - true | |
| 23 | + return !list_libraries.any?{|library| !library.valid?} | |
| 29 | 24 | end |
| 30 | 25 | |
| 31 | 26 | def self.libraries_as_tables list_libraries, disabled=false |
| ... | ... | @@ -59,4 +54,4 @@ class LibraryHelper < DynamicTableHelper |
| 59 | 54 | def self.add_dynamic_table |
| 60 | 55 | libraries_as_tables(nil).first.call |
| 61 | 56 | end |
| 62 | -end | |
| 63 | 57 | \ No newline at end of file |
| 58 | +end | ... | ... |
src/noosfero-spb/software_communities/lib/license_helper.rb
| 1 | 1 | module LicenseHelper |
| 2 | - def self.getListLicenses | |
| 3 | - LicenseInfo.all | |
| 2 | + def self.find_licenses query | |
| 3 | + licenses = LicenseInfo.where("version ILIKE ?", "%#{query}%").select("id, version") | |
| 4 | + licenses.reject!{|license| license.version == "Another"} | |
| 5 | + license_another = LicenseInfo.find_by_version("Another") | |
| 6 | + licenses << license_another if license_another | |
| 7 | + licenses | |
| 4 | 8 | end |
| 5 | -end | |
| 6 | 9 | \ No newline at end of file |
| 10 | +end | ... | ... |
src/noosfero-spb/software_communities/lib/operating_system_helper.rb
| ... | ... | @@ -25,12 +25,8 @@ class OperatingSystemHelper < DynamicTableHelper |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | 27 | def self.valid_list_operating_system? list_operating_system |
| 28 | - return !(list_operating_system.nil? || list_operating_system.length == 0) | |
| 29 | - | |
| 30 | - list_operating_system.each do |operating_system| | |
| 31 | - return false unless operating_system.valid? | |
| 32 | - end | |
| 33 | - true | |
| 28 | + return false if (list_operating_system.nil? || list_operating_system.length == 0) | |
| 29 | + return !list_operating_system.any?{|os| !os.valid?} | |
| 34 | 30 | end |
| 35 | 31 | |
| 36 | 32 | def self.operating_system_as_tables(list_operating_system, disabled=false) | ... | ... |
src/noosfero-spb/software_communities/lib/software_communities_plugin.rb
| ... | ... | @@ -17,9 +17,13 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin |
| 17 | 17 | _('Add Public Software and MPOG features.') |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | + def self.api_mount_points | |
| 21 | + [SoftwareCommunitiesPlugin::API] | |
| 22 | + end | |
| 23 | + | |
| 20 | 24 | def profile_tabs |
| 21 | - if context.profile.community? | |
| 22 | - return profile_tabs_software if context.profile.software? | |
| 25 | + if context.profile.community? && context.profile.software? | |
| 26 | + return profile_tabs_software | |
| 23 | 27 | end |
| 24 | 28 | end |
| 25 | 29 | |
| ... | ... | @@ -43,7 +47,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin |
| 43 | 47 | SoftwareHighlightsBlock => { :type => [Environment] }, |
| 44 | 48 | SoftwareTabDataBlock => {:type => [Community], :position => 1}, |
| 45 | 49 | WikiBlock => {:type => [Community]}, |
| 46 | - StatisticBlock => { :type => [Community] } | |
| 50 | + StatisticBlock => { :type => [Community] }, | |
| 51 | + SoftwareEventsBlock => { :type => [Community] } | |
| 47 | 52 | } |
| 48 | 53 | end |
| 49 | 54 | |
| ... | ... | @@ -102,7 +107,6 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin |
| 102 | 107 | is_admin ||= user_rating.organization.admins.include?(current_user.person) |
| 103 | 108 | |
| 104 | 109 | if is_admin and profile.software? |
| 105 | - | |
| 106 | 110 | render :file => 'organization_ratings_extra_fields_show_data', |
| 107 | 111 | :locals => {:user_rating => user_rating} |
| 108 | 112 | end | ... | ... |
src/noosfero-spb/software_communities/lib/software_communities_plugin/api.rb
0 → 100644
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +require File.dirname(__FILE__) + '/../../../../../lib/noosfero/api/helpers' | |
| 2 | +require_relative 'api_entities' | |
| 3 | + | |
| 4 | +class SoftwareCommunitiesPlugin::API < Grape::API | |
| 5 | + | |
| 6 | + include Noosfero::API::APIHelpers | |
| 7 | + | |
| 8 | + resource :software_communities do | |
| 9 | + get do | |
| 10 | + authenticate! | |
| 11 | + softwares = select_filtered_collection_of(environment,'communities',params).joins(:software_info) | |
| 12 | + present softwares.map{|o|o.software_info}, :with => Entities::SoftwareInfo | |
| 13 | + end | |
| 14 | + | |
| 15 | + get ':id' do | |
| 16 | + authenticate! | |
| 17 | + software = SoftwareInfo.find_by_id(params[:id]) | |
| 18 | + present software, :with => Entities::SoftwareInfo | |
| 19 | + end | |
| 20 | + | |
| 21 | + end | |
| 22 | +end | |
| 23 | + | ... | ... |
src/noosfero-spb/software_communities/lib/software_communities_plugin/api_entities.rb
0 → 100644
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +module Entities | |
| 2 | + class SoftwareInfo < Noosfero::API::Entity | |
| 3 | + root 'software_infos', 'software_info' | |
| 4 | + expose :id, :finality, :repository_link, :public_software, :acronym, :objectives, | |
| 5 | + :features,:license_info, :software_languages, :software_databases, :operating_system_names | |
| 6 | + expose :community_id do |software_info,options| | |
| 7 | + software_info.community.id | |
| 8 | + end | |
| 9 | + end | |
| 10 | +end | ... | ... |
src/noosfero-spb/software_communities/lib/software_events_block.rb
0 → 100644
| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | +class SoftwareEventsBlock < Block | |
| 2 | + | |
| 3 | + def self.description | |
| 4 | + _('Software community events') | |
| 5 | + end | |
| 6 | + | |
| 7 | + def help | |
| 8 | + _('This block displays the software community events in a list.') | |
| 9 | + end | |
| 10 | + | |
| 11 | + def content(args={}) | |
| 12 | + block = self | |
| 13 | + | |
| 14 | + lambda do |object| | |
| 15 | + render( | |
| 16 | + :file => 'blocks/software_events', | |
| 17 | + :locals => { :block => block } | |
| 18 | + ) | |
| 19 | + end | |
| 20 | + end | |
| 21 | + | |
| 22 | + def cacheable? | |
| 23 | + false | |
| 24 | + end | |
| 25 | + | |
| 26 | + def get_events | |
| 27 | + today = DateTime.now.beginning_of_day | |
| 28 | + self.owner.events.where("end_date >= ?", today).order(:start_date) | |
| 29 | + end | |
| 30 | + | |
| 31 | + def get_events_except event_slug="" | |
| 32 | + event_slug = "" if event_slug.nil? | |
| 33 | + | |
| 34 | + get_events.where("slug NOT IN (?)", event_slug) | |
| 35 | + end | |
| 36 | + | |
| 37 | + def has_events_to_display? | |
| 38 | + not get_events.empty? | |
| 39 | + end | |
| 40 | + | |
| 41 | + def should_display_title? | |
| 42 | + self.box.position != 1 | |
| 43 | + end | |
| 44 | +end | ... | ... |
src/noosfero-spb/software_communities/lib/software_helper.rb
| ... | ... | @@ -23,22 +23,6 @@ module SoftwareHelper |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | def self.all_table_is_empty? table, ignored_fields=[] |
| 26 | - filled_fields = [] | |
| 27 | - | |
| 28 | - table.each do |key, value| | |
| 29 | - unless ignored_fields.include? key | |
| 30 | - filled_fields << if value.empty? | |
| 31 | - false | |
| 32 | - else | |
| 33 | - true | |
| 34 | - end | |
| 35 | - end | |
| 36 | - end | |
| 37 | - | |
| 38 | - if filled_fields.include? true | |
| 39 | - false | |
| 40 | - else | |
| 41 | - true | |
| 42 | - end | |
| 26 | + return !table.keys.any?{|key| ignored_fields.include?(key) ? false : !table[key].empty?} | |
| 43 | 27 | end |
| 44 | 28 | end | ... | ... |
src/noosfero-spb/software_communities/lib/software_info.rb
| ... | ... | @@ -84,19 +84,19 @@ class SoftwareInfo < ActiveRecord::Base |
| 84 | 84 | validates_length_of :finality, :maximum => 120 |
| 85 | 85 | validates_length_of :objectives, :maximum => 4000 |
| 86 | 86 | validates_length_of :features, :maximum => 4000 |
| 87 | - validates_presence_of :finality | |
| 87 | + validates_presence_of :finality, :community | |
| 88 | 88 | |
| 89 | 89 | validate :validate_acronym |
| 90 | 90 | |
| 91 | 91 | settings_items :another_license_version, :another_license_link |
| 92 | 92 | |
| 93 | 93 | # used on find_by_contents |
| 94 | - scope :like_search, lambda{ |name| | |
| 94 | + def self.like_search name | |
| 95 | 95 | joins(:community).where( |
| 96 | 96 | "name ILIKE ? OR acronym ILIKE ? OR finality ILIKE ?", |
| 97 | 97 | "%#{name}%", "%#{name}%", "%#{name}%" |
| 98 | 98 | ) |
| 99 | - } | |
| 99 | + end | |
| 100 | 100 | |
| 101 | 101 | scope :search, lambda { |name="", database_description_id = "", |
| 102 | 102 | programming_language_id = "", operating_system_name_id = "", |
| ... | ... | @@ -166,13 +166,16 @@ class SoftwareInfo < ActiveRecord::Base |
| 166 | 166 | another_license_link = attributes.delete(:another_license_link) |
| 167 | 167 | |
| 168 | 168 | software_info = SoftwareInfo.new(attributes) |
| 169 | - if !environment.admins.include? requestor | |
| 169 | + unless environment.admins.include? requestor | |
| 170 | 170 | CreateSoftware.create!( |
| 171 | 171 | attributes.merge( |
| 172 | 172 | :requestor => requestor, |
| 173 | 173 | :environment => environment, |
| 174 | 174 | :name => name, |
| 175 | - :license_info => license_info | |
| 175 | + :identifier => identifier, | |
| 176 | + :license_info => license_info, | |
| 177 | + :another_license_version => another_license_version, | |
| 178 | + :another_license_link => another_license_link | |
| 176 | 179 | ) |
| 177 | 180 | ) |
| 178 | 181 | else |
| ... | ... | @@ -189,15 +192,15 @@ class SoftwareInfo < ActiveRecord::Base |
| 189 | 192 | community.template_id = software_template.id |
| 190 | 193 | end |
| 191 | 194 | |
| 192 | - software_info.license_info = license_info | |
| 193 | - software_info.save | |
| 194 | - community.software_info = software_info | |
| 195 | 195 | community.save! |
| 196 | 196 | community.add_admin(requestor) |
| 197 | + | |
| 198 | + software_info.community = community | |
| 199 | + software_info.license_info = license_info | |
| 200 | + software_info.verify_license_info(another_license_version, another_license_link) | |
| 201 | + software_info.save! | |
| 197 | 202 | end |
| 198 | 203 | |
| 199 | - software_info.verify_license_info(another_license_version, another_license_link) | |
| 200 | - software_info.save! | |
| 201 | 204 | software_info |
| 202 | 205 | end |
| 203 | 206 | ... | ... |
src/noosfero-spb/software_communities/lib/software_language_helper.rb
| ... | ... | @@ -50,10 +50,9 @@ class SoftwareLanguageHelper < DynamicTableHelper |
| 50 | 50 | |
| 51 | 51 | def self.language_html_structure(language_data, disabled) |
| 52 | 52 | language_id = language_data[:programming_language_id] |
| 53 | - language_name = if language_data[:programming_language_id].blank? | |
| 54 | - "" | |
| 55 | - else | |
| 56 | - ProgrammingLanguage.find( | |
| 53 | + language_name = "" | |
| 54 | + unless language_data[:programming_language_id].blank? | |
| 55 | + language_name = ProgrammingLanguage.find( | |
| 57 | 56 | language_data[:programming_language_id], |
| 58 | 57 | :select=>"name" |
| 59 | 58 | ).name | ... | ... |
src/noosfero-spb/software_communities/public/style.css
src/noosfero-spb/software_communities/public/vendor/jquery.maskedinput.min.js
| 1 | -/* | |
| 2 | - Masked Input plugin for jQuery | |
| 3 | - Copyright (c) 2007-2013 Josh Bush (digitalbush.com) | |
| 4 | - Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) | |
| 5 | - Version: 1.3.1 | |
| 6 | -*/ | |
| 7 | -(function(e){function t(){var e=document.createElement("input"),t="onpaste";return e.setAttribute(t,""),"function"==typeof e[t]?"paste":"input"}var n,a=t()+".mask",r=navigator.userAgent,i=/iphone/i.test(r),o=/android/i.test(r);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,r){var c,l,s,u,f,h;return!t&&this.length>0?(c=e(this[0]),c.data(e.mask.dataName)()):(r=e.extend({placeholder:e.mask.placeholder,completed:null},r),l=e.mask.definitions,s=[],u=h=t.length,f=null,e.each(t.split(""),function(e,t){"?"==t?(h--,u=e):l[t]?(s.push(RegExp(l[t])),null===f&&(f=s.length-1)):s.push(null)}),this.trigger("unmask").each(function(){function c(e){for(;h>++e&&!s[e];);return e}function d(e){for(;--e>=0&&!s[e];);return e}function m(e,t){var n,a;if(!(0>e)){for(n=e,a=c(t);h>n;n++)if(s[n]){if(!(h>a&&s[n].test(R[a])))break;R[n]=R[a],R[a]=r.placeholder,a=c(a)}b(),x.caret(Math.max(f,e))}}function p(e){var t,n,a,i;for(t=e,n=r.placeholder;h>t;t++)if(s[t]){if(a=c(t),i=R[t],R[t]=n,!(h>a&&s[a].test(i)))break;n=i}}function g(e){var t,n,a,r=e.which;8===r||46===r||i&&127===r?(t=x.caret(),n=t.begin,a=t.end,0===a-n&&(n=46!==r?d(n):a=c(n-1),a=46===r?c(a):a),k(n,a),m(n,a-1),e.preventDefault()):27==r&&(x.val(S),x.caret(0,y()),e.preventDefault())}function v(t){var n,a,i,l=t.which,u=x.caret();t.ctrlKey||t.altKey||t.metaKey||32>l||l&&(0!==u.end-u.begin&&(k(u.begin,u.end),m(u.begin,u.end-1)),n=c(u.begin-1),h>n&&(a=String.fromCharCode(l),s[n].test(a)&&(p(n),R[n]=a,b(),i=c(n),o?setTimeout(e.proxy(e.fn.caret,x,i),0):x.caret(i),r.completed&&i>=h&&r.completed.call(x))),t.preventDefault())}function k(e,t){var n;for(n=e;t>n&&h>n;n++)s[n]&&(R[n]=r.placeholder)}function b(){x.val(R.join(""))}function y(e){var t,n,a=x.val(),i=-1;for(t=0,pos=0;h>t;t++)if(s[t]){for(R[t]=r.placeholder;pos++<a.length;)if(n=a.charAt(pos-1),s[t].test(n)){R[t]=n,i=t;break}if(pos>a.length)break}else R[t]===a.charAt(pos)&&t!==u&&(pos++,i=t);return e?b():u>i+1?(x.val(""),k(0,h)):(b(),x.val(x.val().substring(0,i+1))),u?t:f}var x=e(this),R=e.map(t.split(""),function(e){return"?"!=e?l[e]?r.placeholder:e:void 0}),S=x.val();x.data(e.mask.dataName,function(){return e.map(R,function(e,t){return s[t]&&e!=r.placeholder?e:null}).join("")}),x.attr("readonly")||x.one("unmask",function(){x.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(n);var e;S=x.val(),e=y(),n=setTimeout(function(){b(),e==t.length?x.caret(0,e):x.caret(e)},10)}).bind("blur.mask",function(){y(),x.val()!=S&&x.change()}).bind("keydown.mask",g).bind("keypress.mask",v).bind(a,function(){setTimeout(function(){var e=y(!0);x.caret(e),r.completed&&e==x.val().length&&r.completed.call(x)},0)}),y()}))}})})(jQuery); | |
| 8 | 1 | \ No newline at end of file |
| 2 | +// jQuery Mask Plugin v1.13.4 | |
| 3 | +// github.com/igorescobar/jQuery-Mask-Plugin | |
| 4 | +(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):"object"===typeof exports?module.exports=b(require("jquery")):b(jQuery||Zepto)})(function(b){var y=function(a,c,d){a=b(a);var g=this,k=a.val(),l;c="function"===typeof c?c(a.val(),void 0,a,d):c;var e={invalid:[],getCaret:function(){try{var q,b=0,e=a.get(0),f=document.selection,c=e.selectionStart;if(f&&-1===navigator.appVersion.indexOf("MSIE 10"))q=f.createRange(),q.moveStart("character",a.is("input")?-a.val().length:-a.text().length), | |
| 5 | +b=q.text.length;else if(c||"0"===c)b=c;return b}catch(d){}},setCaret:function(q){try{if(a.is(":focus")){var b,c=a.get(0);c.setSelectionRange?c.setSelectionRange(q,q):c.createTextRange&&(b=c.createTextRange(),b.collapse(!0),b.moveEnd("character",q),b.moveStart("character",q),b.select())}}catch(f){}},events:function(){a.on("input.mask keyup.mask",e.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){a.keydown().keyup()},100)}).on("change.mask",function(){a.data("changed",!0)}).on("blur.mask", | |
| 6 | +function(){k===a.val()||a.data("changed")||a.triggerHandler("change");a.data("changed",!1)}).on("blur.mask",function(){k=a.val()}).on("focus.mask",function(a){!0===d.selectOnFocus&&b(a.target).select()}).on("focusout.mask",function(){d.clearIfNotMatch&&!l.test(e.val())&&e.val("")})},getRegexMask:function(){for(var a=[],b,e,f,d,h=0;h<c.length;h++)(b=g.translation[c.charAt(h)])?(e=b.pattern.toString().replace(/.{1}$|^.{1}/g,""),f=b.optional,(b=b.recursive)?(a.push(c.charAt(h)),d={digit:c.charAt(h), | |
| 7 | +pattern:e}):a.push(f||b?e+"?":e)):a.push(c.charAt(h).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));a=a.join("");d&&(a=a.replace(new RegExp("("+d.digit+"(.*"+d.digit+")?)"),"($1)?").replace(new RegExp(d.digit,"g"),d.pattern));return new RegExp(a)},destroyEvents:function(){a.off("input keydown keyup paste drop blur focusout ".split(" ").join(".mask "))},val:function(b){var c=a.is("input")?"val":"text";if(0<arguments.length){if(a[c]()!==b)a[c](b);c=a}else c=a[c]();return c},getMCharsBeforeCount:function(a, | |
| 8 | +b){for(var e=0,f=0,d=c.length;f<d&&f<a;f++)g.translation[c.charAt(f)]||(a=b?a+1:a,e++);return e},caretPos:function(a,b,d,f){return g.translation[c.charAt(Math.min(a-1,c.length-1))]?Math.min(a+d-b-f,d):e.caretPos(a+1,b,d,f)},behaviour:function(a){a=a||window.event;e.invalid=[];var c=a.keyCode||a.which;if(-1===b.inArray(c,g.byPassKeys)){var d=e.getCaret(),f=e.val().length,n=d<f,h=e.getMasked(),k=h.length,m=e.getMCharsBeforeCount(k-1)-e.getMCharsBeforeCount(f-1);e.val(h);!n||65===c&&a.ctrlKey||(8!== | |
| 9 | +c&&46!==c&&(d=e.caretPos(d,f,k,m)),e.setCaret(d));return e.callbacks(a)}},getMasked:function(a){var b=[],k=e.val(),f=0,n=c.length,h=0,l=k.length,m=1,p="push",u=-1,t,w;d.reverse?(p="unshift",m=-1,t=0,f=n-1,h=l-1,w=function(){return-1<f&&-1<h}):(t=n-1,w=function(){return f<n&&h<l});for(;w();){var x=c.charAt(f),v=k.charAt(h),r=g.translation[x];if(r)v.match(r.pattern)?(b[p](v),r.recursive&&(-1===u?u=f:f===t&&(f=u-m),t===u&&(f-=m)),f+=m):r.optional?(f+=m,h-=m):r.fallback?(b[p](r.fallback),f+=m,h-=m):e.invalid.push({p:h, | |
| 10 | +v:v,e:r.pattern}),h+=m;else{if(!a)b[p](x);v===x&&(h+=m);f+=m}}a=c.charAt(t);n!==l+1||g.translation[a]||b.push(a);return b.join("")},callbacks:function(b){var g=e.val(),l=g!==k,f=[g,b,a,d],n=function(a,b,c){"function"===typeof d[a]&&b&&d[a].apply(this,c)};n("onChange",!0===l,f);n("onKeyPress",!0===l,f);n("onComplete",g.length===c.length,f);n("onInvalid",0<e.invalid.length,[g,b,a,e.invalid,d])}};g.mask=c;g.options=d;g.remove=function(){var b=e.getCaret();e.destroyEvents();e.val(g.getCleanVal());e.setCaret(b- | |
| 11 | +e.getMCharsBeforeCount(b));return a};g.getCleanVal=function(){return e.getMasked(!0)};g.init=function(c){c=c||!1;d=d||{};g.byPassKeys=b.jMaskGlobals.byPassKeys;g.translation=b.jMaskGlobals.translation;g.translation=b.extend({},g.translation,d.translation);g=b.extend(!0,{},g,d);l=e.getRegexMask();!1===c?(d.placeholder&&a.attr("placeholder",d.placeholder),b("input").length&&!1==="oninput"in b("input")[0]&&"on"===a.attr("autocomplete")&&a.attr("autocomplete","off"),e.destroyEvents(),e.events(),c=e.getCaret(), | |
| 12 | +e.val(e.getMasked()),e.setCaret(c+e.getMCharsBeforeCount(c,!0))):(e.events(),e.val(e.getMasked()))};g.init(!a.is("input"))};b.maskWatchers={};var A=function(){var a=b(this),c={},d=a.attr("data-mask");a.attr("data-mask-reverse")&&(c.reverse=!0);a.attr("data-mask-clearifnotmatch")&&(c.clearIfNotMatch=!0);"true"===a.attr("data-mask-selectonfocus")&&(c.selectOnFocus=!0);if(z(a,d,c))return a.data("mask",new y(this,d,c))},z=function(a,c,d){d=d||{};var g=b(a).data("mask"),k=JSON.stringify;a=b(a).val()|| | |
| 13 | +b(a).text();try{return"function"===typeof c&&(c=c(a)),"object"!==typeof g||k(g.options)!==k(d)||g.mask!==c}catch(l){}};b.fn.mask=function(a,c){c=c||{};var d=this.selector,g=b.jMaskGlobals,k=b.jMaskGlobals.watchInterval,l=function(){if(z(this,a,c))return b(this).data("mask",new y(this,a,c))};b(this).each(l);d&&""!==d&&g.watchInputs&&(clearInterval(b.maskWatchers[d]),b.maskWatchers[d]=setInterval(function(){b(document).find(d).each(l)},k));return this};b.fn.unmask=function(){clearInterval(b.maskWatchers[this.selector]); | |
| 14 | +delete b.maskWatchers[this.selector];return this.each(function(){var a=b(this).data("mask");a&&a.remove().removeData("mask")})};b.fn.cleanVal=function(){return this.data("mask").getCleanVal()};b.applyDataMask=function(a){a=a||b.jMaskGlobals.maskElements;(a instanceof b?a:b(a)).filter(b.jMaskGlobals.dataMaskAttr).each(A)};var p={maskElements:"input,td,span,div",dataMaskAttr:"*[data-mask]",dataMask:!0,watchInterval:300,watchInputs:!0,watchDataMask:!1,byPassKeys:[9,16,17,18,36,37,38,39,40,91],translation:{0:{pattern:/\d/}, | |
| 15 | +9:{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},S:{pattern:/[a-zA-Z]/}}};b.jMaskGlobals=b.jMaskGlobals||{};p=b.jMaskGlobals=b.extend(!0,{},p,b.jMaskGlobals);p.dataMask&&b.applyDataMask();setInterval(function(){b.jMaskGlobals.watchDataMask&&b.applyDataMask()},p.watchInterval)}); | |
| 16 | + | ... | ... |
src/noosfero-spb/software_communities/public/views/comments-software-extra-fields.js
| ... | ... | @@ -15,6 +15,24 @@ modulejs.define('CommentsSoftwareExtraFields', ['jquery'], function($) { |
| 15 | 15 | $(".comments-software-extra-fields div").hide(); |
| 16 | 16 | } |
| 17 | 17 | }); |
| 18 | + var organization_rating_saved_value = $("#organization_rating_saved_value"); | |
| 19 | + var organization_rating_people_benefited = $("#organization_rating_people_benefited"); | |
| 20 | + var people_benefited_tmp = $("#people_benefited_tmp"); | |
| 21 | + var saved_value_tmp = $("#saved_value_tmp"); | |
| 22 | + | |
| 23 | + saved_value_tmp.mask("#.##0,00", {reverse: true}); | |
| 24 | + people_benefited_tmp.mask("000.000.000", {reverse: true}); | |
| 25 | + | |
| 26 | + organization_rating_saved_value.closest("form").submit(function( event ) { | |
| 27 | + var unformated_saved_value = saved_value_tmp.val(); | |
| 28 | + unformated_saved_value = unformated_saved_value.split(".").join(""); | |
| 29 | + unformated_saved_value = unformated_saved_value.replace(",","."); | |
| 30 | + organization_rating_saved_value.val(unformated_saved_value); | |
| 31 | + | |
| 32 | + var unformated_people_benefited = people_benefited_tmp.val(); | |
| 33 | + unformated_people_benefited = unformated_people_benefited.split(".").join(""); | |
| 34 | + organization_rating_people_benefited.val(unformated_people_benefited); | |
| 35 | + }); | |
| 18 | 36 | } |
| 19 | 37 | |
| 20 | 38 | return { | ... | ... |
src/noosfero-spb/software_communities/test/functional/software_communities_plugin_myprofile_controller_test.rb
| 1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
| 2 | -require File.dirname(__FILE__) + '/../helpers/software_test_helper' | |
| 3 | -require( | |
| 4 | - File.dirname(__FILE__) + | |
| 5 | - '/../../controllers/software_communities_plugin_myprofile_controller' | |
| 1 | +require 'test_helper' | |
| 2 | +require_relative '../helpers/software_test_helper' | |
| 3 | +require_relative( | |
| 4 | + '../../controllers/software_communities_plugin_myprofile_controller' | |
| 6 | 5 | ) |
| 7 | 6 | |
| 8 | 7 | class SoftwareCommunitiesPluginMyprofileController; def rescue_action(e) raise e end; |
| ... | ... | @@ -93,7 +92,11 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC |
| 93 | 92 | assert_equal SoftwareInfo.last.acronym, "test" |
| 94 | 93 | end |
| 95 | 94 | |
| 96 | - should 'upgrade a generic software to a public software' do | |
| 95 | + should 'only admin upgrade a generic software to a public software' do | |
| 96 | + admin_person = create_user('admin').person | |
| 97 | + @environment.add_admin(admin_person) | |
| 98 | + | |
| 99 | + login_as(admin_person.user_login) | |
| 97 | 100 | fields_software = software_fields |
| 98 | 101 | fields = software_edit_specific_fields |
| 99 | 102 | |
| ... | ... | @@ -103,15 +106,69 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC |
| 103 | 106 | post( |
| 104 | 107 | :edit_software, |
| 105 | 108 | :profile => software.community.identifier, |
| 106 | - :library => fields[0], | |
| 107 | - :language => fields[1], | |
| 108 | - :database => fields[2], | |
| 109 | 109 | :operating_system => fields[3], |
| 110 | 110 | :software => fields[4], |
| 111 | - :license => fields[5] | |
| 112 | 111 | ) |
| 113 | 112 | |
| 114 | - assert_equal true, SoftwareInfo.last.public_software? | |
| 113 | + assert SoftwareInfo.last.public_software? | |
| 114 | + end | |
| 115 | + | |
| 116 | + should 'not upgrade a generic software to a public software if user is not an admin' do | |
| 117 | + fields_software = software_fields | |
| 118 | + fields = software_edit_specific_fields | |
| 119 | + | |
| 120 | + fields[4]['public_software'] = true | |
| 121 | + software = create_software fields_software | |
| 122 | + | |
| 123 | + post( | |
| 124 | + :edit_software, | |
| 125 | + :profile => software.community.identifier, | |
| 126 | + :software => fields[4] | |
| 127 | + ) | |
| 128 | + | |
| 129 | + refute SoftwareInfo.last.public_software? | |
| 130 | + end | |
| 131 | + | |
| 132 | + ["e_ping","e_mag","icp_brasil","e_arq","intern"].map do |attr| | |
| 133 | + define_method "test_should_#{attr}_not_be_changed_by_not_admin" do | |
| 134 | + fields_software = software_fields | |
| 135 | + fields = software_edit_specific_fields | |
| 136 | + | |
| 137 | + fields[4][attr]=true | |
| 138 | + | |
| 139 | + software = create_software fields_software | |
| 140 | + | |
| 141 | + post( | |
| 142 | + :edit_software, | |
| 143 | + :profile => software.community.identifier, | |
| 144 | + :software => fields[4] | |
| 145 | + ) | |
| 146 | + | |
| 147 | + refute SoftwareInfo.last.send(attr) | |
| 148 | + end | |
| 149 | + end | |
| 150 | + | |
| 151 | + ["e_ping","e_mag","icp_brasil","e_arq","intern"].map do |attr| | |
| 152 | + define_method "test_should_#{attr}_be_changed_by_admin" do | |
| 153 | + admin_person = create_user('admin').person | |
| 154 | + @environment.add_admin(admin_person) | |
| 155 | + login_as(admin_person.user_login) | |
| 156 | + | |
| 157 | + fields_software = software_fields | |
| 158 | + fields = software_edit_specific_fields | |
| 159 | + | |
| 160 | + fields[4][attr]=true | |
| 161 | + | |
| 162 | + software = create_software fields_software | |
| 163 | + | |
| 164 | + post( | |
| 165 | + :edit_software, | |
| 166 | + :profile => software.community.identifier, | |
| 167 | + :software => fields[4] | |
| 168 | + ) | |
| 169 | + | |
| 170 | + assert SoftwareInfo.last.send(attr) | |
| 171 | + end | |
| 115 | 172 | end |
| 116 | 173 | |
| 117 | 174 | should "create software_info with existing license_info" do |
| ... | ... | @@ -146,9 +203,100 @@ class SoftwareCommunitiesPluginMyprofileControllerTest < ActionController::TestC |
| 146 | 203 | :profile => @person.identifier |
| 147 | 204 | ) |
| 148 | 205 | |
| 149 | - assert_equal SoftwareInfo.last.license_info_id, license_another.id | |
| 150 | - assert_equal SoftwareInfo.last.license_info.id, nil | |
| 151 | - assert_equal SoftwareInfo.last.license_info.version, another_license_version | |
| 152 | - assert_equal SoftwareInfo.last.license_info.link, another_license_link | |
| 206 | + assert_equal license_another.id, SoftwareInfo.last.license_info_id | |
| 207 | + assert_equal nil, SoftwareInfo.last.license_info.id | |
| 208 | + assert_equal another_license_version, SoftwareInfo.last.license_info.version | |
| 209 | + assert_equal another_license_link, SoftwareInfo.last.license_info.link | |
| 210 | + end | |
| 211 | + | |
| 212 | + should "create software_info after finish task with 'Another' license_info" do | |
| 213 | + license_another = LicenseInfo.create(:version => "Another", :link => "#") | |
| 214 | + | |
| 215 | + another_license_version = "Different License" | |
| 216 | + another_license_link = "http://diferent.link" | |
| 217 | + | |
| 218 | + post( | |
| 219 | + :new_software, | |
| 220 | + :community => { :name => "New Software", :identifier => "new-software" }, | |
| 221 | + :software_info => { :finality => "something", :repository_link => "" }, | |
| 222 | + :license => { :license_infos_id => license_another.id, | |
| 223 | + :version => another_license_version, | |
| 224 | + :link=> another_license_link | |
| 225 | + }, | |
| 226 | + :profile => @person.identifier | |
| 227 | + ) | |
| 228 | + | |
| 229 | + @environment.add_admin(@person) | |
| 230 | + Task.last.send('finish', @person) | |
| 231 | + | |
| 232 | + assert_equal license_another.id, SoftwareInfo.last.license_info_id | |
| 233 | + assert_equal nil, SoftwareInfo.last.license_info.id | |
| 234 | + assert_equal another_license_version, SoftwareInfo.last.license_info.version | |
| 235 | + assert_equal another_license_link, SoftwareInfo.last.license_info.link | |
| 236 | + end | |
| 237 | + | |
| 238 | + should "show error messages on create software_info" do | |
| 239 | + post( | |
| 240 | + :new_software, | |
| 241 | + :community => {}, | |
| 242 | + :software_info => {}, | |
| 243 | + :license => {}, | |
| 244 | + :profile => @person.identifier | |
| 245 | + ) | |
| 246 | + assert_includes @response.body, "Domain can't be blank" | |
| 247 | + assert_includes @response.body, "Name can't be blank" | |
| 248 | + assert_includes @response.body, "Finality can't be blank" | |
| 249 | + assert_includes @response.body, "Version can't be blank" | |
| 153 | 250 | end |
| 251 | + | |
| 252 | + should "show domain not available error" do | |
| 253 | + @environment.add_admin(@person) | |
| 254 | + | |
| 255 | + post( | |
| 256 | + :new_software, | |
| 257 | + :community => {:name =>"New Software", :identifier => "new-software"}, | |
| 258 | + :software_info => {:finality => "something", :repository_link => ""}, | |
| 259 | + :license =>{:license_infos_id => LicenseInfo.last.id}, | |
| 260 | + :profile => @person.identifier | |
| 261 | + ) | |
| 262 | + post( | |
| 263 | + :new_software, | |
| 264 | + :community => {:name =>"New Software", :identifier => "new-software"}, | |
| 265 | + :software_info => {:finality => "something", :repository_link => ""}, | |
| 266 | + :license =>{:license_infos_id => LicenseInfo.last.id}, | |
| 267 | + :profile => @person.identifier | |
| 268 | + ) | |
| 269 | + | |
| 270 | + assert_includes @response.body, "Domain is not available" | |
| 271 | + end | |
| 272 | + | |
| 273 | + should "create software with admin moderation" do | |
| 274 | + @environment.enable('admin_must_approve_new_communities') | |
| 275 | + | |
| 276 | + post( | |
| 277 | + :new_software, | |
| 278 | + :community => {:name =>"New Software", :identifier => "new-software"}, | |
| 279 | + :software_info => {:finality => "something", :repository_link => ""}, | |
| 280 | + :license =>{:license_infos_id => LicenseInfo.last.id}, | |
| 281 | + :profile => @person.identifier | |
| 282 | + ) | |
| 283 | + | |
| 284 | + @environment.add_admin(@person) | |
| 285 | + Task.last.send('finish', @person) | |
| 286 | + | |
| 287 | + assert_equal "New Software", Task.last.data[:name] | |
| 288 | + assert_equal "New Software", SoftwareInfo.last.community.name | |
| 289 | + end | |
| 290 | + | |
| 291 | + should "dont create software without accept task" do | |
| 292 | + assert_no_difference 'SoftwareInfo.count' do | |
| 293 | + post( | |
| 294 | + :new_software, | |
| 295 | + :community => {:name =>"New Software", :identifier => "new-software"}, | |
| 296 | + :software_info => {:finality => "something", :repository_link => ""}, | |
| 297 | + :license =>{:license_infos_id => LicenseInfo.last.id}, | |
| 298 | + :profile => @person.identifier | |
| 299 | + ) | |
| 300 | + end | |
| 301 | + end | |
| 154 | 302 | end | ... | ... |
src/noosfero-spb/software_communities/test/unit/api_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +require File.dirname(__FILE__) + '/../../../../test/unit/api/test_helper' | |
| 2 | +require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
| 3 | + | |
| 4 | +class SoftwareCommunitiesApiTest < ActiveSupport::TestCase | |
| 5 | + | |
| 6 | + include PluginTestHelper | |
| 7 | + | |
| 8 | + def setup | |
| 9 | + login_api | |
| 10 | + environment = Environment.default | |
| 11 | + environment.enable_plugin(SoftwareCommunitiesPlugin) | |
| 12 | + end | |
| 13 | + | |
| 14 | + should 'list all softwares' do | |
| 15 | + @software_info = create_software_info("software_test") | |
| 16 | + @software_info2 = create_software_info("software_test2") | |
| 17 | + | |
| 18 | + get "/api/v1/software_communities?#{params.to_query}" | |
| 19 | + json = JSON.parse(last_response.body) | |
| 20 | + assert_equivalent [@software_info.id, @software_info2.id], json['software_infos'].map {|c| c['id']} | |
| 21 | + end | |
| 22 | + | |
| 23 | + should 'get software by id' do | |
| 24 | + @software_info = create_software_info("software_test") | |
| 25 | + get "/api/v1/software_communities/#{@software_info.id}?#{params.to_query}" | |
| 26 | + | |
| 27 | + json = JSON.parse(last_response.body) | |
| 28 | + assert_equal @software_info.id, json["software_info"]["id"] | |
| 29 | + end | |
| 30 | + | |
| 31 | +end | ... | ... |
src/noosfero-spb/software_communities/test/unit/software_events_block_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | +require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
| 2 | +require File.dirname(__FILE__) + '/../helpers/plugin_test_helper' | |
| 3 | + | |
| 4 | +class SoftwareEventsBlockTest < ActiveSupport::TestCase | |
| 5 | + include PluginTestHelper | |
| 6 | + | |
| 7 | + def setup | |
| 8 | + @community = create_community("A new community") | |
| 9 | + @software_events_block = SoftwareEventsBlock.new | |
| 10 | + | |
| 11 | + box = Box.new | |
| 12 | + box.position = 1 | |
| 13 | + box.owner = @community | |
| 14 | + box.blocks << @software_events_block | |
| 15 | + box.save! | |
| 16 | + | |
| 17 | + @e1 = Event.new :name=>"Event 1", :body=>"Event 1 body", | |
| 18 | + :start_date=>DateTime.now, :end_date=>(DateTime.now + 1.month) | |
| 19 | + | |
| 20 | + @e2 = Event.new :name=>"Event 2", :body=>"Event 2 body", | |
| 21 | + :start_date=>(DateTime.now - 10.days), :end_date=>(DateTime.now + 10.days) | |
| 22 | + | |
| 23 | + @e3 = Event.new :name=>"Event 3", :body=>"Event 3 body", | |
| 24 | + :start_date=>(DateTime.now - 20.days), :end_date=>(DateTime.now - 10.days) | |
| 25 | + | |
| 26 | + @community.events << @e1 | |
| 27 | + @community.events << @e2 | |
| 28 | + @community.events << @e3 | |
| 29 | + @community.save! | |
| 30 | + end | |
| 31 | + | |
| 32 | + should "give community events that have not yet finished ordered by start date" do | |
| 33 | + events = @software_events_block.get_events | |
| 34 | + | |
| 35 | + assert_equal false, events.include?(@e3) | |
| 36 | + assert_equal @e2, events.first | |
| 37 | + assert_equal @e1, events.last | |
| 38 | + end | |
| 39 | + | |
| 40 | + should "give community events except by a event with a given slug" do | |
| 41 | + events = @software_events_block.get_events_except(@e1.slug) | |
| 42 | + | |
| 43 | + assert_equal false, events.include?(@e1) | |
| 44 | + end | |
| 45 | + | |
| 46 | + should "tell if there are events to be displayed" do | |
| 47 | + assert_equal true, @software_events_block.has_events_to_display? | |
| 48 | + | |
| 49 | + @community.events.update_all :start_date => (DateTime.now - 2.days), | |
| 50 | + :end_date => (DateTime.now - 1.day) | |
| 51 | + | |
| 52 | + assert_equal false, @software_events_block.has_events_to_display? | |
| 53 | + end | |
| 54 | + | |
| 55 | + should "tell that the block must show the title in other areas that are no the main area" do | |
| 56 | + assert_equal false, @software_events_block.should_display_title? | |
| 57 | + | |
| 58 | + @software_events_block.box.position = 3 | |
| 59 | + @software_events_block.save! | |
| 60 | + | |
| 61 | + assert_equal true, @software_events_block.should_display_title? | |
| 62 | + end | |
| 63 | +end | ... | ... |
src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb
src/noosfero-spb/software_communities/views/_main_software_editor_extras.html.erb
| ... | ... | @@ -1,32 +0,0 @@ |
| 1 | -<h2><%= _('Software Information') %></h2> | |
| 2 | - | |
| 3 | -<%= label_tag("name", _('Name'), {:class => 'formlabel'}) %> | |
| 4 | - | |
| 5 | -<div id='software-name-field' class='formfield'> | |
| 6 | - <span id='software-hostname'><%= context.profile.environment.default_hostname %>/</span> | |
| 7 | - <%= text_field_tag(:name, context.profile.software_info.community.name) %> | |
| 8 | -</div> | |
| 9 | - | |
| 10 | -<h3> <%= _("Finality") %> </h3> | |
| 11 | -<div id="finality"> | |
| 12 | - <%= text_field_tag(:finality, context.profile.software_info.finality) %> | |
| 13 | -</div> | |
| 14 | - | |
| 15 | -<h3> <%= _("Licenses") %> </h3> | |
| 16 | -<div id='licenses'> | |
| 17 | - <%= select_tag(:id, options_for_select(LicenseHelper.getListLicenses.collect{|l| [l.version, l.id]}, :selected => context.profile.software_info.license_info.id), :onchange => "get_license_link('version')") %> | |
| 18 | - <br /> | |
| 19 | - | |
| 20 | - <h4> <%= _("License link") %> </h4> | |
| 21 | - <% LicenseHelper.getListLicenses.each do | license | %> | |
| 22 | - <input type="hidden" id = "version_<%=license.id %>" value = "<%=license.link%>"> | |
| 23 | - <% end %> | |
| 24 | - | |
| 25 | - <a id = "version_link" href="<%= context.profile.software_info.license_info.link %>" target="BLANK"> <%= context.profile.software_info.license_info.link %> </a> | |
| 26 | -</div> | |
| 27 | - | |
| 28 | -<div class="formfieldline formfield type-text"> | |
| 29 | - <%= label_tag "repository_url", _("Link to Repository: ") %> | |
| 30 | - <%= text_field_tag(:reository_url) %> | |
| 31 | -</div> | |
| 32 | - |
src/noosfero-spb/software_communities/views/blocks/_software_events_list_item.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +<div class="software-events-list-item-calendar"></div> | |
| 2 | + | |
| 3 | +<span class="software-events-list-item-date"> | |
| 4 | + <%= event.start_date.strftime "%d/%m - " %> | |
| 5 | +</span> | |
| 6 | + | |
| 7 | +<span class="software-events-list-item-title"> | |
| 8 | + <%= link_to event.title, event.url %> | |
| 9 | +</span> | ... | ... |
src/noosfero-spb/software_communities/views/blocks/software_events.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +<div class="software-community-events-block"> | |
| 2 | + <% if block.has_events_to_display? %> | |
| 3 | + <ul class="software-community-events-list"> | |
| 4 | + | |
| 5 | + <% if block.should_display_title? %> | |
| 6 | + <li class="software-events-list-item"> | |
| 7 | + <span class="software-events-list-item-title"> | |
| 8 | + <%= block.title %> | |
| 9 | + </span> | |
| 10 | + </li> | |
| 11 | + <% end %> | |
| 12 | + | |
| 13 | + <% block.get_events_except(params[:page]).each do |event| %> | |
| 14 | + <li class="software-events-list-item"> | |
| 15 | + <%= render :partial=>"blocks/software_events_list_item", | |
| 16 | + :locals => {:event => event} %> | |
| 17 | + </li> | |
| 18 | + <% end %> | |
| 19 | + | |
| 20 | + </ul> | |
| 21 | + <% end %> | |
| 22 | +</div> | ... | ... |
src/noosfero-spb/software_communities/views/comments_extra_fields.html.erb
src/noosfero-spb/software_communities/views/organization_ratings_extra_fields_show_data.html.erb
| 1 | 1 | <div class="aditional-informations"> |
| 2 | 2 | <div class="comments-people-benefited"> |
| 3 | - <span><%=_("Benefited People")%> :</span> <%= user_rating.people_benefited unless user_rating.nil? %> | |
| 3 | + <span><%=_("Benefited People")%>:</span> <%= number_with_delimiter(user_rating.people_benefited, :separator => environment.currency_separator, :delimiter => environment.currency_delimiter) unless user_rating.nil? %> | |
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="comments-saved-value"> |
| 7 | - <span><%=_("Saved Resources")%> :</span> <%= user_rating.saved_value unless user_rating.nil? %> | |
| 7 | + <span><%=_("Saved Resources")%>:</span> <%= float_to_currency(user_rating.saved_value) unless user_rating.nil? %> | |
| 8 | 8 | </div> |
| 9 | 9 | </div> |
| 10 | 10 | ... | ... |
src/noosfero-spb/software_communities/views/search/_full_community.html.erb
| 1 | 1 | <% software = community.software_info %> |
| 2 | 2 | <li class="search-software-item"> |
| 3 | + <% organization_average_rating = '' %> | |
| 4 | + <% unless community.organization_ratings.empty?%> | |
| 5 | + <% organization_average_rating = render :partial => 'shared/organization_average_rating_block', :locals => {:community => community}%> | |
| 6 | + <% end %> | |
| 7 | + | |
| 8 | + <% software_publish_date = render :partial => 'shared/software_publish_date', :locals => {:community => community, :order => @order} %> | |
| 9 | + | |
| 3 | 10 | <div class="search-software-item-column-left"> |
| 4 | - <%= profile_image_link community, :portrait, 'div', community.send(@order + '_label') + show_date(community.created_at) %> | |
| 11 | + <%= profile_image_link community, :portrait, 'div', organization_average_rating + software_publish_date %> | |
| 5 | 12 | </div> |
| 6 | 13 | |
| 7 | 14 | <div class="search-software-item-column-right"> | ... | ... |
src/noosfero-spb/software_communities/views/search/_software_search_form.html.erb
src/noosfero-spb/software_communities/views/shared/_organization_average_rating_block.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +<div class="star-container catalog_rating_block"> | |
| 2 | + <% (1..5).each do |rate_number| %> | |
| 3 | + <% if rate_number <= OrganizationRating.average_rating(community.id) %> | |
| 4 | + <div class="medium-star-positive"></div> | |
| 5 | + <% else %> | |
| 6 | + <div class="medium-star-negative"></div> | |
| 7 | + <% end %> | |
| 8 | + <% end %> | |
| 9 | +</div> | ... | ... |
src/noosfero-spb/software_communities/views/shared/_software_publish_date.html.erb
0 → 100644
src/noosfero-spb/software_communities/views/software_communities_plugin_myprofile/_license_info_fields.html.erb
| 1 | -<% LicenseHelper.getListLicenses.each do | license | %> | |
| 2 | - <input type="hidden" id = "version_<%=license.id %>" value = "<%=license.link%>"> | |
| 3 | -<% end %> | |
| 4 | - | |
| 5 | 1 | <%= text_field_tag "license_info[version]", license_version, :id=>"license_info_version", :class=>"license_info_version", :placeholder=>_('Autocomplete field, type some license') %> |
| 6 | 2 | <%= hidden_field_tag "license[license_infos_id]", license_id, :id=>"license_info_id", :class=>"license_info_id", :data => {:label=>license_version} %> |
| 7 | 3 | ... | ... |
src/noosfero-spb/software_communities/views/software_communities_plugin_myprofile/_main_software_editor_extras.html.erb
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | </div> |
| 6 | 6 | |
| 7 | 7 | <div class= <%= @error_software_acronym %> > |
| 8 | - <%= label_tag("software[acronym]", _('Short Name'), {:class => 'formlabel mandatory'}) %> | |
| 8 | + <%= label_tag("software[acronym]", _('Short Name'), {:class => 'formlabel'}) %> | |
| 9 | 9 | <%= text_field_tag("software[acronym]", @profile.software_info.acronym, :id => 'software_acronym_id', :maxlength=>"10") %> |
| 10 | 10 | </div> |
| 11 | 11 | ... | ... |
src/noosfero-spb/software_communities/views/software_communities_plugin_myprofile/_public_software_info.html.erb
| 1 | 1 | <div id = "public_software"> |
| 2 | - <% if @disabled_public_software_field == true %> | |
| 3 | - <%= check_box_tag("software[public_software]", "true", @software_info.public_software?, :disabled => "disabled") %> | |
| 4 | - <%= label_tag _("Public Software"), _("Public software"), :class => "public_software_disabled" %> | |
| 5 | - <% else %> | |
| 6 | - <%= check_box_tag("software[public_software]", "true", @software_info.public_software?) %> | |
| 7 | - <%= label_tag _("Public Software"), _("Public software"), :class => "public_software_enabled" %> | |
| 8 | - <% end %> | |
| 2 | + <%= check_box_tag("software[public_software]", "true", @software_info.public_software?, :disabled => @non_admin_status) %> | |
| 3 | + <%= label_tag _("Public Software"), _("Public software") %> | |
| 9 | 4 | <div class="public-software-fields"> |
| 10 | 5 | <h4> <%= _("Public Software") %> </h4> |
| 11 | 6 | <div class="formfieldline"> |
| 12 | 7 | <%= label_tag _("Adherent to e-PING ?") %> |
| 13 | 8 | |
| 14 | 9 | <%= label_tag "e_ping_true", "Yes" %> |
| 15 | - <%= radio_button_tag("software[e_ping]", true, @software_info.e_ping)%> | |
| 10 | + <%= radio_button_tag("software[e_ping]", true, @software_info.e_ping, :disabled => @non_admin_status) %> | |
| 16 | 11 | <%= label_tag "e_ping_false", "No"%> |
| 17 | - <%= radio_button_tag("software[e_ping]", false, !@software_info.e_ping)%> | |
| 12 | + <%= radio_button_tag("software[e_ping]", false, !@software_info.e_ping, :disabled => @non_admin_status) %> | |
| 18 | 13 | </div> |
| 19 | 14 | |
| 20 | 15 | <div class="formfieldline"> |
| 21 | 16 | <%= label_tag _("Adherent to e-MAG ?") %> |
| 22 | 17 | |
| 23 | 18 | <%= label_tag "e_mag_true", "Yes"%> |
| 24 | - <%= radio_button_tag("software[e_mag]", true, @software_info.e_mag)%> | |
| 19 | + <%= radio_button_tag("software[e_mag]", true, @software_info.e_mag, :disabled => @non_admin_status) %> | |
| 25 | 20 | <%= label_tag "e_mag_false", "No"%> |
| 26 | - <%= radio_button_tag("software[e_mag]", false, !@software_info.e_mag)%> | |
| 21 | + <%= radio_button_tag("software[e_mag]", false, !@software_info.e_mag, :disabled => @non_admin_status) %> | |
| 27 | 22 | </div> |
| 28 | 23 | |
| 29 | 24 | <div class="formfieldline"> |
| 30 | 25 | <%= label_tag _("Adherent to ICP-Brasil ?") %> |
| 31 | 26 | |
| 32 | 27 | <%= label_tag "icp_brasil_true", "Yes"%> |
| 33 | - <%= radio_button_tag("software[icp_brasil]", true, @software_info.icp_brasil)%> | |
| 28 | + <%= radio_button_tag("software[icp_brasil]", true, @software_info.icp_brasil, :disabled => @non_admin_status) %> | |
| 34 | 29 | <%= label_tag "icp_brasil_false", "No"%> |
| 35 | - <%= radio_button_tag("software[icp_brasil]", false, !@software_info.icp_brasil)%> | |
| 30 | + <%= radio_button_tag("software[icp_brasil]", false, !@software_info.icp_brasil, :disabled => @non_admin_status) %> | |
| 36 | 31 | </div> |
| 37 | 32 | |
| 38 | 33 | <div class="formfieldline"> |
| 39 | 34 | <%= label_tag _("Adherent to e-ARQ ?") %> |
| 40 | 35 | |
| 41 | 36 | <%= label_tag "e_arq_true", "Yes"%> |
| 42 | - <%= radio_button_tag("software[e_arq]", true, @software_info.e_arq)%> | |
| 37 | + <%= radio_button_tag("software[e_arq]", true, @software_info.e_arq, :disabled => @non_admin_status) %> | |
| 43 | 38 | <%= label_tag "e_arq_false", "No"%> |
| 44 | - <%= radio_button_tag("software[e_arq]", false, !@software_info.e_arq)%> | |
| 39 | + <%= radio_button_tag("software[e_arq]", false, !@software_info.e_arq, :disabled => @non_admin_status) %> | |
| 45 | 40 | </div> |
| 46 | 41 | |
| 47 | 42 | <div class="formfieldline"> |
| 48 | 43 | <%= label_tag _("Internacionalizable ?") %> |
| 49 | 44 | |
| 50 | 45 | <%= label_tag "intern_true", "Yes" %> |
| 51 | - <%= radio_button_tag("software[intern]", true, @software_info.intern)%> | |
| 46 | + <%= radio_button_tag("software[intern]", true, @software_info.intern, :disabled => @non_admin_status) %> | |
| 52 | 47 | <%= label_tag "intern_false", "No"%> |
| 53 | - <%= radio_button_tag("software[intern]", false, !@software_info.intern)%> | |
| 48 | + <%= radio_button_tag("software[intern]", false, !@software_info.intern, :disabled => @non_admin_status) %> | |
| 54 | 49 | </div> |
| 55 | 50 | </div> |
| 56 | 51 | </div> | ... | ... |
src/noosfero-spb/spb_migrations/db/migrate/20151106172419_remove_softwares_without_community.rb
0 → 100644
src/pkg-rpm/.gitignore
src/pkg-rpm/Makefile
| 1 | 1 | OBSPROJECT = isv:spb:devel |
| 2 | 2 | COPR_PROJECT = softwarepublico/v5 |
| 3 | -LOCAL_BUILD_DIR = $(PWD)/build | |
| 3 | +LOCAL_BUILD_DIR = $(CURDIR)/build | |
| 4 | 4 | |
| 5 | 5 | # Vagrant environment does not accept links from/to shared folder |
| 6 | -ifeq "$(PWD)" "/vagrant" | |
| 6 | +ifeq "/vagrant" "$(shell ls -1d /vagrant 2>/dev/null)" | |
| 7 | 7 | LOCAL_BUILD_DIR = /home/vagrant/rpmbuild |
| 8 | 8 | endif |
| 9 | 9 | |
| ... | ... | @@ -57,7 +57,7 @@ checkout_packages_obs = $(patsubst %, %-checkout-obs, $(packages)) |
| 57 | 57 | upload_packages_obs = $(patsubst %, %-upload-obs, $(packages)) |
| 58 | 58 | diff_packages_obs = $(patsubst %, %-diff-obs, $(packages)) |
| 59 | 59 | |
| 60 | -.PHONY: $(build_packages) $(checkout_packages_obs) $(upload_packages_obs) $(diff_packages_obs) | |
| 60 | +.PHONY: $(build_packages) $(checkout_packages_obs) $(upload_packages_obs) $(diff_packages_obs) copr-cli | |
| 61 | 61 | |
| 62 | 62 | ### Targets |
| 63 | 63 | |
| ... | ... | @@ -76,8 +76,14 @@ $(build_src_packages): %-build-src : % |
| 76 | 76 | rm -f $(LOCAL_BUILD_DIR)/SRPMS/$*-*.src.rpm |
| 77 | 77 | cd $* && $(BUILD_PREFIX) rpmbuild --define "_topdir $(LOCAL_BUILD_DIR)" -bs $*.spec --nodeps |
| 78 | 78 | |
| 79 | -$(upload_packages): %-upload : %-build-src % | |
| 80 | - copr-cli build $(COPR_PROJECT) $(LOCAL_BUILD_DIR)/SRPMS/$*-*.src.rpm --nowait | |
| 79 | +$(upload_packages): %-upload : %-build-src % copr-cli | |
| 80 | + .virtualenv/bin/copr-cli build $(COPR_PROJECT) $(LOCAL_BUILD_DIR)/SRPMS/$*-*.src.rpm --nowait | |
| 81 | + | |
| 82 | +copr-cli: .virtualenv/bin/copr-cli | |
| 83 | + | |
| 84 | +.virtualenv/bin/copr-cli: | |
| 85 | + virtualenv .virtualenv | |
| 86 | + .virtualenv/bin/pip install copr-cli | |
| 81 | 87 | |
| 82 | 88 | ### OBS targets (deprecated) |
| 83 | 89 | |
| ... | ... | @@ -102,3 +108,8 @@ diff-obs: $(diff_packages_obs) |
| 102 | 108 | |
| 103 | 109 | status-obs st-obs: |
| 104 | 110 | @$(MAKE) diff | diffstat -C |
| 111 | + | |
| 112 | +clean: | |
| 113 | + rm -rf */*.tar.* | |
| 114 | + rm -rf build/ | |
| 115 | + rm -rf .virtualenv/ | ... | ... |
src/pkg-rpm/colab-deps/colab-deps.spec
| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | +Name: colab-spb-plugin | |
| 2 | +Version: 5.0a0 | |
| 3 | +Release: 1 | |
| 4 | +Summary: SPB-specific Colab plugin | |
| 5 | +License: GPL-3.0 | |
| 6 | +Group: Applications/Publishing | |
| 7 | +Url: https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico | |
| 8 | +Source0: %{name}-%{version}.tar.gz | |
| 9 | +Requires: colab >= 1.11 | |
| 10 | +BuildArch: noarch | |
| 11 | +BuildRequires: colab, colab-deps >= 1.11.4, python-virtualenv | |
| 12 | + | |
| 13 | +%description | |
| 14 | +This package contains Colab plugin for the Software Público Brasileiro platform. | |
| 15 | + | |
| 16 | +%prep | |
| 17 | +%setup -q | |
| 18 | + | |
| 19 | +%build | |
| 20 | +# install colab and colab-des into virtualenv | |
| 21 | +rm -rf virtualenv | |
| 22 | +cp -r /usr/lib/colab virtualenv | |
| 23 | +PATH=$(pwd)/virtualenv/bin:$PATH pip install --use-wheel --no-index . | |
| 24 | +virtualenv --relocatable virtualenv | |
| 25 | + | |
| 26 | +rpm -ql colab-deps colab | sed '/^\/usr\/lib\/colab\// !d; s#/usr/lib/colab/##' > cleanup.list | |
| 27 | +while read f; do | |
| 28 | + if [ -f "virtualenv/$f" ]; then | |
| 29 | + rm -f "virtualenv/$f" | |
| 30 | + fi | |
| 31 | +done < cleanup.list | |
| 32 | +rm -f cleanup.list | |
| 33 | +find virtualenv -type d -empty -delete | |
| 34 | +rm -rf virtualenv/bin | |
| 35 | +rm -rf virtualenv/include | |
| 36 | + | |
| 37 | +%install | |
| 38 | + | |
| 39 | +install -d -m 0755 %{buildroot}/usr/lib | |
| 40 | +rm -rf %{buildroot}/usr/lib/colab | |
| 41 | +cp -r virtualenv %{buildroot}/usr/lib/colab | |
| 42 | + | |
| 43 | +%files | |
| 44 | +%defattr(-,root,root) | |
| 45 | +/usr/lib/colab | ... | ... |
src/pkg-rpm/colab-spb-theme/colab-spb-theme.spec
src/pkg-rpm/colab/colab.spec
| 1 | 1 | %define name colab |
| 2 | -%define version 1.11.3 | |
| 3 | -%define default_release 0 | |
| 4 | -%{!?release: %define release %{default_release}} | |
| 2 | +%define version 1.11.4 | |
| 5 | 3 | %define buildvenv /var/tmp/%{name}-%{version} |
| 6 | 4 | |
| 7 | 5 | Summary: Collaboration platform for communities |
| 8 | 6 | Name: %{name} |
| 9 | 7 | Version: %{version} |
| 10 | -Release: 19 | |
| 8 | +Release: 1 | |
| 11 | 9 | Source0: %{name}-%{version}.tar.gz |
| 12 | 10 | License: GPLv2 |
| 13 | 11 | Group: Development/Tools |
| ... | ... | @@ -16,9 +14,9 @@ Prefix: %{_prefix} |
| 16 | 14 | Vendor: Sergio Oliveira <sergio@tracy.com.br> |
| 17 | 15 | Url: https://github.com/colab/colab |
| 18 | 16 | BuildArch: noarch |
| 19 | -BuildRequires: colab-deps >= 1.11.3, python-virtualenv | |
| 17 | +BuildRequires: colab-deps >= 1.11.6, python-virtualenv | |
| 20 | 18 | # FIXME colab should not depend on nginx! |
| 21 | -Requires: colab-deps >= 1.11.3, solr, mailman-api >= 0.3rc3, nginx | |
| 19 | +Requires: colab-deps >= 1.11.6, solr, mailman-api >= 0.3rc3, nginx | |
| 22 | 20 | |
| 23 | 21 | %description |
| 24 | 22 | Integrated software development platform. |
| ... | ... | @@ -227,6 +225,10 @@ if [ $1 -gt 1 ]; then |
| 227 | 225 | systemctl try-restart colab |
| 228 | 226 | fi |
| 229 | 227 | |
| 228 | +colab-admin build_solr_schema > /var/tmp/schema.xml | |
| 229 | +mv -f /var/tmp/schema.xml /usr/share/solr/example/solr/collection1/conf/schema.xml | |
| 230 | +systemctl restart solr | |
| 231 | + | |
| 230 | 232 | systemctl daemon-reload |
| 231 | 233 | |
| 232 | 234 | %preun | ... | ... |
src/pkg-rpm/kalibro-configurations-deps/kalibro-configurations-deps.spec
src/pkg-rpm/prezento-spb-deps/prezento-spb-deps.spec
test/colab_test.sh
| ... | ... | @@ -5,7 +5,7 @@ test_database_connectivity() { |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | test_colab_config_is_in_place() { |
| 8 | - assertTrue 'colab settings.yml is in place' 'run_on integration test -f /etc/colab/settings.yaml' | |
| 8 | + assertTrue 'colab settings.py is in place' 'run_on integration test -f /etc/colab/settings.py' | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | test_colab_running() { | ... | ... |