Changeset 1686

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

Some admin refactoring...

Files:

Legend:

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

    r1587 r1686  
    88  def list 
    99    @categories = Category.find(:all, :order => :position) 
    10   end 
    11  
    12   def show 
    13     @category = Category.find(params[:id]) 
    1410  end 
    1511 
  • trunk/app/controllers/admin/content_controller.rb

    r1679 r1686  
    22module Admin; end 
    33class Admin::ContentController < Admin::BaseController 
    4    
     4#  layout "minimal", :only => 'show' 
     5  layout "administration", :except => 'show' 
     6 
    57  def auto_complete_for_article_keywords 
    68    @items = Tag.find_with_char params[:article][:keywords].strip 
     
    1416 
    1517  def list 
    16     if params[:order] and params[:order] =~ /\A(?:title|created_at|author|state)\Z/ 
    17       if params[:sense] and params[:sense] == 'desc' 
    18         order = params[:order] + " asc" 
    19       else 
    20         order = params[:order] + " desc" 
    21       end 
     18    # Filtering articles 
     19    conditions = "`contents`.id > 0" 
     20    if params[:search] 
     21      @search = params[:search] 
     22 
     23      if @search[:published_at] and %r{(\d\d\d\d)-(\d\d)} =~ @search[:published_at] 
     24        conditions += " AND published_at LIKE '%#{@search[:published_at]}%'" 
     25      end 
     26 
     27      if @search[:user_id] and @search[:user_id].to_i > 0 
     28        conditions += " AND user_id = #{@search[:user_id].to_i}" 
     29      end 
     30       
     31      if @search[:published] and @search[:published].to_s =~ /0|1/ 
     32        conditions += " AND published = #{@search[:published].to_i}" 
     33      end 
     34       
     35      if @search[:category] and @search[:category].to_i > 0 
     36        conditions += " AND categorizations.category_id = #{@search[:category].to_i}" 
     37      end 
     38       
    2239    else 
    23       order = 'id DESC' 
     40      @search = { :category => nil, :user_id => nil, :published_at => nil, :published => nil } 
    2441    end 
    2542 
    2643    now = Time.now 
    27     count = Article.count 
    28     @articles_pages = Paginator.new(self, count, 15, params[:id]) 
    29     @articles = Article.find(:all, :limit => 15, :order => order, 
    30                              :offset => @articles_pages.current.offset) 
     44    count = Article.count(:all, :include => :categorizations, :conditions => conditions) 
     45    @articles_pages = Paginator.new(self, count, 20, params[:id]) 
     46    @articles = Article.find(:all, :limit => 20, :order => "contents.id DESC", :include => :categorizations, :conditions => conditions, :offset => @articles_pages.current.offset) 
    3147    setup_categories 
    3248    @article = Article.new(params[:article]) 
     
    3551  def show 
    3652    @article = Article.find(params[:id]) 
    37     setup_categories 
    38     @resources = Resource.find(:all, :order => 'created_at DESC') 
    3953  end 
    4054 
     
    5367  alias_method :resource_add,    :category_add 
    5468  alias_method :resource_remove, :category_add 
    55  
    56   def category_remove 
    57     @article  = Article.find(params[:id]) 
    58     @category = @article.categories.find(params['category_id']) 
    59     setup_categories 
    60     @article.categorizations.delete(@article.categorizations.find_by_category_id(params['category_id'])) 
    61     @article.save 
    62     render :partial => 'show_categories' 
    63   end 
    6469 
    6570  def preview 
     
    115120    params[:bookmarklet_link] && post_from_bookmarklet 
    116121 
     122    @resources = Resource.find(:all, :order => 'created_at DESC') 
    117123    @article.attributes = params[:article] 
    118124    setup_categories 
  • trunk/app/controllers/admin/pages_controller.rb

    r1631 r1686  
    88 
    99  def list 
    10     if params[:order] and params[:order] =~ /\A(?:title|created_at|state)\Z/ 
    11       if params[:sense] and params[:sense] == 'desc' 
    12         order = params[:order] + " asc" 
    13       else 
    14         order = params[:order] + " desc" 
     10    conditions = "parent_id = 0" 
     11 
     12    if params[:search] 
     13      @search = params[:search] 
     14 
     15      if @search[:published_at] and %r{(\d\d\d\d)-(\d\d)} =~ @search[:published_at] 
     16        conditions += " AND created_at LIKE '%#{@search[:published_at]}%'" 
    1517      end 
     18 
     19      if @search[:user_id] and @search[:user_id].to_i > 0 
     20        conditions += " AND user_id = #{@search[:user_id].to_i}" 
     21      end 
     22       
     23      if @search[:published] and @search[:published].to_s =~ /0|1/ 
     24        conditions += " AND published = #{@search[:published].to_i}" 
     25      end 
     26       
    1627    else 
    17       order = 'title ASC' 
     28      @search = { :user_id => nil, :published_at => nil, :status => nil } 
    1829    end 
    19  
    20     @pages = Page.find(:all, :order => order
     30     
     31    @pages = Page.find(:all, :conditions => conditions
    2132    @page = Page.new(params[:page]) 
    2233    @page.text_filter ||= this_blog.text_filter 
     
    2738  end 
    2839 
     40  accents = { ['á','à','â','À','ã','Ã','Ä','Â','À'] => 'a', 
     41    ['é','Ú','ê','ë','Ë','É','È','Ê'] => 'e', 
     42    ['í','ì','î','ï','I','Î','Ì'] => 'i', 
     43    ['ó','ò','ÃŽ','ö','õ','Õ','Ö','Ô','Ò'] => 'o', 
     44    ['œ'] => 'oe', 
     45    ['ß'] => 'ss', 
     46    ['ú','ù','û','ÃŒ','U','Û','Ù'] => 'u', 
     47    ['ç','Ç'] => 'c' 
     48  } 
     49 
     50  FROM, TO = accents.inject(['','']) { |o,(k,v)| 
     51    o[0] << k * ''; 
     52    o[1] << v * k.size 
     53    o 
     54  } 
     55 
    2956  def new 
    3057    @page = Page.new(params[:page]) 
    3158    @page.user_id = current_user.id 
    3259    @page.text_filter ||= this_blog.text_filter 
    33     if request.post? and @page.save 
    34       flash[:notice] = 'Page was successfully created.' 
    35       redirect_to :action => 'show', :id => @page.id 
     60    @page.parent_id ||= 0 
     61    if request.post?  
     62      if @page.name.blank? 
     63        @page.name = @page.title.tr(FROM, TO).gsub(/<[^>]*>/, '').to_url  
     64      end 
     65      @page.published_at = Time.now 
     66      if @page.save 
     67        flash[:notice] = 'Page was successfully created.' 
     68        redirect_to :action => 'show', :id => @page.id 
     69      end 
    3670    end 
    3771  end 
  • trunk/app/controllers/admin/resources_controller.rb

    r1587 r1686  
    7373    @r = Resource.new 
    7474    @itunes_category_list = @r.get_itunes_categories 
    75     @resources_pages, @resources = paginate :resource, :per_page => 15, :order_by => "created_at DESC", :parameter => 'page' 
     75    @resources_pages, @resources = paginate :resource, :per_page => 20, :order_by => "created_at DESC", :parameter => 'page' 
    7676  end 
    7777 
  • trunk/app/controllers/admin/tags_controller.rb

    r1683 r1686  
    1717    end 
    1818     
    19     @tags = Tag.find_all_with_article_counters(10000, order) 
     19    count = Tag.count 
     20    @tags_pages = Paginator.new(self, count, 20, params[:id]) 
     21    @tags = Tag.find_all_with_article_counters(20 , order, @tags_pages.current.offset) 
     22 
    2023  end 
    2124   
  • trunk/app/helpers/admin/base_helper.rb

    r1636 r1686  
    6060  def link_to_show(record, controller = @controller.controller_name) 
    6161    link_to image_tag('admin/show.png', :alt => "show", :title => "Show content"),  
    62       :controller => controller, :action => 'show', :id => record.id 
     62      {:controller => controller, :action => 'show', :id => record.id},  
     63      {:class => "lbOn"} 
    6364  end 
    6465 
     
    198199    end 
    199200  end 
    200    
    201   def order_link(title, controller, action, order) 
    202     link_to _(title), :controller => controller, :action => action, :order => order, :sense => (params[:sense] and params[:sense] == 'asc') ?  'desc' : 'asc' 
    203   end 
    204    
     201 
    205202  def t_textarea(object_name, method, options) 
    206203    if this_blog.editor == 2 
     
    210207    end 
    211208  end 
     209   
     210  def collection_select_with_current(object, method, collection, value_method, text_method, current_value, prompt=false) 
     211    result = "<select name='#{object}[#{method}]'>\n"  
     212       
     213    if prompt == true 
     214      result << "<option value=''>Please select</option>" 
     215    end 
     216    for element in collection 
     217      if current_value and current_value == element.send(value_method) 
     218        result << "<option value='#{element.send(value_method)}' selected='selected'>#{element.send(text_method)}</option>\n"  
     219      else 
     220        result << "<option value='#{element.send(value_method)}'>#{element.send(text_method)}</option>\n"  
     221      end 
     222    end 
     223    result << "</select>\n"  
     224    return result 
     225  end 
     226 
    212227end 
  • trunk/app/helpers/admin/content_helper.rb

    r1494 r1686  
    66  end 
    77 
     8  def params_qsa 
     9    { 'search[category]' => @search[:category],  
     10      'search[user_id]' => @search[:user_id],  
     11      'search[published_at]' => @search[:published_at],  
     12      'searched[published]' => @search[:published] } 
     13  end 
     14 
    815end 
  • trunk/app/helpers/admin/pages_helper.rb

    r1335 r1686  
    55    [@page] 
    66  end 
     7   
     8  def display_page_row(page) 
     9    result = "<tr alternate_class>\n" 
     10    if page.parent_id == 0 
     11      result << "<td>#{link_to_permalink(page,page.title)}</td>\n" 
     12    else 
     13      result << "<td>–––– #{link_to_permalink(page,page.title)}</td>\n" 
     14    end 
     15    result << "<td>/pages/#{page.name}</td>\n" 
     16    result << "<td>#{page.created_at.strftime('%d/%m/%Y at %H:%M')}</td>\n" 
     17    result << "<td>#{author_link(page)}</td>\n" 
     18    result << "<td class='operation'>"  
     19    if page.published? 
     20      result << image_tag('admin/checked.png', :alt => "online", :title => _("Online"))  
     21    else 
     22      result << image_tag('admin/cancel.png', :alt => "offline", :title => _("Offline"))  
     23    end  
     24    result << "</td>\n" 
     25    result << "<td class='operation'>#{link_to image_tag('admin/show.png', :alt => 'View page', :title => 'Preview page'), {:action => 'show', :id => page.id}}</td>\n" 
     26    result << "<td class='operation'>#{link_to_edit page}</td>\n" 
     27    result << "<td class='operation'>#{link_to_destroy page}</td>\n" 
     28    result << "</tr>\n" 
     29    return result 
     30  end 
     31   
    732end 
  • trunk/app/models/article.rb

    r1676 r1686  
    208208  end 
    209209 
     210  def self.find_by_published_at 
     211    find_by_sql("SELECT date_format(published_at, '%Y-%m') AS publication FROM contents WHERE published_at > 0 GROUP BY publication") 
     212  end 
     213 
    210214  def self.date_from(params_hash) 
    211215    params_hash[:article_year] \ 
  • trunk/app/models/page.rb

    r1494 r1686  
    2222  end 
    2323 
     24  def self.find_by_published_at 
     25    find_by_sql("SELECT date_format(created_at, '%Y-%m') AS publication FROM contents WHERE type = 'Page' GROUP BY publication") 
     26  end 
     27 
     28 
    2429  def edit_url 
    2530    blog.url_for(:controller => "/admin/pages", :action =>"edit", :id => id) 
  • trunk/app/models/tag.rb

    r1683 r1686  
    3232  before_save :ensure_naming_conventions 
    3333 
    34   def self.find_all_with_article_counters(limit = 20, orderby='article_counter DESC'
     34  def self.find_all_with_article_counters(limit=20, orderby='article_counter DESC', start=0
    3535    # Only count published articles 
    3636    self.find_by_sql([%{ 
     
    4343      GROUP BY tags.id, tags.name, tags.display_name 
    4444      ORDER BY #{orderby}  
    45       LIMIT ? 
    46       },true, limit]).each{|item| item.article_counter = item.article_counter.to_i } 
     45      LIMIT ?, ?  
     46      },true, start, limit]).each{|item| item.article_counter = item.article_counter.to_i } 
    4747  end 
    4848 
  • trunk/app/views/admin/categories/_categories.html.erb

    r1649 r1686  
    11<table> 
    2   <tr
    3     <th class="first"><%= _("Title") %></th> 
     2  <tr class="first"
     3    <th><%= _("Title") %></th> 
    44    <th><%= _("Posts") %></th> 
    5     <th><%= _("Status") %></th> 
    6     <th><%= _("View") %></th> 
    75    <th><%= _("Edit") %></th> 
    8     <th class="last"><%= _("Delete") %></th> 
     6    <th><%= _("Delete") %></th> 
    97  </tr> 
    108  <% for category in @categories -%> 
    119  <tr <%= alternate_class -%> id="category_<%= category.id -%>"> 
    12     <td class="first"><%= link_to category.name, {:controller => 'articles', :action => 'category', :id => category.permalink} %></td> 
    13     <td><%= pluralize(category.articles.size, 'article') %></td> 
    14     <td class="operation"><%= image_tag 'admin/checked.png' %></td> 
    15     <td class="operation"><%= link_to_show category %></td> 
     10    <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> 
    1612    <td class="operation"><%= link_to_edit category %></td> 
    17     <td class="operation last"><%= link_to_destroy category %></td> 
     13    <td class="operation"><%= link_to_destroy category %></td> 
    1814  </tr>   
    1915  <% end -%> 
  • trunk/app/views/admin/content/show.html.erb

    r1552 r1686  
    1   <% @page_heading = _('Preview Article') %> 
    2  
    3   <% content_for('tasks') do %> 
    4     <%= task_edit _('Edit this article'), @article.id %> 
    5     <li><%= link_to _('View article on your blog'), @article.permalink_url %></li> 
    6         <%= task_overview %> 
    7   <% end %> 
    8  
    9   <h3>Live Preview</h3> 
    10  
    11   <div class="form" style="text-align: center; margin: auto;"> 
    12         <iframe src="<%=@article.permalink_url%>" width="95%" height="700px"></iframe> 
    13   </div> 
    14  
    15   <h3><%= _("Categories")%></h3> 
    16   <div id="categories" class="form"> 
    17     <%= render :partial => 'show_categories' -%> 
    18   </div> 
    19  
    20   <h3><%= _("Attachments")%></h3> 
    21   <div id="resources" class="form"> 
    22     <%= render :partial => 'show_resources' -%> 
    23   </div> 
     1<iframe src="<%=@article.permalink_url%>" width="960px" height="700px" border="0"></iframe> 
     2<a href="#" class="lbAction" rel="deactivate">Close.</a> 
  • trunk/app/views/admin/content/_articles.html.erb

    r1671 r1686  
     1<% form_tag({:action => 'index'}, :method => :get, :name => 'article') do %> 
    12<table> 
    2 <tr
    3   <th class="first"><%= order_link "Title", 'admin/content', 'list', 'title' %></th> 
     3<tr class="first"
     4  <th><%= _("Title") %></th> 
    45  <th><%= _("Categories") %></th> 
    5   <th><%= _("Comments")%></th> 
    6   <th><%= order_link "Date", 'admin/content', 'list', 'created_at' %></th> 
     6  <th><%= _("Feedback")%></th> 
     7  <th><%= _("Date") %></th> 
    78  <th><%= _("Author")%></th> 
    8   <th><%= order_link _("Status"), 'admin/content', 'list', 'state' %></th> 
    9   <th><%= _("View")%></th> 
     9  <th><%= _("Status") %></th> 
     10  <th><%= _("Preview")%></th> 
    1011  <th><%= _("Edit")%></th> 
    11   <th class="last"><%= _("Delete")%></th> 
     12  <th><%= _("Delete")%></th> 
     13</tr> 
     14<tr class="menubar"> 
     15  <td>&nbsp;</td> 
     16   <td><%= collection_select_with_current('search', 'category', @categories, "id", "name", @search[:category].to_i, true) 
     17  %></td> 
     18  <td></td> 
     19  <td> 
     20    <%= collection_select_with_current(:search, :published_at, Article.find_by_published_at, "publication", "publication", @search[:published_at], true) %> 
     21  </td> 
     22  <td><%= collection_select_with_current(:search, :user_id, User.find(:all), "id", "name", @search[:user_id].to_i, true) %></td> 
     23  <td> 
     24    <select name="search[published]"> 
     25      <option value="">Please select</option> 
     26      <option value="0">Unpublished</option> 
     27      <option value="1">Published</option> 
     28    </select> 
     29  </td> 
     30  <td colspan="3"><input type="submit" value="Filter" /> 
    1231</tr> 
    1332<% for article in @articles %> 
    1433<tr <%= alternate_class %>> 
    15   <td class="first"> <%= link_to_permalink article, h(article.title) %></td> 
     34  <td> <%= link_to_permalink article, h(article.title) %></td> 
    1635  <td><%= article.categories.map { |c| link_to h(c.name), {:controller => 'admin/categories', :action => 'show', :id => c.id}}.join(", ") %></td> 
    1736  <td><%= link_to _(pluralize(article.comments.size, 'comments')), :controller => '/admin/comments', :article_id => article.id, :action => 'list' %></td> 
     
    2140  <td class="operation"><%= link_to_show article %></td> 
    2241  <td class="operation"><%= link_to_edit article %></td> 
    23   <td class="operation last"><%= link_to_destroy article %></td> 
     42  <td class="operation"><%= link_to_destroy article %></td> 
    2443</tr> 
    2544<% end %> 
    2645</table> 
     46<%end%> 
  • trunk/app/views/admin/content/_attachment.html.erb

    r1552 r1686  
    1414    :asynchronus => false -%> 
    1515</div> 
     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/> 
     21<% end %> 
     22<% end %> 
  • trunk/app/views/admin/content/_form.html.erb

    r1679 r1686  
    22<!--[form:articles]--> 
    33<div id="article_keywords_auto_complete" class="auto_complete"></div> 
    4 <fieldset class="set admin" style="display: block"> 
    5   <legend><%= _("Write post") %></legend> 
    6   <div <%='style="width: 48%; float: left;"' if this_blog.editor == 1 %>> 
    7      <ul> 
    8        <li> 
    9           <label for="article_title" class="block"><%= _("Title")%>:</label> 
    10           <%= text_field 'article', 'title', :class => 'large' %> 
    11        </li> 
    12        <li> 
    13           <label for="article_body"><%= _("Post")%>:</label> 
    14           <%= markup_help_popup @article.text_filter, image_tag('admin/help.png', :alt => "markup help", :title => "Markup Help") %> 
    15           <%= t_textarea 'article', 'body', {:height => '300', :style => 'width : 100%'} %> 
    16        </li> 
    17        <li class="paginate l"> 
    18           <label for="article_extended"> 
    19           <%= link_to_function _("Optional Extended Content") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "extended", :duration => 0.2) } %> 
    20           </label> 
    21           <p id="extended" <%= "style='display: none;'" if @article.extended.blank? %>> 
    22             <%= t_textarea 'article', 'extended', :height => '450', :style => 'width : 90%' %> 
    23           </p> 
    24        </li> 
    25        <li class="paginate l"> 
    26           <label for="categories" class="block"> 
    27             <%= link_to_function _("Categories") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "categories", :duration => 0.2) } %> 
    28           </label> 
    29           <select id="categories" class="large" name="categories[]" multiple="multiple" size="10" <%= "style='display:none;'" if @article.categories.blank? %>> 
    30              <%= options_from_collection_for_select(@categories, "id", "name", @selected) %> 
    31           </select> 
    32        </li> 
    33        <li class="paginate l"> 
    34           <label class="block" for="article_keywords"> 
    35            <%= link_to_function _("Tags") + " (+/-)", update_page { |page| page.visual_effect(:toggle_blind, "tags", :duration => 0.2); page.toggle(:tags) } %> 
    36           </label> 
    37           <p id="tags" <%= "style='display: none;'" if @article.keywords.blank? %>> 
    38             <%= text_field 'article', 'keywords', {:autocomplete => 'off', :style => 'width: 90%;'} %> 
    39             <%= auto_complete_field 'article_keywords', { :url => { :action => "auto_complete_for_article_keywords"}, :tokens => ','}%> 
    40           </p> 
     4<ul class="set admin"> 
     5  <li> 
     6    <label for="article_title" class="block title"><%= _("Title")%></label> 
     7    <%= text_field 'article', 'title', :class => 'large' %> 
     8  </li> 
     9  <li> 
     10    <label for="article_body" class="block content"><%= _("Content")%></label> 
     11    <%= t_textarea 'article', 'body', {:height => '300', :class => 'large'} %> 
     12  </li> 
     13  <li> 
     14    <label class="block r" for="article_extended"> 
     15      <%= link_to_function _("Add Extended Content") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "extended", :duration => 0.2) } %> 
     16    </label> 
     17    <ul> 
     18      <li id="extended" <%= "style='display: none;'" if @article.extended.blank? %>> 
     19        <%= t_textarea 'article', 'extended', :height => '450', :class => 'large' %> 
    4120      </li> 
    42       <li class="paginate l"> 
    43         <label class="block"> 
    44           <%= link_to_function _("Publishing options") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "publishing_options", :duration => 0.2) } %> 
    45         </label> 
    46         <div id="publishing_options" <%= "style='display: none;'" unless @article.published.blank? %> > 
    47           <p> 
    48            <label for="article_published_at" class="float"><%= _("Publish at")%>:</label> 
    49            <%= datetime_select 'article', 'published_at', :include_blank => true  %> 
    50          </p> 
    51          <p> 
    52           <label for="article_published" class="float"><%= _("Online")%>:</label> 
    53           <%= check_box 'article', 'published'  %> 
    54         </p> 
    55         </div> 
     21    </ul> 
     22  </li> 
     23  <li style="margin-bottom: 20px;"> 
     24    <label class="block tags" for="article_keywords"><%= _("Tags") %></label> 
     25        <%= text_field 'article', 'keywords', {:autocomplete => 'off', :class => 'large'} %> 
     26        <%= auto_complete_field 'article_keywords', { :url => { :action => "auto_complete_for_article_keywords"}, :tokens => ','}%> 
     27  </li> 
     28  <li class="paginate l"> 
     29    <label for="categories" class="block"> 
     30      <%= link_to_function _("Categories") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "categories", :duration => 0.2) } %> 
     31    </label> 
     32    <select id="categories" class="large" name="categories[]" multiple="multiple" size="10" <%= "style='display:none;'" if @article.categories.blank? %>> 
     33      <%= options_from_collection_for_select(@categories, "id", "name", @selected) %> 
     34    </select> 
     35  </li> 
     36  <li class="paginate l"> 
     37    <label class="block"> 
     38      <%= link_to_function _("Uploads") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "uploads", :duration => 0.2) } %> 
     39    </label> 
     40    <ul> 
     41      <li id="uploads" <%= 'style="display: none"' unless @article.resources.count > 0 %>> 
     42        <%= render :partial => 'admin/content/attachment', :locals => { :attachment_num => 1, :hidden => false } -%> 
    5643      </li> 
    57      </ul> 
    58      <p class="r"><%= save(_("Save") + " &raquo;") %></p> 
    59   </div> 
    60     <% if this_blog.editor == 1 %> 
    61     <iframe id="preview" class="post" style="display: block;"></iframe> 
    62   <br style ="clear: both"/> 
    63     <% end %> 
    64 </fieldset> 
    65  
    66 <fieldset class="set admin"> 
    67   <legend><%= _("Upload")%></legend> 
    68   <div id="attachments"> 
    69     <%= render :partial => 'admin/content/attachment', :locals => { :attachment_num => 1, :hidden => false } -%> 
    70   </div> 
    71 </fieldset> 
    72  
    73 <fieldset class="set admin"> 
    74   <legend><%= _("Options")%></legend> 
    75   <ul> 
    76     <li><%= _("These are advanced options. Only experimented users should use them")%>.</li> 
    77     <li class="paginate l"> 
    78       <label for="article_permalink" class="block"> 
    79         <%= link_to_function _("Permalink") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "article_permalink", :duration => 0.2) } %> 
    80       </label> 
    81       <%= text_field 'article', 'permalink', :style => 'width: 90%;' + "display:none;" if @article.keywords.blank?  %> 
    82     </li>      
    83       
    84      <li class="checkbox"> 
    85        <label for="article_allow_comments" class="float"><%= _("Allow comments") %>: </label> 
    86        <%= check_box 'article', 'allow_comments'  %> 
    87      </li> 
    88      <li class="checkbox"> 
    89         <label for="article_allow_pings" class="float"><%= _("Allow trackbacks")%>: </label> 
    90         <%= check_box 'article', 'allow_pings'  %> 
    91      </li> 
     44    </ul> 
     45  </li> 
     46  <li class="paginate l"> 
     47    <label class="block"> 
     48      <%= link_to_function _("Post settings") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "publishing_options", :duration => 0.2) } %> 
     49    </label> 
     50    <ul> 
     51      <li id="publishing_options" <%= "style='display: none;'" unless @article.published.blank? %> > 
     52        <ul> 
     53          <li> 
     54            <label for="article_published_at" class="float"><%= _("Publish at")%>:</label> 
     55            <%= datetime_select 'article', 'published_at', :include_blank => true  %>             
     56          </li> 
     57          <li> 
     58            <label for="article_published" class="float"><%= _("Online")%>:</label> 
     59            <%= check_box 'article', 'published'  %> 
     60          </li> 
     61          <li> 
     62            <label for="article_permalink" class="float"><%= _("Permalink") %></label> 
     63            <%= text_field 'article', 'permalink' %> 
     64          </li>      
     65          <li class="checkbox"> 
     66            <label for="article_allow_comments" class="float"><%= _("Allow comments") %>: </label> 
     67            <%= check_box 'article', 'allow_comments'  %> 
     68          </li> 
     69          <li class="checkbox"> 
     70            <label for="article_allow_pings" class="float"><%= _("Allow trackbacks")%>: </label> 
     71            <%= check_box 'article', 'allow_pings'  %> 
     72          </li> 
     73        </ul> 
    9274        <%= hidden_field_tag 'text_filter', this_blog.text_filter %> 
    93   </ul
    94 </fieldset
    95  
    96  
     75      </li
     76    </ul
     77  </li> 
     78</ul> 
    9779<!--[eoform:articles]--> 
  • trunk/app/views/admin/content/_pages.html.erb

    r1552 r1686  
    1     <%= link_to _("Previous page"), { :id => pages.current.previous } if pages.current.previous -%> 
    2     <%= pagination_links pages, :name => 'id' -%> 
    3     <%= link_to _("Next page"), { :id => pages.current.next } if pages.current.next -%> 
     1    <%= link_to _("Previous page"), :id => pages.current.previous, :params => params_qsa if pages.current.previous -%> 
     2    <%= pagination_links pages, {:name => 'id' , :params => params_qsa} -%> 
     3    <%= link_to _("Next page"), :id => pages.current.next, :params => params_qsa if pages.current.next -%> 
  • trunk/app/views/admin/feedback/list.html.erb

    r1671 r1686  
    22 
    33<% content_for('tasks') do %> 
    4   <li><%= link_to _("all feedback"), {:controller => 'feedback'}, :class => all_feedback %></li
     4  <%= task_showmod(count_unconfirmed, "Unapproved comments", limit_to_unconfirmed) %
    55  <%= task_showmod(count_spam , "Limit to spam", limit_to_spam) %> 
    6   <%= task_showmod(count_unconfirmed, "Limit to unconfirmed", limit_to_unconfirmed) %> 
    7   <%= task_showmod(count_unconfirmed_spam, "Limit to unconfirmed spam", limit_to_unconfirmed_spam) %> 
    86  <%= tab _("Blacklist"), :controller=>"blacklist", :action=>"index" %> 
    97<% end %> 
  • trunk/app/views/admin/pages/show.html.erb

    r1552 r1686  
    22   
    33  <% content_for('tasks') do %> 
    4     <%= task_edit _('Edit this page'), @page.id %> 
    5     <li><%= link_to _('View page on your blog'), @page.permalink_url %></li
     4    <%= task_overview %> 
     5    <%= task_edit _('Edit'), @page.id %
    66  <% end %>  
    7  
    8   <h3>Live Preview</h3> 
    97 
    108  <div class="form" style="text-align: center; margin: auto;"> 
  • trunk/app/views/admin/pages/_form.html.erb

    r1636 r1686  
    11<%= error_messages_for 'page' %> 
    22<!--[form:pages]--> 
    3 <fieldset class="set admin" style="display: block"> 
    4   <iframe id="preview" class="post" style="display: none;"></iframe> 
    5   <div <%='style="width: 48%; float: left;"' if this_blog.editor == 1 %>> 
    6      <ul> 
    7        <li> 
    8           <label for="page_title" class="block"><%= _("Title")%>:</label> 
    9           <%= text_field 'page', 'title', :size => 20, :style => "width: 100%;"  %> 
    10        </li> 
    11        <li> 
    12           <label for="page_name" class="block"><%= _("Permalink")%>:</label> 
    13           <%= this_blog.base_url %>pages/ <%= text_field 'page', 'name', :size => 25  %> 
    14        </li> 
    15        <li> 
    16           <label for="page_body"><%= _("Page Content")%>:</label> 
    17           <%= markup_help_popup @page.text_filter, image_tag('admin/help.png', :alt => " markup help", :title => "Markup help") %> 
    18           <%= t_textarea 'page', 'body', {:height => '300', :style => 'width: 100%;'} %>  
    19        </li> 
    20      </ul> 
    21      <p class="r"><%= save(_("Save") + " &raquo;") %></p> 
    22   </div> 
    23   <br style="clear: both;" /> 
    24 </fieldset> 
     3<ul class="set admin"> 
     4  <li> 
     5    <label for="page_title" class="block title"><%= _("Title")%></label> 
     6    <%= text_field 'page', 'title', :class => 'large'  %> 
     7  </li> 
     8  <li> 
     9    <label for="page_body" class="block content"><%= _("Content")%></label> 
     10    <%= t_textarea 'page', 'body', {:height => '300', :class => 'large'} %>  
     11  </li> 
     12  <li class="paginate l"> 
     13    <label for="options"> 
     14      <%= link_to_function _("Options") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "options", :duration => 0.2) } %> 
     15    </label> 
     16    <ul> 
     17      <li id="options" style='display: none;'> 
     18        <ul> 
     19          <li> 
     20            <label for="page_name" class="float"><%= _("Permalink")%>:</label> 
     21            <%= text_field 'page', 'name', :size => 25  %> 
     22          </li> 
     23          <li> 
     24            <label for="page_published" class="float"><%= _("Online")%>:</label> 
     25            <%= check_box 'page', 'published'  %> 
     26            <%= hidden_field_tag 'text_filter', this_blog.text_filter %> 
     27          </li> 
     28        </ul> 
     29      </li> 
     30    </ul> 
     31  </li> 
    2532 
    26 <fieldset class="set admin"> 
    27   <legend><%= _("Options")%></legend> 
    28   <ul> 
    29      <li> 
    30        <label for="page_text_filter" class="float"><%= _("Textfilter")%>: </label> 
    31        <%= select 'page', 'text_filter', text_filter_options %> 
    32      </li> 
    33      <li> 
    34        <label for="page_published" class="float"><%= _("Online")%>:</label> 
    35        <%= check_box 'page', 'published'  %> 
    36      </li> 
    3733 
    38   </ul> 
    39 </fieldset
     34 
     35</ul
    4036 
    4137<!--[eoform:pages]--> 
  • trunk/app/views/admin/pages/_pages.html.erb

    r1634 r1686  
     1<% form_tag({:action => 'index'}, :method => :get, :name => 'search') do %> 
    12<table cellspacing="1" cellpadding="0"> 
    2 <tr> 
    3   <th class="first"><%= order_link "Title", 'admin/pages', 'list', 'title'%></th> 
    4   <th><%= _("Permalink")%></th> 
    5   <th><%= order_link "Date", 'admin/pages', 'list', 'created_at' %></th> 
    6   <th><%= _("Author")%></th> 
    7   <th><%= order_link _("Status"), 'admin/pages', 'list', 'state' %></th> 
    8   <th><%= _("View")%></th> 
    9   <th><%= _("Edit")%></th> 
    10   <th class="last"><%= _("Delete")%></th> 
    11 </tr> 
    12 <% for page in @pages %> 
    13 <tr <%= alternate_class %>> 
    14   <td class="first"> <%= link_to_permalink(page,page.title) %></td> 
    15   <td>/pages/<%= page.name %></td> 
    16   <td><%= page.created_at.strftime("%d/%m/%Y at %H:%M") %></td> 
    17   <td><%= author_link(page)  %></td> 
    18   <td class="operation"><%= (page.published?) ? image_tag('admin/checked.png', :alt => "online", :title => _("Online")) : image_tag('admin/cancel.png', :alt => "offline", :title => _("Offline")) %></td> 
    19   <td class="operation"><%= link_to image_tag('admin/show.png', :alt => "View page", :title => "Preview page"), {:action => "show", :id => page.id} %></td> 
    20   <td class="operation"><%= link_to_edit page %></td> 
    21   <td class="operation last"><%= link_to_destroy page %></td>     
    22 </tr>   
     3  <tr class="first"> 
     4    <th><%= _("Title") %></th> 
     5    <th><%= _("Permalink")%></th> 
     6    <th><%= _("Date") %></th> 
     7    <th><%= _("Author")%></th> 
     8    <th><%= _("Status") %></th> 
     9    <th><%= _("Preview")%></th> 
     10    <th><%= _("Edit")%></th> 
     11    <th><%= _("Delete")%></th> 
     12  </tr> 
     13  <tr class="menubar"> 
     14    <td colspan=2>&nbsp;</td> 
     15    <td> 
     16    <%= collection_select_with_current(:search, :published_at, Page.find_by_published_at, "publication", "publication", @search[:published_at].to_s, true) %>       
     17    </td> 
     18    <td><%= collection_select_with_current(:search, :user_id, User.find(:all), "id", "name", @search[:user_id].to_i, true) %></td> 
     19    <td> 
     20      <select name="search[published]"> 
     21        <option value="">Please select</option> 
     22        <option value="0">Unpublished</option> 
     23        <option value="1">Published</option> 
     24      </select> 
     25    </td> 
     26    <td colspan="3"><input type="submit" value="Filter" /> 
     27  </tr> 
     28  <% for page in @pages %> 
     29   
     30  <tr <%= alternate_class %>> 
     31    <td><%= link_to_permalink(page, page.title) %></td> 
     32    <td><%= page.name%></td> 
     33    <td><%= page.created_at.strftime('%d/%m/%Y at %H:%M') %></td> 
     34    <td><%= author_link(page) %></td> 
     35    <td class="operation"> 
     36    <% if page.published? %> 
     37    <%= image_tag('admin/checked.png', :alt => "online", :title => _("Online")) %> 
     38    <% else %> 
     39    <%= image_tag('admin/cancel.png', :alt => "offline", :title => _("Offline"))  %> 
     40    <% end %> 
     41    </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_edit page %></td> 
     44    <td class='operation'><%= link_to_destroy page %></td> 
     45  </tr> 
     46  <% end %> 
     47  </table> 
    2348<% end %> 
    24 </table> 
  • trunk/app/views/admin/resources/_resources.html.erb

    r1587 r1686  
    1 <table cellspacing="1" cellpadding="0"
    2 <tr
    3   <th class="first"><%= _("Filename")%> <small>(<%= _('right-click for link')%>)</small></th> 
     1<table
     2<tr class="first"
     3  <th><%= _("Filename")%> <small>(<%= _('right-click for link')%>)</small></th> 
    44  <th><%= _("Content Type")%></th> 
    55  <th><%= _("MetaData")%></th> 
     
    1111<% for upload in resources -%> 
    1212<tr <%= alternate_class -%>> 
    13   <td class="first"><%= link_to "#{upload.filename}", "#{blog_root}/files/#{upload.filename}" -%></td> 
     13  <td><%= link_to "#{upload.filename}", "#{blog_root}/files/#{upload.filename}" -%></td> 
    1414  <td> 
    1515    <%= task_edit_resource_mime(upload.mime, upload.id) %> 
     
    3535  <td><%=h upload.size rescue 0 -%> bytes</td> 
    3636  <td><%=h upload.created_at.strftime('%Y-%m-%d %H:%M:%S') -%></td> 
    37   <td class="operation last"><%= link_to_destroy upload -%></td>     
     37  <td class="operation"><%= link_to_destroy upload -%></td>     
    3838</tr>   
    3939<% end -%> 
  • trunk/app/views/admin/shared/_edit.html.erb

    r1563 r1686  
    22  <%= render :partial => "form" %> 
    33 
    4   <div id="operations" class="paginate"> 
    5     <p class="r"><%= save(_("Save") + " &raquo;") %></p> 
    6   </div>