Class: Blogit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/blogit/configuration.rb

Constant Summary

REDCARPET_OPTIONS =

When using redcarpet as content parser, pass these options as defaults.

{
  hard_wrap: true,
  filter_html: true,
  autolink: true,
  no_intra_emphasis: true,
  fenced_code_blocks: true,
  gh_blockcode: true,
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/blogit/configuration.rb', line 101

def initialize
  @include_comments            = :active_record
  @disqus_shortname            = ""
  @include_share_bar           = false
  @twitter_username            = ""
  @current_blogger_method      = :current_user
  @blogger_display_name_method = :username
  @datetime_format             = :short
  @posts_per_page              = 5
  @authentication_method       = :login_required
  @author_edits_only           = false
  @ajax_comments               = true
  @include_admin_actions       = true
  @include_admin_links         = true
  @cache_pages                 = false
  @default_parser              = :markdown
  @highlight_code_syntax       = true
  @rss_feed_title              = "#{Rails.application.engine_name.titleize} Blog Posts"
  @rss_feed_description        = "#{Rails.application.engine_name.titleize} Blog Posts"
  @ping_search_engines         = false
  @redcarpet_options           = REDCARPET_OPTIONS
end

Instance Attribute Details

#ajax_commentsObject

If set to true, the comments form will POST and DELETE to the comments controller using AJAX calls. Defaults to true



50
51
52
# File 'lib/blogit/configuration.rb', line 50

def ajax_comments
  @ajax_comments
end

#authentication_methodObject

The name of the before filter we'll call to authenticate the current user. Defaults to :login_required



41
42
43
# File 'lib/blogit/configuration.rb', line 41

def authentication_method
  @authentication_method
end

#author_edits_onlyObject

If set to true, only the user who authored the post may, edit or destroy. Defaults to false



45
46
47
# File 'lib/blogit/configuration.rb', line 45

def author_edits_only
  @author_edits_only
end

#blogger_display_name_methodObject

what method do we call on blogger to return their display name? Defaults to :username



21
22
23
# File 'lib/blogit/configuration.rb', line 21

def blogger_display_name_method
  @blogger_display_name_method
end

#cache_pagesObject

Should the controllers cache the blog pages as HTML? Defaults to false



72
73
74
# File 'lib/blogit/configuration.rb', line 72

def cache_pages
  @cache_pages
end

#current_blogger_methodObject

The name of the controller method we'll call to return the current blogger.



17
18
19
# File 'lib/blogit/configuration.rb', line 17

def current_blogger_method
  @current_blogger_method
end

#datetime_formatObject

Which DateTime::FORMATS format do we use to display blog and comment publish time Defaults to :short



26
27
28
# File 'lib/blogit/configuration.rb', line 26

def datetime_format
  @datetime_format
end

#default_parserObject

The default format for parsing the blog content. Defaults to :markdown



64
65
66
# File 'lib/blogit/configuration.rb', line 64

def default_parser
  @default_parser
end

#disqus_shortnameObject

When using disqus comments, what is the shortname of your forum ?



8
9
10
# File 'lib/blogit/configuration.rb', line 8

def disqus_shortname
  @disqus_shortname
end

#highlight_code_syntaxObject

Note:
  • At the moment this only works when default_parser

is :markdown

Should text within ““`” or “`” be highlighted as code? Defaults to true



37
38
39
# File 'lib/blogit/configuration.rb', line 37

def highlight_code_syntax
  @highlight_code_syntax
end

#include_admin_actionsObject

If set to true, the create, edit, update and destroy actions will be included. If set to false, you'll have to set these yourself elsewhere in the app



55
56
57
# File 'lib/blogit/configuration.rb', line 55

def include_admin_actions
  @include_admin_actions
end

If set to true, links for new posts, editing posts and deleting comments will be available. If set to false, you'll have to set these yourself in the templates.



60
61
62
# File 'lib/blogit/configuration.rb', line 60

def include_admin_links
  @include_admin_links
end

#include_commentsObject

What kind of comments do you want to add to your blog ? (:active_record, :disqus or :no)



5
6
7
# File 'lib/blogit/configuration.rb', line 5

def include_comments
  @include_comments
end

#include_share_barObject

Should there be a share bar on every post ?



11
12
13
# File 'lib/blogit/configuration.rb', line 11

def include_share_bar
  @include_share_bar
end

#inline_main_app_named_routesObject

Should the routes of the main app be accessible without the “main_app.” prefix ?



84
85
86
# File 'lib/blogit/configuration.rb', line 84

def inline_main_app_named_routes
  @inline_main_app_named_routes
end

#ping_search_enginesObject

Should blogit ping search engines with your sitemap when posts are created, updated or destroyed? Defaults to false



89
90
91
# File 'lib/blogit/configuration.rb', line 89

def ping_search_engines
  @ping_search_engines
end

#posts_per_pageObject

Number of posts to show per page



31
32
33
# File 'lib/blogit/configuration.rb', line 31

def posts_per_page
  @posts_per_page
end

#redcarpet_optionsObject

When using redcarpet as content parser, pass these options as defaults Defaults to REDCARPET_OPTIONS



68
69
70
# File 'lib/blogit/configuration.rb', line 68

def redcarpet_options
  @redcarpet_options
end

#rss_feed_descriptionObject

The description of the RSS feed for the blog posts Defaults to “[Application Name] Blog Posts”



80
81
82
# File 'lib/blogit/configuration.rb', line 80

def rss_feed_description
  @rss_feed_description
end

#rss_feed_titleObject

The title of the RSS feed for the blog posts Defaults to “[Application Name] Blog Posts”



76
77
78
# File 'lib/blogit/configuration.rb', line 76

def rss_feed_title
  @rss_feed_title
end

#twitter_usernameObject

Twitter username used in the share bar



14
15
16
# File 'lib/blogit/configuration.rb', line 14

def twitter_username
  @twitter_username
end

Instance Method Details

#default_parser_classObject



124
125
126
# File 'lib/blogit/configuration.rb', line 124

def default_parser_class
  "Blogit::Parsers::#{@default_parser.to_s.classify}Parser".constantize
end

#rss_feed_language=(locale) ⇒ Object



146
147
148
# File 'lib/blogit/configuration.rb', line 146

def rss_feed_language=(locale)
  blogit_warn "#{self.class}#rss_feed_language has been deprecated. You can remove this from your blogit.rb configuration file"
end