app/controllers/concepts/versions_controller.rb in iqvoc-4.3.3 vs app/controllers/concepts/versions_controller.rb in iqvoc-4.4.0
- old
+ new
@@ -35,27 +35,27 @@
ActiveRecord::Base.transaction do
if current_concept.blank? || current_concept.destroy
new_version.rdf_updated_at = nil
new_version.publish
new_version.unlock
- if new_version.valid_with_full_validation?
+ if new_version.publishable?
new_version.save
- if Iqvoc.config["triplestore.autosync"]
+ if Iqvoc.config['triplestore.autosync']
synced = triplestore_syncer.sync([new_version]) # XXX: blocking
- flash[:warning] = "triplestore synchronization failed" unless synced # TODO: i18n
+ flash[:warning] = 'triplestore synchronization failed' unless synced # TODO: i18n
end
- flash[:success] = t("txt.controllers.versioning.published")
- redirect_to concept_path(:id => new_version)
+ flash[:success] = t('txt.controllers.versioning.published')
+ redirect_to concept_path(id: new_version)
else
- flash[:error] = t("txt.controllers.versioning.merged_publishing_error")
- redirect_to concept_path(:published => 0, :id => new_version)
+ flash[:error] = t('txt.controllers.versioning.merged_publishing_error')
+ redirect_to concept_path(published: 0, id: new_version)
end
else
- flash[:error] = t("txt.controllers.versioning.merged_delete_error")
- redirect_to concept_path(:published => 0, :id => new_version)
+ flash[:error] = t('txt.controllers.versioning.merged_delete_error')
+ redirect_to concept_path(published: 0, id: new_version)
end
end
end
def branch
@@ -71,12 +71,12 @@
new_version = nil
ActiveRecord::Base.transaction do
new_version = current_concept.branch(current_user)
new_version.save!
end
- flash[:success] = t("txt.controllers.versioning.branched")
- redirect_to edit_concept_path(:published => 0, :id => new_version)
+ flash[:success] = t('txt.controllers.versioning.branched')
+ redirect_to edit_concept_path(published: 0, id: new_version)
end
def lock
new_version = Iqvoc::Concept.base_class.
by_origin(params[:origin]).
@@ -88,14 +88,14 @@
end
authorize! :lock, new_version
new_version.lock_by_user(current_user.id)
- new_version.save :validate => false
+ new_version.save validate: false
- flash[:success] = t("txt.controllers.versioning.locked")
- redirect_to edit_concept_path(:published => 0, :id => new_version)
+ flash[:success] = t('txt.controllers.versioning.locked')
+ redirect_to edit_concept_path(published: 0, id: new_version)
end
def unlock
new_version = Iqvoc::Concept.base_class.
by_origin(params[:origin]).
@@ -107,31 +107,31 @@
end
authorize! :unlock, new_version
new_version.unlock
- new_version.save :validate => false
+ new_version.save validate: false
- flash[:success] = t("txt.controllers.versioning.unlocked")
+ flash[:success] = t('txt.controllers.versioning.unlocked')
- redirect_to concept_path(:published => 0, :id => new_version)
+ redirect_to concept_path(published: 0, id: new_version)
end
def consistency_check
concept = Iqvoc::Concept.base_class.
by_origin(params[:origin]).
unpublished.
last!
authorize! :check_consistency, concept
- if concept.valid_with_full_validation?
- flash[:success] = t("txt.controllers.versioning.consistency_check_success")
- redirect_to concept_path(:published => 0, :id => concept)
+ if concept.publishable?
+ flash[:success] = t('txt.controllers.versioning.consistency_check_success')
+ redirect_to concept_path(published: 0, id: concept)
else
- flash[:error] = t("txt.controllers.versioning.consistency_check_error")
- redirect_to edit_concept_path(:published => 0, :id => concept, :full_consistency_check => "1")
+ flash[:error] = t('txt.controllers.versioning.consistency_check_error')
+ redirect_to edit_concept_path(published: 0, id: concept, full_consistency_check: '1')
end
end
def to_review
concept = Iqvoc::Concept.base_class.
@@ -141,10 +141,9 @@
authorize! :send_to_review, concept
concept.to_review
concept.save!
- flash[:success] = t("txt.controllers.versioning.to_review_success")
- redirect_to concept_path(:published => 0, :id => concept)
+ flash[:success] = t('txt.controllers.versioning.to_review_success')
+ redirect_to concept_path(published: 0, id: concept)
end
-
end