Class: PettanrPettanCommonsV01Licenses::AttributesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/pettanr_pettan_commons_v01_licenses/attributes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/pettanr_pettan_commons_v01_licenses/attributes_controller.rb', line 22

def create
  @original_picture, @original_picture_license_group, @license_group = 
    PettanrPettanCommonsV01Licenses::Attribute.remember_params params, @operators
  @pettan_commons_license = PettanrPettanCommonsV01Licenses::Attribute.new params[:pettan_commons_license]
  @license = License.show @pettan_commons_license.license_id, @operators
  @resource_picture = @original_picture.resource_picture || ResourcePicture.new
  @resource_picture.attributes = @pettan_commons_license.resource_picture_attributes @original_picture, @license
  @resource_picture.overwrite @original_picture
  respond_to do |format|
    if @pettan_commons_license.valid?
      format.html { render main_app.new_resource_picture_path }
      format.json { render json: @resource_picture.to_json(ResourcePicture.show_json_opt), status: :created }
    else
      format.html { render action: "new" }
      format.json { render json: @resource_picture.errors, status: :unprocessable_entity }
    end
  end
end

#newObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/pettanr_pettan_commons_v01_licenses/attributes_controller.rb', line 8

def new
  @original_picture, @original_picture_license_group, @license_group = 
    PettanrPettanCommonsV01Licenses::Attribute.remember_params params, @operators
  @pettan_commons_license = PettanrPettanCommonsV01Licenses::Attribute.new
  # rare case !  
  # Attribute need artist name by @operators  
  @pettan_commons_license.supply_default @operators

  respond_to do |format|
    format.html # new.html.erb
#        format.js
  end
end