catégories & droits divers
This commit is contained in:
parent
58f5896865
commit
6a5def0f50
@ -3,6 +3,9 @@ class Forum::ForumCategoriesController < ApplicationController
|
|||||||
|
|
||||||
before_filter :auth_fuser
|
before_filter :auth_fuser
|
||||||
|
|
||||||
|
def index
|
||||||
|
@categories = ForumCategory.all
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@ -25,7 +28,7 @@ class Forum::ForumCategoriesController < ApplicationController
|
|||||||
@category = ForumCategory.new(params.require(:forum_category).permit!)
|
@category = ForumCategory.new(params.require(:forum_category).permit!)
|
||||||
|
|
||||||
if @category.save
|
if @category.save
|
||||||
redirect_to forum_forum_path(@category.forum)
|
redirect_to forum_forum_categories_path
|
||||||
|
|
||||||
else
|
else
|
||||||
render :action => "new"
|
render :action => "new"
|
||||||
@ -36,7 +39,7 @@ class Forum::ForumCategoriesController < ApplicationController
|
|||||||
@category = ForumCategory.find(params[:id])
|
@category = ForumCategory.find(params[:id])
|
||||||
|
|
||||||
if @category.update_attributes(params.require(:forum_category).permit!)
|
if @category.update_attributes(params.require(:forum_category).permit!)
|
||||||
redirect_to forum_forum_path(@category.forum)
|
redirect_to forum_forum_categories_path
|
||||||
|
|
||||||
else
|
else
|
||||||
render :action => "edit"
|
render :action => "edit"
|
||||||
@ -49,7 +52,7 @@ class Forum::ForumCategoriesController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@category = ForumCategory.find(params[:id])
|
@category = ForumCategory.find(params[:id])
|
||||||
@category.destroy
|
@category.destroy
|
||||||
redirect_to forum_forum_path(@category.forum)
|
redirect_to forum_forum_categories_path
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,8 +34,11 @@ class Forum::ForumMessagesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
if moderator?
|
||||||
@message = ForumMessage.find(params[:id])
|
@message = ForumMessage.find(params[:id])
|
||||||
|
else
|
||||||
|
@message = current_fuser.messages.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
if @message.update_attributes(params.require(:forum_message).permit!)
|
if @message.update_attributes(params.require(:forum_message).permit!)
|
||||||
redirect_to forum_forum_topic_path(@message.forum_topic_id, :anchor => "forum_message_#{@message.id}")
|
redirect_to forum_forum_topic_path(@message.forum_topic_id, :anchor => "forum_message_#{@message.id}")
|
||||||
@ -49,9 +52,11 @@ class Forum::ForumMessagesController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
if moderator?
|
||||||
@message = ForumMessage.find(params[:id])
|
@message = ForumMessage.find(params[:id])
|
||||||
@message.destroy
|
@message.destroy
|
||||||
redirect_to forum_forum_topic_path(@message.forum_topic_id)
|
redirect_to forum_forum_topic_path(@message.forum_topic_id)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,7 +38,11 @@ class Forum::ForumTopicsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
if moderator?
|
||||||
@topic = ForumTopic.find(params[:id])
|
@topic = ForumTopic.find(params[:id])
|
||||||
|
else
|
||||||
|
@topic = current_fuser.topics.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
if @topic.update_attributes(params.require(:forum_topic).permit!)
|
if @topic.update_attributes(params.require(:forum_topic).permit!)
|
||||||
redirect_to forum_forum_category_path(@topic.category)
|
redirect_to forum_forum_category_path(@topic.category)
|
||||||
@ -52,9 +56,11 @@ class Forum::ForumTopicsController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
if moderator?
|
||||||
@topic = ForumTopic.find(params[:id])
|
@topic = ForumTopic.find(params[:id])
|
||||||
@topic.destroy
|
@topic.destroy
|
||||||
redirect_to forum_forum_topics_path()
|
redirect_to forum_forum_topics_path()
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ class Forum::ForumUsersController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@user = ForumUser.find(params[:id])
|
@user = ForumUser.find(params[:id])
|
||||||
|
if @user == current_fuser or moderator?
|
||||||
|
|
||||||
|
|
||||||
if @user.update_attributes(params.require(:forum_user).permit!)
|
if @user.update_attributes(params.require(:forum_user).permit!)
|
||||||
redirect_to forum_forum_user_path(@user)
|
redirect_to forum_forum_user_path(@user)
|
||||||
@ -50,15 +52,17 @@ class Forum::ForumUsersController < ApplicationController
|
|||||||
else
|
else
|
||||||
render :action => "edit"
|
render :action => "edit"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
if moderator?
|
||||||
@user = ForumUser.find(params[:id])
|
@user = ForumUser.find(params[:id])
|
||||||
@user.destroy
|
@user.destroy
|
||||||
redirect_to forum_forum_users_path
|
redirect_to forum_forum_users_path
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ class ForumUser < ActiveRecord::Base
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elsif self.id
|
||||||
|
|
||||||
else
|
else
|
||||||
errors.add :sheet_number, "Vous devez saisir votre numéro adhérent (présent en bas de chaque mails)."
|
errors.add :sheet_number, "Vous devez saisir votre numéro adhérent (présent en bas de chaque mails)."
|
||||||
end
|
end
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
|
|
||||||
|
|
||||||
%td
|
%td
|
||||||
%h2=link_to forum_category.title, [:forum, forum_category]
|
=link_to forum_category.title, [:forum, forum_category]
|
||||||
=markdown forum_category.description
|
|
||||||
%td
|
|
||||||
=forum_category.forum_topics.count
|
|
||||||
|
|
||||||
-if moderator?
|
-if moderator?
|
||||||
%td
|
%td
|
||||||
=link_to "modifier", edit_forum_forum_category_path(forum_category)
|
=link_to i(:pencil), edit_forum_forum_category_path(forum_category)
|
||||||
=link_to "supprimer", [:forum, forum_category], :confirm => "Supprimer cette catégorie ?", :method => :delete
|
=link_to i(:"trash-o"), [:forum, forum_category], :confirm => "Supprimer cette catégorie ?", :method => :delete
|
||||||
|
|
12
app/views/forum/forum_categories/index.haml
Normal file
12
app/views/forum/forum_categories/index.haml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
=link_to "nouvel catégorie", new_forum_forum_category_path, :class => "btn btn-primary", :style => "margin:1em 0em;float:right" if moderator?
|
||||||
|
|
||||||
|
%h1 Liste des catégories
|
||||||
|
|
||||||
|
%table.table.table-hover.table-striped
|
||||||
|
%tr
|
||||||
|
|
||||||
|
%th Nom
|
||||||
|
|
||||||
|
-if moderator?
|
||||||
|
%th Actions
|
||||||
|
=render @categories
|
@ -45,6 +45,7 @@
|
|||||||
%ul.nav
|
%ul.nav
|
||||||
%li=link_to "Fils de discussion", forum_forum_topics_path
|
%li=link_to "Fils de discussion", forum_forum_topics_path
|
||||||
%li=link_to "Utilisateurs", forum_forum_users_path
|
%li=link_to "Utilisateurs", forum_forum_users_path
|
||||||
|
%li=link_to "Catégories", forum_forum_categories_path if moderator?
|
||||||
|
|
||||||
|
|
||||||
%ul.nav.pull-right
|
%ul.nav.pull-right
|
||||||
|
Loading…
x
Reference in New Issue
Block a user