static_blocks 0.1.1 → 1.0.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/README.md +13 -7
- data/app/controllers/static_blocks/application_controller.rb +0 -4
- data/app/controllers/static_blocks/{static_blocks_controller.rb → snippets_controller.rb} +36 -36
- data/app/helpers/static_blocks/{static_blocks_helper.rb → snippets_helper.rb} +0 -0
- data/app/models/static_blocks/{static_block.rb → snippet.rb} +19 -19
- data/app/views/layouts/static_blocks/application.html.erb +10 -8
- data/app/views/static_blocks/{static_blocks → snippets}/_form.html.erb +4 -4
- data/app/views/static_blocks/snippets/edit.html.erb +4 -0
- data/app/views/static_blocks/{static_blocks → snippets}/index.html.erb +14 -14
- data/app/views/static_blocks/snippets/new.html.erb +3 -0
- data/app/views/static_blocks/snippets/show.html.erb +23 -0
- data/config/routes.rb +11 -7
- data/db/migrate/20130611042319_create_static_blocks_static_blocks.rb +2 -2
- data/db/migrate/20130612034816_create_static_block_translations.rb +3 -3
- data/lib/static_blocks/engine.rb +2 -1
- data/lib/static_blocks/helpers.rb +11 -11
- data/lib/static_blocks/version.rb +1 -1
- data/lib/tasks/populate.rake +1 -1
- data/spec/dummy/app/views/info/index.html.erb +1 -1
- data/spec/dummy/config/initializers/static_blocks.rb +2 -1
- data/spec/dummy/config/routes.rb +1 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20130611042521_create_static_blocks_static_blocks.static_blocks.rb +2 -2
- data/spec/dummy/db/migrate/20130612035223_create_static_block_translations.static_blocks.rb +3 -3
- data/spec/dummy/db/schema.rb +5 -5
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +34145 -0
- data/spec/dummy/log/test.log +17664 -0
- data/spec/dummy/tmp/capybara/capybara-201306271715434400421805.html +105 -0
- data/spec/dummy/tmp/capybara/capybara-201306271720151310204564.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271721083468243101.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271721478445036540.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271721487345133836.html +97 -0
- data/spec/dummy/tmp/capybara/capybara-201306271722466837246437.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271722471821301599.html +105 -0
- data/spec/dummy/tmp/capybara/capybara-201306271724391294417961.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271725269568506755.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271725532116510731.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271726399551759972.html +97 -0
- data/spec/dummy/tmp/capybara/capybara-201306271732329832575014.html +105 -0
- data/spec/dummy/tmp/capybara/capybara-201306271733118671160246.html +105 -0
- data/spec/dummy/tmp/capybara/capybara-201306271733551813912702.html +105 -0
- data/spec/dummy/tmp/capybara/capybara-201306271736422992487098.html +105 -0
- data/spec/dummy/tmp/capybara/capybara-201306271737422569974960.html +2 -0
- data/spec/dummy/tmp/capybara/capybara-201306271741158405455507.html +3 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/helpers/static_blocks_helper_spec.rb +4 -4
- data/spec/integration/import_export_spec.rb +41 -0
- data/spec/integration/search_spec.rb +41 -0
- data/spec/integration/static_blocks_spec.rb +12 -12
- data/spec/integration/translations_spec.rb +24 -0
- data/spec/models/static_block_spec.rb +3 -3
- metadata +52 -14
- data/app/views/static_blocks/static_blocks/edit.html.erb +0 -4
- data/app/views/static_blocks/static_blocks/new.html.erb +0 -3
- data/app/views/static_blocks/static_blocks/show.html.erb +0 -23
- data/spec/dummy/tmp/cache/96E/880/static_block%3A%3Aen%3A%3Afoo +0 -2
- data/spec/dummy/tmp/cache/97D/300/static_block%3A%3Awk%3A%3Afoo +0 -2
@@ -0,0 +1,105 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>StaticBlocks</title>
|
5
|
+
<link href="/assets/static_blocks/application.css" media="all" rel="stylesheet" type="text/css" />
|
6
|
+
<script src="/assets/static_blocks/application.js" type="text/javascript"></script>
|
7
|
+
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<div class="navbar">
|
12
|
+
<div class="navbar-inner">
|
13
|
+
<div class="container">
|
14
|
+
<a href="/static_blocks/en/snippets" class="brand">Static Blocks</a>
|
15
|
+
<div class="nav-collapse collapse">
|
16
|
+
<ul class="nav pull-right">
|
17
|
+
<li><a href="/static_blocks/en/snippets">List blocks</a></li>
|
18
|
+
<li><a href="/static_blocks/en/snippets/new">New block</a></li>
|
19
|
+
<li><a href="/static_blocks/en/snippets/export.csv">Export</a></li>
|
20
|
+
<li><a href="/static_blocks/en/snippets/export_translations.csv">Export translations</a></li> </ul>
|
21
|
+
</div><!--/.nav-collapse -->
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="container">
|
27
|
+
|
28
|
+
|
29
|
+
<div id="locale">
|
30
|
+
Language
|
31
|
+
|
32
|
+
en
|
33
|
+
<a href="/static_blocks/wk/snippets">wk</a>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<h1>Listing snippets</h1>
|
37
|
+
<div class="row">
|
38
|
+
<div class="span6">
|
39
|
+
<h2>Search</h2>
|
40
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets" class="static_blocks/snippet_search" id="static_blocks/snippet_search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
41
|
+
<div class="field">
|
42
|
+
<label for="q_title_cont">Title contains</label>
|
43
|
+
<input id="q_title_cont" name="q[title_cont]" size="30" type="text" />
|
44
|
+
</div>
|
45
|
+
<div class="field">
|
46
|
+
<label for="q_translations_content_cont">Content contains</label>
|
47
|
+
<input id="q_translations_content_cont" name="q[translations_content_cont]" size="30" type="text" value="english bar" />
|
48
|
+
</div>
|
49
|
+
<div class="field">
|
50
|
+
<label for="q_status_cont">Status contains</label>
|
51
|
+
<select id="q_status_cont" name="q[status_cont]"><option value=""></option>
|
52
|
+
<option value="draft">Draft</option>
|
53
|
+
<option value="published">Published</option></select>
|
54
|
+
</div>
|
55
|
+
<div class="actions"><input name="commit" type="submit" value="Search" /></div>
|
56
|
+
</form></div>
|
57
|
+
<div class="span6">
|
58
|
+
<h2>Import</h2>
|
59
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets/import" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
60
|
+
<input id="file" name="file" type="file" />
|
61
|
+
<input name="commit" type="submit" value="Import" />
|
62
|
+
</form> <h2>Import Translations</h2>
|
63
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets/import_translations" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
64
|
+
<input id="file" name="file" type="file" />
|
65
|
+
<input name="commit" type="submit" value="Import Translations" />
|
66
|
+
</form></div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<table id="static-block-list" class="table table-striped">
|
72
|
+
<tr>
|
73
|
+
<th style="min-width: 60px;"><a href="/static_blocks/en/snippets?q%5Bs%5D=title+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Title</a></th>
|
74
|
+
<th><a href="/static_blocks/en/snippets?q%5Bs%5D=content+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Content</a></th>
|
75
|
+
<th style="min-width: 80px;"><a href="/static_blocks/en/snippets?q%5Bs%5D=status+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Status</a></th>
|
76
|
+
<th></th>
|
77
|
+
<th></th>
|
78
|
+
<th></th>
|
79
|
+
</tr>
|
80
|
+
|
81
|
+
<tr>
|
82
|
+
<td>foo</td>
|
83
|
+
<td>english bar</td>
|
84
|
+
<td>published</td>
|
85
|
+
<td><a href="/static_blocks/en/snippets/1" class="btn btn-mini btn-success">Show</a></td>
|
86
|
+
<td><a href="/static_blocks/en/snippets/1/edit" class="btn btn-mini btn-warning">Edit</a></td>
|
87
|
+
<td><a href="/static_blocks/en/snippets/1" class="btn btn-mini btn-danger" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a></td>
|
88
|
+
</tr>
|
89
|
+
</table>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<script type="text/javascript">
|
97
|
+
$('.wysihtml5').each(function(i, elem) {
|
98
|
+
$(elem).wysihtml5({
|
99
|
+
html: true
|
100
|
+
});
|
101
|
+
});
|
102
|
+
</script>
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>StaticBlocks</title>
|
5
|
+
<link href="/assets/static_blocks/application.css" media="all" rel="stylesheet" type="text/css" />
|
6
|
+
<script src="/assets/static_blocks/application.js" type="text/javascript"></script>
|
7
|
+
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<div class="navbar">
|
12
|
+
<div class="navbar-inner">
|
13
|
+
<div class="container">
|
14
|
+
<a href="/static_blocks/en/snippets" class="brand">Static Blocks</a>
|
15
|
+
<div class="nav-collapse collapse">
|
16
|
+
<ul class="nav pull-right">
|
17
|
+
<li><a href="/static_blocks/en/snippets">List blocks</a></li>
|
18
|
+
<li><a href="/static_blocks/en/snippets/new">New block</a></li>
|
19
|
+
<li><a href="/static_blocks/en/snippets/export.csv">Export</a></li>
|
20
|
+
<li><a href="/static_blocks/en/snippets/export_translations.csv">Export translations</a></li> </ul>
|
21
|
+
</div><!--/.nav-collapse -->
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="container">
|
27
|
+
|
28
|
+
|
29
|
+
<div id="locale">
|
30
|
+
Language
|
31
|
+
|
32
|
+
en
|
33
|
+
<a href="/static_blocks/wk/snippets">wk</a>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<h1>Listing snippets</h1>
|
37
|
+
<div class="row">
|
38
|
+
<div class="span6">
|
39
|
+
<h2>Search</h2>
|
40
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets" class="static_blocks/snippet_search" id="static_blocks/snippet_search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
41
|
+
<div class="field">
|
42
|
+
<label for="q_title_cont">Title contains</label>
|
43
|
+
<input id="q_title_cont" name="q[title_cont]" size="30" type="text" />
|
44
|
+
</div>
|
45
|
+
<div class="field">
|
46
|
+
<label for="q_translations_content_cont">Content contains</label>
|
47
|
+
<input id="q_translations_content_cont" name="q[translations_content_cont]" size="30" type="text" value="english bar" />
|
48
|
+
</div>
|
49
|
+
<div class="field">
|
50
|
+
<label for="q_status_cont">Status contains</label>
|
51
|
+
<select id="q_status_cont" name="q[status_cont]"><option value=""></option>
|
52
|
+
<option value="draft">Draft</option>
|
53
|
+
<option value="published">Published</option></select>
|
54
|
+
</div>
|
55
|
+
<div class="actions"><input name="commit" type="submit" value="Search" /></div>
|
56
|
+
</form></div>
|
57
|
+
<div class="span6">
|
58
|
+
<h2>Import</h2>
|
59
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets/import" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
60
|
+
<input id="file" name="file" type="file" />
|
61
|
+
<input name="commit" type="submit" value="Import" />
|
62
|
+
</form> <h2>Import Translations</h2>
|
63
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets/import_translations" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
64
|
+
<input id="file" name="file" type="file" />
|
65
|
+
<input name="commit" type="submit" value="Import Translations" />
|
66
|
+
</form></div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<table id="static-block-list" class="table table-striped">
|
72
|
+
<tr>
|
73
|
+
<th style="min-width: 60px;"><a href="/static_blocks/en/snippets?q%5Bs%5D=title+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Title</a></th>
|
74
|
+
<th><a href="/static_blocks/en/snippets?q%5Bs%5D=content+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Content</a></th>
|
75
|
+
<th style="min-width: 80px;"><a href="/static_blocks/en/snippets?q%5Bs%5D=status+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Status</a></th>
|
76
|
+
<th></th>
|
77
|
+
<th></th>
|
78
|
+
<th></th>
|
79
|
+
</tr>
|
80
|
+
|
81
|
+
<tr>
|
82
|
+
<td>foo</td>
|
83
|
+
<td>english bar</td>
|
84
|
+
<td>published</td>
|
85
|
+
<td><a href="/static_blocks/en/snippets/1" class="btn btn-mini btn-success">Show</a></td>
|
86
|
+
<td><a href="/static_blocks/en/snippets/1/edit" class="btn btn-mini btn-warning">Edit</a></td>
|
87
|
+
<td><a href="/static_blocks/en/snippets/1" class="btn btn-mini btn-danger" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a></td>
|
88
|
+
</tr>
|
89
|
+
</table>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<script type="text/javascript">
|
97
|
+
$('.wysihtml5').each(function(i, elem) {
|
98
|
+
$(elem).wysihtml5({
|
99
|
+
html: true
|
100
|
+
});
|
101
|
+
});
|
102
|
+
</script>
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>StaticBlocks</title>
|
5
|
+
<link href="/assets/static_blocks/application.css" media="all" rel="stylesheet" type="text/css" />
|
6
|
+
<script src="/assets/static_blocks/application.js" type="text/javascript"></script>
|
7
|
+
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<div class="navbar">
|
12
|
+
<div class="navbar-inner">
|
13
|
+
<div class="container">
|
14
|
+
<a href="/static_blocks/en/snippets" class="brand">Static Blocks</a>
|
15
|
+
<div class="nav-collapse collapse">
|
16
|
+
<ul class="nav pull-right">
|
17
|
+
<li><a href="/static_blocks/en/snippets">List blocks</a></li>
|
18
|
+
<li><a href="/static_blocks/en/snippets/new">New block</a></li>
|
19
|
+
<li><a href="/static_blocks/en/snippets/export.csv">Export</a></li>
|
20
|
+
<li><a href="/static_blocks/en/snippets/export_translations.csv">Export translations</a></li> </ul>
|
21
|
+
</div><!--/.nav-collapse -->
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="container">
|
27
|
+
|
28
|
+
|
29
|
+
<div id="locale">
|
30
|
+
Language
|
31
|
+
|
32
|
+
en
|
33
|
+
<a href="/static_blocks/wk/snippets">wk</a>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<h1>Listing snippets</h1>
|
37
|
+
<div class="row">
|
38
|
+
<div class="span6">
|
39
|
+
<h2>Search</h2>
|
40
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets" class="static_blocks/snippet_search" id="static_blocks/snippet_search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
41
|
+
<div class="field">
|
42
|
+
<label for="q_title_cont">Title contains</label>
|
43
|
+
<input id="q_title_cont" name="q[title_cont]" size="30" type="text" />
|
44
|
+
</div>
|
45
|
+
<div class="field">
|
46
|
+
<label for="q_translations_content_cont">Content contains</label>
|
47
|
+
<input id="q_translations_content_cont" name="q[translations_content_cont]" size="30" type="text" value="english bar" />
|
48
|
+
</div>
|
49
|
+
<div class="field">
|
50
|
+
<label for="q_status_cont">Status contains</label>
|
51
|
+
<select id="q_status_cont" name="q[status_cont]"><option value=""></option>
|
52
|
+
<option value="draft">Draft</option>
|
53
|
+
<option value="published">Published</option></select>
|
54
|
+
</div>
|
55
|
+
<div class="actions"><input name="commit" type="submit" value="Search" /></div>
|
56
|
+
</form></div>
|
57
|
+
<div class="span6">
|
58
|
+
<h2>Import</h2>
|
59
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets/import" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
60
|
+
<input id="file" name="file" type="file" />
|
61
|
+
<input name="commit" type="submit" value="Import" />
|
62
|
+
</form> <h2>Import Translations</h2>
|
63
|
+
<form accept-charset="UTF-8" action="/static_blocks/en/snippets/import_translations" enctype="multipart/form-data" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
64
|
+
<input id="file" name="file" type="file" />
|
65
|
+
<input name="commit" type="submit" value="Import Translations" />
|
66
|
+
</form></div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<table id="static-block-list" class="table table-striped">
|
72
|
+
<tr>
|
73
|
+
<th style="min-width: 60px;"><a href="/static_blocks/en/snippets?q%5Bs%5D=title+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Title</a></th>
|
74
|
+
<th><a href="/static_blocks/en/snippets?q%5Bs%5D=content+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Content</a></th>
|
75
|
+
<th style="min-width: 80px;"><a href="/static_blocks/en/snippets?q%5Bs%5D=status+asc&q%5Bstatus_cont%5D=&q%5Btitle_cont%5D=&q%5Btranslations_content_cont%5D=english+bar" class="sort_link">Status</a></th>
|
76
|
+
<th></th>
|
77
|
+
<th></th>
|
78
|
+
<th></th>
|
79
|
+
</tr>
|
80
|
+
|
81
|
+
<tr>
|
82
|
+
<td>foo</td>
|
83
|
+
<td>english bar</td>
|
84
|
+
<td>published</td>
|
85
|
+
<td><a href="/static_blocks/en/snippets/1" class="btn btn-mini btn-success">Show</a></td>
|
86
|
+
<td><a href="/static_blocks/en/snippets/1/edit" class="btn btn-mini btn-warning">Edit</a></td>
|
87
|
+
<td><a href="/static_blocks/en/snippets/1" class="btn btn-mini btn-danger" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a></td>
|
88
|
+
</tr>
|
89
|
+
</table>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<script type="text/javascript">
|
97
|
+
$('.wysihtml5').each(function(i, elem) {
|
98
|
+
$(elem).wysihtml5({
|
99
|
+
html: true
|
100
|
+
});
|
101
|
+
});
|
102
|
+
</script>
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
27761
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe StaticBlocks::
|
3
|
+
describe StaticBlocks::SnippetsHelper do
|
4
4
|
before do
|
5
|
-
s = StaticBlocks::
|
5
|
+
s = StaticBlocks::Snippet.create!({"title" => "foo", "content" => "bar", "status" => "published"})
|
6
6
|
end
|
7
7
|
|
8
|
-
describe "
|
8
|
+
describe "snippet helper" do
|
9
9
|
it "should return content" do
|
10
|
-
|
10
|
+
snippet_for("foo").should eq "bar"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
feature "csv import and export" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
visit "/static_blocks"
|
7
|
+
click_link "New block"
|
8
|
+
fill_in "Title", :with => "foo"
|
9
|
+
fill_in "Content", :with => "english bar"
|
10
|
+
click_button "Submit"
|
11
|
+
end
|
12
|
+
|
13
|
+
scenario "can download a default csv before a translation" do
|
14
|
+
click_link "Export"
|
15
|
+
page.should have_content("id,title,content,status,created_at,updated_at")
|
16
|
+
page.should have_content("1,foo,english bar,published,")
|
17
|
+
end
|
18
|
+
|
19
|
+
context "after a translation" do
|
20
|
+
before do
|
21
|
+
visit "/static_blocks"
|
22
|
+
click_link "wk"
|
23
|
+
click_link "Edit"
|
24
|
+
fill_in "snippet_content", :with => "wookie bar"
|
25
|
+
click_button "Submit"
|
26
|
+
end
|
27
|
+
|
28
|
+
scenario "the original static block fields will be changed after a translation" do
|
29
|
+
click_link "Export"
|
30
|
+
page.should have_content("id,title,content,status,created_at,updated_at")
|
31
|
+
page.should have_content("1,foo,wookie bar,published,")
|
32
|
+
end
|
33
|
+
|
34
|
+
scenario "can download translations csv" do
|
35
|
+
click_link "Export translations"
|
36
|
+
page.should have_content("id,static_blocks_snippet_id,locale,content,created_at,updated_at")
|
37
|
+
page.should have_content("1,1,en,english bar,")
|
38
|
+
page.should have_content("2,1,wk,wookie bar,")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
feature "search blocks" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
visit "/static_blocks"
|
7
|
+
click_link "New block"
|
8
|
+
fill_in "Title", :with => "foo"
|
9
|
+
fill_in "Content", :with => "english bar"
|
10
|
+
click_button "Submit"
|
11
|
+
click_link "List blocks"
|
12
|
+
end
|
13
|
+
|
14
|
+
scenario "can search default blocks" do
|
15
|
+
fill_in "Content contains", :with => "english bar"
|
16
|
+
click_button "Search"
|
17
|
+
page.should have_content("english bar")
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "search translated blocks" do
|
21
|
+
|
22
|
+
before do
|
23
|
+
visit "/static_blocks"
|
24
|
+
click_link "wk"
|
25
|
+
click_link "Edit"
|
26
|
+
fill_in "snippet_content", :with => "wookie bar"
|
27
|
+
click_button "Submit"
|
28
|
+
click_link "List blocks"
|
29
|
+
end
|
30
|
+
|
31
|
+
scenario "can search translated blocks" do
|
32
|
+
fill_in "Title contains", :with => "foo"
|
33
|
+
fill_in "Content contains", :with => "wookie bar"
|
34
|
+
select('Published', :from => "Status")
|
35
|
+
click_button "Search"
|
36
|
+
page.should have_content("wookie bar")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
@@ -1,28 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
feature "creating
|
3
|
+
feature "creating snippets" do
|
4
4
|
|
5
5
|
before do
|
6
|
-
static_blocks = StaticBlocks::
|
7
|
-
visit "/
|
6
|
+
static_blocks = StaticBlocks::Snippet.create(title: 'foo', content: 'bar', status: 'Published')
|
7
|
+
visit "/static_blocks"
|
8
8
|
end
|
9
9
|
|
10
10
|
scenario "can see admin page" do
|
11
11
|
page.should have_content('Static Blocks')
|
12
|
-
page.should have_content('Listing
|
12
|
+
page.should have_content('Listing snippets')
|
13
13
|
end
|
14
14
|
|
15
15
|
scenario "can create new static block" do
|
16
16
|
click_link "New"
|
17
|
-
page.should have_content('New
|
17
|
+
page.should have_content('New snippet')
|
18
18
|
fill_in "Title", :with => "baz"
|
19
19
|
fill_in "Content", :with => "qux"
|
20
20
|
select('Published', :from => "Status")
|
21
21
|
click_button "Submit"
|
22
|
-
page.should have_content('
|
22
|
+
page.should have_content('Snippet was successfully created.')
|
23
23
|
page.should have_content('baz')
|
24
24
|
page.should have_content('qux')
|
25
|
-
StaticBlocks::
|
25
|
+
StaticBlocks::Snippet.count.should eq 2
|
26
26
|
end
|
27
27
|
|
28
28
|
scenario "can see static block on list page" do
|
@@ -33,8 +33,8 @@ end
|
|
33
33
|
feature "editing and translating static blocks" do
|
34
34
|
|
35
35
|
before do
|
36
|
-
|
37
|
-
visit "/
|
36
|
+
snippet = StaticBlocks::Snippet.create(title: 'foo', content: 'bar', status: 'Published')
|
37
|
+
visit "/static_blocks"
|
38
38
|
end
|
39
39
|
|
40
40
|
scenario "can edit and translate static block" do
|
@@ -55,14 +55,14 @@ end
|
|
55
55
|
feature "deleting static blocks" do
|
56
56
|
|
57
57
|
before do
|
58
|
-
|
59
|
-
visit "/
|
58
|
+
snippet = StaticBlocks::Snippet.create(title: 'foo', content: 'bar', status: 'Published')
|
59
|
+
visit "/static_blocks"
|
60
60
|
end
|
61
61
|
|
62
62
|
scenario "can delete static block" do
|
63
63
|
click_link "Destroy"
|
64
64
|
page.should_not have_content('foo')
|
65
|
-
StaticBlocks::
|
65
|
+
StaticBlocks::Snippet.count.should eq 0
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|