Module: PublishMyData::ApplicationHelper

Defined in:
app/helpers/publish_my_data/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#appnameObject



14
15
16
# File 'app/helpers/publish_my_data/application_helper.rb', line 14

def appname
  PublishMyData.application_name
end

#bodyclass(c) ⇒ Object



4
5
6
# File 'app/helpers/publish_my_data/application_helper.rb', line 4

def bodyclass(c)
  @bodyclass = c;
end

#page_description(description) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/publish_my_data/application_helper.rb', line 18

def page_description(description)
  content_for :page_description do
    # should be content_tag(:meta, '', name: 'description', content:description)
    # but content tag doesn't generate valid html accoring to the w3c validator :(
    # content_tag(:meta, '', name: 'description', content: "hello world") => <meta content="hello world" name="description"></meta>
    if (description)
      raw "<meta name='description' content='#{description}'>"
    end
  end
end

#pagination_required?(resources, pagination_params) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/helpers/publish_my_data/application_helper.rb', line 29

def pagination_required?(resources, pagination_params)
  (resources.total_count > pagination_params.per_page)
end

#set_page_title(title = nil) ⇒ Object



8
9
10
11
12
# File 'app/helpers/publish_my_data/application_helper.rb', line 8

def set_page_title(title=nil)
  content_for :page_title do
    "| #{title}"
  end
end