Changeset 583

Show
Ignore:
Timestamp:
09/09/07 00:38:15 (1 year ago)
Author:
duane.johns..@gmail.com
Message:

Marble: show posts on a per-subdomain basis, change exception layout to one_column, add comments controller to admin, fix magic_scaffold

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • apps/marble/trunk/app/controllers/admin/blogs.rb

    r500 r583  
    11module Admin 
    22  class Blogs < Application 
    3     self._layout = :admin_layout 
     3    self._layout = :admin 
    44 
    55    magic_scaffold_here(Blog) { 
  • apps/marble/trunk/app/controllers/admin/posts.rb

    r500 r583  
    11module Admin 
    22  class Posts < Application 
    3     self._layout = :admin_layout 
     3    self._layout = :admin 
    44 
    55    magic_scaffold_here(Post) { 
  • apps/marble/trunk/app/controllers/admin/users.rb

    r500 r583  
    11module Admin 
    22  class Users < Application 
    3     self._layout = :admin_layout 
     3    self._layout = :admin 
    44     
    55    magic_scaffold_here(User) { 
  • apps/marble/trunk/app/controllers/application.rb

    r500 r583  
    11# all your other controllers should inherit from this one to share code. 
    22class Application < Merb::Controller 
    3 end   
     3  self._layout = :one_column 
     4end 
     5 
     6# Change all exception controllers layouts to one-column 
     7x = Merb::ControllerExceptions 
     8x::HTTPErrors.constants.each { |e| x.const_get(e)._layout = :one_column } 
  • apps/marble/trunk/app/models/comment.rb

    r582 r583  
    11class Comment < Sequel::Model(:comments) 
     2  # This is a Sequel model, so we define the schema inside the class 
    23  set_schema do 
    34    primary_key :id 
     
    56    varchar :title 
    67    text :body 
     8    text :additional_thoughts 
    79    varchar :ip_address 
    810  end 
     
    1719  when 'test', 'development' 
    1820    recreate_table 
     21    # We fill the table with some sample data here 
    1922    [ 
    2023      {:user_id => 1, :title => "I Like Your Site", :body => "Dude, nice site.  Want some cheap pharmaceutical products?"} 
  • apps/marble/trunk/app/views/exceptions/gone.html.erb

    r500 r583  
    1 <div id="container"> 
    2   <div id="header-container"> 
    3     <img src="/images/merb.jpg"> 
    4     <h1><%= exception %></h1> 
    5     <hr /> 
    6   </div> 
     1  <h3>Gone</h3> 
     2  <p>You've found a page that may have been here but is no longer.</p> 
    73 
    8   <div id="left-container"> 
    9     <h3>What's going on?</h3> 
    10     <p>The thing you're looking for may have been here before, but it's gone now.</p> 
    11   </div> 
     4  <h3>What Next?</h3> 
     5  <p>If you arrived here from an outside source, please notify the other website that 
     6    their link is no longer valid.</p> 
     7  <p>On the other hand, if we made this mistake ourselves, please let us know how you 
     8    got here and we'll see if we can't remedy the situation.</p> 
    129 
    13   <div id="main-container"> 
    14     <h3>Where do I go?</h3> 
    15     <p>You can use your browser's back button to return to the page you came from and try searching for something else.</p> 
    16   </div> 
    17  
    18   <div id="footer-container"> 
    19     <hr /> 
    20     <div class="left"></div> 
    21     <div class="right">&copy; 2007 Duane Johnson</div> 
    22     <p>&nbsp;</p> 
    23   </div> 
    24 </div> 
     10  <h3 class="red">Exception:</h3> 
     11  <p><%= message %></p> 
     12  <p><%= Merb.html_exception(exception) %></p> 
     13   
     14   
  • apps/marble/trunk/app/views/exceptions/not_found.html.erb

    r500 r583  
    1 <% throw_content :left do %> 
    2   <h3>Exception:</h3> 
    3   <p><%= exception %></p> 
    4 <% end %> 
    5  
    61  <h3>Page Not Found</h3> 
    72  <p>You've found a page that doesn't exist.</p> 
     
    127  <p>On the other hand, if we made this mistake ourselves, please let us know how you 
    138    got here and we'll see if we can't remedy the situation.</p> 
     9 
     10  <h3 class="red">Exception:</h3> 
     11  <p><%= message %></p> 
  • apps/marble/trunk/config/router.rb

    r582 r583  
    2222puts "Compiling routes.." 
    2323Merb::Router.prepare do |r| 
    24   # RESTful routes 
    25   # r.resources :users 
    2624 
    27   # r.match("/artists/:artist_name").to(:controller => "artists") 
    28   #  
    2925  r.match("/admin") do |admin| 
    3026    admin.resources(:users, :controller => 'admin/users') 
     
    4036   
    4137  # Change this for your home page to be avaiable at / 
    42   r.match('/').to(:controller => 'welcome', :action => 'index') 
     38  r.match('/').to(:controller => 'posts', :action => 'index') 
    4339end 
    4440 
  • apps/marble/trunk/lib/magic_scaffold.rb

    r582 r583  
    99         
    1010        if respond_to?(:scaffold_loaded) 
    11           puts "Scaffold for class #{self} loaded
     11          puts "Scaffold for class #{self} loaded\n\n
    1212          block.call 
    1313          send(:include, "#{self}::Scaffold".constantize) 
     
    5858           
    5959          unless new_contents == original_contents 
    60             puts "Scaffolding #{model_class} - #{filename}:#{line}" 
     60            puts "Creating scaffold for #{model_class}\nFile: #{filename}:#{line}" 
    6161            File.open(filename, "w") do |f| 
    6262              f.write new_contents 
    6363            end 
    64           end 
    65              
    66           meta_def(:scaffold_loaded) { true } 
    67           load filename 
     64          else 
     65            puts "Scaffold unchanged for #{model_class}\nFile: #{filename}:#{line}" 
     66          end 
     67           
     68          Thread.new { 
     69            sleep(0.2) 
     70            meta_def(:scaffold_loaded) { true } 
     71            load filename 
     72          } 
    6873        end 
    6974      end 
  • apps/marble/trunk/public/stylesheets/admin.css

    r500 r583  
    1818        border-bottom: 2px solid #555; 
    1919} 
     20.form-element { 
     21  margin-bottom: 4px; 
     22} 
  • apps/marble/trunk/public/stylesheets/master.css

    r500 r583  
    6969  color: black; 
    7070  padding-top: 15px; 
     71  overflow: auto; 
    7172} 
    7273 
    73 #left-container h3
     74#left-container h3, h3.red
    7475  color: #c55; 
    7576}