diff --git a/app/admin.rb b/app/admin.rb index 675749d..827c8c8 100644 --- a/app/admin.rb +++ b/app/admin.rb @@ -1,5 +1,5 @@ module Roam - class Admin < App + class AdminApp < App register Mustache::Sinatra diff --git a/app/user.rb b/app/user.rb index 122232f..7ec3153 100644 --- a/app/user.rb +++ b/app/user.rb @@ -1,5 +1,5 @@ module Roam - class User < App + class UserApp < App # Require mustache views Dir["views/user/*.rb"].sort.each {|req| require req} @@ -44,7 +44,7 @@ def cache # # The site variable is added automatically as it is required # mustache(:page, :page => page) - # UserApp::Views::Page.new(:site => site, :page => page).render + # User::Views::Page.new(:site => site, :page => page).render def mustache(template, args={}, layout=true) args = args.update(:site => site, :site_tags => tags) layout_class = UserApp::Views::Layout diff --git a/config.ru b/config.ru index c1c4590..d43f3f3 100644 --- a/config.ru +++ b/config.ru @@ -2,6 +2,6 @@ $: << File.join(File.dirname(__FILE__)) require 'init' run Rack::URLMap.new( - '/' => Roam::User.new, - '/admin' => Roam::Admin.new + '/' => Roam::UserApp.new, + '/admin' => Roam::AdminApp.new ) \ No newline at end of file diff --git a/models/post.rb b/models/post.rb index ef33383..51e7826 100644 --- a/models/post.rb +++ b/models/post.rb @@ -95,10 +95,6 @@ def self.tags matic_accessor :title, :body, :author, :slug, :published_at, :tags - def tags - self[:tags].to_a - end - def validate %w{ title author body}.each do |attr| errors.add(attr, 'is required') if self[attr].blank? @@ -106,17 +102,13 @@ def validate end def before_insert_or_update + split_tags generate_slug + parse_published end - def tags=(list) - list = list.split(%r{,\s*}).uniq if list.is_a?(String) - self[:tags] = list - end - - def published_at=(publish) - publish = Chronic.parse(publish) if publish.is_a?(String) - self[:published_at] = publish.utc if publish.is_a?(Time) + def tags + self[:tags].to_a end def html @@ -133,6 +125,11 @@ def active? protected + def split_tags + list = self[:tags].split(%r{,\s*}).uniq if self[:tags].is_a?(String) + self[:tags] = list + end + def generate_slug return nil if title.empty? date = published_at.is_a?(Time) ? published_at : Time.now.in_time_zone @@ -140,4 +137,9 @@ def generate_slug self.slug = "#{prefix}-#{title.slugize}" end + def parse_published + publish = Chronic.parse(self[:published_at]) if self[:published_at].is_a?(String) + self[:published_at] = publish.is_a?(Time) ? publish.utc : nil + end + end diff --git a/models/site.rb b/models/site.rb index 90ba180..1d74c3b 100644 --- a/models/site.rb +++ b/models/site.rb @@ -31,7 +31,7 @@ def design def design=(design) self.design_id = design.id.to_s - save + update end protected diff --git a/models/user.rb b/models/user.rb index f107bb6..d52e7ea 100644 --- a/models/user.rb +++ b/models/user.rb @@ -48,7 +48,7 @@ def before_insert_or_update def record_login self.login_at = Time.now.utc - save + update end protected diff --git a/views/admin/design.rb b/views/admin/design.rb index 1c6384e..75e5cbd 100644 --- a/views/admin/design.rb +++ b/views/admin/design.rb @@ -1,33 +1,35 @@ -class AdminApp - module Views - class Design < Layout +module Roam + class AdminApp + module Views + class Design < Layout - def page_header - new_design ? "New Design" : design_name - end + def page_header + new_design ? "New Design" : design_name + end - def page_action - new_design ? "/admin/designs" : "/admin/designs/#{design_id}" - end + def page_action + new_design ? "/admin/designs" : "/admin/designs/#{design_id}" + end - def page_method - new_design ? "post" : "put" - end + def page_method + new_design ? "post" : "put" + end - def new_design - @design.new_record? - end + def new_design + @design.new_record? + end - def design_id - @design.id - end + def design_id + @design.id + end + + def initialize + create_getters_and_errors('design', %w{ name description layout blog home page + post feed missing error style script }) + end - def initialize - create_getters_and_errors('design', %w{ name description layout blog home page - post feed missing error style script }) end end - end -end +end \ No newline at end of file diff --git a/views/admin/designs.rb b/views/admin/designs.rb index 47d7bf6..4d7e9d8 100644 --- a/views/admin/designs.rb +++ b/views/admin/designs.rb @@ -1,44 +1,46 @@ -class AdminApp - module Views - class Designs < Layout +module Roam + class AdminApp + module Views + class Designs < Layout - def designs - @_designs.map do |design| - { - :design_name => get_design_name(design), - :design_status => get_design_status(design), - :design_description => design.description, - :design_copy => get_design_copy(design), - :design_updated => get_short_date(design.updated_at) - } + def designs + @_designs.map do |design| + { + :design_name => get_design_name(design), + :design_status => get_design_status(design), + :design_description => design.description, + :design_copy => get_design_copy(design), + :design_updated => get_short_date(design.updated_at) + } + end end - end - private - def get_design_name(design) - <<-EOD + private + def get_design_name(design) + <<-EOD #{design.name} - EOD - end + EOD + end - def get_design_status(design) - if site.design == design - "Active" - else - <<-EOD + def get_design_status(design) + if site.design == design + "Active" + else + <<-EOD Set Active - EOD + EOD + end end - end - def get_design_copy(design) - <<-EOD + def get_design_copy(design) + <<-EOD Copy - EOD - end + EOD + end + end end end -end +end \ No newline at end of file diff --git a/views/admin/error.rb b/views/admin/error.rb index 7983252..4080d1c 100644 --- a/views/admin/error.rb +++ b/views/admin/error.rb @@ -1,6 +1,8 @@ -class AdminApp - module Views - class Error < Layout +module Roam + class AdminApp + module Views + class Error < Layout + end end end -end +end \ No newline at end of file diff --git a/views/admin/home.rb b/views/admin/home.rb index 14e886f..8fe8c60 100644 --- a/views/admin/home.rb +++ b/views/admin/home.rb @@ -1,6 +1,8 @@ -class AdminApp - module Views - class Home < Layout +module Roam + class AdminApp + module Views + class Home < Layout + end end end end \ No newline at end of file diff --git a/views/admin/layout.rb b/views/admin/layout.rb index 8d48185..c450d5b 100644 --- a/views/admin/layout.rb +++ b/views/admin/layout.rb @@ -1,88 +1,90 @@ -class AdminApp - module Views - class Layout < Mustache +module Roam + class AdminApp + module Views + class Layout < Mustache - include ViewHelpers + include ViewHelpers - def timestamp - Time.now.to_i.to_s - end + def timestamp + Time.now.to_i.to_s + end - def message_notice - @flash['notice'] if @flash - end + def message_notice + @flash['notice'] if @flash + end - def message_warning - @flash['warning'] if @flash - end + def message_warning + @flash['warning'] if @flash + end - def current_user - @current_user - end + def current_user + @current_user + end - def site - @site || Site.default - end + def site + @site || Site.default + end - def site_title - site.title - end + def site_title + site.title + end - def site_domain - site.domain - end + def site_domain + site.domain + end - def site_location - site.location - end + def site_location + site.location + end - def site_cache - site.cache - end + def site_cache + site.cache + end - def site_timezone - site.timezone - end + def site_timezone + site.timezone + end - def timezones - us = ActiveSupport::TimeZone.us_zones - nus = (ActiveSupport::TimeZone.all - ActiveSupport::TimeZone.us_zones) - selected = "" - (us + nus).map do |zone| - if (site_timezone == zone.name) && selected.empty? - selected = "selected=selected" - else - selected = "" + def timezones + us = ActiveSupport::TimeZone.us_zones + nus = (ActiveSupport::TimeZone.all - ActiveSupport::TimeZone.us_zones) + selected = "" + (us + nus).map do |zone| + if (site_timezone == zone.name) && selected.empty? + selected = "selected=selected" + else + selected = "" + end + {:option => ""} end - {:option => ""} end - end - def site_settings - site.settings.map { |k,v| {:name => k, :value => v} } - end + def site_settings + site.settings.map { |k,v| {:name => k, :value => v} } + end - def initialize - super - dynamic_settings - end + def initialize + super + dynamic_settings + end - private - ## - # Dynamic Settings - # - # Create a site_#{key} method for each key in the Site.settings Hash - # eg: $site.settings['monkey'] creates the site_monkey method - def dynamic_settings - site.settings.each do |k,v| - self.class.class_eval do - define_method(:"setting_#{k}") do - site.settings[k] + private + ## + # Dynamic Settings + # + # Create a site_#{key} method for each key in the Site.settings Hash + # eg: $site.settings['monkey'] creates the site_monkey method + def dynamic_settings + site.settings.each do |k,v| + self.class.class_eval do + define_method(:"setting_#{k}") do + site.settings[k] + end end end end - end + end end end -end +end \ No newline at end of file diff --git a/views/admin/login.rb b/views/admin/login.rb index 3d5ed89..7ae6b67 100644 --- a/views/admin/login.rb +++ b/views/admin/login.rb @@ -1,6 +1,8 @@ -class AdminApp - module Views - class Login < Layout +module Roam + class AdminApp + module Views + class Login < Layout + end end end end \ No newline at end of file diff --git a/views/admin/missing.rb b/views/admin/missing.rb index dcfcb07..69cbbe5 100644 --- a/views/admin/missing.rb +++ b/views/admin/missing.rb @@ -1,6 +1,8 @@ -class AdminApp - module Views - class Missing < Layout +module Roam + class AdminApp + module Views + class Missing < Layout + end end end end \ No newline at end of file diff --git a/views/admin/page.rb b/views/admin/page.rb index e0bf8bb..15c2468 100644 --- a/views/admin/page.rb +++ b/views/admin/page.rb @@ -1,27 +1,29 @@ -class AdminApp - module Views - class Page < Layout +module Roam + class AdminApp + module Views + class Page < Layout - def initialize - create_getters_and_errors('page',%w{slug title body}) - end + def initialize + create_getters_and_errors('page',%w{slug title body}) + end - def new_page - @page.new_record? - end + def new_page + @page.new_record? + end - def page_action - @page.new_record? ? "/admin/pages" : "/admin/pages/#{@page.slug}" - end + def page_action + @page.new_record? ? "/admin/pages" : "/admin/pages/#{@page.slug}" + end - def page_method - @page.new_record? ? "post" : "put" - end + def page_method + @page.new_record? ? "post" : "put" + end - def page_header - @page.new_record? ? "New Page" : @page.title - end + def page_header + @page.new_record? ? "New Page" : @page.title + end + end end end -end +end \ No newline at end of file diff --git a/views/admin/pages.rb b/views/admin/pages.rb index b66a996..1b836de 100644 --- a/views/admin/pages.rb +++ b/views/admin/pages.rb @@ -1,17 +1,19 @@ -class AdminApp - module Views - class Pages < Layout +module Roam + class AdminApp + module Views + class Pages < Layout - def pages - @_pages.map do |page| - { - :page_updated => get_short_date(page.updated_at), - :page_slug => page.slug, - :page_title => page.title - } + def pages + @_pages.map do |page| + { + :page_updated => get_short_date(page.updated_at), + :page_slug => page.slug, + :page_title => page.title + } + end end - end + end end end -end +end \ No newline at end of file diff --git a/views/admin/post.rb b/views/admin/post.rb index c73f18c..fa3647a 100644 --- a/views/admin/post.rb +++ b/views/admin/post.rb @@ -1,40 +1,42 @@ -class AdminApp - module Views - class Post < Layout +module Roam + class AdminApp + module Views + class Post < Layout - def new_post - @post.new_record? - end + def new_post + @post.new_record? + end - def page_action - new_post ? "/admin/posts" : "/admin/posts/#{post_slug}" - end + def page_action + new_post ? "/admin/posts" : "/admin/posts/#{post_slug}" + end - def page_method - new_post ? "post" : "put" - end + def page_method + new_post ? "post" : "put" + end - def page_header - new_post ? "New Post" : post_title - end + def page_header + new_post ? "New Post" : post_title + end - def initialize - create_getters_and_errors('post',%w{slug title body}) - create_error_getter('post',%w{author published_at tags}) - end + def initialize + create_getters_and_errors('post',%w{slug title body}) + create_error_getter('post',%w{author published_at tags}) + end - def post_author - @post.author ||= @current_user.name - end + def post_author + @post.author ||= @current_user.name + end - def post_date - get_short_date(@post.published_at) - end + def post_date + get_short_date(@post.published_at) + end - def post_tags - @post.tags.join(', ') - end + def post_tags + @post.tags.join(', ') + end + end end end -end +end \ No newline at end of file diff --git a/views/admin/posts.rb b/views/admin/posts.rb index ca4379a..4776533 100644 --- a/views/admin/posts.rb +++ b/views/admin/posts.rb @@ -1,30 +1,32 @@ -class AdminApp - module Views - class Posts < Layout +module Roam + class AdminApp + module Views + class Posts < Layout - def nodate_posts - map_posts(@nodate) - end + def nodate_posts + map_posts(@nodate) + end - def future_posts - map_posts(@future) - end + def future_posts + map_posts(@future) + end - def active_posts - map_posts(@active) - end + def active_posts + map_posts(@active) + end - def map_posts(_posts) - _posts.map do |post| - { - :post_date => get_short_date(post.published_at), - :post_slug => post.slug, - :post_title => post.title, - :post_status => post.active? ? "Published" : "Pending" - } + def map_posts(_posts) + _posts.map do |post| + { + :post_date => get_short_date(post.published_at), + :post_slug => post.slug, + :post_title => post.title, + :post_status => post.active? ? "Published" : "Pending" + } + end end - end + end end end -end +end \ No newline at end of file diff --git a/views/admin/settings.rb b/views/admin/settings.rb index ac87422..70a6eab 100644 --- a/views/admin/settings.rb +++ b/views/admin/settings.rb @@ -1,6 +1,8 @@ -class AdminApp - module Views - class Settings < Layout +module Roam + class AdminApp + module Views + class Settings < Layout + end end end end \ No newline at end of file diff --git a/views/admin/templates.rb b/views/admin/templates.rb index e6dfadf..2b9b9a7 100644 --- a/views/admin/templates.rb +++ b/views/admin/templates.rb @@ -1,6 +1,8 @@ -class AdminApp - module Views - class Templates < Layout +module Roam + class AdminApp + module Views + class Templates < Layout + end end end end \ No newline at end of file diff --git a/views/admin/user.rb b/views/admin/user.rb index 4cb52af..e7297e0 100644 --- a/views/admin/user.rb +++ b/views/admin/user.rb @@ -1,32 +1,34 @@ -class AdminApp - module Views - class User < Layout +module Roam + class AdminApp + module Views + class User < Layout - def page_header - new_user ? "New User" : user_name - end + def page_header + new_user ? "New User" : user_name + end - def page_action - new_user ? "/admin/users" : "/admin/users/#{user_id}" - end + def page_action + new_user ? "/admin/users" : "/admin/users/#{user_id}" + end - def page_method - new_user ? "post" : "put" - end + def page_method + new_user ? "post" : "put" + end - def new_user - @user.new_record? - end + def new_user + @user.new_record? + end - def initialize - create_getters_and_errors('user',%w{name login}) - create_error_getters('user',%w{password password_confirmation}) - end + def initialize + create_getters_and_errors('user',%w{name login}) + create_error_getters('user',%w{password password_confirmation}) + end - def user_id - @user.id - end + def user_id + @user.id + end + end end end -end +end \ No newline at end of file diff --git a/views/admin/users.rb b/views/admin/users.rb index faec6fa..81454f3 100644 --- a/views/admin/users.rb +++ b/views/admin/users.rb @@ -1,24 +1,26 @@ -class AdminApp - module Views - class Users < Layout +module Roam + class AdminApp + module Views + class Users < Layout - def users - @_users.map do |user| - { - :user_login => get_user_login(user), - :user_name => user.name, - :user_last_login => get_short_date(user.login_at) - } + def users + @_users.map do |user| + { + :user_login => get_user_login(user), + :user_name => user.name, + :user_last_login => get_short_date(user.login_at) + } + end end - end - private - def get_user_login(user) - <<-EOD + private + def get_user_login(user) + <<-EOD #{user.login} - EOD - end + EOD + end + end end end -end +end \ No newline at end of file diff --git a/views/user/blog.rb b/views/user/blog.rb index a117414..f5e1403 100644 --- a/views/user/blog.rb +++ b/views/user/blog.rb @@ -1,33 +1,35 @@ -class UserApp - module Views - class Blog < Layout +module Roam + class UserApp + module Views + class Blog < Layout - def title - "Blog Posts" - end + def title + "Blog Posts" + end - def search - if @tag.empty? - "All Posts" - else - "Posts tagged #{@tag}" + def search + if @tag.empty? + "All Posts" + else + "Posts tagged #{@tag}" + end end - end - def filtered? - !@tag.empty? - end + def filtered? + !@tag.empty? + end - def posts - @posts.map do |post| - { - :title => post.title, - :date => get_long_date(post.published_at), - :path => get_post_path(post) - } + def posts + @posts.map do |post| + { + :title => post.title, + :date => get_long_date(post.published_at), + :path => get_post_path(post) + } + end end - end + end end end -end +end \ No newline at end of file diff --git a/views/user/error.rb b/views/user/error.rb index 8231a48..5588644 100644 --- a/views/user/error.rb +++ b/views/user/error.rb @@ -1,11 +1,13 @@ -class UserApp - module Views - class Error < Layout +module Roam + class UserApp + module Views + class Error < Layout - def title - "Error" - end + def title + "Error" + end + end end end -end +end \ No newline at end of file diff --git a/views/user/feed.rb b/views/user/feed.rb index 5a466b4..99f3503 100644 --- a/views/user/feed.rb +++ b/views/user/feed.rb @@ -1,29 +1,31 @@ -class UserApp - module Views - class Feed < Layout +module Roam + class UserApp + module Views + class Feed < Layout - def title - "RSS Feed" - end + def title + "RSS Feed" + end - def site_updated - @updated.iso8601 rescue nil - end + def site_updated + @updated.iso8601 rescue nil + end - def posts - @posts.map do |post| - { - :title => post.title, - :path => get_post_url(site_domain,post), - :published => post.published_at.iso8601, - :updated => post.updated_at.iso8601, - :author => post.author, - :summary => post.excerpt, - :html => post.html - } + def posts + @posts.map do |post| + { + :title => post.title, + :path => get_post_url(site_domain,post), + :published => post.published_at.iso8601, + :updated => post.updated_at.iso8601, + :author => post.author, + :summary => post.excerpt, + :html => post.html + } + end end - end + end end end -end +end \ No newline at end of file diff --git a/views/user/home.rb b/views/user/home.rb index 041a91a..89470ff 100644 --- a/views/user/home.rb +++ b/views/user/home.rb @@ -1,60 +1,62 @@ -class UserApp - module Views - class Home < Layout +module Roam + class UserApp + module Views + class Home < Layout - def title - @post.title if @post - end + def title + @post.title if @post + end - def slug - @post.slug - end + def slug + @post.slug + end - def path - get_post_path(@post) - end + def path + get_post_path(@post) + end - def author - @post.author - end + def author + @post.author + end - def html - @post.html - end + def html + @post.html + end - def date - get_long_date(@post.published_at) - end + def date + get_long_date(@post.published_at) + end - def post - @post - end + def post + @post + end - def has_tags? - !@post.tags.empty? - end + def has_tags? + !@post.tags.empty? + end - def tag_list - @post.tags.map do |tag| - { - :tag => tag, - :path => get_tag_path(tag), - :first? => @post.tags.first == tag, - :last? => @post.tags.last == tag - } + def tag_list + @post.tags.map do |tag| + { + :tag => tag, + :path => get_tag_path(tag), + :first? => @post.tags.first == tag, + :last? => @post.tags.last == tag + } + end end - end - def posts - @posts.map do |post| - { - :title => post.title, - :date => get_long_date(post.published_at), - :path => get_post_path(post) - } + def posts + @posts.map do |post| + { + :title => post.title, + :date => get_long_date(post.published_at), + :path => get_post_path(post) + } + end end - end + end end end -end +end \ No newline at end of file diff --git a/views/user/layout.rb b/views/user/layout.rb index b834c67..a47e5d4 100644 --- a/views/user/layout.rb +++ b/views/user/layout.rb @@ -1,81 +1,83 @@ -class UserApp - module Views - class Layout < Mustache +module Roam + class UserApp + module Views + class Layout < Mustache - include ViewHelpers + include ViewHelpers - def initialize(args={}) - args.each {|k,v| instance_variable_set("@#{k.to_s}",v)} - generate_dynamic_methods - end + def initialize(args={}) + args.each {|k,v| instance_variable_set("@#{k.to_s}",v)} + generate_dynamic_methods + end - ## - # Page title - # - # If the @page_title variable is set make the page_title - # "My Blog - My Page", otherwise, just make it "My Blog" - def page_title - @page_title ? "#{site_title} - #{@page_title}" : site_title - end + ## + # Page title + # + # If the @page_title variable is set make the page_title + # "My Blog - My Page", otherwise, just make it "My Blog" + def page_title + @page_title ? "#{site_title} - #{@page_title}" : site_title + end - ## - # Site variables - # - # These variables are usable site_wide - def site_title - @site.title - end + ## + # Site variables + # + # These variables are usable site_wide + def site_title + @site.title + end - def site_domain - @site.domain - end + def site_domain + @site.domain + end - def site_location - @site.location - end + def site_location + @site.location + end - def site_has_tags? - !@site_tags.empty? - end + def site_has_tags? + !@site_tags.empty? + end - def site_tags - @site_tags.map do |tag| - { - :tag => tag, - :path => get_tag_path(tag), - :first? => @site_tags.first == tag, - :last? => @site_tags.last == tag - } + def site_tags + @site_tags.map do |tag| + { + :tag => tag, + :path => get_tag_path(tag), + :first? => @site_tags.first == tag, + :last? => @site_tags.last == tag + } + end end - end - ## - # Link to Google Maps based on the Site Location variable - def site_map - if site_location - loc = URI.escape(site_location) - <<-EOD -#{site_location} - EOD + ## + # Link to Google Maps based on the Site Location variable + def site_map + if site_location + loc = URI.escape(site_location) + <<-EOD + #{site_location} + EOD + end end - end - ## - # Dynamic Methods - # - # Create a site_#{key} method for each key in the Site.settings Hash - # eg: $site.settings['monkey'] creates the site_monkey method - def generate_dynamic_methods - return unless (@site && @site.settings) - @site.settings.each do |k,v| - self.class.class_eval do - define_method(:"setting_#{k}") do - @site.settings[k] + ## + # Dynamic Methods + # + # Create a site_#{key} method for each key in the Site.settings Hash + # eg: $site.settings['monkey'] creates the site_monkey method + def generate_dynamic_methods + return unless (@site && @site.settings) + @site.settings.each do |k,v| + self.class.class_eval do + define_method(:"setting_#{k}") do + @site.settings[k] + end end end end - end + end end end -end +end \ No newline at end of file diff --git a/views/user/missing.rb b/views/user/missing.rb index cc78f8d..ba5eebc 100644 --- a/views/user/missing.rb +++ b/views/user/missing.rb @@ -1,11 +1,13 @@ -class UserApp - module Views - class Missing < Layout +module Roam + class UserApp + module Views + class Missing < Layout - def title - "Not Found" - end + def title + "Not Found" + end + end end end -end +end \ No newline at end of file diff --git a/views/user/page.rb b/views/user/page.rb index dab4632..bf2c6fa 100644 --- a/views/user/page.rb +++ b/views/user/page.rb @@ -1,15 +1,17 @@ -class UserApp - module Views - class Page < Layout +module Roam + class UserApp + module Views + class Page < Layout - def title - @page.title - end + def title + @page.title + end - def html - @page.html - end + def html + @page.html + end + end end end -end +end \ No newline at end of file diff --git a/views/user/post.rb b/views/user/post.rb index 9f6f636..6d0f7bb 100644 --- a/views/user/post.rb +++ b/views/user/post.rb @@ -1,74 +1,76 @@ -class UserApp - module Views - class Post < Layout +module Roam + class UserApp + module Views + class Post < Layout - def slug - @post.slug - end + def slug + @post.slug + end - def url - get_post_url(site_domain,@post) - end + def url + get_post_url(site_domain,@post) + end - def title - @post.title - end + def title + @post.title + end - def path - get_post_path(@post) - end + def path + get_post_path(@post) + end - def author - @post.author - end + def author + @post.author + end - def html - @post.html - end + def html + @post.html + end - def date - get_long_date(@post.published_at) - end + def date + get_long_date(@post.published_at) + end - def has_tags? - !@post.tags.empty? - end + def has_tags? + !@post.tags.empty? + end - def tag_list - @post.tags.map do |tag| - { - :tag => tag, - :path => get_tag_path(tag), - :first? => @post.tags.first == tag, - :last? => @post.tags.last == tag - } + def tag_list + @post.tags.map do |tag| + { + :tag => tag, + :path => get_tag_path(tag), + :first? => @post.tags.first == tag, + :last? => @post.tags.last == tag + } + end end - end - def posts - @posts - end + def posts + @posts + end - def younger - @posts[:younger].map do |post| - { - :title => post.title, - :date => get_long_date(post.published_at), - :path => get_post_path(post) - } + def younger + @posts[:younger].map do |post| + { + :title => post.title, + :date => get_long_date(post.published_at), + :path => get_post_path(post) + } + end end - end - def older - @posts[:older].map do |post| - { - :title => post.title, - :date => get_long_date(post.published_at), - :path => get_post_path(post) - } + def older + @posts[:older].map do |post| + { + :title => post.title, + :date => get_long_date(post.published_at), + :path => get_post_path(post) + } + end end - end + end end end -end +end \ No newline at end of file diff --git a/views/user/script.rb b/views/user/script.rb index 6375d5a..b05e844 100644 --- a/views/user/script.rb +++ b/views/user/script.rb @@ -1,6 +1,8 @@ -class UserApp - module Views - class Script < Layout +module Roam + class UserApp + module Views + class Script < Layout + end end end end \ No newline at end of file diff --git a/views/user/style.rb b/views/user/style.rb index 6988f9a..f528a60 100644 --- a/views/user/style.rb +++ b/views/user/style.rb @@ -1,6 +1,8 @@ -class UserApp - module Views - class Style < Layout +module Roam + class UserApp + module Views + class Style < Layout + end end end end \ No newline at end of file