Class: ActiveVersioning::Workflow::ShowResource

Inherits:
ActiveAdmin::Views::Pages::Show
  • Object
show all
Includes:
PreviewLink
Defined in:
lib/active_versioning/workflow/show_resource.rb

Instance Method Summary collapse

Methods included from PreviewLink

#preview_link_for, #preview_path_for

Instance Method Details

#committed_version_columnObject



45
46
47
48
49
# File 'lib/active_versioning/workflow/show_resource.rb', line 45

def committed_version_column
  column class: 'committed-version-column column' do
    committed_version_panels
  end
end

#committed_version_panelsObject



33
34
35
# File 'lib/active_versioning/workflow/show_resource.rb', line 33

def committed_version_panels
  instance_exec(resource, &version_block)
end

#current_draft_columnObject



51
52
53
54
55
# File 'lib/active_versioning/workflow/show_resource.rb', line 51

def current_draft_column
  column class: 'current-draft-column column' do
    current_draft_panels
  end
end

#current_draft_panelsObject



37
38
39
40
41
42
43
# File 'lib/active_versioning/workflow/show_resource.rb', line 37

def current_draft_panels
  if resource.current_draft?
    instance_exec(resource.current_draft, &version_block)
  else
    blank_slate(draft_blank_slate_content)
  end
end

#main_contentObject



6
7
8
# File 'lib/active_versioning/workflow/show_resource.rb', line 6

def main_content
  instance_exec(resource, &show_block)
end

#version_attributes_panel(version, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/active_versioning/workflow/show_resource.rb', line 10

def version_attributes_panel(version, &block)
  args = if version.live?
    [I18n.t('active_versioning.panels.committed_version'), id: 'committed-panel']
  else
    [I18n.t('active_versioning.panels.current_draft'), id: 'current-draft-panel']
  end

  panel(*args) do
    if version.live?
      header_action(versions_link)
    else
      header_action(discard_link)
      header_action(commit_link)
      header_action(preview_link)
      header_action(edit_link)

      render 'commit_form'
    end

    instance_eval(&block)
  end
end