echo du réseau
This commit is contained in:
parent
be25103b63
commit
da4c4ecfae
@ -113,7 +113,7 @@ class Admin::ArticlesController < ApplicationController
|
||||
|
||||
private
|
||||
def article_params
|
||||
params.require(:article).permit(:author_id, :category_id, :enabled, :published_at, :title, :slug, :tags_cache, :description, :image_file_id, :title_cached)
|
||||
params.require(:article).permit(:author_id, :category_id, :echo, :enabled, :published_at, :title, :slug, :tags_cache, :description, :image_file_id, :title_cached)
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ class Public::ArticlesController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
@articles = Article.before(Date.today).recents
|
||||
@articles = Article.where(:echo => false).before(Date.today).recents
|
||||
|
||||
@articles = @articles.page(params[:page]).per(12)
|
||||
|
||||
@ -18,6 +18,16 @@ class Public::ArticlesController < ApplicationController
|
||||
@index_title = "Actualités du Pic Vert"
|
||||
end
|
||||
|
||||
def reseau
|
||||
|
||||
@articles = Article.where(:echo => true).before(Date.today).recents
|
||||
|
||||
@articles = @articles.page(params[:page]).per(12)
|
||||
|
||||
|
||||
@index_title = "Echo du réseau"
|
||||
end
|
||||
|
||||
def feed
|
||||
# this will be the name of the feed displayed on the feed reader
|
||||
@title = "La cabane du lutin"
|
||||
|
@ -1,12 +1,14 @@
|
||||
= semantic_form_for [:admin,@article], :remote => true do |form|
|
||||
.content
|
||||
= form.inputs do
|
||||
= form.input :echo, :label => "Echo du réseau ?"
|
||||
=form.input :image_file_id, :as => :qi_image_select
|
||||
=form.input :author_id, :as => :select, :collection => Author.order(:name), :include_blank => false
|
||||
=form.input :category_id, :as => :select, :collection => Category.order(:name)
|
||||
= form.input :enabled,:as => :boolean , :label => "Actif"
|
||||
= form.input :published_at, :label => "Date de publication : ",:as => :qi_date_picker
|
||||
|
||||
|
||||
= form.input :title, :label => "Titre :"
|
||||
= form.input :title_cached,:as => :boolean , :label => "Titre masqué ?"
|
||||
= form.input :slug, :label => "Slug :"
|
||||
|
54
app/views/admin/articles/reseau.html.haml
Normal file
54
app/views/admin/articles/reseau.html.haml
Normal file
@ -0,0 +1,54 @@
|
||||
.row{:style => "max-width:inherit;"}
|
||||
.col-xs-9
|
||||
.right= link_to 'Ajouter un article', new_admin_article_path(), :class => "btn btn-primary", :remote => true
|
||||
%h1 Liste des articles
|
||||
|
||||
#articles_index=render :partial => "index_block"
|
||||
|
||||
.col-xs-3
|
||||
%h3 Tags
|
||||
=render :partial => "tags"
|
||||
|
||||
|
||||
:coffeescript
|
||||
root = exports ? this
|
||||
root.tag_id = []
|
||||
|
||||
|
||||
$(document.body).on "click", "#tags .tag_label", ->
|
||||
|
||||
if $(this).hasClass("active")
|
||||
$(this).removeClass "active"
|
||||
|
||||
else
|
||||
$(this).addClass "active"
|
||||
|
||||
root.tag_id = []
|
||||
|
||||
$("#tags .tag_label.active").each ->
|
||||
root.tag_id.push $(this).data "tag_id"
|
||||
|
||||
if root.tag_id.length > 0
|
||||
$(".set_tag").show()
|
||||
else
|
||||
$(".set_tag").hide()
|
||||
|
||||
|
||||
$(document.body).on "click", ".set_tag", ->
|
||||
|
||||
$.ajax({
|
||||
url:$(this).attr("href"),
|
||||
type: "PUT",
|
||||
data: {
|
||||
tag_id : tag_id
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
%h1=@index_title
|
||||
%p=link_to "Actualités du réseau", reseau_path
|
||||
|
||||
=render :partial => "index"
|
||||
|
||||
-content_for :sidebar do
|
||||
|
7
app/views/public/articles/reseau.html.haml
Normal file
7
app/views/public/articles/reseau.html.haml
Normal file
@ -0,0 +1,7 @@
|
||||
%h1=@index_title
|
||||
%p=link_to "Actualités du Pic Vert", articles_path
|
||||
|
||||
=render :partial => "index"
|
||||
|
||||
-content_for :sidebar do
|
||||
=render :partial => "sidebar_archives"
|
@ -6,6 +6,7 @@ Survey::Application.routes.draw do
|
||||
get "agenda.html" => "public/events#index", :as => "public_events"
|
||||
get 'actualites/:id.html' => "public/articles#show", :as => "public_article"
|
||||
get 'actualites.html' => "public/articles#index", :as => "articles"
|
||||
get 'actualite-du-reseau.html' => "public/articles#reseau", :as => "reseau"
|
||||
|
||||
get 'faqs/:id.html' => "public/faqs#show", :as => "public_faq"
|
||||
get 'faqs.html' => "public/faqs#index", :as => "faqs"
|
||||
|
5
db/migrate/20151106153327_add_reseau_to_articles.rb
Normal file
5
db/migrate/20151106153327_add_reseau_to_articles.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddReseauToArticles < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :articles, :echo, :boolean, :default => 0
|
||||
end
|
||||
end
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151021135332) do
|
||||
ActiveRecord::Schema.define(version: 20151106153327) do
|
||||
|
||||
create_table "admins", force: true do |t|
|
||||
t.string "email", default: "", null: false
|
||||
@ -82,6 +82,7 @@ ActiveRecord::Schema.define(version: 20151021135332) do
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "author_id"
|
||||
t.boolean "echo", default: false
|
||||
end
|
||||
|
||||
add_index "articles", ["author_id"], name: "index_articles_on_author_id", using: :btree
|
||||
|
Loading…
x
Reference in New Issue
Block a user