diff --git a/.gitignore b/.gitignore index 8046438f921cc0a67d6bc5669f2f65ca132a96e5..05b8fd85d331fa539da4cad93551ce90f9fdb16d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ Gemfile.lock /public/assets /config/orientdb.yml /config/dspace.yml + # ignore server scripts puma.sh start_puma.sh @@ -30,3 +31,7 @@ portalmec.service portalmec-sidekiq.service sidekiq.sh autocomplete-server.service + +# ignore configs +/config/database.yml +/config/sidekiq.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0f5a273dd3aff2a1278261d9d2f99ffdbf727d0c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ruby:2.2.0 +RUN apt-get update -qq && apt-get install -y build-essential nodejs + +RUN mkdir /app + +WORKDIR /tmp +COPY Gemfile Gemfile +COPY Gemfile.lock Gemfile.lock +RUN bundle install -j 3 + +WORKDIR /app + +CMD ["rails", "server", "-b", "0.0.0.0"] diff --git a/Gemfile b/Gemfile index 09f7e960a0c0d6724e8339ed0494288757d3edf7..224591bbe039a8a483ace0834304345056bdef73 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.5.1' +gem 'rails', '4.2.6' # Use postgresql as the database for Active Record gem 'pg' # Use SCSS for stylesheets @@ -123,6 +123,7 @@ end group :test do gem 'shoulda' + gem 'minitest-reporters' end gem 'streamio-ffmpeg', '~> 1.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index b62bcf9210790bae96ccc68e9b49277f74c4d477..36a29235253aae55ec171f2ee179c8789645a866 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,48 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.5.1) - actionpack (= 4.2.5.1) - actionview (= 4.2.5.1) - activejob (= 4.2.5.1) + actionmailer (4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5.1) - actionview (= 4.2.5.1) - activesupport (= 4.2.5.1) + actionpack (4.2.6) + actionview (= 4.2.6) + activesupport (= 4.2.6) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.5.1) - activesupport (= 4.2.5.1) + actionview (4.2.6) + activesupport (= 4.2.6) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5.1) - activesupport (= 4.2.5.1) + activejob (4.2.6) + activesupport (= 4.2.6) globalid (>= 0.3.0) - activemodel (4.2.5.1) - activesupport (= 4.2.5.1) + activemodel (4.2.6) + activesupport (= 4.2.6) builder (~> 3.1) - activerecord (4.2.5.1) - activemodel (= 4.2.5.1) - activesupport (= 4.2.5.1) + activerecord (4.2.6) + activemodel (= 4.2.6) + activesupport (= 4.2.6) arel (~> 6.0) activerecord-import (0.12.0) activerecord (>= 3.0) - activesupport (4.2.5.1) + activesupport (4.2.6) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) + ansi (1.5.0) arel (6.0.3) ast (2.2.0) - autoprefixer-rails (6.3.3.1) + autoprefixer-rails (6.3.4) execjs axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -175,7 +176,7 @@ GEM dm-core (~> 1.2.0) do_sqlite3 (0.10.17) data_objects (= 0.10.17) - dspace_rest_client (2.2.5) + dspace_rest_client (2.2.6) activesupport (~> 4.2, >= 4.2.0) faraday (~> 0.9.2) json (~> 1.8, >= 1.8.3) @@ -265,6 +266,11 @@ GEM rake mini_portile2 (2.0.0) minitest (5.8.4) + minitest-reporters (1.1.8) + ansi + builder + minitest (>= 5.0) + ruby-progressbar multi_json (1.11.2) multi_xml (0.5.5) multipart-post (2.0.0) @@ -310,7 +316,7 @@ GEM pg (0.18.4) phantomjs (2.1.1.0) ptools (1.3.3) - puma (3.1.0) + puma (3.2.0) pundit (1.1.0) activesupport (>= 3.0.0) quiet_assets (1.1.0) @@ -323,16 +329,16 @@ GEM rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.5.1) - actionmailer (= 4.2.5.1) - actionpack (= 4.2.5.1) - actionview (= 4.2.5.1) - activejob (= 4.2.5.1) - activemodel (= 4.2.5.1) - activerecord (= 4.2.5.1) - activesupport (= 4.2.5.1) + rails (4.2.6) + actionmailer (= 4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + activemodel (= 4.2.6) + activerecord (= 4.2.6) + activesupport (= 4.2.6) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5.1) + railties (= 4.2.6) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -342,14 +348,14 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.5.1) - actionpack (= 4.2.5.1) - activesupport (= 4.2.5.1) + railties (4.2.6) + actionpack (= 4.2.6) + activesupport (= 4.2.6) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.1.0) rake (11.1.1) - rake-compiler (0.9.6) + rake-compiler (0.9.7) rake rdoc (4.2.2) json (~> 1.4) @@ -359,13 +365,14 @@ GEM parser (~> 2.3, >= 2.3.0.6) rainbow (~> 2.0) ref (2.0.0) - resource_kit (0.1.4) + resource_kit (0.1.5) addressable (~> 2.3.6) - responders (2.1.1) + responders (2.1.2) railties (>= 4.2.0, < 5.1) resumablejs-rails (1.1) railties (> 3.1, < 5) rmagick (2.15.4) + ruby-progressbar (1.7.5) ruby2ruby (2.3.0) ruby_parser (~> 3.1) sexp_processor (~> 4.0) @@ -504,6 +511,7 @@ DEPENDENCIES meta-tags mimemagic mina + minitest-reporters omniauth-facebook omniauth-google-oauth2 omniauth-twitter @@ -514,7 +522,7 @@ DEPENDENCIES quiet_assets rack-cors rack-mini-profiler - rails (= 4.2.5.1) + rails (= 4.2.6) rainbow rdoc resumablejs-rails diff --git a/README.md b/README.md index 39badc22b6abec3a8bf9c33cc007812125df8927..e601b62d932b21da1b00610250c070ec666ff8c1 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ After this setup, open the config files and update some vars: * config/initializers/gitlab.rb: change your gitlab host for bug reports and set env var with private token. ( $ export GITLAB_PORTALMEC_PRIVATE_TOKEN=131237128937128937 ) ### Development environment + + #### Using docker for development env + You can use docker for your development environment. For that, run: + ``` ./bin/docker-setup ``` + Now, redis, elasticsearch and postgres are running as services and linked to PortalMEC application. Database migrations were execute and the configs (database.yml, sidekiq.yml was replaced by config/docker/...). + If all development and test vars are set, run: ``` ./bin/setup ``` This command will install the rubygems, create/reset your database schema, seed some default data and import all dspace data. @@ -25,7 +31,7 @@ This command will install the rubygems, create/reset your database schema, seed After this, your application is ready to use and you can access it with: ``` bundle exec rails s ``` -### Test environment +### Running tests suite For tests, TestUnit is used, and to run it: ``` bundle exec rake test ``` diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index f95f3f9c241b3fbb1150f2d6b3aaf9f12d1a2a51..65ba7f3d9594236df4225461288b4d7aad11eebd 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -487,8 +487,6 @@ header { } } -@media only screen and (min-width: 1010px) { -/*For Desktops*/ footer { padding-top: 50px; color: #FFF; @@ -499,97 +497,21 @@ header { min-height: 256px; .container-height{ - min-height: 200px; .top-padding{ padding-top: 50px; } } - .logo-footer{ - width: 18%; - - .logos-footer{ - height: 70px; - } - .ministerio-size{ - margin-left: 60px; - } - .fnde-size{ - height: 100px; - margin-top: -8%; - margin-left: 20px; - } - .ufpr-size{ - margin-left: 60px; - } - .c3sl-size{ - margin-left: 40px; - } - } - } - - .footerbar{ - padding: 16px; - background-color: #AAB1AD; - } - .footer-bar { - color: #FFF; - background-color: #2178F5; - - .logo { - text-align: center; - width: 165px; - margin: 10px auto auto auto; - - h3 { - margin-top: 10px; - font-weight: 400; - } - a { - color: #FFF; - } - } - } - } -} - -@media only screen and (min-width: 600px) and (max-width: 1009px){ -/*For tablets*/ - footer { - padding-top: 30px; - color: #FFF; - - .main { - background-color: #E6E6E6; - padding: 16px 0px 0px 0px; - min-height: 200px; - - .container-height{ - min-height: 140px; - .top-padding{ - padding-top: 30px; - } - } - - .logo-footer{ - width: 2%; - display: inline-block; - - .logos-footer{ - height: 40px; - } - .ministerio-size{ - margin-left: 120px; - } - .fnde-size{ - height: 60px; - margin-top: -8%; - margin-left: 170px; - } - .ufpr-size{ - margin-left: 290px; + .logos-footer{ + display: flex; + justify-content: space-between; + width: 100%; + margin-bottom: 30px; + img{ + width: auto; } - .c3sl-size{ - margin-left: 370px; + .logo-footer{ + height: 70px; + display: inline-block; } } } @@ -617,73 +539,9 @@ header { } } } -} - -@media only screen and (max-width: 599px){ -/*For Smartphones*/ - footer { - padding-top: 20px; - color: #FFF; - - .main { - background-color: #E6E6E6; - padding: 5px 0px 0px 0px; - min-height: 156px; - .container-height{ - min-height: 90px; - .top-padding{ - padding-top: 10px; - } - } - .logo-footer{ - width: 2%; - display: inline-block; - .logos-footer{ - height: 18px; - } - .ministerio-size{ - margin-left: 40px; - } - .fnde-size{ - height: 60px; - margin-top: -8%; - margin-left: 50px; - } - .ufpr-size{ - margin-left: 150px; - } - .c3sl-size{ - margin-left: 170px; - } - } - } - - .footerbar{ - padding: 16px; - background-color: #AAB1AD; - } - .footer-bar { - color: #FFF; - background-color: #2178F5; - - .logo { - margin: 10px auto auto auto; - text-align: center; - width: 100px; - h3 { - margin-top: 5px; - font-weight: 300; - } - a { - color: #FFF; - } - } - } - } -} td.stars { width: 22%; @@ -1054,6 +912,6 @@ input.chk { } .send-new-item h3{ - position: relative; padding-left: 20px; + position: relative; } diff --git a/app/assets/stylesheets/application/learning_objects.scss b/app/assets/stylesheets/application/learning_objects.scss index 17cdf3e2cefec37e6f3a0ec8bb02ae064327c341..f2077fd6a3a0893d8ffa6fa7a3cc29bc736a8f48 100644 --- a/app/assets/stylesheets/application/learning_objects.scss +++ b/app/assets/stylesheets/application/learning_objects.scss @@ -230,6 +230,16 @@ $checked_icon: 'icons/checked.png'; margin-top: 5px; } } + .bookmark{ + i{ + padding-top: 3px; + color: #818080; + width: 20px; + height: 20px; + margin-bottom: 5px; + margin-top: 5px; + } + } .download{ line-height: 35px; diff --git a/app/controllers/chunks_controller.rb b/app/controllers/chunks_controller.rb index 1a291da370c3f79afbe8b8f5d09ffc0e6d701643..be663c6f83cc362d0027c3bd32f31a05e7120ccb 100644 --- a/app/controllers/chunks_controller.rb +++ b/app/controllers/chunks_controller.rb @@ -7,19 +7,26 @@ class ChunksController < ApplicationController def show chunk = resumable_chunk chunk_number - if File.exists?(chunk) - post_file_and_create_thumbnail @learning_object, resumable_filename if last_chunk? - #Let resumable.js know this chunk already exists - render :nothing => true, :status => 200 + unless valid_mime_type? + render :nothing => true, :status => 415 else - #Let resumable.js know this chunk doesnt exists and needs to be uploaded - render :nothing => true, :status => 404 + if File.exists?(chunk) + post_file_and_create_thumbnail @learning_object, resumable_filename if last_chunk? + #Let resumable.js know this chunk already exists + render :nothing => true, :status => 200 + else + #Let resumable.js know this chunk doesnt exists and needs to be uploaded + render :nothing => true, :status => 404 + end end - end - #POST /chunk def create + + unless valid_mime_type? + return render :nothing => true, :status => 415 + end + #chunk path based on the parameters chunk = resumable_chunk chunk_number @@ -101,6 +108,13 @@ class ChunksController < ApplicationController @learning_object = LearningObject.find chunks_params[:learning_object_id] end + def resumable_file_extension + File.extname(chunks_params[:resumableFilename])[1..-1] + end + + def valid_mime_type? + @learning_object.object_type.mime_types.map(&:extension).include? resumable_file_extension + end # Never trust parameters from the scary internet, only allow the white list through. def chunks_params params.permit(:file, :learning_object_id, :resumableIdentifier, :resumableFilename, :resumableChunkNumber, :resumableTotalChunks, :resumableChunkSize) diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index d4aee9e51cf831e20da805bc0db77e8362173dd3..fd8ca3a098e7745f3b1dbaf67f006f3e7cdaed41 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -60,7 +60,7 @@ class CollectionsController < ApplicationController respond_to do |format| if @collection.save - format.html { redirect_to :back, notice: 'Coleção criada com sucesso.' } + format.html { redirect_to :back, notice: t('activerecord.attributes.collection.create.notice.successfully_created') } else format.html { render :new } end @@ -72,7 +72,7 @@ class CollectionsController < ApplicationController def update respond_to do |format| if Collection.update(collection_params) - format.html { redirect_to @collection, notice: 'Coleção atualizada com sucesso.' } + format.html { redirect_to @collection, notice: t('activerecord.attributes.collection.update.notice.successfully_updated') } else format.html { render :edit } end @@ -85,7 +85,7 @@ class CollectionsController < ApplicationController Collection.destroy @collection respond_to do |format| - format.html { redirect_to user_path(current_user), notice: 'Coleção excluida com sucesso.' } + format.html { redirect_to user_path(current_user), notice: t('activerecord.attributes.collection.destroy.notice.successfully_destroy') } end end diff --git a/app/controllers/complaints_controller.rb b/app/controllers/complaints_controller.rb index c83724f235e47114724a38f375de20f7dda1fd5a..0766279742594ccac197ebb57f097158e3b562a8 100644 --- a/app/controllers/complaints_controller.rb +++ b/app/controllers/complaints_controller.rb @@ -10,9 +10,9 @@ class ComplaintsController < ApplicationController respond_to do |format| if complaint.save - format.html { redirect_to :back, notice: 'Denúncia realizada com sucesso.' } + format.html { redirect_to :back, notice: t('activerecord.attributes.complaint.create.notice.sucess') } else - format.html { redirect_to :back, alert: 'Objeto já foi denunciado por você.' } + format.html { redirect_to :back, alert: t('activerecord.attributes.complaint.create.alert.failure') } end end end diff --git a/app/controllers/feedbacks_controller.rb b/app/controllers/feedbacks_controller.rb index e511d602599c0ec74b0e08ed4fc9bde4f2cabe38..bf391b700c3b8f13aff4b4a7ec5228b46c51c575 100644 --- a/app/controllers/feedbacks_controller.rb +++ b/app/controllers/feedbacks_controller.rb @@ -32,7 +32,7 @@ class FeedbacksController < ApplicationController respond_to do |format| if feedback_service.report_bug @bug - format.html { redirect_to :back, notice: 'Problema relatado com sucesso!' } + format.html { redirect_to :back, notice: t('activerecord.attributes.feedback.report_bug.notice.success') } end end end diff --git a/app/controllers/institutions_controller.rb b/app/controllers/institutions_controller.rb index 0496cd655fae13d66302beda0fa3784c0a689ff5..0f89f86b0a5bf486916863ece16809455b1162d8 100644 --- a/app/controllers/institutions_controller.rb +++ b/app/controllers/institutions_controller.rb @@ -31,7 +31,7 @@ class InstitutionsController < ApplicationController respond_to do |format| if Institution.save @institution - format.html { redirect_to @institution, notice: 'Institution was successfully created.' } + format.html { redirect_to @institution, notice: t('activerecord.attributes.institution.create.notice.successfully_created') } else format.html { render :new } end @@ -43,7 +43,7 @@ class InstitutionsController < ApplicationController def update respond_to do |format| if Institution.update(institution_params) - format.html { redirect_to @learning_object, notice: 'Institution was successfully updated.' } + format.html { redirect_to @learning_object, notice: t('activerecord.attributes.institution.update.notice.successfully_updated') } else format.html { render :edit } end @@ -56,7 +56,7 @@ class InstitutionsController < ApplicationController Institution.destroy @institution respond_to do |format| - format.html { redirect_to institutions_url, notice: 'Learning object was successfully destroyed.' } + format.html { redirect_to institutions_url, notice: t('activerecord.attributes.institution.destroy.notice.successfully_destroy') } end end diff --git a/app/controllers/learning_objects_controller.rb b/app/controllers/learning_objects_controller.rb index 3995ddfb8e311ec309df1b8e655653713e9f9228..0f40b94dcad9e3e51fe9dd8039fee346e8ca4341 100644 --- a/app/controllers/learning_objects_controller.rb +++ b/app/controllers/learning_objects_controller.rb @@ -40,7 +40,7 @@ class LearningObjectsController < ApplicationController # go to file submission page format.html { success_redirect @learning_object } else - format.html { render :new, notice: 'Não foi possÃvel criar o objeto.' } + format.html { render :new, notice: t('activerecord.attributes.learning_object.create.notice.failure') } end end @@ -64,7 +64,7 @@ class LearningObjectsController < ApplicationController LearningObject.destroy @learning_object respond_to do |format| - format.html { redirect_to learning_objects_url, notice: 'Learning object was successfully destroyed.' } + format.html { redirect_to learning_objects_url, notice: t('activerecord.attributes.learning_object.destroy.notice.successfully_destroy') } end end @@ -121,7 +121,7 @@ class LearningObjectsController < ApplicationController def success_redirect(learning_object) #if 'Website externo' == learning_object.object_type.name - redirect_to learning_object_build_path(learning_object, :upload_attachments), notice: 'Seu objeto foi criado com sucesso!' + redirect_to learning_object_build_path(learning_object, :upload_attachments), notice: t('activerecord.attributes.learning_object.success_redirect.notice.successfully_created') end def set_form_objects diff --git a/app/helpers/learning_objects/builder_helper.rb b/app/helpers/learning_objects/builder_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..53f5cdc33a2640744b32f850a2b2b1c4a9ec0161 --- /dev/null +++ b/app/helpers/learning_objects/builder_helper.rb @@ -0,0 +1,5 @@ +module LearningObjects::BuilderHelper + def get_mime_types learning_object + @learning_object.object_type.mime_types.map(&:extension) + end +end \ No newline at end of file diff --git a/app/views/learning_objects/_learning_object_horizontal.erb b/app/views/learning_objects/_learning_object_horizontal.erb index c2e5cc26308e4a198ec7caaa82da7eec0a001f4e..074787ddddf50294cd0cd29e047d846fe8042535 100644 --- a/app/views/learning_objects/_learning_object_horizontal.erb +++ b/app/views/learning_objects/_learning_object_horizontal.erb @@ -23,7 +23,7 @@ <h4 class="learning-object-heading"><%= learning_object_title learning_object %></h4> <% end %> - <span class="author-label">Por <%= learning_object.get_metadata_value_of("dc.contributor.author") %></span><br/> + <span class="author-label">Por <%= learning_object.author || learning_object.publisher.name %></span><br/> <i class="fa fa-eye" data-toggle="tooltip" data-placement="bottom" title="Visualizações"></i><%= learning_object.views.count %> <i class="fa fa-thumbs-up" data-toggle="tooltip" data-placement="bottom" title="Curtidas"></i><span data-id="<%= learning_object.id %>" class="votes-count"><%= learning_object.likes.count %></span><br> diff --git a/app/views/learning_objects/_learning_object_vertical.erb b/app/views/learning_objects/_learning_object_vertical.erb index 5319ca6735e835e96ae00b41db508fa07681cd81..eb6f9e61bf49a384073af8861f6d349bef69fb05 100644 --- a/app/views/learning_objects/_learning_object_vertical.erb +++ b/app/views/learning_objects/_learning_object_vertical.erb @@ -15,7 +15,7 @@ <h4 class="media-heading"><%= learning_object_title(learning_object) %></h4> <i class="fa fa-eye" data-toggle="tooltip" data-placement="bottom" title="Visualizações"></i><%= learning_object.views.size %> <i class="fa fa-thumbs-up" data-toggle="tooltip" data-placement="bottom" title="Curtidas"></i><span data-id="<%= learning_object.id %>" class="votes-count"><%= learning_object.likes.size %></span> - <span class="author-label">Por <%= learning_object.get_metadata_value_of("dc.contributor.author") %></span> + <span class="author-label">Por <%= learning_object.author || learning_object.publisher.name %></span> </div> </div> </div> diff --git a/app/views/learning_objects/build/_file_upload_form.html.erb b/app/views/learning_objects/build/_file_upload_form.html.erb index 1be80ee18d85bb9cfdf1cebc979e39983eda368a..5c2314f2fedd8bfb2216df354eb1357d64c52abe 100644 --- a/app/views/learning_objects/build/_file_upload_form.html.erb +++ b/app/views/learning_objects/build/_file_upload_form.html.erb @@ -161,7 +161,7 @@ maxFiles: 3, simultaneousUploads: 4, chunkSize: 1024 * 256, - fileType: [] + fileType: <%= raw(get_mime_types @learning_object) %> }); var results = $('#results'), diff --git a/app/views/learning_objects/show.html.erb b/app/views/learning_objects/show.html.erb index 8cafb1f17617abc77bd4dec4bd29268ada9067a4..4d164f3b4f50e2d5db13355d13983138266f9f98 100644 --- a/app/views/learning_objects/show.html.erb +++ b/app/views/learning_objects/show.html.erb @@ -24,15 +24,14 @@ <div class="col-md-5"> <div class="rightbar"> - <% author = @learning_object.get_metadata_value_of("dc.contributor.author") %> - <% unless author.blank? %> + <% unless @learning_object.author.blank? %> <div class="media"> <div class="media-left"> <a href="#"><img class="user-image-small" src="<%#= current_user.avatar.url(:thumb) %><%= asset_path('user-anon.png')%>" alt="Foto do usuário"/></a> </div> <div class="media-body"> <h5>Autor</h5> - <h3><%= author %></h3> + <h3><%= @learning_object.author %></h3> </div> </div> <% end %> @@ -79,6 +78,11 @@ <%= image_tag "icons/btn_add.png", alt: "Adicionar à coleção" %> </a> </div> + <div class="action"> + <%= link_to bookmark_add_path(id: @learning_object.id, type: @learning_object.class.to_s), class:"btn btn-primary bookmark", title: "Adicionar aos favoritos", method: :post, remote: true do %> + <i class="fa fa-bookmark"></i> + <%end%> + </div> <div class="action"> <%= render 'complaints/complaints_button' %> </div> @@ -125,7 +129,7 @@ <div class="row"> <div class="col-sm-12"> <ul> - <li><b>Autor:</b> <%= @learning_object.get_metadata_value_of("dc.contributor.author") %></li> + <li><b>Autor:</b> <%= @learning_object.author %></li> <li><b>Tipo:</b> <%= @learning_object.get_metadata_value_of("dc.type") %></li> <li><b>Data:</b> <%= @learning_object.get_metadata_value_of("dc.date.available") %></li> <li><b>Linguagem:</b> <%= @learning_object.get_metadata_value_of("dc.language") %></li> diff --git a/app/views/management/carousels/_form.html.erb b/app/views/management/carousels/_form.html.erb index 9c4fa033325ca034ee30381bc9fdc017379a6001..c763b8bc889fffbf0b7fa104790e3b00b3407d7d 100644 --- a/app/views/management/carousels/_form.html.erb +++ b/app/views/management/carousels/_form.html.erb @@ -2,7 +2,7 @@ <% if @carousel.errors.any? %> <div class="ls-alert-danger"> - <h2><%= pluralize(@carousel.errors.count, "erro") %> <%= "happened".pluralize(@carousel.errors.count) %>:</h2> + <h2><%= pluralize(@carousel.errors.count, "erro") %> <%= "ocorreu".pluralize(@carousel.errors.count) %>:</h2> <ul> <% @carousel.errors.full_messages.each do |message| %> <li><%= message %></li> diff --git a/app/views/management/complaint_reasons/_form.html.erb b/app/views/management/complaint_reasons/_form.html.erb index 07a08e4ec563ec28e36df56967ef6e5f656b169e..9e65eb93c12ac89f0db6ca60a122a27782466f49 100644 --- a/app/views/management/complaint_reasons/_form.html.erb +++ b/app/views/management/complaint_reasons/_form.html.erb @@ -2,7 +2,7 @@ <% if @complaint_reason.errors.any? %> <div class="ls-alert-danger"> - <h2><%= pluralize(@complaint_reason.errors.count, "erro") %> <%= "happened".pluralize(@complaint_reason.errors.count) %>:</h2> + <h2><%= pluralize(@complaint_reason.errors.count, "erro") %> <%= "ocorreu".pluralize(@complaint_reason.errors.count) %>:</h2> <ul> <% @complaint_reason.errors.full_messages.each do |message| %> <li><%= message %></li> diff --git a/app/views/management/mime_types/_form.html.erb b/app/views/management/mime_types/_form.html.erb index 8419a7d4f0ddb52f4daccb8f399753ccc5f1a256..ddafa69c442003bbba168e81380795a51e158796 100644 --- a/app/views/management/mime_types/_form.html.erb +++ b/app/views/management/mime_types/_form.html.erb @@ -1,7 +1,7 @@ <%= form_for([:management, @mime_type]) do |f| %> <% if @mime_type.errors.any? %> <div id="error_explanation"> - <h2><%= pluralize(@mime_type.errors.count, "error") %> prohibited this management_mime_type from being saved:</h2> + <h2><%= pluralize(@mime_type.errors.count, "erro") %> impedem este mime_type de ser salvo:</h2> <ul> <% @mime_type.errors.full_messages.each do |message| %> @@ -13,7 +13,11 @@ <fieldset> <label class="ls-label col-md-6"> - <b class="ls-label-text">Extensões</b> + <b class="ls-label-text">Extensões  + <a style="text-decoration: none;" href="#" data-toggle="popover" title="Informação" data-trigger="hover" data-content="Inclua somente a extensão. Exemplo: 'jpg' e não '.jpg'"> + <i class="ls-ico-info"></i> + </a> + </b> <p>Digite o nome do tipo</p> <%= f.text_field :extension, {required: true} %> @@ -31,3 +35,8 @@ <%= link_to "Cancelar", management_mime_types_path,class: "ls-btn-danger"%> </div> <% end %> +<script> + $(document).ready(function(){ + $('[data-toggle="popover"]').popover(); + }); +</script> diff --git a/app/views/management/mime_types/index.html.erb b/app/views/management/mime_types/index.html.erb index 79f73dcdeeb9c1a770545e0af537469d1f20ded9..3ff644214786f3a057bc6831812d5524f1d38c4b 100644 --- a/app/views/management/mime_types/index.html.erb +++ b/app/views/management/mime_types/index.html.erb @@ -3,7 +3,7 @@ <table class="ls-table"> <thead> <tr> - <th>Nome</th> + <th>Extensão</th> <th>MimeType</th> <th></th> <th></th> diff --git a/app/views/management/object_types/_form.html.erb b/app/views/management/object_types/_form.html.erb index 7cb97dfb5a330720c731e6aae0ae133a9aa66ad0..77b367b3f895ea5ccf1329a32fda506cde3a1475 100644 --- a/app/views/management/object_types/_form.html.erb +++ b/app/views/management/object_types/_form.html.erb @@ -1,7 +1,7 @@ <%= form_for([:management ,@object_type]) do |f| %> <% if @object_type.errors.any? %> <div id="error_explanation"> - <h2><%= pluralize(@object_type.errors.count, "error") %> prohibited this management_object_type from being saved:</h2> + <h2><%= pluralize(@object_type.errors.count, "error") %> impedem este tipo de objeto de ser salvo:</h2> <ul> <% @object_type.errors.full_messages.each do |message| %> @@ -47,4 +47,4 @@ placeholder: "MimeTypes", width: '100%' }); -</script> \ No newline at end of file +</script> diff --git a/app/views/management/users/_form.html.erb b/app/views/management/users/_form.html.erb index 4f8d70fd4db0e3c3e4a146ad48405ad44fd751df..ed16eaec3317bea42d467c94972a026e7e979e89 100644 --- a/app/views/management/users/_form.html.erb +++ b/app/views/management/users/_form.html.erb @@ -2,7 +2,7 @@ <% if @user.errors.any? %> <div class="ls-alert-danger"> - <h2><%= pluralize(@user.errors.count, "erro") %> <%= "happened".pluralize(@user.errors.count) %>:</h2> + <h2><%= pluralize(@user.errors.count, "erro") %> <%= "ocorreu".pluralize(@user.errors.count) %>:</h2> <ul> <% @user.errors.full_messages.each do |message| %> <li><%= message %></li> diff --git a/app/views/shared/application/_footer.html.erb b/app/views/shared/application/_footer.html.erb index d6c62da8734141051337b18f0aa76af323089e99..4af454f87a0342eea0a2217a9a39b2b68e30ad95 100644 --- a/app/views/shared/application/_footer.html.erb +++ b/app/views/shared/application/_footer.html.erb @@ -15,33 +15,37 @@ <div class="main"> <div class="container container-height"> <div class="row top-padding"> - <div class="logo-footer col-md-2"> + <div class="col-md-12"> + <div class="logos-footer"> + <div class="col-md 2"> <%= link_to 'http://www.brasil.gov.br/' do %> - <%= image_tag 'logo_brasil.png',class:'logos-footer' %> + <%= image_tag 'logo_brasil.png',class:'logo-footer' %> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.fnde.gov.br/' do %> - <%= image_tag 'logo_ministerio.png',class:'logos-footer ministerio-size' %> + <%= image_tag 'logo_ministerio.png',class:'logo-footer' %> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.fnde.gov.br/' do %> - <%= image_tag 'fnde.png', class:'fnde-size' %> + <%= image_tag 'fnde.png', class:'logo-footer' %> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.ufpr.br/portalufpr/' do %> - <%= image_tag 'logo_ufpr.jpg',class:'logos-footer ufpr-size'%> + <%= image_tag 'logo_ufpr.jpg',class:'logo-footer'%> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.c3sl.ufpr.br/' do %> - <%= image_tag 'logo_c3.png', class:'logos-footer c3sl-size'%> + <%= image_tag 'logo_c3.png', class:'logo-footer'%> <% end %> </div> + </div> </div> </div> + </div> <div class="footerbar"> <div class="container"> @@ -52,4 +56,5 @@ </div> </div> </div> +</div> </footer> diff --git a/app/views/shared/application/_footer_home.html.erb b/app/views/shared/application/_footer_home.html.erb index adc9be490525a674848fd4d1168a6b9ef365ff83..35e3f0e0ce41818c39d40f0fc2fd7cb0ffcf8220 100644 --- a/app/views/shared/application/_footer_home.html.erb +++ b/app/views/shared/application/_footer_home.html.erb @@ -28,33 +28,37 @@ <div class="main"> <div class="container container-height"> <div class="row top-padding"> - <div class="logo-footer col-md-2"> + <div class="col-md-12"> + <div class="logos-footer"> + <div class="col-md 2"> <%= link_to 'http://www.brasil.gov.br/' do %> - <%= image_tag 'logo_brasil.png',class:'logos-footer' %> + <%= image_tag 'logo_brasil.png',class:'logo-footer' %> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.fnde.gov.br/' do %> - <%= image_tag 'logo_ministerio.png',class:'logos-footer ministerio-size' %> + <%= image_tag 'logo_ministerio.png',class:'logo-footer' %> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.fnde.gov.br/' do %> - <%= image_tag 'fnde.png', class:'fnde-size' %> + <%= image_tag 'fnde.png', class:'logo-footer' %> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.ufpr.br/portalufpr/' do %> - <%= image_tag 'logo_ufpr.jpg',class:'logos-footer ufpr-size'%> + <%= image_tag 'logo_ufpr.jpg',class:'logo-footer'%> <% end %> </div> - <div class="col-md-2 logo-footer"> + <div class="col-md 2"> <%= link_to 'http://www.c3sl.ufpr.br/' do %> - <%= image_tag 'logo_c3.png', class:'logos-footer c3sl-size'%> + <%= image_tag 'logo_c3.png', class:'logo-footer'%> <% end %> </div> + </div> </div> </div> +</div> <div class="footerbar"> <div class="container"> diff --git a/app/views/shared/application/_header.html.erb b/app/views/shared/application/_header.html.erb index 1de38f3061c2e427718ff976272d285c612c382b..931fb5560a3eaf90a4c1593306aae47b39149545 100644 --- a/app/views/shared/application/_header.html.erb +++ b/app/views/shared/application/_header.html.erb @@ -67,7 +67,6 @@ <nav class="navigation" id="menu-bar"> <div class="container"> - <div class="row"> <ul class="nav navbar-nav"> <li role="separator" class="divider"></li> <li class="dropdown nav-button"><h3><%= link_to 'Coleções Institucionais', collections_path %> </h3></li> @@ -84,12 +83,11 @@ <%= image_tag "icons/Upload.png"%> <h3>Enviar novo item</h3> </div> - <% end %> + <%end%> </li> <li role="separator" class="divider"></li> </ul> </div> - </div> </nav> <div class="navigation-content"> <div class="container"> diff --git a/bin/docker-setup b/bin/docker-setup new file mode 100755 index 0000000000000000000000000000000000000000..69560962062acd88bae0187fd4f0f5639999b9a7 --- /dev/null +++ b/bin/docker-setup @@ -0,0 +1,21 @@ +# bin/docker-setup +#!/bin/bash + +set -e + +# overwrite default configs for docker +# cp -f config/docker/* config/ + +# build app image +docker-compose build + +# start mysql and redis in background +# docker-compose start db +# docker-compose start redis +# docker-compose start elasticsearch + +# setup database +docker-compose run web rake db:create db:migrate + +# ensure all containers are up and running +docker-compose up \ No newline at end of file diff --git a/config/docker/database.yml b/config/docker/database.yml new file mode 100644 index 0000000000000000000000000000000000000000..9698fdbf7ea210284fe421ad2aaa2cc091528254 --- /dev/null +++ b/config/docker/database.yml @@ -0,0 +1,28 @@ +default: &defaults + adapter: postgresql + encoding: unicode + +development: &default + adapter: postgresql + encoding: unicode + database: postgres + pool: 5 + username: postgres + password: + host: db + +test: + <<: *defaults + pool: 5 + database: portalmec_test + username: portalmec + password: 123mudar + host: postgres + +production: + <<: *defaults + host: <%= ENV['PORTALMEC_DB_HOST'] %> + pool: <%= ENV['PORTALMEC_DB_POOL'] %> + database: <%= ENV['PORTALMEC_DB_NAME'] %> + username: <%= ENV['PORTALMEC_DB_USERNAME'] %> + password: <%= ENV['PORTALMEC_DB_PASSWORD'] %> diff --git a/config/docker/sidekiq.yml b/config/docker/sidekiq.yml new file mode 100644 index 0000000000000000000000000000000000000000..9b3e3c8ec1a39623d3d4c2895374f804d1cdec4d --- /dev/null +++ b/config/docker/sidekiq.yml @@ -0,0 +1,30 @@ +# +# IMPORTANT: +# If you plan to run workers on different machines, use the full hostname, +# instead of just "localhost". And remember to use the exactly same configs +# on all of the machines, including database's configs and +# environment type (development, test, production). +# +:pidfile: ./shared/pids/sidekiq.pid +:logfile: ./shared/logs/sidekiq.log +:queues: + - default + - score + - convert_video + - searchkick + - [attachment_cache, 2] + - [high_priority, 5] +# :daemon: true + +development: &development + :concurrency: 8 + host: redis + port: 6379 + +test: + host: portalmecdev1.c3sl.ufpr.br + port: 6379 + +production: + host: portalmecdev1.c3sl.ufpr.br + port: 6379 diff --git a/config/env_vars.sh b/config/env_vars.sh index 47d12764c176201ce947943d8cd9e23a53e586d4..4d251f130d865005cac9f1505466489b086c9316 100644 --- a/config/env_vars.sh +++ b/config/env_vars.sh @@ -24,6 +24,9 @@ export ACTION_MAILER_HOST= export SMTP_ADDRESS= export SMTP_PORT= +# Gitlab +export GITLAB_PORTALMEC_PRIVATE_TOKEN= + ### Rails environment export RAILS_SERVE_STATIC_FILES=FALSE export RAILS_ENV=production diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 6670a9dce73ce690f231b3b0dd5391d8acffee83..83f6a8e69ea3846fcbd2d028f3a9acdd23fb4d70 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -137,8 +137,45 @@ pt-BR: object_type: "Tipo do objeto" language: "Idioma" author: "Autor" + create: + notice: + failure: "Não foi possÃvel criar o objeto." + destroy: + notice: + successfully_destroy: "Objeto educacional excluÃdo com sucesso." + success_redirect: + notice: + successfully_created: "Seu objeto educacional foi criado com sucesso!" + collection: + create: + notice: + successfully_created: "Coleção criada com sucesso." + update: + notice: + sucessfully_updated: "Coleção atualizada com sucesso." + destroy: + notice: + successfully_destroy: "Coleção excluÃda com sucesso." + complaint: + create: + notice: + sucess: "Denúncia realizada com sucesso." + alert: + failure: "Este objeto já foi denunciado por você." + feedback: + report_bug: + notice: + success: "Problema relatado com sucesso!" institution: - name: "Nome" + create: + notice: + successfully_created: "Instituição criada com sucesso." + update: + notice: + sucessfully_updated: "Instituição atualizada com sucesso." + destroy: + notice: + successfully_destroy: "Instituição excluÃda com sucesso." review: create: notice: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..30949bc2f0c097cf57601245dfe95020b912cb49 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +web: + build: . + volumes: + - .:/app + ports: + - "3000:3000" + links: + - db + - redis + - elasticsearch + +db: + image: postgres + +redis: + image: redis + +elasticsearch: + image: elasticsearch \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index bdf790ce69a68760e7d56175acd8e66d2c58cd74..6a870e6884d5c232d224ee6b7eccdbe389f2e22f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,7 @@ ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'minitest/mock' +require 'minitest/reporters' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. @@ -24,4 +25,5 @@ class ActiveSupport::TestCase # ActiveRecord::Base.subclasses.each(&:delete_all) # end + Minitest::Reporters.use! end