Module: ApplicationHelper
- Defined in:
- app/helpers/application_helper.rb
Overview
Copyright 2011 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
- #error_messages_for(object) ⇒ Object
- #iqvoc_default_rdf_namespaces ⇒ Object
-
#item_listing(items, &block) ⇒ Object
Formats a list ob items or returns a remark if no items where given.
- #options_for_language_select(selected = nil) ⇒ Object
- #user_details(user) ⇒ Object
Instance Method Details
#error_messages_for(object) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/helpers/application_helper.rb', line 50 def (object) if object.errors.any? content_tag :ul, :class => "flash_error error_list" do object.errors..each do |msg| concat(content_tag(:li, msg)) end end end end |
#iqvoc_default_rdf_namespaces ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/application_helper.rb', line 19 def iqvoc_default_rdf_namespaces Iqvoc.rdf_namespaces.merge({ :default => root_url(:format => nil, :lang => nil, :trailing_slash => true).gsub(/\/\/$/, "/"), # gsub because of a Rails bug :-( :coll => collections_url(:trailing_slash => true, :lang => nil, :format => nil), :schema => controller.schema_url(:format => nil, :anchor => "", :lang => nil) }) end |
#item_listing(items, &block) ⇒ Object
Formats a list ob items or returns a remark if no items where given
38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/application_helper.rb', line 38 def item_listing(items, &block) return content_tag :p, "-", :class => 'term-unavailable' if items.empty? content_tag :ul, :class => "entity_list" do items.map do |item| content_tag :li, :class => (items.last == item ? "last-child" : "") do block.call(item) end end.join("\n").html_safe end end |
#options_for_language_select(selected = nil) ⇒ Object
27 28 29 30 31 |
# File 'app/helpers/application_helper.rb', line 27 def (selected = nil) locales_collection = Iqvoc.available_languages.map { |l| [l, l] } (locales_collection, selected) end |
#user_details(user) ⇒ Object
33 34 35 |
# File 'app/helpers/application_helper.rb', line 33 def user_details(user) "#{user.name} (#{user.telephone_number})" end |