Module: DashboardHelper
- Defined in:
- app/helpers/dashboard_helper.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
- #consistency_status(item) ⇒ Object
- #link_to_dashboard_item(item) ⇒ Object
- #sorting_controls_for(name) ⇒ Object
- #sorting_params ⇒ Object
Instance Method Details
#consistency_status(item) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/dashboard_helper.rb', line 27 def consistency_status(item) css, msg = if item.publishable? ['valid', '✓'] else ['invalid', '✗'] end content_tag :span, raw(msg), class: css end |
#link_to_dashboard_item(item) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/dashboard_helper.rb', line 37 def link_to_dashboard_item(item) if item.is_a?(Label::Base) item.published? ? label_path(id: item.origin) : label_path(published: 0, id: item.origin) elsif item.is_a?(Collection::Base) item.published? ? collection_path(id: item.origin) : collection_path(published: 0, id: item.origin) else item.published? ? concept_path(id: item.origin) : concept_path(published: 0, id: item.origin) end end |
#sorting_controls_for(name) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/helpers/dashboard_helper.rb', line 18 def sorting_controls_for(name) content_tag :div, class: 'sorting-controls' do link_to(icon('arrow-circle-o-up', 'sorting-arrow'), sorting_params.merge({ sort: "#{name} ASC" })) + link_to(icon('arrow-circle-o-down', 'sorting-arrow'), sorting_params.merge({ sort: "#{name} DESC" })) end end |
#sorting_params ⇒ Object
47 48 49 |
# File 'app/helpers/dashboard_helper.rb', line 47 def sorting_params sorting_params = params.permit(:sort, :check_consistency) end |