Class: Goldencobra::ArticletypePresenter
- Inherits:
-
Object
- Object
- Goldencobra::ArticletypePresenter
- Defined in:
- app/presenters/goldencobra/articletype_presenter.rb
Constant Summary collapse
- METATAG_FIELDS =
{ metatag_title_tag: :meta_tag_title_tag, metatag_meta_description: :meta_tag_meta_description, metatag_open_graph_title: :meta_tag_open_graph_title, metatag_open_graph_description: :meta_tag_open_graph_description, metatag_open_graph_type: :meta_tag_open_graph_type, metatag_open_graph_url: :meta_tag_open_graph_url, metatag_open_graph_image: :meta_tag_open_graph_image }.freeze
Instance Method Summary collapse
- #active_since ⇒ Object
- #article_images ⇒ Object
- #author ⇒ Object
-
#breadcrumb ⇒ Object
Info: breadcrumb muss hier, obwohl default Feld, extra definiert werden, da es einen NavigationHelper gibt mit selbigem Namen.
- #commentable ⇒ Object
- #content ⇒ Object
- #context_info ⇒ Object
- #creator ⇒ Object
- #dynamic_redirection ⇒ Object
- #enable_social_sharing ⇒ Object
- #frontend_tag_list ⇒ Object
- #index__article_descendents_depth ⇒ Object
- #index__article_for_index_id ⇒ Object
-
#index__display_index_articles ⇒ Object
Index Methods.
- #index__display_index_articletypes ⇒ Object
- #index__display_index_types ⇒ Object
- #index__index_of_articles_tagged_with ⇒ Object
- #index__not_tagged_with ⇒ Object
- #index__reverse_sort ⇒ Object
- #index__sort_order ⇒ Object
- #index__sorter_limit ⇒ Object
-
#initialize(f, articletype) ⇒ ArticletypePresenter
constructor
A new instance of ArticletypePresenter.
-
#metatags ⇒ Object
Deprecated Methods.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
Alle nicht vom default abweichenden Artikel Methoden werden herüber abgefangen, es sei denn es gibt einen Helper, der den selben Namen hat wie die Methode (Bsp. breadcrumb) - ätzend.
- #parent_id ⇒ Object
- #permissions ⇒ Object
- #state ⇒ Object
- #summary ⇒ Object
- #tag_list ⇒ Object
- #teaser ⇒ Object
- #widgets ⇒ Object
Constructor Details
#initialize(f, articletype) ⇒ ArticletypePresenter
Returns a new instance of ArticletypePresenter.
5 6 7 8 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 5 def initialize(f, articletype) @f = f @articletype = articletype end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
Alle nicht vom default abweichenden Artikel Methoden werden herüber abgefangen, es sei denn es gibt einen Helper, der den selben Namen hat wie die Methode (Bsp. breadcrumb) - ätzend
211 212 213 214 215 216 217 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 211 def method_missing(method_name, *arguments, &block) if @f.object.respond_to?(method_name) input_form_for(method_name.to_sym) else super end end |
Instance Method Details
#active_since ⇒ Object
45 46 47 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 45 def active_since input_form_for(:active_since, as: :string, input_html: { size: "20" }) end |
#article_images ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 121 def article_images @f.has_many :article_images, heading: "", new_record: "+ hinzufügen" do |ai| ai.input :image, as: :select, collection: Goldencobra::Upload.where(id: ai.object.image_id).map { |c| [c.complete_list_name, c.id] }, input_html: { class: "article_image_file chosen-select-deselect get_goldencobra_uploads_per_remote", style: "width: 80%;", "data-placeholder" => "Bitte warten" }, label: "Medium wählen", include_blank: false ai.input :position, as: :select, collection: Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip), include_blank: false ai.input :_destroy, as: :boolean, label: "Löschen" end end |
#author ⇒ Object
233 234 235 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 233 def warn("Deprecated method author") end |
#breadcrumb ⇒ Object
Info: breadcrumb muss hier, obwohl default Feld, extra definiert werden, da es einen NavigationHelper gibt mit selbigem Namen. Somit greift method_missing nicht.
12 13 14 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 12 def input_form_for(:breadcrumb) end |
#commentable ⇒ Object
229 230 231 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 229 def commentable warn("Deprecated method commentable") end |
#content ⇒ Object
33 34 35 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 33 def content input_form_for(:content, input_html: { class: "html-textarea" }) end |
#context_info ⇒ Object
49 50 51 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 49 def context_info input_form_for(:context_info, input_html: { class: "html-textarea" }) end |
#creator ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 53 def creator @f.input :creator_id, as: :select, collection: User.all.map { |u| [u.title, u.id] }, include_blank: true, hint: I18n.t("goldencobra.article_field_hints.creator") end |
#dynamic_redirection ⇒ Object
92 93 94 95 96 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 92 def dynamic_redirection collection = Goldencobra::Article::DynamicRedirectOptions.map { |a| [a[1], a[0]] } input_form_for(:dynamic_redirection, as: :select, collection: collection, include_blank: false) end |
#enable_social_sharing ⇒ Object
225 226 227 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 225 def warn("Deprecated method enable_social_sharing") end |
#frontend_tag_list ⇒ Object
75 76 77 78 79 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 75 def frontend_tag_list @f.input :frontend_tag_list, hint: I18n.t("goldencobra.article_field_hints.frontend_tag_list"), input_html: { value: @f.object.frontend_tag_list.join(", ") } end |
#index__article_descendents_depth ⇒ Object
153 154 155 156 157 158 159 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 153 def index__article_descendents_depth @f.input :index_of_articles_descendents_depth, as: :select, collection: [["1 Ebene", "1"], ["2 Ebenen", "2"], ["3 Ebenen", "3"], %w(Alle all)], include_blank: false, label: I18n.t("active_admin.articles.index.views.label4"), hint: I18n.t("active_admin.articles.index.views.hint4") end |
#index__article_for_index_id ⇒ Object
143 144 145 146 147 148 149 150 151 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 143 def index__article_for_index_id collection = Goldencobra::Article.articles_for_index_selecetion @f.input :article_for_index_id, label: I18n.t("active_admin.articles.index.views.label1"), hint: I18n.t("active_admin.articles.index.views.hint1"), as: :select, collection: collection, include_blank: "/", id: "article_event_articleindex_id", input_html: { class: "chosen-select", style: "width: 80%;" } end |
#index__display_index_articles ⇒ Object
Index Methods
138 139 140 141 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 138 def index__display_index_articles @f.input :display_index_articles, label: I18n.t("active_admin.articles.index.views.display_index_articles.label"), hint: I18n.t("active_admin.articles.index.views.display_index_articles.hint") end |
#index__display_index_articletypes ⇒ Object
170 171 172 173 174 175 176 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 170 def index__display_index_articletypes @f.input :display_index_articletypes, label: I18n.t("active_admin.articles.index.views.label3"), hint: I18n.t("active_admin.articles.index.views.hint3"), as: :select, collection: ["all"] + Goldencobra::Article.article_types_for_search, include_blank: false end |
#index__display_index_types ⇒ Object
161 162 163 164 165 166 167 168 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 161 def index__display_index_types @f.input :display_index_types, label: I18n.t("active_admin.articles.index.views.label2"), hint: I18n.t("active_admin.articles.index.views.hint2"), as: :select, collection: Goldencobra::Article::DisplayIndexTypes, include_blank: false end |
#index__index_of_articles_tagged_with ⇒ Object
178 179 180 181 182 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 178 def index__index_of_articles_tagged_with @f.input :index_of_articles_tagged_with, label: "Artikel mit folgenden Tags", hint: "Auf der Übersichtsseite werden alle Artikel des gleichen Artikeltyps mit diesen Tags ausgegeben. Sind keine Tags angegeben, werden alle Artikel des gleichen Artikeltyps ausgegeben." end |
#index__not_tagged_with ⇒ Object
184 185 186 187 188 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 184 def index__not_tagged_with @f.input :not_tagged_with, label: "Artikel ohne folgende Tags", hint: "Artikel mit diesen Tags nicht anzeigen!" end |
#index__reverse_sort ⇒ Object
205 206 207 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 205 def index__reverse_sort @f.input :reverse_sort, hint: "Soll absteigend sortiert werden? Standard: aufsteigend" end |
#index__sort_order ⇒ Object
196 197 198 199 200 201 202 203 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 196 def index__sort_order = Goldencobra::Article::SortOptions + Array(@f.object..try(:sort_options)) @f.input :sort_order, hint: "Created_at - Reihenfolge nach Erstellungsdatum | Updated_at - Reihenfolge nach Aktualisierungsdatum | Random - Reihenfolge zufällig | Alphabetically - Reihenfolge alphabetisch | GlobalSortID - Reihenfolge nach globaler Sortiernummer im Einzelartikel", as: :select, collection: , include_blank: false end |
#index__sorter_limit ⇒ Object
190 191 192 193 194 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 190 def index__sorter_limit @f.input :sorter_limit, label: "Anzahl anzuzeigender Artikel", hint: "Wieviel Artikel sollen maximal auf der Übersichtsseite erscheinen?" end |
#metatags ⇒ Object
Deprecated Methods
221 222 223 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 221 def warn("Deprecated method metatags") end |
#parent_id ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 81 def parent_id css_name = "get_goldencobra_articles_per_remote" + (@f.object.startpage ? " include_blank_true " : " include_blank_false ") collection = [[@f.object.try(:parent).try(:parent_path), @f.object.try(:parent).try(:id)]] input_form_for(:parent_id, as: :select, collection: collection, input_html: { class: css_name }, style: "width: 80%;", dataplaceholder: "Elternelement auswählen") end |
#permissions ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 98 def @f.has_many :permissions do |p| p.input :domain, include_blank: "Alle" p.input :role, include_blank: "Alle" p.input :action, as: :select, collection: Goldencobra::Permission::PossibleActions, include_blank: false p.input :_destroy, as: :boolean end end |
#state ⇒ Object
61 62 63 64 65 66 67 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 61 def state @f.input :state, as: :select, collection: Goldencobra::Article.state_attributes_for_select, include_blank: false, hint: I18n.t("goldencobra.article_field_hints.state") end |
#summary ⇒ Object
41 42 43 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 41 def summary input_form_for(:summary, input_html: { rows: 5, class: "html-textarea" }) end |
#tag_list ⇒ Object
69 70 71 72 73 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 69 def tag_list @f.input :tag_list, hint: I18n.t("goldencobra.article_field_hints.tag_list"), input_html: { value: @f.object.tag_list.join(", ") } end |
#teaser ⇒ Object
37 38 39 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 37 def input_form_for(:teaser, input_html: { rows: 5 }) end |
#widgets ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'app/presenters/goldencobra/articletype_presenter.rb', line 108 def Goldencobra::Widget.tag_counts_on(:tags).map(&:name).each do |wtag| @f.inputs "Position: #{wtag}" do @f.input :widgets, as: :select, collection: Goldencobra::Widget.tagged_with(wtag), input_html: { class: "chosen-select", style: "width: 80%; margin-left:20%", "data-placeholder" => "Widgets auswählen" }, wrapper_html: { class: "hidden_label" } end end end |