theme 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/theme.rb CHANGED
@@ -1,5 +1,147 @@
1
- require "theme/version"
1
+ require 'nokogiri'
2
+ require 'nokogiri-styles'
3
+ require 'tilt'
2
4
 
3
5
  module Theme
4
- # Your code goes here...
6
+ autoload :Version, 'theme/version'
7
+ autoload :Component, 'theme/component'
8
+ autoload :Assets, 'theme/assets'
9
+ autoload :Middleware, 'theme/middleware'
10
+ autoload :Render, 'theme/render'
11
+ autoload :Events, 'theme/events'
12
+
13
+ IMAGE_TYPES = %w(png gif jpg jpeg)
14
+ FONT_TYPES = %w(eot woff ttf svg)
15
+ STATIC_TYPES = %w(html js css map)
16
+ VIEW_TYPES = %w(html slim haml erb md markdown mkd mab nokogiri)
17
+ PARTIAL_REGEX = Regexp.new '([a-zA-Z_]+)$'
18
+ JS_ESCAPE = { '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n', "\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'" }
19
+
20
+
21
+ attr_accessor :config, :reset_config
22
+
23
+ class NoFileFound < StandardError; end
24
+
25
+ class << self
26
+ def setup app = false
27
+ if app
28
+ load_component_files
29
+ app.plugin Assets
30
+ app.use Middleware
31
+ else
32
+ yield config
33
+ end
34
+ end
35
+
36
+ def config
37
+ @config || reset_config!
38
+ end
39
+
40
+ def reset_config!
41
+ @config = OpenStruct.new({
42
+ path: './',
43
+ component_path: './theme/components',
44
+ component_url: '/components',
45
+ components: {},
46
+ view_path: './views',
47
+ layout: 'app',
48
+ layout_path: './views/layouts',
49
+ assets: OpenStruct.new({
50
+ js: {},
51
+ css: {}
52
+ }),
53
+ asset_url: '/assets',
54
+ asset_path: './assets',
55
+ asset_js_folder: 'js',
56
+ asset_css_folder: 'css',
57
+ assets_compiled: false
58
+ })
59
+ end
60
+
61
+ def cache
62
+ Thread.current[:_theme_cache] ||= OpenStruct.new({
63
+ file: {},
64
+ dom: {}
65
+ })
66
+ end
67
+
68
+ def load_component_files
69
+ Dir.glob("#{Theme.config.component_path}/**/*.rb").each do |c|
70
+ require c
71
+ end
72
+ end
73
+
74
+ def load_file path, c = {}, instance = self
75
+ cache = Theme.cache.file.fetch(path) {
76
+ template = false
77
+
78
+ ext = path[/\.[^.]*$/][1..-1]
79
+
80
+ if ext && File.file?(path)
81
+ if STATIC_TYPES.include? ext
82
+ template = Tilt::PlainTemplate.new nil, 1, outvar: '@_output', default_encoding: 'UTF-8' do |t|
83
+ File.read(path)
84
+ end
85
+ elsif FONT_TYPES.include?(ext) || IMAGE_TYPES.include?(ext)
86
+ template = File.read path
87
+ else
88
+ template = Tilt.new path, 1, outvar: '@_output'
89
+ end
90
+ else
91
+ VIEW_TYPES.each do |type|
92
+ f = "#{path}.#{type}"
93
+
94
+ if File.file? f
95
+ template = Tilt.new f, 1, outvar: '@_output'
96
+ break
97
+ end
98
+ end
99
+ end
100
+
101
+ unless template
102
+ raise Theme::NoFileFound,
103
+ "Could't find file: #{path} with any of these extensions: #{VIEW_TYPES.join(', ')}."
104
+ end
105
+
106
+ template
107
+ }
108
+
109
+ if defined? cache.render
110
+ cache.render instance, c.to_h
111
+ else
112
+ cache.to_s
113
+ end
114
+ end
115
+ end
116
+
117
+ def component name, options = {}, &block
118
+ theme_components[name].set_locals options
119
+ end
120
+ alias :comp :component
121
+
122
+ def theme_components
123
+ # Dir.glob("#{Theme.config.component_path}/**/*.rb").each do |c|
124
+ # load c
125
+ # end
126
+ req.env[:_theme_components] ||= begin
127
+ components = {}
128
+
129
+ Theme.config.components.each do |name, klass|
130
+ component = Object.const_get(klass).new self
131
+ components[name] = component
132
+ end
133
+
134
+ components.each do |name, component|
135
+ if listeners = component.class._listeners
136
+ listeners.each do |id|
137
+ if c = components[id.to_sym]
138
+ c.add_listener component
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ components
145
+ end
146
+ end
5
147
  end
