ordre articles
This commit is contained in:
parent
b0b1c47fb2
commit
0117c1eb10
@ -112,7 +112,7 @@ class Admin::ArticlesController < ApplicationController
|
||||
|
||||
private
|
||||
def article_params
|
||||
params.require(:article).permit(:frontpage, :enabled, :published_at, :title, :slug, :tags_cache, :description, :image_file_id)
|
||||
params.require(:article).permit(:frontpage, :enabled, :published_at, :end_at, :title, :slug, :tags_cache, :description, :image_file_id, :priority_level)
|
||||
|
||||
|
||||
|
||||
|
@ -12,6 +12,13 @@ class Article < ActiveRecord::Base
|
||||
HUMAN_NAME = "lien vers un article."
|
||||
|
||||
before_validation do
|
||||
if self.published_at?
|
||||
self.published_at = self.published_at.beginning_of_day
|
||||
end
|
||||
if self.end_at?
|
||||
self.end_at = self.end_at.beginning_of_day
|
||||
end
|
||||
|
||||
self.slug = [self.published_at.year,self.published_at.month,self.published_at.day].join("-")+"-"+self.title.to_slug
|
||||
#self.tags_cache = self.tags_cache.gsub(/ +/, ' ').gsub(/, /,',').gsub(/ ,/,',').gsub(/,+/, ',')
|
||||
#self.tags_cache = self.tags_cache.to_s.gsub(/ +/, ' ').gsub(/, /,',').gsub(/ ,/,',').gsub(/,+/, ',')
|
||||
@ -34,7 +41,7 @@ class Article < ActiveRecord::Base
|
||||
end
|
||||
|
||||
scope :frontpage, where("frontpage = ?",true )
|
||||
scope :recents, where("enabled = ?",true ).order("published_at DESC, priority_level ASC")
|
||||
scope :recents, where("enabled = ?",true ).order("published_at DESC, priority_level DESC")
|
||||
|
||||
scope :between, lambda { |start, stop|
|
||||
after(start).before(stop)
|
||||
|
@ -13,7 +13,7 @@
|
||||
= link_to i(:trash), [:admin, article], :confirm => 'Voulez-vous vraiment supprimer cet article ?', :method => :delete, :remote => true
|
||||
|
||||
= link_to i(:pencil), edit_admin_article_path(article), :style => "padding:0px 0px 0px 0px;", :remote => true
|
||||
= link_to i(:info), edit_admin_article_path(article), :style => "padding:0px 0px 0px 0px;"
|
||||
= link_to i(:plus), edit_admin_article_path(article), :style => "padding:0px 0px 0px 0px;"
|
||||
|
||||
=#link_to i(:"level-down"), admin_article_path(:id => article.id, :format => "js"), :class => "set_tag"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
%td.actions{:style => "width:200px;text-align:right;"}
|
||||
= link_to i(:copy), new_admin_event_path(:event_id => event), :remote => true, :style => "padding-right:5px;"
|
||||
= link_to i(:trash), [:admin, event], :confirm => 'Voulez-vous vraiment supprimer cet événement ?', :method => :delete, :remote => true
|
||||
|
||||
= link_to i(:plus), edit_admin_event_path(event), :style => "padding:5px;", :class => "show_details"
|
||||
= link_to i(:pencil), edit_admin_event_path(event), :remote => true
|
||||
= link_to i(:plus), edit_admin_event_path(event), :style => "padding:5px;", :class => "show_details"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user