Module: AppyantraAdmin::ApplicationHelper
- Defined in:
- app/helpers/appyantra_admin/application_helper.rb
Instance Method Summary collapse
-
#asset_display_field(asset_class_name) ⇒ Object
displays the name of the first field of a model.
-
#asset_display_name(asset) ⇒ Object
displays the value of the first field of a model object (asset).
- #breadcrumb ⇒ Object
- #display_date(date) ⇒ Object
- #fetch_activity_feeds ⇒ Object
- #google_analytics_script ⇒ Object
- #include_rich_text_editor ⇒ Object
- #page_title ⇒ Object
- #path_for(slug) ⇒ Object
- #setting_value(entity_name, default = 'Not Set') ⇒ Object
Instance Method Details
#asset_display_field(asset_class_name) ⇒ Object
displays the name of the first field of a model
28 29 30 31 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 28 def asset_display_field(asset_class_name) asset_class = eval asset_class_name asset_class.column_names[1].capitalize end |
#asset_display_name(asset) ⇒ Object
displays the value of the first field of a model object (asset)
34 35 36 37 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 34 def asset_display_name(asset) field_name = asset.class.column_names[1] asset[field_name] end |
#breadcrumb ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 15 def = '' if @breadcrumbs while !@breadcrumbs.empty? do = @breadcrumbs.pop << "<a href='#{[1]}'>#{[0]}</a><div class='breadcrumb_divider'></div>" end << "<a class='current'>#{@current_breadcrumb}</a>" end end |
#display_date(date) ⇒ Object
2 3 4 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 2 def display_date(date) date.strftime("%m-%d-%Y %H:%M") end |
#fetch_activity_feeds ⇒ Object
70 71 72 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 70 def fetch_activity_feeds ActivityFeed.latest end |
#google_analytics_script ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 61 def google_analytics_script analytics_settings = AdminSetting.group_settings('Google Analytics') if analytics_settings.has_key?(:tracking_code) && analytics_settings.has_key?(:domain) tracking_code = analytics_settings[:tracking_code] domain = analytics_settings[:domain] render partial: '/pages/google_analytics', locals: { analytics_tracking_code: tracking_code, analytics_domain: domain } end end |
#include_rich_text_editor ⇒ Object
55 56 57 58 59 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 55 def include_rich_text_editor if AdminSetting.value_of('rich_text_editor') == 'ckeditor' javascript_include_tag "ckeditor/ckeditor.js" end end |
#page_title ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 39 def page_title if @page @page.title elsif @page_title @page_title end end |
#path_for(slug) ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 47 def path_for slug if Page.where(slug: slug).exists? main_app.display_page_path(slug) else '#' end end |
#setting_value(entity_name, default = 'Not Set') ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/helpers/appyantra_admin/application_helper.rb', line 6 def setting_value(entity_name, default='Not Set') setting = AdminSetting.find_by_name(entity_name) if setting && setting.entity render partial: "/appyantra_admin/shared/types/#{setting.entity.class.name.underscore}", locals: { entity: setting.entity} else default end end |