Class: ActionAdmin::SeoAnalysisInput
- Inherits:
-
SimpleForm::Inputs::Base
- Object
- SimpleForm::Inputs::Base
- ActionAdmin::SeoAnalysisInput
- Defined in:
- app/inputs/action_admin/seo_analysis_input.rb
Instance Method Summary collapse
- #base_url ⇒ Object
- #description_hidden_field ⇒ Object
- #input(wrapper_options) ⇒ Object
- #keywords_hidden_field ⇒ Object
- #label(wrapper_options) ⇒ Object
- #score_hidden_field ⇒ Object
- #seo_keyword ⇒ Object
- #seo_output ⇒ Object
- #seo_preview ⇒ Object
- #slug_hidden_field ⇒ Object
- #title_hidden_field ⇒ Object
Instance Method Details
#base_url ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 28 def base_url url_value = object.try(.fetch :slug, :slug) method = .fetch :url, ActionAdmin.config.app_urls if object.new_record? template.root_url.chomp('/') else template.try(method, object).to_s.sub(url_value, '').chomp('/') end end |
#description_hidden_field ⇒ Object
59 60 61 62 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 59 def description_hidden_field attrib = .fetch :description, :seo_description @builder.hidden_field(attrib, data: { default: attribute_default(attrib) }) end |
#input(wrapper_options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 3 def input() = { seo_analysis: '', base_url: base_url, text: text_html_id, slug: id_from_html(slug_hidden_field), title: id_from_html(title_hidden_field), meta: id_from_html(description_hidden_field), keywords: id_from_html(keywords_hidden_field), score: id_from_html(score_hidden_field) } template.content_tag :div, class: 'seo-analysis', data: do template.concat title_hidden_field template.concat description_hidden_field template.concat keywords_hidden_field template.concat score_hidden_field template.concat slug_hidden_field if [:slug_input].present? template.concat seo_keyword template.concat seo_preview template.concat seo_output end end |
#keywords_hidden_field ⇒ Object
64 65 66 67 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 64 def keywords_hidden_field attrib = .fetch :keywords, :seo_keywords @builder.hidden_field(attrib, data: { default: attribute_default(attrib) }) end |
#label(wrapper_options) ⇒ Object
79 80 81 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 79 def label() '' end |
#score_hidden_field ⇒ Object
74 75 76 77 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 74 def score_hidden_field attrib = .fetch :score, :seo_score @builder.hidden_field(attrib, data: { default: attribute_default(attrib) }) end |
#seo_keyword ⇒ Object
39 40 41 42 43 44 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 39 def seo_keyword attrib = .fetch :focus_keyword, :seo_focus_keyword content = @builder.text_field(attrib, placeholder: 'Enter focus keyword...', data: { seo_keyword: '' }) content_tag :div, content, class: 'seo-keyword' end |
#seo_output ⇒ Object
50 51 52 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 50 def seo_output content_tag :div, nil, class: 'seo-output', data: { seo_output: '' } end |
#seo_preview ⇒ Object
46 47 48 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 46 def seo_preview content_tag :div, nil, class: 'seo-preview', data: { seo_preview: '' } end |
#slug_hidden_field ⇒ Object
69 70 71 72 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 69 def slug_hidden_field attrib = .fetch :slug, :slug @builder.hidden_field(attrib, data: { default: attribute_default(attrib) }) end |
#title_hidden_field ⇒ Object
54 55 56 57 |
# File 'app/inputs/action_admin/seo_analysis_input.rb', line 54 def title_hidden_field attrib = .fetch :title, :seo_title @builder.hidden_field(attrib, data: { default: attribute_default(attrib) }) end |