-
- def edit
- @ground_color = GroundColor.show(params[:id], @author)
- @panel = Panel.edit(@ground_color.panel.id, @author)
-
- respond_to do |format|
- format.html
- end
- end
-
- def create
- @ground_color = GroundColor.new params[:ground_color]
- @ground_color.supply_default
- @panel = Panel.edit(@author.working_panel, @author)
- @ground_color.overwrite @panel.id
-
- respond_to do |format|
- if @ground_color.valid?
- if @ground_color.store @author
- flash[:notice] = I18n.t('flash.notice.created', :model => Panel.model_name.human)
- format.html { redirect_to @panel }
- format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
- else
- format.html { render action: "panels/new" }
- format.json { render json: @panel.errors, status: :unprocessable_entity }
- end
- else
- format.html { render action: "new" }
- format.json { render json: @ground_color.errors, status: :unprocessable_entity }
- end
- end
- end
-
- def update
- @ground_color = GroundColor.show(params[:id], @author)
- @ground_color.attributes = params[:ground_color]
- @panel = Panel.edit(@ground_color.panel.id, @author)
- @ground_color.overwrite @panel.id
-
- respond_to do |format|
- if @ground_color.store @author
- flash[:notice] = I18n.t('flash.notice.updated', :model => GroundColor.model_name.human)
- format.html { redirect_to @ground_color }
- format.json { head :ok }
- else
- format.html { render action: "edit" }
- format.json { render json: @ground_color.errors, status: :unprocessable_entity }
- end
- end