accescible_app/app/controllers/portlet/table_cols_controller.rb
Nicolas Bally d4484275e8 initial
2011-06-25 12:08:06 +02:00

36 lines
721 B
Ruby

# -*- encoding : utf-8 -*-
class Portlet::TableColsController < ApplicationController
def create
@table_content = TableContent.find(params[:table_content_id])
@table_content.table_rows.each do |table_row|
CelTable.create( :position => params[:position], :table_row_id => table_row.id)
end
@table_content.nbr_cols = @table_content.nbr_cols + 1
@table_content.save
end
def update
end
def destroy
@table_content = TableContent.find(params[:table_content_id])
CelTable.where(:table_row_id => @table_content.table_row_ids,:position => params[:id] ).each do |cel_table|
cel_table.destroy
end
@table_content.nbr_cols = @table_content.nbr_cols - 1
@table_content.save
end
end