diff --git a/app/assets/stylesheets/application/feedbacks.scss b/app/assets/stylesheets/application/feedbacks.scss index b779a8b96e2d27edbcf4055c779f987105023805..6e6e94f97c6792a2b9d51a0ce7a45859f0950c8b 100644 --- a/app/assets/stylesheets/application/feedbacks.scss +++ b/app/assets/stylesheets/application/feedbacks.scss @@ -1,7 +1,25 @@ /** Feedback Buttons **/ -.report_bug, .send_feedback {position: fixed; bottom: 0; height: 30px; width: auto; padding: 5px; z-index: 999;} -.report_bug {left: 25%; background-color: #730E15; color: white;} -.send_feedback {right: 25%; background-color: #ffae0d; color: black;} +// .report_bug, .send_feedback {position: fixed; bottom: 0; height: 30px; width: auto; padding: 5px; z-index: 999;} +// .report_bug {left: 25%; background-color: #730E15; color: white;} +// .send_feedback {right: 25%; background-color: #ffae0d; color: black;} +.report_bug { + position: fixed; + bottom: 0; + color:maroon !important; + text-shadow:1px 1px 0 white, + -1px -1px 0 white, + 1px -1px 0 white, + -1px 1px 0 white, + 0px 1px 0 white, + 1px 0px 0 white, + 0px -1px 0 white, + -1px 0px 0 white; + width: auto; + text-align: center; + padding: 5px; + z-index: 999; + right: 0; +} /** Forms **/ -.feedback-modal-form-textarea { height: 200px; } \ No newline at end of file +.feedback-modal-form-textarea { height: 200px; } diff --git a/app/models/learning_object.rb b/app/models/learning_object.rb index d941a4170369ba185cf31e755df2bf4ab3e992fd..cb26659b66731306cb5f7e75c28b42f6451dba2e 100644 --- a/app/models/learning_object.rb +++ b/app/models/learning_object.rb @@ -18,11 +18,11 @@ class LearningObject < ActiveRecord::Base belongs_to :object_type belongs_to :attachment, class_name: 'LearningObject::Attachment' - validates_presence_of :name, :publisher, :object_type, :language, :topics, :author, :school_level + validates_presence_of :name, :publisher, :object_type, :language, :author validates :id_dspace, presence: true, uniqueness: true, unless: Proc.new { |lo| lo.is_draft? } searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type] - default_scope { includes(:object_type, :attachments, :attachment, :publisher, :topics).order(score: :desc) } + default_scope { includes(:object_type, :attachments, :attachment, :topics).order(score: :desc) } scope :missing_thumbnail, ->() { where(thumbnail_file_name: nil) } def search_data diff --git a/app/policies/collection_policy.rb b/app/policies/collection_policy.rb index ecb2a4833b0bb580d17a71c8bba4999cf52895ac..e24b8c1ce29c0469397484ac0306466c1d841cac 100644 --- a/app/policies/collection_policy.rb +++ b/app/policies/collection_policy.rb @@ -1,4 +1,6 @@ class CollectionPolicy < ApplicationPolicy + include SociablePolicy + include FollowablePolicy def create? record if user_exists? diff --git a/app/policies/followable_policy.rb b/app/policies/followable_policy.rb new file mode 100644 index 0000000000000000000000000000000000000000..17aba92708f7ba0ea0ddd702d95a22cb1fc1c3e6 --- /dev/null +++ b/app/policies/followable_policy.rb @@ -0,0 +1,10 @@ +module FollowablePolicy + + def follow? + record if user_exists? + end + + def unfollow? + record if user_exists? + end +end diff --git a/app/policies/learning_object_policy.rb b/app/policies/learning_object_policy.rb index 15b25f333079c548a62c1c5b67f70c677be5ff2b..e91c7db7122b4e0b2587d97586ce3dd223ee71f8 100644 --- a/app/policies/learning_object_policy.rb +++ b/app/policies/learning_object_policy.rb @@ -1,4 +1,7 @@ class LearningObjectPolicy < ApplicationPolicy + include SociablePolicy + include ReportablePolicy + class Scope < Scope def resolve if user.nil? diff --git a/app/policies/reportable_policy.rb b/app/policies/reportable_policy.rb new file mode 100644 index 0000000000000000000000000000000000000000..e7a36a5d7e66f73174ceeb151bc56f55b10af5a3 --- /dev/null +++ b/app/policies/reportable_policy.rb @@ -0,0 +1,10 @@ +module ReportablePolicy + + def report_object? + record if user_exists? + end + + def set_complaint_messages? + record if user_exists? + end +end diff --git a/app/policies/sociable_policy.rb b/app/policies/sociable_policy.rb new file mode 100644 index 0000000000000000000000000000000000000000..ca646cc8c3f3abd40d899f960d8bbba6c61b0c9d --- /dev/null +++ b/app/policies/sociable_policy.rb @@ -0,0 +1,18 @@ +module SociablePolicy + + def like? + record if user_exists? + end + + def dislike? + record if user_exists? + end + + def liked? + record if user_exists? + end + + def download? + record if user_exists? + end +end diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index 5fc8e5841ac35d03b0d0324b9574f0065f97e0e3..9e4a7612da1c85ee55511fb816a30780ac4054b0 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -1,4 +1,6 @@ class UserPolicy < ApplicationPolicy + include FollowablePolicy + def show? record if user_exists? end @@ -7,11 +9,4 @@ class UserPolicy < ApplicationPolicy record end - def follow? - record if user_exists? - end - - def unfollow? - record if user_exists? - end end diff --git a/app/services/dspace/learning_object_importer.rb b/app/services/dspace/learning_object_importer.rb index 6e250dcbb78fa4d1e13e9513f59de6353e194307..d57517435ea68215d04f1ca0ff4542088f174b67 100644 --- a/app/services/dspace/learning_object_importer.rb +++ b/app/services/dspace/learning_object_importer.rb @@ -28,8 +28,8 @@ class Dspace::LearningObjectImporter end end - def item_exists? item - LearningObject.exists? id_dspace: item.id + def item_exists?(item) + LearningObject.where(id_dspace: item.id).exists? end end diff --git a/app/views/shared/application/_feedback.html.erb b/app/views/shared/application/_feedback.html.erb index f5ee2e05df88491673385f862ac2c2274ea9ff22..504f6248ac2e7085be9c22f97b00e3daed524768 100644 --- a/app/views/shared/application/_feedback.html.erb +++ b/app/views/shared/application/_feedback.html.erb @@ -1,2 +1,2 @@ -<a href="#report_bug" class="report_bug">Está com problemas? Clique aqui e nos mantenha informado.</a> -<!-- <a href="#send_feedback" class="send_feedback">Mande seu feedback!</a> --> \ No newline at end of file +<a href="#report_bug" class="report_bug"><i class="fa fa-bug" style=""></i> relatar problema</a> +<!-- <a href="#send_feedback" class="send_feedback">Mande seu feedback!</a> --> diff --git a/config/database.yml b/config/database.yml index c68c4605a5035d0c0e3038c30f3c01f8d26c363f..3b40ba589c8c0f29a9563677dafa1bfaa7db72e7 100644 --- a/config/database.yml +++ b/config/database.yml @@ -17,6 +17,7 @@ test: production: <<: *defaults + host: <%= ENV['PORTALMEC_DB_HOST'] %> database: <%= ENV['PORTALMEC_DB_NAME'] %> username: <%= ENV['PORTALMEC_DB_USERNAME'] %> password: <%= ENV['PORTALMEC_DB_PASSWORD'] %> diff --git a/config/env_vars.sh b/config/env_vars.sh index 297e8dfc99eb55ca72f8d1592c88260854d77667..23a1ea104a2ec9fdfe525c13636d1959810aebcd 100644 --- a/config/env_vars.sh +++ b/config/env_vars.sh @@ -4,17 +4,11 @@ export SECRET_TOKEN=$(rake secret) export SECRET_KEY_BASE=$(rake secret) ### Postgres/Active Record credentials +export PORTALMEC_DB_HOST=localhost export PORTALMEC_DB_NAME=portalmec export PORTALMEC_DB_USERNAME= export PORTALMEC_DB_PASSWORD= -### OrientDB credentials -export PORTALMEC_ORIENTDB_HOST=localhost -export PORTALMEC_ORIENTDB_DATABASE=portalmec -export PORTALMEC_ORIENTDB_USERNAME= -export PORTALMEC_ORIENTDB_PASSWD= -export PORTALMEC_ORIENTDB_PORT=2480 - ### Dspace credentials export PORTALMEC_DSPACE_LOGIN= export PORTALMEC_DSPACE_PASSWORD= diff --git a/db/migrate/20160124145100_create_object_types.rb b/db/migrate/20160124145100_create_object_types.rb new file mode 100644 index 0000000000000000000000000000000000000000..74917748b4aa98e279ece1006f585a2e2c9d3db8 --- /dev/null +++ b/db/migrate/20160124145100_create_object_types.rb @@ -0,0 +1,7 @@ +class CreateObjectTypes < ActiveRecord::Migration + def change + create_table :object_types do |t| + t.string :name + end + end +end diff --git a/lib/tasks/portalmec.rake b/lib/tasks/portalmec.rake index bd9da76ac1c5861939ebf7eb583516170e88afc6..9eb27b7621214b988866fddcd5f359a8d7e0db79 100644 --- a/lib/tasks/portalmec.rake +++ b/lib/tasks/portalmec.rake @@ -1,8 +1,6 @@ namespace :portalmec do - desc 'setup initial environment' task :setup do - # runs db:drop db:create db:migrate Rake::Task['db:migrate:reset'].invoke Rake::Task['db:seed'].invoke @@ -10,10 +8,9 @@ namespace :portalmec do Rake::Task['import:learning_objects'].invoke Rake::Task['import:topics'].invoke Rake::Task['topics:define_defaults'].invoke + Rake::Task['object_type:restart'].invoke - puts "\n Want to generate thumnails? [Y/N]" - answer = STDIN.gets.chomp - Rake::Task['thumbnail:create_missing'].invoke if answer =~ /y/i + Rake::Task['attachments:set_unknown'].invoke + Rake::Task['thumbnail:create_missing'].invoke end - end