app/controllers/data_objects_controller.rb
# GET /data_objects/new
# requires a taxon_id as a parameter.
# We're only creating new user data objects in the context of a taxon concept so we need taxon_id to be provided in route
GET /data_objects/new
requires a taxon_id as a parameter.
We're only creating new user data objects in the context of a taxon concept so we need taxon_id to be provided in route
GET / data_objects / new requires a taxon_id as a parameter . We ' re only creating new user data objects in the context of a taxon concept so we need taxon_id to be provided in route
def new
    @taxon_concept = TaxonConcept.find(params[:taxon_id])
    set_text_data_object_options
    @data_object ||= DataObject.new(data_type: DataType.text,
                                  license_id: License.cc.id,
                                  object_created_at: Time.now,
                                  object_modified_at: Time.now,
                                  language_id: current_language.id)
    unless params[:data_object]
      selected_toc_item = @toc_items.select { |ti| ti.id == params[:toc].to_i }.first ||
                          @toc_items.select { |ti| ti == TocItem.brief_summary }.first ||
                          @toc_items[0]
      @selected_toc_item_id = selected_toc_item.id
    end
    if params[:link] || params[:commit_link]
      @add_link = true
      @page_title = I18n.t(:dato_new_text_link_for_taxon_page_title, taxon: Sanitize.clean(@taxon_concept.title_canonical))
    else
      @add_article = true
      @page_title = I18n.t(:dato_new_text_for_taxon_page_title, taxon: Sanitize.clean(@taxon_concept.title_canonical))
    end
    @page_description = I18n.t(:dato_new_text_page_description)
    render :new
  end
def new @taxon_concept = TaxonConcept . find ( params [ :taxon_id ] ) set_text_data_object_options @data_object ||= DataObject . new ( data_type : DataType . text , license_id : License . cc . id , object_created_at : Time . now , object_modified_at : Time . now , language_id : current_language . id ) unless params [ :data_object ] selected_toc_item = @toc_items . select { | ti | ti . id == params [ :toc ] . to_i } . first || @toc_items . select { | ti | ti == TocItem . brief_summary } . first || @toc_items [ 0 ] @selected_toc_item_id = selected_toc_item . id end if params [ :link ] || params [ :commit_link ] @add_link = true @page_title = I18n . t ( :dato_new_text_link_for_taxon_page_title , taxon : Sanitize . clean ( @taxon_concept . title_canonical ) ) else @add_article = true @page_title = I18n . t ( :dato_new_text_for_taxon_page_title , taxon : Sanitize . clean ( @taxon_concept . title_canonical ) ) end @page_description = I18n . t ( :dato_new_text_page_description ) render :new end
GET /data_objects/new
requires a taxon_id as a parameter.
GET / data_objects / new requires a taxon_id as a parameter .
# default to passed in toc param or brief summary if selectable, otherwise just the first selectable toc item