Changeset 1688
- Timestamp:
- 04/30/08 22:33:39 (2 weeks ago)
- Files:
-
- trunk/app/controllers/admin/content_controller.rb (modified) (2 diffs)
- trunk/app/controllers/admin/pages_controller.rb (modified) (2 diffs)
- trunk/app/controllers/admin/tags_controller.rb (modified) (1 diff)
- trunk/app/controllers/admin/users_controller.rb (modified) (2 diffs)
- trunk/app/helpers/admin/base_helper.rb (modified) (1 diff)
- trunk/app/helpers/application_helper.rb (modified) (1 diff)
- trunk/app/models/tag.rb (modified) (1 diff)
- trunk/app/views/admin/categories/_categories.html.erb (modified) (1 diff)
- trunk/app/views/admin/content/show.html.erb (modified) (1 diff)
- trunk/app/views/admin/content/_articles.html.erb (modified) (1 diff)
- trunk/app/views/admin/content/_attachment.html.erb (modified) (1 diff)
- trunk/app/views/admin/pages/show.html.erb (modified) (1 diff)
- trunk/app/views/admin/pages/_pages.html.erb (modified) (2 diffs)
- trunk/app/views/admin/tags/show.html.erb (deleted)
- trunk/app/views/admin/tags/_tags.html.erb (modified) (1 diff)
- trunk/app/views/admin/users/edit.html.erb (modified) (1 diff)
- trunk/app/views/admin/users/list.html.erb (modified) (2 diffs)
- trunk/app/views/admin/users/show.html.erb (deleted)
- trunk/public/stylesheets/typo_code.css (added)
- trunk/spec/controllers/admin/categories_controller_spec.rb (modified) (1 diff)
- trunk/spec/controllers/admin/users_controller_spec.rb (modified) (2 diffs)
- trunk/themes/dirtylicious/stylesheets/application.css (modified) (1 diff)
- trunk/themes/scribbish/stylesheets/content.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/controllers/admin/content_controller.rb
r1686 r1688 2 2 module Admin; end 3 3 class Admin::ContentController < Admin::BaseController 4 # layout "minimal", :only => 'show'5 4 layout "administration", :except => 'show' 6 5 … … 130 129 set_article_categories 131 130 set_the_flash 132 redirect_to :action => ' show', :id => @article.id131 redirect_to :action => 'list' 133 132 end 134 133 end trunk/app/controllers/admin/pages_controller.rb
r1687 r1688 2 2 3 3 class Admin::PagesController < Admin::BaseController 4 layout "administration", :except => 'show' 4 5 def index 5 6 list … … 65 66 if @page.save 66 67 flash[:notice] = 'Page was successfully created.' 67 redirect_to :action => ' show', :id => @page.id68 redirect_to :action => 'list' 68 69 end 69 70 end trunk/app/controllers/admin/tags_controller.rb
r1686 r1688 33 33 end 34 34 35 def show36 @tag = Tag.find(params[:id])37 end38 39 35 def destroy 40 36 @tag = Tag.find(params[:id]) trunk/app/controllers/admin/users_controller.rb
r1682 r1688 8 8 def list 9 9 @users = User.find :all 10 end11 12 def show13 @user = User.find(params[:id], :include => [ :articles ])14 @articles = @user.articles15 10 end 16 11 … … 30 25 if request.post? and @user.save 31 26 flash[:notice] = 'User was successfully updated.' 32 redirect_to :action => ' show', :id => @user.id27 redirect_to :action => 'list' 33 28 end 34 29 end trunk/app/helpers/admin/base_helper.rb
r1686 r1688 225 225 end 226 226 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 227 232 end trunk/app/helpers/application_helper.rb
r1665 r1688 198 198 <link rel="alternate" type="application/atom+xml" title="Atom" href="#{ @auto_discovery_url_atom }" /> 199 199 <link rel="alternate" type="application/rss+xml" title="RSS" href="#{ @auto_discovery_url_rss }" /> 200 #{ stylesheet_link_tag 'typo_code.css', :media => 'all' } 200 201 #{ javascript_include_tag "lang/" + Localization.lang.to_s } 201 202 #{ javascript_include_tag "cookies" } trunk/app/models/tag.rb
r1686 r1688 47 47 end 48 48 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 49 53 def self.find_by_permalink(*args) 50 54 self.find_by_name(*args) || new(:name => args.first) trunk/app/views/admin/categories/_categories.html.erb
r1686 r1688 3 3 <th><%= _("Title") %></th> 4 4 <th><%= _("Posts") %></th> 5 <th><%= _("View") %></th> 5 6 <th><%= _("Edit") %></th> 6 7 <th><%= _("Delete") %></th> 7 8 </tr> 9 <%= render_void_table(@categories.size, 5) %> 10 8 11 <% for category in @categories -%> 9 12 <tr <%= alternate_class -%> id="category_<%= category.id -%>"> 10 13 <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> 12 16 <td class="operation"><%= link_to_edit category %></td> 13 17 <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> 2 2 <a href="#" class="lbAction" rel="deactivate">Close.</a> trunk/app/views/admin/content/_articles.html.erb
r1686 r1688 30 30 <td colspan="3"><input type="submit" value="Filter" /> 31 31 </tr> 32 <%= render_void_table(@articles.size, 9) %> 32 33 <% for article in @articles %> 33 34 <tr <%= alternate_class %>> trunk/app/views/admin/content/_attachment.html.erb
r1686 r1688 15 15 </div> 16 16 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 %> 21 22 <% 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 26 26 <td colspan="3"><input type="submit" value="Filter" /> 27 27 </tr> 28 <%= render_void_table(@pages.size, 8) %> 29 28 30 <% for page in @pages %> 29 30 31 <tr <%= alternate_class %>> 31 32 <td><%= link_to_permalink(page, page.title) %></td> … … 40 41 <% end %> 41 42 </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> 43 44 <td class='operation'><%= link_to_edit page %></td> 44 45 <td class='operation'><%= link_to_destroy page %></td> trunk/app/views/admin/tags/_tags.html.erb
r1686 r1688 4 4 <th><%= _("Name") %></th> 5 5 <th><%= _("Articles") %></th> 6 <th><%= _("View")%></th>7 6 <th><%= _("Edit")%></th> 8 7 <th><%= _("Delete")%></th> 9 8 </tr> 9 <%= render_void_table(@tags.size, 5) %> 10 10 <% for tag in @tags %> 11 11 <tr <%= alternate_class %>> 12 <td> <%= tag.display_name%></td>12 <td> <%= link_to tag.display_name, tag %></td> 13 13 <td><%= tag.name %></td> 14 14 <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>16 15 <td class="operation"><%= link_to_edit tag %></td> 17 16 <td class="operation"><%= link_to_destroy tag %></td> trunk/app/views/admin/users/edit.html.erb
r1565 r1688 1 1 <% @page_heading = _('Edit User') %> 2 2 <% 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"%> 5 5 <% end%> 6 6 trunk/app/views/admin/users/list.html.erb
r1565 r1688 7 7 <div class="list"> 8 8 <table> 9 <tr >9 <tr class="first"> 10 10 <th class="first"><%= _("Name")%></th> 11 11 <th><%= _("Username")%></th> … … 24 24 <td class="field"><%= Article.count :conditions => "user_id = #{user.id}" %></td> 25 25 <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> 27 27 <td class="operation"><%= link_to_edit user %></td> 28 28 <td class="operation last"><%= link_to_destroy user %></td> trunk/spec/controllers/admin/categories_controller_spec.rb
r1686 r1688 84 84 :children => { :count => Category.count + 1, 85 85 :only => { :tag => "tr", 86 :children => { :count => 4,86 :children => { :count => 5, 87 87 :only => { :tag => /t[dh]/ } } } } 88 88 end trunk/spec/controllers/admin/users_controller_spec.rb
r1623 r1688 36 36 end 37 37 38 def test_show39 get :show, :id => users(:tobi).id40 assert_template 'show'41 assert_valid assigns(:user)42 43 assert_template_has 'user'44 assert_template_has 'articles'45 end46 47 38 def test_edit 48 39 user_id = users(:tobi).id … … 54 45 :email => 'corey@test.com', :password => 'testpass', 55 46 :password_confirmation => 'testpass' } 56 assert_response :redirect, :action => ' show'47 assert_response :redirect, :action => 'list' 57 48 follow_redirect 58 assert_template ' show'49 assert_template 'list' 59 50 assert_valid assigns(:user) 60 51 end trunk/themes/dirtylicious/stylesheets/application.css
r1602 r1688 326 326 327 327 #searchform {padding: 10px;} 328 trunk/themes/scribbish/stylesheets/content.css
r1496 r1688 397 397 display: inline; 398 398 } 399
