Class: DashboardController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DashboardController
- Defined in:
- app/controllers/dashboard_controller.rb
Overview
Copyright 2011-2013 innoQ Deutschland GmbH
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Instance Method Summary collapse
Instance Method Details
#collection_index ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/dashboard_controller.rb', line 41 def collection_index :use, :dashboard collections = Iqvoc::Collection.base_class.for_dashboard.load if params[:sort] && params[:sort].include?('state ') sort = params[:sort].split(',').select { |s| s.include? 'state ' }.last.gsub('state ', '') collections = collections.to_a.sort_by { |c| c.state } collections = sort == 'DESC' ? collections.reverse : collections elsif params[:sort] order_params = sanatize_order params[:sort] order_params = order_params.gsub('value', 'labels.value').gsub('locking_user', 'users.surname').gsub('updated_at', 'concepts.updated_at') collections = collections.includes(:pref_labels, :locking_user).references(:pref_labels).references(:locking_user).order(order_params) end @items = Kaminari.paginate_array(collections).page(params[:page]) render 'index', locals: { active_class: Iqvoc::Collection.base_class } end |
#concept_index ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/dashboard_controller.rb', line 18 def concept_index :use, :dashboard concepts = Iqvoc::Concept.base_class.for_dashboard.load if params[:sort] && params[:sort].include?('state ') sort = params[:sort].split(',').select { |s| s.include? 'state ' }.last.gsub('state ', '') concepts = concepts.to_a.sort_by { |c| c.state } concepts = sort == 'DESC' ? concepts.reverse : concepts elsif params[:sort] order_params = params[:sort] #FIXME: how to order by state in database? order_params = sanatize_order order_params order_params = order_params.gsub('value', 'labels.value').gsub('locking_user', 'users.surname').gsub('follow_up', 'concepts.follow_up').gsub('updated_at', 'concepts.updated_at') concepts = concepts.includes(:pref_labels, :locking_user).references(:pref_labels).references(:locking_user).order(order_params) end @items = Kaminari.paginate_array(concepts).page(params[:page]) render 'index', locals: { active_class: Iqvoc::Concept.base_class } end |
#glance ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/dashboard_controller.rb', line 62 def glance :use, :dashboard objects = params[:type].constantize.by_origin(params[:origin]) object = objects.send(params[:published] == "1" ? 'published' : 'unpublished').first @title = object.to_s @editorial_notes = Note::SKOS::EditorialNote.where(owner_id: object.id, owner_type: object.class) @path = send(object.class_path, id: object, published: params[:published]) respond_to do |format| format.html do render layout: false end end end |
#reset ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'app/controllers/dashboard_controller.rb', line 79 def reset :reset, :thesaurus if request.post? DatabaseCleaner.strategy = :truncation, { except: Iqvoc.truncation_blacklist } DatabaseCleaner.clean flash.now[:success] = t('txt.views.dashboard.reset_success') else flash.now[:danger] = t('txt.views.dashboard.reset_warning') flash.now[:error] = t('txt.views.dashboard.jobs_pending_warning') if Delayed::Job.any? end end |