Class: Contentful::Bootstrap::Templates::Gallery

Inherits:
Base
  • Object
show all
Defined in:
lib/contentful/bootstrap/templates/gallery.rb

Instance Attribute Summary

Attributes inherited from Base

#skip_content_types, #space

Instance Method Summary collapse

Methods inherited from Base

#after_run, #initialize, #run

Constructor Details

This class inherits a constructor from Contentful::Bootstrap::Templates::Base

Instance Method Details

#assetsObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/contentful/bootstrap/templates/gallery.rb', line 70

def assets
  [
    {
      'id' => 'pie',
      'title' => 'Pie in the Sky',
      'file' => create_file('pie.jpg', 'https://c2.staticflickr.com/6/5245/5335909339_d307a7cbcf_b.jpg')
    },
    {
      'id' => 'flower',
      'title' => 'The Flower',
      'file' => create_file('flower.jpg', 'http://c2.staticflickr.com/4/3922/15045568809_b24591e318_b.jpg')
    }
  ]
end

#content_typesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/contentful/bootstrap/templates/gallery.rb', line 8

def content_types
  [
    {
      'id' => 'author',
      'name' => 'Author',
      'displayField' => 'name',
      'fields' => [
        {
          'name' => 'Name',
          'id' => 'name',
          'type' => 'Symbol'
        }
      ]
    },
    {
      'id' => 'image',
      'name' => 'Image',
      'displayField' => 'title',
      'fields' => [
        {
          'id' => 'title',
          'name' => 'Title',
          'type' => 'Symbol'
        },
        {
          'id' => 'photo',
          'name' => 'Photo',
          'type' => 'Link',
          'linkType' => 'Asset'
        }
      ]
    },
    {
      'id' => 'gallery',
      'name' => 'Gallery',
      'displayField' => 'title',
      'fields' => [
        {
          'id' => 'title',
          'name' => 'Title',
          'type' => 'Symbol'
        },
        {
          'id' => 'author',
          'name' => 'Author',
          'type' => 'Link',
          'linkType' => 'Entry'
        },
        {
          'id' => 'images',
          'name' => 'Images',
          'type' => 'Array',
          'items' => {
            'type' => 'Link',
            'linkType' => 'Entry'
          }
        }
      ]
    }
  ]
end

#entriesObject



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/contentful/bootstrap/templates/gallery.rb', line 85

def entries
  {
    'author' => [
      {
        'id' => 'dave',
        'name' => 'Dave'
      }
    ],
    'image' => [
      {
        'id' => 'pie_entry',
        'title' => 'A Pie in the Sky',
        'photo' => Links::Asset.new('pie')
      },
      {
        'id' => 'flower_entry',
        'title' => 'The Flower',
        'photo' => Links::Asset.new('flower')
      }
    ],
    'gallery' => [
      {
        'id' => 'gallery',
        'title' => 'Photo Gallery',
        'author' => Links::Entry.new('dave'),
        'images' => [Links::Entry.new('pie_entry'), Links::Entry.new('flower_entry')]
      }
    ]
  }
end