Class: ActiveVersioning::Workflow::ShowResource

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

Instance Method Summary collapse

Instance Method Details

#committed_version_columnObject



43
44
45
46
47
# File 'lib/active_versioning/workflow/show_resource.rb', line 43

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

#committed_version_panelsObject



31
32
33
# File 'lib/active_versioning/workflow/show_resource.rb', line 31

def committed_version_panels
  instance_exec(resource, &version_block)
end

#current_draft_columnObject



49
50
51
52
53
# File 'lib/active_versioning/workflow/show_resource.rb', line 49

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

#current_draft_panelsObject



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

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



4
5
6
# File 'lib/active_versioning/workflow/show_resource.rb', line 4

def main_content
  instance_exec(resource, &show_block)
end

#version_attributes_panel(version, &block) ⇒ Object



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

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