Class: Inkling::Theme
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Inkling::Theme
- Includes:
- FileUtils
- Defined in:
- app/models/inkling/theme.rb
Overview
maintain one record which will theme the entire site for now
Constant Summary collapse
- @@default_content =
" <html>\n <head>\n <title>Your Inkling CMS</title>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"keywords\" content=\"\" />\n <meta name=\"description\" content=\"\" />\n </head>\n <body>\n\n This is the default theme for public users to view content on your site. <br/>\n \n An administrator should log into Inkling Administration and configure the 'content' theme. <br/>\n\n <div class=\"notice\"><%= notice %></div>\n <div class=\"alert\"><%= alert %></div>\n\n <div id=\"page\">\n <div id=\"main\">\n <%= yield %> \n </div>\n </div>\n\n <div id=\"footer\">\n <span id=\"version\" align='center'>Inkling version <%= Inkling::VERSION %></span>\n </div>\n\n\n </body>\n </html>\n"
Class Method Summary collapse
- .content ⇒ Object
-
.install_from_dir(dirname) ⇒ Object
takes a directory and recursively interns all structures there as a theme structure (just like any sub directory in app/views).
- .site_theme_file ⇒ Object
Instance Method Summary collapse
Class Method Details
.content ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/models/inkling/theme.rb', line 45 def self.content if Inkling::Theme.find_by_name("content").nil? self.create!(:name => "content", :body => @@default_content) end Inkling::Theme.find_by_name("content") end |
.install_from_dir(dirname) ⇒ Object
takes a directory and recursively interns all structures there as a theme structure (just like any sub directory in app/views)
59 60 61 |
# File 'app/models/inkling/theme.rb', line 59 def self.install_from_dir(dirname) end |
.site_theme_file ⇒ Object
53 54 55 |
# File 'app/models/inkling/theme.rb', line 53 def self.site_theme_file "#{Inkling::THEME_LAYOUTS_DIR}#{self.site.file_name}" end |
Instance Method Details
#check_init ⇒ Object
67 68 69 70 71 |
# File 'app/models/inkling/theme.rb', line 67 def check_init mkdir(Inkling::TMP_DIR) unless File.exist?(Inkling::TMP_DIR) mkdir("#{Inkling::THEMES_DIR}") unless File.exist?("#{Inkling::THEMES_DIR}") mkdir("#{Inkling::THEME_LAYOUTS_DIR}") unless File.exist?("#{Inkling::THEME_LAYOUTS_DIR}") end |
#delete_file ⇒ Object
73 74 75 |
# File 'app/models/inkling/theme.rb', line 73 def delete_file rm("#{Inkling::THEME_LAYOUTS_DIR}#{self.file_name}") end |
#file_name ⇒ Object
77 78 79 |
# File 'app/models/inkling/theme.rb', line 77 def file_name "#{self.name}#{self.extension}" end |
#write_file ⇒ Object
63 64 65 |
# File 'app/models/inkling/theme.rb', line 63 def write_file File.open("#{Inkling::THEME_LAYOUTS_DIR}#{self.file_name}", "w") {|f| f.write(self.body)} end |