themen interface cleanup1

This commit is contained in:
2014-06-21 14:53:16 +05:30
parent 6fdee8a7d6
commit 6c9a1b51c4
15 changed files with 102 additions and 91 deletions

View File

@@ -3,24 +3,12 @@ class ThemenController < ApplicationController
# GET /themen.json
load_and_authorize_resource
def index
@themen = Thema.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @themen }
end
end
# GET /themen/1
# GET /themen/1.json
def show
@thema = Thema.find(params[:id])
@fragen=@thema.fragen
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}]
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("thema.manage"), :path=>verwalten_thema_path(@thema)}]
@toolbar_elements << [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')}
respond_to do |format|
@@ -33,10 +21,7 @@ class ThemenController < ApplicationController
def verwalten
@thema = Thema.find(params[:id])
@attachment=Attachment.new
@fragen=@thema.fragen
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}]
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')}
@@ -57,7 +42,7 @@ class ThemenController < ApplicationController
# GET /themen/1/edit
def edit
@thema = Thema.find(params[:id])
if @thema.is_wiki?
redirect_to edit_wiki_path(Wiki.find(@thema.id))
return
@@ -72,12 +57,11 @@ class ThemenController < ApplicationController
# POST /themen.json
def create
@thema = Thema.new(params[:thema])
respond_to do |format|
if @thema.save
@themen = @thema.themengruppe.themen.order(:priority).reverse
format.html { redirect_to @thema, notice: 'Thema was successfully created.' }
format.html { redirect_to @thema, notice: I18n.t("thema.created") }
format.json { render json: @thema, status: :created, location: @thema }
format.js {render action: "update"}
else
@@ -107,12 +91,13 @@ class ThemenController < ApplicationController
# PUT /themen/1.json
def update
@thema = Thema.find(params[:id])
@themen = @thema.themengruppe.themen.order(:priority).reverse
@themen = @thema.themengruppe.themen.order(:priority).reverse
@thema.assign_attributes(params[:thema])
@thema.fix_links(request.host_with_port)
respond_to do |format|
if @thema.save
format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }
format.html { redirect_to @thema, notice: I18n.t("thema.updated") }
format.json { head :no_content }
format.js
else
@@ -128,7 +113,7 @@ class ThemenController < ApplicationController
def destroy
@thema = Thema.find(params[:id])
@thema.destroy
@themen = @thema.themengruppe.themen.order(:priority).reverse
@themen = @thema.themengruppe.themen.order(:priority).reverse
respond_to do |format|
format.html { redirect_to themengruppe_path(@thema.themengruppe) }
format.json { head :no_content }

View File

@@ -5,7 +5,7 @@ class ThemengruppenController < ApplicationController
def index
@themengruppen = Themengruppe.where(:public=>true).order(:priority).reverse
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}]
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('common.verwalten'), :path=>verwalten_all_themengruppen_path()}]
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()}]
respond_to do |format|
format.html # index.html.erb