Improve IFC models table

- Show and order by created_at ascending as the first models probably are the most important.
- Do not link to "show" IFC model until conversion to xkt and metadata have finished.
pull/7924/head
Wieland Lindenthal 5 years ago
parent 69da54d5fe
commit ca0b6e0bb3
  1. 18
      modules/ifc_models/app/cells/ifc_models/models/row_cell.rb
  2. 5
      modules/ifc_models/app/cells/ifc_models/models/table_cell.rb
  3. 2
      modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb

@ -6,8 +6,12 @@ module IFCModels
include ::Redmine::I18n
def title
link_to model.title,
ifc_models_project_ifc_model_path(model.project, model)
if still_processing?
model.title
else
link_to model.title,
ifc_models_project_ifc_model_path(model.project, model)
end
end
def updated_at
@ -20,13 +24,17 @@ module IFCModels
end
def processing
if model.xkt_attachment.present?
I18n.t('ifc_models.processing_state.completed')
else
if still_processing?
I18n.t('ifc_models.processing_state.in_progress')
else
I18n.t('ifc_models.processing_state.completed')
end
end
def still_processing?
model.xkt_attachment.nil? || model.metadata_attachment.nil?
end
###
def button_links

@ -2,10 +2,10 @@ module IFCModels
module Models
class TableCell < ::TableCell
include ::IconsHelper
columns :title, :updated_at, :uploader, :processing
columns :title, :created_at, :updated_at, :uploader, :processing
def initial_sort
[:updated_at, :desc]
[:created_at, :asc]
end
def sortable?
@ -27,6 +27,7 @@ module IFCModels
def headers
[
['title', caption: IFCModel.human_attribute_name(:title)],
['created_at', caption: IFCModel.human_attribute_name(:created_at)],
['updated_at', caption: IFCModel.human_attribute_name(:updated_at)],
['uploader', caption: IFCModel.human_attribute_name(:uploader)],
['processing', caption: I18n.t('ifc_models.processing_state.label')],

@ -42,7 +42,7 @@ module ::IFCModels
def index
@ifc_models = @project
.ifc_models
.order('updated_at DESC')
.order('created_at ASC')
.includes(:uploader, :project)
end

Loading…
Cancel
Save