Commit 4a12362e authored by Alexandre Friquet's avatar Alexandre Friquet
Browse files

Add menu for club novels: refs #100.

parent 08963b00
class ClubNovelsController < ApplicationController
def index
@title = Menu.find_by(uid: 'club_novels')&.title
end
end
<% title @title %>
<div class="card-block">
<h1><%= yield :title %></h1>
</div>
......@@ -61,6 +61,8 @@
</ul>
</li>
<% end %>
<% when "club_novels" %>
<%= menu_to menu.title, club_novels_path, class: 'menu_item' %>
<% when "member_zone" %>
<li class="menu_item">
<span class="menu_title"><%= menu.title %></span>
......
......@@ -91,6 +91,7 @@ Rails.application.routes.draw do
patch :move_down
end
end
resources :club_novels
patch '/newsletter_items/:id/move_up' => 'newsletter_items#move_up', as: 'move_up_item'
patch '/newsletter_items/:id/move_down' => 'newsletter_items#move_down', as: 'move_down_item'
......
class AddClubNovelsMenu < ActiveRecord::Migration[5.1]
def up
Menu.find_or_create_by(uid: 'club_novels') do |menu|
menu.title = "Info des clubs Sport Adapté Girondins"
end
end
def down
Menu.find_by(uid: 'club_novels').destroy
end
end
......@@ -32,7 +32,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180917093307) do
ActiveRecord::Schema.define(version: 20190812122439) do
create_table "activities", force: :cascade do |t|
t.string "title", limit: 255
......
......@@ -32,6 +32,7 @@ fixed_menus = [
{ title: "Où pratiquer", uid: "member_groups"},
{ title: "Zone membre", uid: "member_zone"},
{ title: "Pied de page", uid: "footer"}
{ title: "Info des clubs Sport Adapté Girondins", uid: "club_novels"}
]
fixed_menus.each do |fixed_menu|
unless Menu.find_by_uid(fixed_menu[:uid])
......
#
# OLIGAA - Stands for "Outil en Ligne d'Information et de Gestion des Activités
# des Associations" which is an online tool for associations to manage news,
# actors and activities.
# Copyright (C) 2010-2018 Comité Départemental du Sport Adapté de la Gironde (CDSA
# 33) <contact@cdsa33.org>
#
# This file is part of OLIGAA.
#
# OLIGAA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# OLIGAA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OLIGAA. If not, see <http://www.gnu.org/licenses/>.
#
require 'rails_helper'
feature "Manage club novels" do
before(:all) { create :menu, title: "Info des clubs Sport Adapté Girondins", uid: "club_novels" }
context "as an admin" do
before { login_as_admin }
scenario "I can create one"
scenario "I can delete one"
scenario "I can change its info"
scenario "I can publish one"
end
context "as a guest" do
scenario "I have access to the 4 latest ones" do
visit root_path
within "nav#main-nav" do
click_link "Info des clubs Sport Adapté Girondins"
end
expect(current_path).to eq club_novels_path
within "section#content" do
expect(page).to have_content "Info des clubs Sport Adapté Girondins"
end
end
scenario "I can access to a published one"
scenario "I cannot access to a private one"
scenario "I can access to the atom feed of published novels"
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment