diff --git a/app/controllers/communities_controller.rb b/app/controllers/communities_controller.rb index 0fa7673444..bb846d7db7 100644 --- a/app/controllers/communities_controller.rb +++ b/app/controllers/communities_controller.rb @@ -33,21 +33,12 @@ def index # GET /communities/mycity.json def show; end - def edit; end - def new @title = t "communities.new.title" @community = Community.new end - def update - if @community.update(community_params) - redirect_to @community, :notice => t(".success") - else - flash.now[:alert] = t(".failure") - render :edit - end - end + def edit; end def create @community = Community.new(community_params) @@ -59,6 +50,15 @@ def create end end + def update + if @community.update(community_params) + redirect_to @community, :notice => t(".success") + else + flash.now[:alert] = t(".failure") + render :edit + end + end + private def recent_changesets diff --git a/app/controllers/community_links_controller.rb b/app/controllers/community_links_controller.rb index 52fdad594d..754c02c9cd 100644 --- a/app/controllers/community_links_controller.rb +++ b/app/controllers/community_links_controller.rb @@ -7,13 +7,13 @@ class CommunityLinksController < ApplicationController load_and_authorize_resource :except => [:create, :new] authorize_resource - def edit; end - def index @community = Community.friendly.find(params[:community_id]) @links = @community.community_links end + def edit; end + def new @community = Community.friendly.find(params[:community_id]) @title = t "community_links.new.title" @@ -21,15 +21,6 @@ def new @link.community_id = params[:community_id] end - def update - if @link.update(link_params) - redirect_to @link.community, :notice => t(".success") - else - flash.now[:alert] = t(".failure") - render :edit - end - end - def create @community = Community.friendly.find(params[:community_id]) @link = @community.community_links.build(link_params) @@ -41,6 +32,15 @@ def create end end + def update + if @link.update(link_params) + redirect_to @link.community, :notice => t(".success") + else + flash.now[:alert] = t(".failure") + render :edit + end + end + def destroy community_id = @link.community_id @link.delete