Changeset 276

Show
Ignore:
Timestamp:
06/08/07 00:00:08 (1 year ago)
Author:
wyca..@gmail.com
Message:

A bunch of refactorings to CSS and models to make things saner

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mrblog/trunk/dist/app/controllers/blog.rb

    r235 r276  
    22 
    33  def show 
    4     @post = Post.find params[:id] 
    5     @comments = @post.comments 
    6     render 
     4    @post = Post.find_by_id params[:id] 
     5    if @post.nil? 
     6      redirect_back_or_default("/") 
     7    else 
     8      @comments = @post.comments 
     9      render 
     10    end 
    711  end 
    812 
  • mrblog/trunk/dist/app/helpers/global_helper.rb

    r220 r276  
    2323    end 
    2424     
     25    def logged_in? 
     26      @controller.send(:logged_in?) 
     27    end 
     28     
     29    def current_user 
     30      @controller.send(:current_user) 
     31    end 
     32     
    2533  end 
    2634end     
  • mrblog/trunk/dist/app/models/user.rb

    r133 r276  
    3535    crypted_password == encrypt(password) 
    3636  end 
     37   
     38  def admin? 
     39    true 
     40  end 
    3741 
    3842  protected 
  • mrblog/trunk/dist/app/views/account/login.herb

    r133 r276  
    11 
    2 <form method="post" action="/account/login"
     2<form method="post" action="/account/login" class="mascot"
    33 
    44  <p><label for="login">Login</label> 
     
    88  <input type="password" id="password" name="password"></p> 
    99 
    10   <p><input type="submit" value="Log in"></p> 
     10  <p class="buttons"><button class="imaged" type="submit" value="Log in">Log In</button></p> 
    1111   
    1212</form> 
  • mrblog/trunk/dist/app/views/account/signup.herb

    r220 r276  
    11<%= error_messages_for @user %> 
    22 
    3 <form method="post" action="/account/signup"
     3<form method="post" action="/account/signup" class="mascot"
    44 
    55  <p><label for="user_login">Login</label> 
     
    1212  <input type="password" id="user_password" name="user[password]"></p> 
    1313 
    14   <p><label for="user_password_confirmation">Confirm Password</label> 
     14  <p><label for="user_password_confirmation">Confirm</label> 
    1515  <input type="password" id="user_password_confirmation" 
    1616         name="user[password_confirmation]"></p> 
    1717 
    18   <p><input type="submit" value="Sign up"></p> 
     18  <p class="buttons"><button type="submit" value="Sign up" class="imaged">Sign Up</button></p> 
    1919   
    2020</form> 
  • mrblog/trunk/dist/app/views/admin/index.herb

    r229 r276  
    1 <br /> 
    21<h3>Articles</h3> 
    32<hr /> 
     
    1110  <span></span> 
    1211  <% end %> 
     12  <%= "<h2>No articles yet</h2>" if @page.items.blank? %> 
    1313</div> 
    1414<br /> 
    1515<p><%= link_to("Prev", "/admin/index?page=#{@page.prev.number}") if @page.prev? %> 
    1616<%= link_to("Next", "/admin/index?page=#{@page.next.number}") if @page.next? %></p> 
    17 <%= link_to image_tag('new.gif'), "/admin/new"%>  
     17<%= link_to image_tag('new.gif'), "/admin/new", :class => "button" %>  
  • mrblog/trunk/dist/app/views/blog/index.herb

    r138 r276  
    77  <span><%= truncate p.body, 300 %></span> 
    88  <% end %> 
     9  <%= "<h2>No articles yet</h2>" if @page.items.blank? %>   
    910</div> 
    1011<br /> 
  • mrblog/trunk/dist/app/views/layout/admin.herb

    r133 r276  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    22<html xmlns="http://www.w3.org/1999/xhtml"> 
     3  <head> 
     4        <title>Merb: Mongrel + Erb</title> 
     5        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
     6        <%= css_include_tag :merb %> 
     7        <%= js_include_tag :prototype, :effects %> 
     8  </head> 
    39 
    4 <head> 
    5         <title>Merb: Mongrel + Erb</title> 
    6         <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
    7         <%= css_include_tag :merb %> 
    8         <%= js_include_tag :prototype, :effects %> 
    9 </head> 
     10  <body> 
    1011 
    11 <body> 
     12    <div id="blogtitle"> 
     13         <div id="small">Welcome to Merbivore | 
     14           <a href="http://svn.devjavu.com/merb">SVN</a> | 
     15           <a href="http://svn.devjavu.com/merb/trunk/README">README</a> | 
     16           <a href="http://merb.devjavu.com/">Trac</a> | 
     17           <%= link_to "Login", "/account/login" if !logged_in? %> 
     18           <%= link_to "Logout #{current_user.login}", "/account/login" if logged_in? %> | 
     19           <%= link_to "Blog", "/" %> 
     20          </div> 
     21    </div> 
    1222 
    13   <div id="blogtitle"> 
    14          <div id="small">Welcome to Merbivore |  <a href="http://svn.devjavu.com/merb">SVN</a>  |  <a href="http://svn.devjavu.com/merb/README">README</a>  |   <a href="http://merb.devjavu.com/">Trac</a></div> 
    15   </div> 
     23    <div id="border"> 
     24      <div id="container"> 
     25        <div id="content"> 
     26            <div id="topmenu"> 
     27            <ul> 
     28              <li><a href="/admin"><span>Articles</span></a></li> 
     29              <li><a href="/admin/files"><span>Manage Files</span></a></li> 
     30                <li><a href="/admin/settings"><span>Settings</span></a></li> 
     31              </ul> 
     32          </div> 
    1633 
    17 <div id="border"> 
     34          <div id='main'> 
     35            <%= catch_content :layout %> 
     36          </div> 
     37        </div> 
     38      </div> 
    1839 
    19  <div id="container"
     40      <div id="footer">Merb: Mongrel + Erb</div
    2041 
    21   <div id="content"> 
    22                  
    23         <div id="topmenu"> 
    24      <ul> 
    25       <li><a href="/admin"><span>Articles</span></a></li> 
    26       <li><a href="/admin/files"><span>Manage Files</span></a></li> 
    27           <li><a href="/admin/settings"><span>Settings</span></a></li> 
    28          </ul> 
    29    </div> 
     42    </div> 
    3043 
    31    <div id='main'> 
    32      <%= catch_content :layout %> 
    33    </div> 
    34   </div> 
    35  </div> 
    36  
    37 <div id="footer">Merb: Mongrel + Erb</div> 
    38  
    39 </div> 
    40  
    41  
    42  
    43  
    44 </body> 
     44  </body> 
    4545</html> 
  • mrblog/trunk/dist/app/views/layout/application.herb

    r222 r276  
    1313 
    1414  <div id="blogtitle"> 
    15          <div id="small">Welcome to Merbivore |  <a href="http://svn.devjavu.com/merb">SVN</a>  |  <a href="http://svn.devjavu.com/merb/README">README</a>  |   <a href="http://merb.devjavu.com/">Trac</a></div> 
     15         <div id="small">Welcome to Merbivore | 
     16           <a href="http://svn.devjavu.com/merb">SVN</a> | 
     17           <a href="http://svn.devjavu.com/merb/trunk/README">README</a> | 
     18           <a href="http://merb.devjavu.com/">Trac</a> | 
     19           <%= link_to "Login", "/account/login" if !logged_in? %> 
     20           <%= " | #{link_to "Blog", "/"}" if !logged_in? && @controller.class != Blog %>           
     21           <%= link_to "Logout #{current_user.login}", "/account/login" if logged_in? %> 
     22           <%= " | #{link_to "Admin", "/admin"}" if current_user && current_user.admin? %> 
     23   </div> 
    1624  </div> 
    1725 
  • mrblog/trunk/dist/public/stylesheets/merb.css

    r275 r276  
    3333        font-weight:bold; 
    3434        padding:0 2px; 
    35         margin:0; 
     35        margin:10px 0 0 0; 
    3636} 
    3737 
     
    302302} 
    303303 
     304form.mascot { 
     305  margin-top: 20px; 
     306  float: left; 
     307} 
     308 
     309form.mascot p input, form.mascot p textarea { 
     310  width: 385px; 
     311} 
     312 
    304313form p.buttons { 
    305314  text-align: right; 
     
    312321  cursor: pointer; 
    313322} 
     323 
     324form p button.imaged { 
     325  background: transparent url(/images/blank_button.gif) no-repeat; 
     326  width: 67px; 
     327  height: 23px; 
     328  line-height: 20px; 
     329  padding-bottom: 4px; 
     330  text-align: center; 
     331}