@@ -0,0 +1,62 @@
1
+ class HeaderComponent < Theme::Component
2
+ id :header
3
+ src 'test/dummy/index.html'
4
+ dom 'body > .body > header'
5
+ clean do
6
+ node.css('.sf-menu > li').each_with_index do |li, i|
7
+ if i != 0
8
+ li.remove
9
+ li.css('ul').remove
10
+ else
11
+ li.at('a').inner_html = ''
12
+ li.at('ul').inner_html = ''
13
+ end
14
+ end
15
+ end
16
+
17
+ on_event :test, for: 'some_component', use: 'some_component_test'
18
+
19
+ attr_reader :menu, :node_li, :node_ul
20
+
21
+ def display
22
+ @node_li = node.at('.sf-menu > li').remove
23
+ @node_ul = node_li.at('ul').remove
24
+ node_menu = node.at('.sf-menu')
25
+
26
+ add_menus @menu, node_menu
27
+
28
+ node
29
+ end
30
+
31
+ private
32
+
33
+ def some_component_test
34
+ res.write 'this is from the header component'
35
+ end
36
+
37
+ def add_menus menu, node_menu
38
+ menu.each do |name, data|
39
+ data = data.to_h
40
+ li = node_li
41
+ a = li.at('a')
42
+ a.inner_html = name
43
+ a['href'] = data[:href] if data.key? :href
44
+
45
+ node_menu.add_child li
46
+
47
+ if links = data[:links]
48
+ node_menu.add_child node_ul
49
+
50
+ add_menus links, node_menu.at('ul')
51
+ end
52
+ end
53
+ end
54
+
55
+ def node_li
56
+ @node_li.dup
57
+ end
58
+
59
+ def node_ul
60
+ @node_ul.dup
61
+ end
62
+ end
@@ -0,0 +1,3 @@
1
+ class SomeComponent < Theme::Component
2
+ id :some_component
3
+ end
@@ -0,0 +1,386 @@
1
+ <!DOCTYPE HTML>
2
+ <html class="no-js">
3
+ <head>
4
+ <!-- Basic Page Needs
5
+ ================================================== -->
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
+ <title>Native Church</title>
8
+ <meta name="description" content="">
9
+ <meta name="keywords" content="">
10
+ <meta name="author" content="">
11
+ <!-- Mobile Specific Metas
12
+ ================================================== -->
13
+ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
14
+ <meta name="format-detection" content="telephone=no">
15
+ <!-- CSS
16
+ ================================================== -->
17
+ <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
18
+ <link href="plugins/mediaelement/mediaelementplayer.css" rel="stylesheet" type="text/css">
19
+ <link href="css/style.css" rel="stylesheet" type="text/css">
20
+ <link href="plugins/prettyphoto/css/prettyPhoto.css" rel="stylesheet" type="text/css">
21
+ <!--[if lte IE 8]><link rel="stylesheet" type="text/css" href="css/ie8.css" media="screen" /><![endif]-->
22
+ <!-- Color Style -->
23
+ <link href="colors/color1.css" rel="stylesheet" type="text/css">
24
+ <link href="css/custom.css" rel="stylesheet" type="text/css">
25
+ <!-- SCRIPTS
26
+ ================================================== -->
27
+ <script src="js/modernizr.js"></script><!-- Modernizr -->
28
+ </head>
29
+ <body>
30
+ <!--[if lt IE 7]>
31
+ <p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
32
+ <![endif]-->
33
+ <div class="body">
34
+ <!-- Start Site Header -->
35
+ <header class="site-header">
36
+ <div class="topbar">
37
+ <div class="container">
38
+ <div class="row">
39
+ <div class="col-md-4 col-sm-6 col-xs-8">
40
+ <h1 class="logo"> <a href="index.html"><img src="images/logo.png" alt="Logo"></a> </h1>
41
+ </div>
42
+ <div class="col-md-8 col-sm-6 col-xs-4">
43
+ <div class="social-icons pull-right hidden-sm hidden-xs"> <a href="https://www.facebook.com/" target="_blank"><i class="fa fa-facebook"></i></a> <a href="https://twitter.com/" target="_blank"><i class="fa fa-twitter"></i></a> <a href="http://www.pinterest.com/" target="_blank"><i class="fa fa-pinterest"></i></a> <a href="https://plus.google.com/" target="_blank"><i class="fa fa-google-plus"></i></a> <a href="http://www.pinterest.com/" target="_blank"><i class="fa fa-youtube"></i></a> <a href="#"><i class="fa fa-rss"></i></a> </div>
44
+ <a href="#" class="visible-sm visible-xs menu-toggle"><i class="fa fa-bars"></i></a> </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <div class="main-menu-wrapper">
49
+ <div class="container">
50
+ <div class="row">
51
+ <div class="col-md-12">
52
+ <nav class="navigation">
53
+ <ul class="sf-menu">
54
+ <li><a href="index.html">Home</a>
55
+ <ul class="dropdown">
56
+ <li><a href="index.html">Sliders</a>
57
+ <ul class="dropdown">
58
+ <li><a href="index.html">Flex Slider</a></li>
59
+ <li><a href="index-nivoslider.html">Nivo Slider <span class="label label-danger">New</span></a></li>
60
+ </ul>
61
+ </li>
62
+ <li><a href="index.html">Headers</a>
63
+ <ul class="dropdown">
64
+ <li><a href="index.html">Style 1</a></li>
65
+ <li><a href="header-style2.html">Style 2 <span class="label label-danger">New</span></a></li>
66
+ <li><a href="header-style3.html">Style 3 <span class="label label-danger">New</span></a></li>
67
+ </ul>
68
+ </li>
69
+ <li><a href="index.html">Home version 1</a></li>
70
+ <li><a href="index1.html">Home version 2</a></li>
71
+ <li><a href="index2.html">Home version 3</a></li>
72
+ <li><a href="index3.html">Home version 4</a></li>
73
+ <li><a href="index4.html">Home version 5 <span class="label label-danger">New</span></a></li>
74
+ </ul>
75
+ </li>
76
+ <li><a href="about.html">About Us</a>
77
+ <ul class="dropdown">
78
+ <li><a href="about.html">Overview</a></li>
79
+ <li><a href="contact.html">Where we meet</a></li>
80
+ <li><a href="our-staff.html">Our Staff</a></li>
81
+ </ul>
82
+ </li>
83
+ <li class="megamenu"><a href="shortcodes.html">Mega Menu</a>
84
+ <ul class="dropdown">
85
+ <li>
86
+ <div class="megamenu-container container">
87
+ <div class="row">
88
+ <div class="col-md-3 hidden-sm hidden-xs"> <span class="megamenu-sub-title"><i class="fa fa-bell"></i> Today's Prayer</span>
89
+ <iframe width="200" height="150" src="http://player.vimeo.com/video/19564018?title=0&amp;byline=0&amp;color=007F7B"></iframe>
90
+ </div>
91
+ <div class="col-md-3"> <span class="megamenu-sub-title"><i class="fa fa-pagelines"></i> Our Ministries</span>
92
+ <ul class="sub-menu">
93
+ <li><a href="ministry.html">Women's Ministry</a></li>
94
+ <li><a href="ministry.html">Men's Ministry</a></li>
95
+ <li><a href="ministry.html">Children's Ministry</a></li>
96
+ <li><a href="ministry.html">Youth Ministry</a></li>
97
+ <li><a href="ministry.html">Prayer Requests</a></li>
98
+ </ul>
99
+ </div>
100
+ <div class="col-md-3"> <span class="megamenu-sub-title"><i class="fa fa-clock-o"></i> Upcoming Events</span>
101
+ <ul class="sub-menu">
102
+ <li><a href="single-event.html">Monday Prayer</a> <span class="meta-data">Monday | 06:00 PM</span> </li>
103
+ <li><a href="single-event.html">Staff members meet</a> <span class="meta-data">Tuesday | 08:00 AM</span> </li>
104
+ <li><a href="single-event.html">Evening Prayer</a> <span class="meta-data">Friday | 07:00 PM</span> </li>
105
+ </ul>
106
+ </div>
107
+ <div class="col-md-3"> <span class="megamenu-sub-title"><i class="fa fa-cog"></i> Features</span>
108
+ <ul class="sub-menu">
109
+ <li><a href="shortcodes.html">Shortcodes</a></li>
110
+ <li><a href="typography.html">Typography</a></li>
111
+ </ul>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </li>
116
+ </ul>
117
+ </li>
118
+ <li><a href="events.html">Events</a>
119
+ <ul class="dropdown">
120
+ <li><a href="events.html">Events Listing</a></li>
121
+ <li><a href="events-timeline.html">Events Timeline</a></li>
122
+ <li><a href="google-calendar.html">Google Calender <span class="label label-danger">New</span></a></li>
123
+ <li><a href="events-calendar.html">Events Calender</a></li>
124
+ <li><a href="events-grid.html">Events Masonry Grid</a></li>
125
+ <li><a href="single-event.html">Single Event</a></li>
126
+ </ul>
127
+ </li>
128
+ <li><a href="sermons.html">Sermons</a>
129
+ <ul class="dropdown">
130
+ <li><a href="sermon-albums.html">Sermon Albums <span class="label label-danger">New</span></a></li>
131
+ <li><a href="sermons.html">Sermons Archive</a></li>
132
+ <li><a href="single-sermon.html">Single Sermon</a></li>
133
+ </ul>
134
+ </li>
135
+ <li><a href="gallery-2cols-pagination.html">Gallery</a>
136
+ <ul class="dropdown">
137
+ <li><a href="gallery-2cols-pagination.html">With Pagination</a>
138
+ <ul class="dropdown">
139
+ <li><a href="gallery-2cols-pagination.html">2 Columns</a></li>
140
+ <li><a href="gallery-3cols-pagination.html">3 Columns</a></li>
141
+ <li><a href="gallery-4cols-pagination.html">4 Columns</a></li>
142
+ </ul>
143
+ </li>
144
+ <li><a href="gallery-2cols-filter.html">With Filter</a>
145
+ <ul class="dropdown">
146
+ <li><a href="gallery-2cols-filter.html">2 Columns</a></li>
147
+ <li><a href="gallery-3cols-filter.html">3 Columns</a></li>
148
+ <li><a href="gallery-4cols-filter.html">4 Columns</a></li>
149
+ </ul>
150
+ </li>
151
+ <li><a href="gallery-masonry.html">Masonry Grid</a></li>
152
+ </ul>
153
+ </li>
154
+ <li><a href="blog-masonry.html">Blog</a>
155
+ <ul class="dropdown">
156
+ <li><a href="blog-masonry.html">Masonry Blog</a></li>
157
+ <li><a href="blog-full-width.html">Full Width Blog</a></li>
158
+ <li><a href="blog-timeline.html">Timeline Blog</a></li>
159
+ <li><a href="blog-medium-thumbnails.html">Medium Thumbnails</a></li>
160
+ <li><a href="blog-post.html">Single Blog Post</a></li>
161
+ </ul>
162
+ </li>
163
+ <li><a href="contact.html">Contact</a></li>
164
+ </ul>
165
+ </nav>
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+ </header>
171
+ <!-- End Site Header -->
172
+ <!-- Start Hero Slider -->
173
+ <div class="hero-slider flexslider clearfix" data-autoplay="yes" data-pagination="yes" data-arrows="yes" data-style="fade" data-pause="yes">
174
+ <ul class="slides">
175
+ <li class=" parallax" style="background-image:url(http://placehold.it/1280x635&amp;text=IMAGE+PLACEHOLDER);"></li>
176
+ <li class="parallax" style="background-image:url(http://placehold.it/1280x635&amp;text=IMAGE+PLACEHOLDER);"></li>
177
+ </ul>
178
+ </div>
179
+ <!-- End Hero Slider -->
180
+ <!-- Start Notice Bar -->
181
+ <div class="notice-bar">
182
+ <div class="container">
183
+ <div class="row">
184
+ <div class="col-md-3 col-sm-6 col-xs-6 notice-bar-title"> <span class="notice-bar-title-icon hidden-xs"><i class="fa fa-calendar fa-3x"></i></span> <span class="title-note">Next</span> <strong>Upcoming Event</strong> </div>
185
+ <div class="col-md-3 col-sm-6 col-xs-6 notice-bar-event-title">
186
+ <h5><a href="single-event.html">Sountheast Asia Meet</a></h5>
187
+ <span class="meta-data">13th July, 2015</span> </div>
188
+ <div id="counter" class="col-md-4 col-sm-6 col-xs-12 counter" data-date="July 13, 2015">
189
+ <div class="timer-col"> <span id="days"></span> <span class="timer-type">days</span> </div>
190
+ <div class="timer-col"> <span id="hours"></span> <span class="timer-type">hrs</span> </div>
191
+ <div class="timer-col"> <span id="minutes"></span> <span class="timer-type">mins</span> </div>
192
+ <div class="timer-col"> <span id="seconds"></span> <span class="timer-type">secs</span> </div>
193
+ </div>
194
+ <div class="col-md-2 col-sm-6 hidden-xs"> <a href="events.html" class="btn btn-primary btn-lg btn-block">All Events</a> </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ <!-- End Notice Bar -->
199
+ <!-- Start Content -->
200
+ <div class="main" role="main">
201
+ <div id="content" class="content full">
202
+ <div class="container">
203
+ <div class="row">
204
+ <!-- Start Featured Blocks -->
205
+ <div class="featured-blocks clearfix">
206
+ <div class="col-md-4 col-sm-4 featured-block"> <a href="our-staff.html" class="img-thumbnail"> <img src="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" alt="staff"> <strong>Our Pastors</strong> <span class="more">read more</span> </a> </div>
207
+ <div class="col-md-4 col-sm-4 featured-block"> <a href="about.html" class="img-thumbnail"> <img src="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" alt="staff"> <strong>New Here</strong> <span class="more">read more</span> </a> </div>
208
+ <div class="col-md-4 col-sm-4 featured-block"> <a href="sermons.html" class="img-thumbnail"> <img src="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" alt="staff"> <strong>Sermons Archive</strong> <span class="more">read more</span> </a> </div>
209
+ </div>
210
+ <!-- End Featured Blocks -->
211
+ </div>
212
+ <div class="row">
213
+ <div class="col-md-8 col-sm-6">
214
+ <!-- Events Listing -->
215
+ <div class="listing events-listing">
216
+ <header class="listing-header">
217
+ <h3>More Coming Events</h3>
218
+ </header>
219
+ <section class="listing-cont">
220
+ <ul>
221
+ <li class="item event-item">
222
+ <div class="event-date"> <span class="date">06</span> <span class="month">Aug</span> </div>
223
+ <div class="event-detail">
224
+ <h4><a href="single-event.html">Monday Prayer</a></h4>
225
+ <span class="event-dayntime meta-data">Monday | 07:00 AM</span> </div>
226
+ <div class="to-event-url">
227
+ <div><a href="single-event.html" class="btn btn-default btn-sm">Details</a></div>
228
+ </div>
229
+ </li>
230
+ <li class="item event-item">
231
+ <div class="event-date"> <span class="date">28</span> <span class="month">Aug</span> </div>
232
+ <div class="event-detail">
233
+ <h4><a href="single-event.html">Staff members meet</a></h4>
234
+ <span class="event-dayntime meta-data">Monday | 01:00 PM</span> </div>
235
+ <div class="to-event-url">
236
+ <div><a href="single-event.html" class="btn btn-default btn-sm">Details</a></div>
237
+ </div>
238
+ </li>
239
+ <li class="item event-item">
240
+ <div class="event-date"> <span class="date">25</span> <span class="month">Sep</span> </div>
241
+ <div class="event-detail">
242
+ <h4><a href="single-event.html">Evening Prayer</a></h4>
243
+ <span class="event-dayntime meta-data">Friday | 06:00 PM</span> </div>
244
+ <div class="to-event-url">
245
+ <div><a href="single-event.html" class="btn btn-default btn-sm">Details</a></div>
246
+ </div>
247
+ </li>
248
+ </ul>
249
+ </section>
250
+ </div>
251
+ <div class="spacer-30"></div>
252
+ <!-- Latest News -->
253
+ <div class="listing post-listing">
254
+ <header class="listing-header">
255
+ <h3>Latest News</h3>
256
+ </header>
257
+ <section class="listing-cont">
258
+ <ul>
259
+ <li class="item post">
260
+ <div class="row">
261
+ <div class="col-md-4"> <a href="#" class="media-box"> <img src="http://placehold.it/800x600&amp;text=IMAGE+PLACEHOLDER" alt="" class="img-thumbnail"> </a></div>
262
+ <div class="col-md-8">
263
+ <div class="post-title">
264
+ <h2><a href="blog-post.html">Voluptatum deleniti atque corrupti</a></h2>
265
+ <span class="meta-data"><i class="fa fa-calendar"></i> on 17th Dec, 2013</span></div>
266
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis egestas rhoncus. Donec facilisis fermentum sem, ac viverra ante luctus vel. Donec vel mauris quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis egestas rhoncus.</p>
267
+ </div>
268
+ </div>
269
+ </li>
270
+ <li class="item post">
271
+ <div class="row">
272
+ <div class="col-md-4"> <a href="blog-post.html" class="media-box"> <img src="http://placehold.it/800x600&amp;text=IMAGE+PLACEHOLDER" alt="" class="img-thumbnail"> </a></div>
273
+ <div class="col-md-8">
274
+ <div class="post-title">
275
+ <h2><a href="blog-post.html">Voluptatum deleniti atque corrupti</a></h2>
276
+ <span class="meta-data"><i class="fa fa-calendar"></i> on 17th Dec, 2013</span></div>
277
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis egestas rhoncus. Donec facilisis fermentum sem, ac viverra ante luctus vel. Donec vel mauris quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis egestas rhoncus.</p>
278
+ </div>
279
+ </div>
280
+ </li>
281
+ </ul>
282
+ </section>
283
+ </div>
284
+ </div>
285
+ <!-- Start Sidebar -->
286
+ <div class="col-md-4 col-sm-6">
287
+ <!-- Latest Sermons -->
288
+ <div class="listing sermons-listing">
289
+ <header class="listing-header">
290
+ <h3>Recent Sermons</h3>
291
+ </header>
292
+ <section class="listing-cont">
293
+ <ul>
294
+ <li class="item sermon featured-sermon"> <span class="date">Feb 14, 2014</span>
295
+ <h4><a href="single-sermon.html">How To Recover The Cutting Edge</a></h4>
296
+ <div class="featured-sermon-video">
297
+ <iframe width="200" height="150" src="http://player.vimeo.com/video/19564018?title=0&amp;byline=0&amp;color=007F7B"></iframe>
298
+ </div>
299
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis egestas rhoncus. Donec facilisis consectetur adipiscing elit. Nulla convallis egestas rhoncus</p>
300
+ <div class="sermon-actions"> <a href="#" data-placement="top" data-toggle="tooltip" data-original-title="Video"><i class="fa fa-video-camera"></i></a> <a href="#" data-placement="top" data-toggle="tooltip" data-original-title="Audio"><i class="fa fa-headphones"></i></a> <a href="#" data-placement="top" data-toggle="tooltip" data-original-title="Read online"><i class="fa fa-file-text-o"></i></a> <a href="#" data-placement="top" data-toggle="tooltip" data-original-title="Download PDF"><i class="fa fa-book"></i></a> </div>
301
+ </li>
302
+ <li class="item sermon">
303
+ <h2 class="sermon-title"><a href="single-sermon.html">Voluptatum deleniti atque corrupti</a></h2>
304
+ <span class="meta-data"><i class="fa fa-calendar"></i> on 17th Dec, 2013</span> </li>
305
+ <li class="item sermon">
306
+ <h2 class="sermon-title"><a href="single-sermon.html">Voluptatum deleniti atque corrupti</a></h2>
307
+ <span class="meta-data"><i class="fa fa-calendar"></i> on 17th Dec, 2013</span> </li>
308
+ <li class="item sermon">
309
+ <h2 class="sermon-title"><a href="single-sermon.html">Voluptatum deleniti atque corrupti</a></h2>
310
+ <span class="meta-data"><i class="fa fa-calendar"></i> on 17th Dec, 2013</span> </li>
311
+ </ul>
312
+ </section>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ </div>
317
+ </div>
318
+ </div>
319
+ <!-- Start Featured Gallery -->
320
+ <div class="featured-gallery">
321
+ <div class="container">
322
+ <div class="row">
323
+ <div class="col-md-3 col-sm-3">
324
+ <h4>Updates from our gallery</h4>
325
+ <a href="#" class="btn btn-default btn-lg">More Galleries</a> </div>
326
+ <div class="col-md-3 col-sm-3 post format-image"> <a href="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" class="media-box" data-rel="prettyPhoto[Gallery]"> <img src="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" alt=""> </a> </div>
327
+ <div class="col-md-3 col-sm-3 post format-video"> <a href="http://youtu.be/NEFfnbQlGo8" class="media-box" data-rel="prettyPhoto[Gallery]"> <img src="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" alt=""> </a> </div>
328
+ <div class="col-md-3 col-sm-3 post format-image"> <a href="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" class="media-box" data-rel="prettyPhoto[Gallery]"> <img src="http://placehold.it/600x400&amp;text=IMAGE+PLACEHOLDER" alt=""> </a> </div>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ <!-- End Featured Gallery -->
333
+ <!-- Start Footer -->
334
+ <footer class="site-footer">
335
+ <div class="container">
336
+ <div class="row">
337
+ <!-- Start Footer Widgets -->
338
+ <div class="col-md-4 col-sm-4 widget footer-widget">
339
+ <h4 class="footer-widget-title">About our Church</h4>
340
+ <img src="images/logo.png" alt="Logo">
341
+ <div class="spacer-20"></div>
342
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis egestas rhoncus. Donec facilisis consectetur adipiscing elit. Nulla convallis egestas rhoncus</p>
343
+ </div>
344
+ <div class="col-md-4 col-sm-4 widget footer-widget">
345
+ <h4 class="footer-widget-title">Blogroll</h4>
346
+ <ul>
347
+ <li><a href="index.html">Church Home</a></li>
348
+ <li><a href="about.html">About Us</a></li>
349
+ <li><a href="events.html">All Events</a></li>
350
+ <li><a href="sermons.html">Sermons Archive</a></li>
351
+ <li><a href="blog-masonry.html">Our Blog</a></li>
352
+ </ul>
353
+ </div>
354
+ <div class="col-md-4 col-sm-4 widget footer-widget">
355
+ <h4 class="footer-widget-title">Our Church on twitter</h4>
356
+ <ul class="twitter-widget">
357
+ </ul>
358
+ </div>
359
+ </div>
360
+ </div>
361
+ </footer>
362
+ <footer class="site-footer-bottom">
363
+ <div class="container">
364
+ <div class="row">
365
+ <div class="copyrights-col-left col-md-6 col-sm-6">
366
+ <p>&copy; 2014 NativeChurch. All Rights Reserved</p>
367
+ </div>
368
+ <div class="copyrights-col-right col-md-6 col-sm-6">
369
+ <div class="social-icons"> <a href="https://www.facebook.com/" target="_blank"><i class="fa fa-facebook"></i></a> <a href="https://twitter.com/" target="_blank"><i class="fa fa-twitter"></i></a> <a href="http://www.pinterest.com/" target="_blank"><i class="fa fa-pinterest"></i></a> <a href="https://plus.google.com/" target="_blank"><i class="fa fa-google-plus"></i></a> <a href="http://www.pinterest.com/" target="_blank"><i class="fa fa-youtube"></i></a> <a href="#"><i class="fa fa-rss"></i></a> </div>
370
+ </div>
371
+ </div>
372
+ </div>
373
+ </footer>
374
+ <!-- End Footer -->
375
+ <a id="back-to-top"><i class="fa fa-angle-double-up"></i></a> </div>
376
+ <script src="js/jquery-2.0.0.min.js"></script> <!-- Jquery Library Call -->
377
+ <script src="plugins/prettyphoto/js/prettyphoto.js"></script> <!-- PrettyPhoto Plugin -->
378
+ <script src="js/helper-plugins.js"></script> <!-- Plugins -->
379
+ <script src="js/bootstrap.js"></script> <!-- UI -->
380
+ <script src="js/waypoints.js"></script> <!-- Waypoints -->
381
+ <script src="plugins/mediaelement/mediaelement-and-player.min.js"></script> <!-- MediaElements -->
382
+ <script src="js/init.js"></script> <!-- All Scripts -->
383
+ <script src="plugins/flexslider/js/jquery.flexslider.js"></script> <!-- FlexSlider -->
384
+ <script src="plugins/countdown/js/jquery.countdown.min.js"></script> <!-- Jquery Timer -->
385
+ </body>
386
+ </html>
@@ -0,0 +1,30 @@
1
+ require_relative 'helper'
2
+
3
+ class Testing < Theme::Component
4
+ id :testing
5
+
6
+ on_event :test do |text|
7
+ puts text
8
+ end
9
+ end
10
+
11
+ class AnotherTesting
12
+ include Theme::Events
13
+
14
+ on_event :test, for: 'testing' do
15
+ puts 'triggered from testing'
16
+ end
17
+ end
18
+
19
+ scope 'events' do
20
+ test 'listener' do
21
+ output = Cutest.capture_output do
22
+ testing = Testing.new
23
+ testing.add_listener AnotherTesting.new
24
+ testing.trigger :test, 'event for testing'
25
+ end
26
+
27
+ assert output['triggered from testing']
28
+ assert output['event for testing']
29
+ end
30
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,5 @@
1
+ lib = File.expand_path('../../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'theme'
5
+ require 'cuba'