Changeset 583
- Timestamp:
- 09/09/07 00:38:15 (1 year ago)
- Files:
-
- apps/marble/trunk/app/controllers/admin/blogs.rb (modified) (1 diff)
- apps/marble/trunk/app/controllers/admin/comments.rb (added)
- apps/marble/trunk/app/controllers/admin/posts.rb (modified) (1 diff)
- apps/marble/trunk/app/controllers/admin/users.rb (modified) (1 diff)
- apps/marble/trunk/app/controllers/application.rb (modified) (1 diff)
- apps/marble/trunk/app/controllers/artists.rb (deleted)
- apps/marble/trunk/app/controllers/posts.rb (added)
- apps/marble/trunk/app/controllers/welcome.rb (deleted)
- apps/marble/trunk/app/models/comment.rb (modified) (3 diffs)
- apps/marble/trunk/app/views/exceptions/gone.html.erb (modified) (1 diff)
- apps/marble/trunk/app/views/exceptions/internal_server_error.html.erb (added)
- apps/marble/trunk/app/views/exceptions/not_found.html.erb (modified) (2 diffs)
- apps/marble/trunk/app/views/layout/admin_layout.html.erb (deleted)
- apps/marble/trunk/app/views/layout/application.herb (deleted)
- apps/marble/trunk/app/views/posts (added)
- apps/marble/trunk/app/views/posts/index.html.erb (added)
- apps/marble/trunk/app/views/posts/index.xml (added)
- apps/marble/trunk/config/router.rb (modified) (2 diffs)
- apps/marble/trunk/lib/magic_scaffold.rb (modified) (2 diffs)
- apps/marble/trunk/public/stylesheets/admin.css (modified) (1 diff)
- apps/marble/trunk/public/stylesheets/master.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
apps/marble/trunk/app/controllers/admin/blogs.rb
r500 r583 1 1 module Admin 2 2 class Blogs < Application 3 self._layout = :admin _layout3 self._layout = :admin 4 4 5 5 magic_scaffold_here(Blog) { apps/marble/trunk/app/controllers/admin/posts.rb
r500 r583 1 1 module Admin 2 2 class Posts < Application 3 self._layout = :admin _layout3 self._layout = :admin 4 4 5 5 magic_scaffold_here(Post) { apps/marble/trunk/app/controllers/admin/users.rb
r500 r583 1 1 module Admin 2 2 class Users < Application 3 self._layout = :admin _layout3 self._layout = :admin 4 4 5 5 magic_scaffold_here(User) { apps/marble/trunk/app/controllers/application.rb
r500 r583 1 1 # all your other controllers should inherit from this one to share code. 2 2 class Application < Merb::Controller 3 end 3 self._layout = :one_column 4 end 5 6 # Change all exception controllers layouts to one-column 7 x = Merb::ControllerExceptions 8 x::HTTPErrors.constants.each { |e| x.const_get(e)._layout = :one_column } apps/marble/trunk/app/models/comment.rb
r582 r583 1 1 class Comment < Sequel::Model(:comments) 2 # This is a Sequel model, so we define the schema inside the class 2 3 set_schema do 3 4 primary_key :id … … 5 6 varchar :title 6 7 text :body 8 text :additional_thoughts 7 9 varchar :ip_address 8 10 end … … 17 19 when 'test', 'development' 18 20 recreate_table 21 # We fill the table with some sample data here 19 22 [ 20 23 {: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> 7 3 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> 12 9 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">© 2007 Duane Johnson</div> 22 <p> </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 6 1 <h3>Page Not Found</h3> 7 2 <p>You've found a page that doesn't exist.</p> … … 12 7 <p>On the other hand, if we made this mistake ourselves, please let us know how you 13 8 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 22 22 puts "Compiling routes.." 23 23 Merb::Router.prepare do |r| 24 # RESTful routes25 # r.resources :users26 24 27 # r.match("/artists/:artist_name").to(:controller => "artists")28 #29 25 r.match("/admin") do |admin| 30 26 admin.resources(:users, :controller => 'admin/users') … … 40 36 41 37 # 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') 43 39 end 44 40 apps/marble/trunk/lib/magic_scaffold.rb
r582 r583 9 9 10 10 if respond_to?(:scaffold_loaded) 11 puts "Scaffold for class #{self} loaded "11 puts "Scaffold for class #{self} loaded\n\n" 12 12 block.call 13 13 send(:include, "#{self}::Scaffold".constantize) … … 58 58 59 59 unless new_contents == original_contents 60 puts " Scaffolding #{model_class} -#{filename}:#{line}"60 puts "Creating scaffold for #{model_class}\nFile: #{filename}:#{line}" 61 61 File.open(filename, "w") do |f| 62 62 f.write new_contents 63 63 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 } 68 73 end 69 74 end apps/marble/trunk/public/stylesheets/admin.css
r500 r583 18 18 border-bottom: 2px solid #555; 19 19 } 20 .form-element { 21 margin-bottom: 4px; 22 } apps/marble/trunk/public/stylesheets/master.css
r500 r583 69 69 color: black; 70 70 padding-top: 15px; 71 overflow: auto; 71 72 } 72 73 73 #left-container h3 {74 #left-container h3, h3.red { 74 75 color: #c55; 75 76 }
