Changeset 1688

Show
Ignore:
Timestamp:
04/30/08 22:33:39 (2 weeks ago)
Author:
neuro
Message:

Some more admin enhancement
Added typo:code stylesheet

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/admin/content_controller.rb

    r1686 r1688  
    22module Admin; end 
    33class Admin::ContentController < Admin::BaseController 
    4 #  layout "minimal", :only => 'show' 
    54  layout "administration", :except => 'show' 
    65 
     
    130129        set_article_categories 
    131130        set_the_flash 
    132         redirect_to :action => 'show', :id => @article.id 
     131        redirect_to :action => 'list' 
    133132      end 
    134133    end 
  • trunk/app/controllers/admin/pages_controller.rb

    r1687 r1688  
    22 
    33class Admin::PagesController < Admin::BaseController 
     4  layout "administration", :except => 'show' 
    45  def index 
    56    list 
     
    6566      if @page.save 
    6667        flash[:notice] = 'Page was successfully created.' 
    67         redirect_to :action => 'show', :id => @page.id 
     68        redirect_to :action => 'list' 
    6869      end 
    6970    end 
  • trunk/app/controllers/admin/tags_controller.rb

    r1686 r1688  
    3333  end 
    3434     
    35   def show 
    36     @tag = Tag.find(params[:id]) 
    37   end 
    38      
    3935  def destroy 
    4036    @tag = Tag.find(params[:id]) 
  • trunk/app/controllers/admin/users_controller.rb

    r1682 r1688  
    88  def list 
    99    @users = User.find :all 
    10   end 
    11  
    12   def show 
    13     @user = User.find(params[:id], :include => [ :articles ]) 
    14     @articles = @user.articles 
    1510  end 
    1611 
     
    3025    if request.post? and @user.save 
    3126      flash[:notice] = 'User was successfully updated.' 
    32       redirect_to :action => 'show', :id => @user.id 
     27      redirect_to :action => 'list' 
    3328    end 
    3429  end 
  • trunk/app/helpers/admin/base_helper.rb

    r1686 r1688  
    225225  end 
    226226 
     227  def render_void_table(size, cols) 
     228    if size == 0 
     229      "<tr>\n<td colspan=#{cols}>There is no #{controller.controller_name} yet. Why don't you start and create one?</td>\n</tr>\n" 
     230    end 
     231  end 
    227232end 
  • trunk/app/helpers/application_helper.rb

    r1665 r1688  
    198198  <link rel="alternate" type="application/atom+xml" title="Atom" href="#{ @auto_discovery_url_atom }" /> 
    199199  <link rel="alternate" type="application/rss+xml" title="RSS" href="#{ @auto_discovery_url_rss }" /> 
     200  #{ stylesheet_link_tag 'typo_code.css', :media => 'all' } 
    200201  #{ javascript_include_tag "lang/" + Localization.lang.to_s } 
    201202  #{ javascript_include_tag "cookies" } 
  • trunk/app/models/tag.rb

    r1686 r1688  
    4747  end 
    4848 
     49  def self.merge(from, to) 
     50    self.update_by_sql([%{UPDATE article_tags SET tag_id = #{to} WHERE tag_id = #{from} }]) 
     51  end 
     52 
    4953  def self.find_by_permalink(*args) 
    5054    self.find_by_name(*args) || new(:name => args.first) 
  • trunk/app/views/admin/categories/_categories.html.erb

    r1686 r1688  
    33    <th><%= _("Title") %></th> 
    44    <th><%= _("Posts") %></th> 
     5    <th><%= _("View") %></th> 
    56    <th><%= _("Edit") %></th> 
    67    <th><%= _("Delete") %></th> 
    78  </tr> 
     9  <%= render_void_table(@categories.size, 5)  %> 
     10   
    811  <% for category in @categories -%> 
    912  <tr <%= alternate_class -%> id="category_<%= category.id -%>"> 
    1013    <td><%= link_to_permalink category, category.name %></td> 
    11     <td><%= link_to pluralize(category.articles.size, 'article'), {:controller => 'content', :action => 'list', "search[category]" => category.id} %></td> 
     14    <td><%= pluralize(category.articles.size, 'article') %></td> 
     15    <td class="operation"><%= link_to image_tag('admin/show.png'), {:controller => 'content', :action => 'list', "search[category]" => category.id} %></td> 
    1216    <td class="operation"><%= link_to_edit category %></td> 
    1317    <td class="operation"><%= link_to_destroy category %></td> 
  • trunk/app/views/admin/content/show.html.erb

    r1686 r1688  
    1 <iframe src="<%=@article.permalink_url%>" width="960px" height="700px" border="0"></iframe> 
     1<iframe src="<%=@article.permalink_url%>" width="100%" height="700px" border="0"></iframe> 
    22<a href="#" class="lbAction" rel="deactivate">Close.</a> 
  • trunk/app/views/admin/content/_articles.html.erb

    r1686 r1688  
    3030  <td colspan="3"><input type="submit" value="Filter" /> 
    3131</tr> 
     32  <%= render_void_table(@articles.size, 9)  %> 
    3233<% for article in @articles %> 
    3334<tr <%= alternate_class %>> 
  • trunk/app/views/admin/content/_attachment.html.erb

    r1686 r1688  
    1515</div> 
    1616 
    17 <% if @article.id %> 
    18 <h4><%= _("You can associate the following resources")%></h4> 
    19 <% for resource in @resources - @article.resources %> 
    20   <%= link_to_remote "+ #{resource.filename}", :url => { :action => "resource_add", :id => @article.id, :resource_id => resource.id}, :update => 'resources' %><br/> 
     17<% if @article.id and @resources %> 
     18  <h4><%= _("You can associate the following resources")%></h4> 
     19  <% for resource in @resources - @article.resources %> 
     20    <%= link_to_remote "+ #{resource.filename}", :url => { :action => "resource_add", :id => @article.id, :resource_id => resource.id}, :update => 'resources' %><br /> 
     21    <% end %> 
    2122<% end %> 
    22 <% end %> 
  • trunk/app/views/admin/pages/show.html.erb

    r1686 r1688  
    1   <% @page_heading = _('Pages') %> 
    2    
    3   <% content_for('tasks') do %> 
    4     <%= task_overview %> 
    5     <%= task_edit _('Edit'), @page.id %> 
    6   <% end %>  
    7  
    8   <div class="form" style="text-align: center; margin: auto;"> 
    9         <iframe src="<%=@page.permalink_url%>" width="95%" height="700px"></iframe> 
    10   </div> 
     1<iframe src="<%=@page.permalink_url%>" width="100%" height="700px" border="0"></iframe> 
     2<a href="#" class="lbAction" rel="deactivate">Close.</a> 
  • trunk/app/views/admin/pages/_pages.html.erb

    r1686 r1688  
    2626    <td colspan="3"><input type="submit" value="Filter" /> 
    2727  </tr> 
     28  <%= render_void_table(@pages.size, 8)  %> 
     29 
    2830  <% for page in @pages %> 
    29    
    3031  <tr <%= alternate_class %>> 
    3132    <td><%= link_to_permalink(page, page.title) %></td> 
     
    4041    <% end %> 
    4142    </td> 
    42     <td class='operation'><%= link_to image_tag('admin/show.png', :alt => 'View page', :title => 'Preview page'), {:action => 'show', :id => page.id} %></td> 
     43    <td class='operation'><%= link_to_show page %></td> 
    4344    <td class='operation'><%= link_to_edit page %></td> 
    4445    <td class='operation'><%= link_to_destroy page %></td> 
  • trunk/app/views/admin/tags/_tags.html.erb

    r1686 r1688  
    44  <th><%= _("Name") %></th> 
    55  <th><%= _("Articles") %></th> 
    6   <th><%= _("View")%></th> 
    76  <th><%= _("Edit")%></th> 
    87  <th><%= _("Delete")%></th> 
    98</tr> 
     9<%= render_void_table(@tags.size, 5)  %> 
    1010<% for tag in @tags %> 
    1111<tr <%= alternate_class %>> 
    12   <td> <%= tag.display_name %></td> 
     12  <td> <%= link_to tag.display_name, tag %></td> 
    1313  <td><%= tag.name %></td> 
    1414  <td><%= tag.article_counter %></td> 
    15   <td class="operation"><%= link_to image_tag('admin/show.png', :alt => "View tags", :title => "Preview tags"), {:action => "show", :id => tag.id} %></td> 
    1615  <td class="operation"><%= link_to_edit tag %></td> 
    1716  <td class="operation"><%= link_to_destroy tag %></td>     
  • trunk/app/views/admin/users/edit.html.erb

    r1565 r1688  
    11  <% @page_heading = _('Edit User') %> 
    22  <% content_for('tasks') do %> 
    3   <%= tab _("New User"), :controller=>"users", :action=>"new"%> 
    4   <%= task_overview %> 
     3    <%= task_overview %> 
     4    <%= tab _("New User"), :controller=>"users", :action=>"new"%> 
    55  <% end%> 
    66 
  • trunk/app/views/admin/users/list.html.erb

    r1565 r1688  
    77<div class="list"> 
    88  <table> 
    9     <tr
     9    <tr class="first"
    1010                <th class="first"><%= _("Name")%></th> 
    1111      <th><%= _("Username")%></th> 
     
    2424      <td class="field"><%= Article.count :conditions => "user_id = #{user.id}"  %></td> 
    2525      <td class="field"><%= Comment.count :conditions => "user_id = #{user.id}"  %></td> 
    26           <td class="operation"><%= link_to_show user %></td> 
     26          <td class="operation"><%= link_to image_tag('admin/show.png'), {:controller => 'content', :action => 'list', "search[user_id]" => user.id} %></td> 
    2727      <td class="operation"><%= link_to_edit user %></td> 
    2828      <td class="operation last"><%= link_to_destroy user %></td>     
  • trunk/spec/controllers/admin/categories_controller_spec.rb

    r1686 r1688  
    8484      :children => { :count => Category.count + 1, 
    8585        :only => { :tag => "tr", 
    86           :children => { :count => 4
     86          :children => { :count => 5
    8787            :only => { :tag => /t[dh]/ } } } } 
    8888  end 
  • trunk/spec/controllers/admin/users_controller_spec.rb

    r1623 r1688  
    3636  end 
    3737 
    38   def test_show 
    39     get :show, :id => users(:tobi).id 
    40     assert_template 'show' 
    41     assert_valid assigns(:user) 
    42  
    43     assert_template_has 'user' 
    44     assert_template_has 'articles' 
    45   end 
    46  
    4738  def test_edit 
    4839    user_id = users(:tobi).id 
     
    5445      :email => 'corey@test.com', :password => 'testpass', 
    5546      :password_confirmation => 'testpass' } 
    56     assert_response :redirect, :action => 'show
     47    assert_response :redirect, :action => 'list
    5748    follow_redirect 
    58     assert_template 'show
     49    assert_template 'list
    5950    assert_valid assigns(:user) 
    6051  end 
  • trunk/themes/dirtylicious/stylesheets/application.css

    r1602 r1688  
    326326 
    327327#searchform {padding: 10px;} 
     328 
  • trunk/themes/scribbish/stylesheets/content.css

    r1496 r1688  
    397397        display: inline;  
    398398} 
     399